Reputation: 151
Says I'm using the wrong types here. Both img and image are iplImages, what type should I be using and how do I use it? Thanks
IplImage image = IplImage.create(120, 120, IPL_DEPTH_8U, 4);
//resize the image
cvResize(img,image);
cvSaveImage("4-rjb" + capture + ".pgm", img);
Upvotes: 3
Views: 5411
Reputation: 2435
this should work
IplImage resizeImage = IplImage.create(120, 120, origImg.depth(), origImg.nChannels());
and here a full example
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");
}
Upvotes: 2
Reputation: 45
you should use the same number of the channels as in the source image
Upvotes: 1