Ask Your Question

Revision history [back]

Convert a ARGB buffer to YUV420P

In case I wish to convert an ARGB buffer to YUV 12 bit format, can it be done using OpenCV. I tried writing the following code But the problem was that , what should be the type of Mat for YUV 12 bit? Is the following way the right way of conversion?

            cv::Size sz(720,576);

// For ARGB cv::Mat imageWithData = cv::Mat(sz, CV_32S, (void*)pUncompressed, 1);

// For YUV420P
cv::Mat destYUV = cv::Mat(sz, ?????);

cv::InputArray input(imageWithData);
cv::OutputArray output(destYUV);
int iCode = CV_BGRA2YUV_I420;
cv::cvtColor(input, output, iCode);