1. YUV420 -> Mat 可用于转换接受到的YUV视频源到OpenCV可以识别的数据
Mat myuv( Frame_Height + Frame_Height / 2, Frame_Width, CV_8UC1, (unsigned char *) YUV420_Image_Buffer);
cvtColor(myuv, mgMat, CV_YUV420p2RGB);
2. Mat -> YUV420 可用于OpenCV处理完视频信号后返回
cvtColor(mgMat, myuv,CV_RGB2YUV_I420);
memcpy( YUV420_Image_Buffer, myuv.data, Frame_Width * Frame_Height * ( 3 / 2 ) * sizeof(unsigned char) );
时间: 2024-10-09 07:47:22