Matlab imshow doesn't plot correctly but imshowpair does

有些话、适合烂在心里 提交于 2019-12-01 12:22:41

It sounds like a problem where the majority of your intensities / colour data are outside the dynamic range of what is accepted for imshow when showing double data.

I also see that you're using im2double, but im2double simply converts the image to double and if the image is already double, nothing happens. It's probably because of the way you are filtering the images. Are you doing some sort of edge detection? The reason why you're getting dark images is probably because the majority of your intensities are negative, or are hovering around 0. imshow whe displaying double type images assumes that the dynamic range of intensities is [0,1].

Therefore, one way to resolve your problem is to do:

imshow(im,[]);

This shifts the display so that range so the smallest value is mapped to 0, and the largest to 1.

If you'd like a more permanent solution, consider creating a new output variable that does this for you:

out = (im - min(im(:))) / (max(im(:)) - min(im(:)));

This will perform the same shifting that imshow does when displaying data for you. You can now just do:

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