c++ - how to display a Mat in Opencv -


For a matched archive of images, it is easy to use imshow . But if the data type of mat is CV_32FC1, how can I show this mat?

I have tried, but the display shape is completely white and when I zoom zoom, it is still completely empty, and I can not see the float number in the mat.

Is there anyone who knows to show the matrix completely?

PS: Thank you for answering. I'll post some code and statistics to show more details: Code:

  mat mat1; Mat1 = Mat :: ones (3,4, CV_32FC1); Matte 1 = matte 1 * 200; Imshow ("test", matte 1); WaitKey (0); Mat dst; General (matte 1, dst, 0, 1, nommmmmmmx); Imshow ("test1", dst); WaitKey (0); Mat1.convertTo (DST, CV_8UC1); Imshow ("test2", dst); WaitKey (0); Return 0;  

Output:

Enter image details here

After zooming in to 150%:

image here Enter the details

Then after zooming up to 150%, we can see that 'test' is completely white and we can not see its element values. 'Test1' is completely black and we still can not see its element values. But for 'test2', it is brown and we can see the value of its element which is 200.

Does this mean that imshow () only CV_8UC1 and we can not show any other statistics?

If image is a type of CV_32F, then image is floating 32 -Point-bits multiply the pixel values ​​by 255 - that is, [0,1] the value is mapped to the range [0, 255]. So your floating point image should have range 0 .. 1.

This will display a CV 32F image, regardless of the range:

  cv :: Mat DST CV :: generalized (image, DST, 0, 1 , CV :: NOMMMMMMX); Cv :: imshow ("test", dst); CV :: waitKey (0);  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -