0

我尝试了一些方法来从 3 通道 IplImage 创建新的 4 通道 IplImage。我尝试将此代码从 C 转换为 JavaCV:

CvMat * src; // your source image
CvMat * dst // your destination image
CvMat * zeros = cvCreateMat(src->cols, src->rows, CV_8UC1);
cvSet(zeros, cvScalar(0, 0, 0, 0));
CvArr * input[] = { src, zeros };
int from_to[] = { 0,0, 1,1, 2,2, 3,3 };
cvMixChannels(input, 2, &dst, 1, from_to, 4);

取自这里,我的转换是:

    CvMat src; 
    CvMat dst;
    CvMat zeros = cvCreateMat(src.cols(), src.rows(), CV_8UC1);
    cvSet(zeros, cvScalar(0, 0, 0, 0));
    CvArr input[] = { src, zeros };
    int from_to[] = { 0,0, 1,1, 2,2, 3,3 };
    cvMixChannels(input, 2, dst, 1, from_to, 4);

但是eclipse说,JavaCV混合通道方法是这样的:

The method cvMixChannels(opencv_core.CvArr[], int, opencv_core.CvArr[], int, int[],int) in the type opencv_core is not applicable for the arguments opencv_core.CvArr[], int, opencv_core.CvMat, int, int[], int)

谁能帮我?

谢谢

4

1 回答 1

1

您的错误是您将CvMat作为第一个和第三个参数传递给cvMixChannels,而您应该通过CvMat[]

于 2013-11-21T15:17:58.037 回答