Black image getting saved while using imsave
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hey,
I am trying to save a part of a 16 bit image using imsave as a TIFF file. When I save the image (using imsave()), it is showing up as a black image on my computer's image viewer (Windows Photo Viewer). Initially I thought that Photo Viewer might not be supporting 16 bit images, but that doesn't make much sense because I can see the full image before I import it into MATLAB for cropping.
When I import the saved TIFF file to MATLAB, I can use imagesc() to view the image but not imshow(image, [0 2^16-1]). When I checked the maximum value of the imported image, it's only around 957. So, I think what's going on is that since the pixel values are just between 0 and 957, and the image viewer has 2^16 levels, the image isn't showing up properly. Is there anyway I can save the image such that it shows up on my viewer?
Thanks in advance.
Thank you.
0 Commenti
Risposte (1)
Adam
il 13 Mar 2015
Just scale it up to use the full 16-bit range before you save it.
i.e. multiply by 65535/957
but replacing the hard-coded numbers with something calculated for reusablility.
2 Commenti
Adam
il 16 Mar 2015
Well, obviously 957 is not going to be correct for every image you may use so you should replace that code with code that takes its value from the maximum of your image.
Likewise the 65535 is only correct for a 16-bit image. If you may be handling images of other data types then this value should be taken appropriately for the data type.
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!