how to display a Mat in Opencv

前端 未结 1 1770
情书的邮戳
情书的邮戳 2021-01-01 03:42

For the mat which stores images, it is easy to show it using imshow.But if the data type of the Mat is CV_32FC1, how can I display this mat ?

I tried i

相关标签:
1条回答
  • 2021-01-01 04:17

    If image is a Mat of type CV_32F, If the image is 32-bit floating-point, imshow() multiplies the pixel values by 255 - that is, the value range [0,1] is mapped to [0,255]. So your floating point image has to have a range 0 .. 1.

    This will display a CV32F image, no matter what the range is:

            cv::Mat dst
            cv::normalize(image, dst, 0, 1, cv::NORM_MINMAX);
            cv::imshow("test", dst);
            cv::waitKey(0);
    
    0 讨论(0)
提交回复
热议问题