I seem to miss something but I cannot understand how to resize an image. Here is code:
#include <opencv2\core\core.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2\highgui\highgui.hpp>
using namespace cv;
int main(int argc, char* argv[])
{
IplImage* src = NULL;
IplImage* dst = NULL;
src = cvLoadImage("image.tif");
dst = cvCreateImage(cvSize( src->width / 10, src->height / 10 ), src->depth, src->nChannels );
resize(src, dst, dst->nSize, 0.1, 0.1, CV_INTER_AREA );
return 0;
}
But this code only results into the compiler error:
error C2664: 'cv::resize' : cannot convert parameter 1 from 'IplImage *' to 'cv::InputArray'
Can someone tell me what’s wrong here? I mean how can I create an InputArray from an IplImage?
Thanks,
Christian
You are mixing up OpenCV C and C++ functions. If you are programming in C++ you should use the Mat class to store image data. If you are on the other hand using pure C you should use the function cvResize to resize your IplImage.
As you can see in the OpenCV API documentation, there is a C and C++ programming interface for every function. They are essentially doing the same and you can of course use the C functions in C++, but you cannot use C OpenCV structs (like IplImage) with C++ OpenCV functions (like resize()).
This introduction describes the basic concepts of the OpenCV C++ API.