博客地址:http://home.cnblogs.com/u/zengjianrong/

opecv 显示yu12图像

        cv::Mat image(msg->height, msg->width, CV_8UC1);;
        memcpy(image.data, msg->data, msg->height*msg->width);
        
        cv::Mat yu12(msg->height*3/2, msg->width, CV_8UC1);;
        memcpy(yu12.data, msg->data, msg->height*msg->width*3/2);
        cv::Mat rgbImg;
        cv::cvtColor(yu12, rgbImg, CV_YUV2BGR_I420);
        printf("w %d h %d len %d \n", msg->height, msg->width, msg.GetDataLen());

        cv::imshow("visualization_for_gpus_rec", image);
        cv::imshow("visualization_for_gpus_rec_yu12", rgbImg);
        cv::waitKey(1);

 

posted @ 2021-02-02 16:06  black_man  阅读(47)  评论(0编辑  收藏  举报