imshow shows image as noisy even though its not

Hi, Im trying to learn a segmentation network using CNN, my network is producing very poor results. I looked at the images and I'm wondering if this is the reason. My input images are stack of images in a .tif file. In Windows image viewer below is what I get:
I am trying to detect and segment the bright spots shown above
But when I open the same in Matlab using imshow() I get
All the information is basically lost. However when I use imagesc() I get the following:
Which is much better, but why are my images not working with my network? Is it reading in the imshow() version output? How do I fix this?
Thanks
edit:
below is the code I am using to read in the tiff files:
fname = 'my_file_with_lots_of_images.tif';
info = imfinfo(fname);
imageStack = [];
numberOfImages = length(info);
for k = 1:numberOfImages
currentImage = imread(fname, k, 'Info', info);
imageStack(:,:,k) = currentImage;
end

5 Comments

Most likely, you're using imshow wrong. Without the original image and the code you're actually using it's difficult to tell.
Is the display better if you use:
imshow(yourimage, []) %[] to tell matlab to use the full range of intensity whatever that is.
Hi, Ive updated the question with the code im using, I'm conderned about how the image is read in or interpreted by the the network? Or how the image data is read in by my CNN? is it the version shown by imshow?
I agree with Guillaume. You probably have a floating point image outside the range 0-1 so using [] in imshow() will fix it. However you're not showing us your call to imshow().
imshow(imageStack(:,:,7))
imagesc(imageStack(:,:,7))
My concern is how the data is interpreted by the CNN network, is it how it is shown in imshow()?
Also
imshow(imageStack(:,:,7), [])
produces the following
13213.jpg
Thanks
We need either the raw image (the tif file) or the output of imfinfo to understand what type of image you're dealing with.
Other than a different colour map (grey vs green) your latest display with imshow looks more or less the same as the one you get with the image viewer.
Possibly, the image is indexed, in which case, you're currently not loading the colour map (2nd output of imread). Hence the difference.
Your CNN will have requirements for the type of images it can process. That's completely independent of imshow but if you've not loaded the image properly, then yes you'll run into trouble.

Sign in to comment.

Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Asked:

on 16 Dec 2018

Commented:

on 16 Dec 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!