表示我在这里使用了错误的类型。img和image都是iplImages,我应该使用什么类型,如何使用?谢谢
IplImage image = IplImage.create(120, 120, IPL_DEPTH_8U, 4);
//resize the image
cvResize(img,image);
cvSaveImage("4-rjb" + capture + ".pgm", img);
应该能行
IplImage resizeImage = IplImage.create(120, 120, origImg.depth(), origImg.nChannels());
,这里有一个完整的例子
OpenCVFrameGrabber frameGrabber = new OpenCVFrameGrabber(video_in);
try {
frameGrabber.start();
IplImage origImg = frameGrabber.grab();
IplImage resizedImage = IplImage.create(IMG_WIDTH, IMG_HEIGHT, origImg.depth(), origImg.nChannels());
//cvSmooth(origImg, origImg);
cvResize(origImg, resizedImage);
cvSaveImage(image_out.getAbsolutePath(),resizedImage);
cvReleaseImage(resizedImage);
} catch (OpenCVFrameGrabber.Exception e) {
e.printStackTrace();
throw new NullPointerException("fileExtension");
}
您应该使用与源图像相同的通道数
将IPL_DEPTH_8U参数替换为img.nChannels()