我尝试过一些方法从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);
取自here,我的转换是:
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)
任何人都可以帮助我吗?
由于
答案 0 :(得分:1)
您的错误是您将CvMat
作为第一和第三个参数传递给cvMixChannels
,而您应该通过CvMat[]
。