I'm trying to get information from an image using the function cvGet2D in OpenCV.
I created an array of 10 IplImage
pointers:
IplImage *imageArray[10];
and I'm saving 10 images from my webcam:
imageArray[numPicture] = cvQueryFrame(capture);
when I call the function:
info = cvGet2D(imageArray[0], 250, 100);
where info
:
CvScalar info;
I got the error:
OpenCV Error: Bad argument (unrecognized or unsupported array type) in cvPtr2D, file /build/buildd/opencv-2.1.0/src/cxcore/cxarray.cpp, line 1824
terminate called after throwing an instance of 'cv::Exception'
what(): /build/buildd/opencv-2.1.0/src/cxcore/cxarray.cpp:1824: error: (-5) unrecognized or unsupported array type in function cvPtr2D
If I use the function cvLoadImage
to initialize an IplImage
pointer and then I pass it to the cvGet2D
function, the code works properly:
IplImage* imagen = cvLoadImage("test0.jpg");
info = cvGet2D(imagen, 250, 100);
however, I want to use the information already stored in my array.
Do you know how can I solve it?
Best Answer
Even though its a very late response, but I guess someone might be still searching for the solution with
CvGet2D
. Here it is.For
CvGet2D
, we need to pass the arguments in the order ofY
first and thenX
.Example:
Its not mentioned anywhere in the documentation, but you find it only inside
core.h
/core_c.h
. Try to go to the declaration ofCvGet2D()
, and above the function prototypes, there are few comments that explain this.