1 | initial version |
Hi @Xiang!
You can use the following code to convert Image from YUV to RGB.
Mat Img_Source_YUV(m_ImgHeight,m_ImgWidth,CV_8UC2);
Mat Img_Destination_Bgr(m_ImgHeight,m_ImgWidth,CV_8UC3);
FILE * f;
f=fopen(FileName_S.c_str(),"rb");
if ( !f )
{
MessageBox(L"File Not Found");
return;
}
uchar* pYUVPixels;//w-2592 h- 1944
UINT32 Img_Size= (m_ImgWidth * m_ImgHeight*2);
pYUVPixels = new uchar[Img_Size];
fread(pYUVPixels,Img_Size,1,f);
fclose(f);
Img_Source_YUV.data= pYUVPixels;
cvtColor(Img_Source_YUV,Img_Destination_Bgr,COLOR_YUV2BGR_Y422);
namedWindow("Img_Destination_Bgr",WINDOW_AUTOSIZE);
imshow("Img_Destination_Bgr",Img_Destination_Bgr);