The difference between uint8 and double images when using imshow

不想你离开。 提交于 2019-12-02 07:04:55

Images of type double are assumed to have values between 0 and 1 and uint8 images are assumed to have values between 0 and 255. Since your double data contains values between 0 and 255 (since you simply cast it as a double and don't perform any scaling), it will appear as mostly white since most values are greater than 1.

You can use the second input to imshow to indicate that you would like to ignore this assumption and automatically scale the display to the dynamic range of the data

imshow(h, [])

Or you can normalize the double version using mat2gray prior to displaying the image

h = mat2gray(h);
imshow(h)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!