Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

disclaimer: i've never done this ! but here is, what i'd try:

// 1. load it into an *1d* , uchar mat (else the 3/2 factor will get in your way):
Mat yuv(1, width * height * 3/2, CV_8U, bytepointer);

// 2. convert it to bgr. unfortunately, it has like 100 choices here, 
//     no idea, what to choose (you have to try)
Mat bgr;
cvtConvert(yuv, bgr, COLOR_YUV420sp2BGR);

// 3. reshape it to original size
bgr = bgr.reshape(-1, height);

for the list of possible conversions, see here

also, carefully looking at the docs of whatever gave you that buffer might be useful !

good luck !