- QImage cvMat2QImage(const cv::Mat& mat)
- {
- // 8-bits unsigned, NO. OF CHANNELS = 1
- if(mat.type() == CV_8UC1)
- {
- QImage image(mat.cols, mat.rows, QImage::Format_Indexed8);
- // Set the color table (used to translate colour indexes to qRgb values)
- image.setColorCount(256);
- for(int i = 0; i < 256; i++)
- {
- image.setColor(i, qRgb(i, i, i));
- }
- // Copy input Mat
QImage和 Mat 转化
最新推荐文章于 2022-11-18 17:35:30 发布