1、ARGB -> RGB
//unsigned char *data 存的是ARGB的裸数据;
cv::Mat argbImg;
cv::Mat rgbImg(cy, cx,CV_8UC3);
yuvImg.create(cy, cx, CV_8UC4);
memcpy(argbImg.data, data, len);
cv::cvtColor(argbImg, rgbImg, CV_RGBA2RGB);
flip(rgbImg, rgbImg, 0); //垂直翻转
2、YUV -> RGB
//unsigned char *data 存的是YUYV的裸数据;
cv::Mat yuvImg;
cv::Mat rgbImg(cy, cx,CV_8UC3);
yuvImg.create(cy , cx, CV_8UC2);
memcpy(yuvImg.data, data, len);
cv::cvtColor(yuvImg, rgbImg, CV_YUV2BGR_YUYV);
3、I420 -> RGB
//unsigned char *data 存的是I420的裸数据;
cv::Mat yuvImg;
cv::Mat rgbImg(cy, cx,CV_8UC3);
yuvImg.create(cy * 3/2, cx, CV_8UC1)