Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

please try to avoid the outdated c-api calls, IplImage, cv* functions, stick with Mat and the cv:: namespace.

you should be able to create a Mat directly from pBuffer:

Mat img = Mat(height,width,CV_8UC3, (uchar*)pBuffer);

now if pBuffer goes out of scope before img does, you have to clone it (above is just a shallow copy):

Mat rgb = img.clone();

then you can just show it (no further IplImage required):

namedWindow("rgb,1);
imshow("rgb",rgb);
waitKey(10); // nessecary for imshow to work

please try to avoid the outdated c-api calls, IplImage, cv* functions, stick with Mat and the cv:: namespace.

you should be able to create a Mat directly from pBuffer:

Mat img = Mat(height,width,CV_8UC3, (uchar*)pBuffer);

now if pBuffer goes out of scope before img does, you have to clone it (above is just a shallow copy):

Mat rgb = img.clone();

then you can just show it (no further IplImage required):

namedWindow("rgb,1);
namedWindow("rgb",1);
imshow("rgb",rgb);
waitKey(10); // nessecary for imshow to work