How to read image from a buffer of YUV422
I have some image data, its format is yuyv(YUV422), and only have its buffer.
I use Mat::Mat(Size size, int type, void* data, size_t step=AUTO_STEP)
and write cv::Mat img = cv::Mat(cv::Size(640,480), CV_8UC2, imgBuffer);
the step is AUTO_STEP, is it correct?
Then I try to change a zone to black ( 0,44,64 en YUV )
for (int i=0; i<50; i++)
{
for (int j=0; j<50; j++)
{
img.at<cv::Vec2b>(j,i)[0]=0;
if(j%2==0)
img.at<cv::Vec2b>(j,i)[1]=44;
else
img.at<cv::Vec2b>(j,i)[1]=62;
}
}
But the output color is green, I don't know why? Please, help me