Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Initialize MAT from pointer - help.

Hi, Im working with a camera, and the camera gives me the image in its own type of variable, that contains image width , height , depth , and other things.

In this data i receive a pointer for the first pixel , and i know that the RGB is organized like (assuming the image as n pixels), the first n address have the R, the next n address have the G and the last n address have the B.

So im trying to initialize the image like this.

cv::Mat dummy_query = cv::Mat(img->h, img->w, CV_8UC3, pData , 0 );

pData is the pointer from the first pixel. the 0 ,on openCV doc they say its the step , i really dont understand what is this step.

whit this i get some data to the matrix, but when i do the imshow nothing happens.

hope someone can help. =)