Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CvMat vs cv::Mat data pointer

Hi,

I am trying to convert some code using CvMat to cv::Mat, but I cannot seem to figure out how to access the float* fl field present in data union of CvMat using cv::Mat. For example,

CvMat* Y; 
Y->data.fl[0] = (float)(a);
Y->data.fl[1] = (float)(b);

how to convert the above code if Y is cv::Mat?

 cv::Mat* Y; 
 Y->data.fl[0] = (float)(a);         //data is a pointer instead of a union
 Y->data.fl[1] = (float)(b);

I think I will have to use double index in cv::Mat case such as data[x][y]. But how to decide the values of x and y using .fl[i] index.

Thanks!