|
|
How to write a grayscale 16 bit tiff image from a 2D image array
Hi,
I've got some 2D arrays which contain image information in grayscale and they are uint16 (so they have values from 0 - 2^16, 0 being the black).
I'm trying to save tiff images from these arrays but no luck.. I can't see how to determine the bit depth and I'm always getting a white image full of 255. I've been using imwrite().
Thanks for any help on that!
Kostas
|
|
0
|
|
|
|
Reply
|
kostas
|
9/15/2010 5:04:05 PM |
|
"kostas Karakasiliotis" <kostas.karakasiliotis@epfl.ch> wrote in message <i6qua5$fcq$1@fred.mathworks.com>...
> Hi,
>
> I've got some 2D arrays which contain image information in grayscale and they are uint16 (so they have values from 0 - (
2^16 -1)
, 0 being the black).
> I'm trying to save tiff images from these arrays but no luck.. I can't see how to determine the bit depth and I'm always getting a white image full of 255. I've been using imwrite().
>
> Thanks for any help on that!
> Kostas
How are you viewing the images once you've written them? IMWRITE with 16bit Tiff options, according to the doc should be acceptable.
When you view the image what range are you viewing it with? I would check and see if you're only viewing it from 0-255 in which case most of the 16bit values will appear white.
Try:
>>imshow(I,[ 0 2^16-1])
|
|
0
|
|
|
|
Reply
|
Sean
|
9/15/2010 5:21:07 PM
|
|
Hi,
It was kind of stupid in the end because it needs to specify again the type of the image contents individually using "uint16(image)" even if when I was building the image I was loading uint16s. Then it saves the tiff fine.
Regards,
Kostas
"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <i6qva3$lr3$1@fred.mathworks.com>...
> "kostas Karakasiliotis" <kostas.karakasiliotis@epfl.ch> wrote in message <i6qua5$fcq$1@fred.mathworks.com>...
> > Hi,
> >
> > I've got some 2D arrays which contain image information in grayscale and they are uint16 (so they have values from 0 - (
> 2^16 -1)
> , 0 being the black).
> > I'm trying to save tiff images from these arrays but no luck.. I can't see how to determine the bit depth and I'm always getting a white image full of 255. I've been using imwrite().
> >
> > Thanks for any help on that!
> > Kostas
>
> How are you viewing the images once you've written them? IMWRITE with 16bit Tiff options, according to the doc should be acceptable.
>
> When you view the image what range are you viewing it with? I would check and see if you're only viewing it from 0-255 in which case most of the 16bit values will appear white.
> Try:
> >>imshow(I,[ 0 2^16-1])
|
|
0
|
|
|
|
Reply
|
kostas
|
9/15/2010 6:37:05 PM
|
|
|
2 Replies
660 Views
(page loaded in 1.303 seconds)
|
|
|
|
|
|
|
|
|