opencv Mat QImage

opencv Mat  QImage

 

    if (imgParam.channels() == 3)
    {
        cv::cvtColor(imgParam, rgb, CV_BGR2RGB);
        img = QImage((const uchar*)(rgb.data), rgb.cols, rgb.rows, rgb.cols*rgb.channels(), QImage::Format_RGB888);
    }
    else
    {
        img = QImage((const uchar*)(imgParam.data), imgParam.cols, imgParam.rows, imgParam.cols*imgParam.channels(), QImage::Format_Indexed8);
    }

 

 

 

 

#############################

posted @ 2021-10-28 08:12  西北逍遥  阅读(41)  评论(0编辑  收藏  举报