Matlab imshow doesn't plot correctly but imshowpair does

前端 未结 1 639

I have imported an image. I have parsed it to double precision and performed some filtering on it.

When I plot the result with imshow, the double image

1条回答
  •  走了就别回头了
    2021-01-16 05:17

    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);
    

    0 讨论(0)
提交回复
热议问题