Ask Your Question

Revision history [back]

IplImage to Mat returns no data

Hello,

I'm new to OpenCV so sorry if this is a basic question.

I'm converting from the IplImage structure into a Mat matrix however there seem to be a problem because when I try to access an element within the matrix, it return no data. Naturally I have tried debugging it and checking (using visual studios debug tools) to see if the matrix structure contains any data. From what I can see it does not.

Heres my code:

Mat imageMatrix(image);

cout << "Data: " << imageMatrix.at<unsigned char>(0, 0) << endl;

cvWaitKey();

The fact i'm having to use unsigned char is a little worrying as well as the image is binary. It should just be int, should it not?

Can anyone help me at all with this>

Thanks.