Ask Your Question

Problem with c++ and cv::resize

asked 2013-05-11 03:09:11 -0500

Franrupa gravatar image

updated 2015-12-21 06:36:46 -0500

Hi! Forgive the question. I am new to c + + and using opencv. I have a problem. I have the following code, and I think it should work.

  using cv;

      int CImageProcessor::DoProcess(IplImage** image) {
            CvMat c1;
            CvMat & imag4=c1;
            if(!image || !*image) return(EINVALID_PARAMETER);
            dst_mat = cvGetMat(img, &stub, 0, 0);

But it shows me the following error.

image_processing.cpp: In member function ‘int CImageProcessor::DoProcess(IplImage**)’:
image_processing.cpp:30: error: invalid initialization of reference of type ‘cv::Mat&’ from expression of type ‘CvMat’
../opencv-2.x.x/include/opencv/cv.hpp:320: error: in passing argument 2 of ‘void cv::resize(const cv::Mat&, cv::Mat&, cv::Size, double, double, int)’

What is my problem? I'm sorry, I think it will be a silly, but I've been days trying to make it work, and I get nothing. thanks

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2013-05-11 03:59:57 -0500

berak gravatar image

updated 2013-05-11 04:01:29 -0500

please try not to mix the old 1.0 (iPlImage/CvMat) and the newer 2.0 Api(cv::Mat).

in this case, call:

CvMat *dst = cvCreateMat(rows, cols, type); // you need to alloc space for the result
cvResize( src, dst, CV_INTER_LINEAR );  // see, you had it in the wrong order, too!

(but hard for me to see, which is your input, and which is the output img in your code.)

edit flag offensive delete link more

Question Tools


Asked: 2013-05-11 03:09:11 -0500

Seen: 4,061 times

Last updated: May 11 '13