pngread does not read 12bit gray images
Søren Hauberg
soren at hauberg.org
Fri Jul 11 02:22:57 CDT 2008
fre, 11 07 2008 kl. 01:10 -0400, skrev de Almeida, Valmor F.:
> > From: Søren Hauberg [mailto:soren at hauberg.org]
> > Since you have 'pngread' installed 'imread' will try to use that. So,
> > I'd try to use '__magick_read__' directly, i.e.
> >
> > Y = __magick_read__ ("foo.png");
> >
> > and see how that works.
>
> Yep. It does work. However it is a little tricky to compare the max(Y(:)) and min(Y(:)) values octave has in memory with the output of imagemagick's "identify" tool.
>
> Just for the record. In the following output from identify
>
> Format: PNG (Portable Network Graphics)
> Class: DirectClass
> Geometry: 275x220+0+0
> Type: Grayscale
> Endianess: Undefined
> Colorspace: Gray
> Depth: 16-bit
> Channel depth:
> Gray: 12-bit
> Channel statistics:
> Gray:
> Min: 774 (0.188968)
> Max: 1558 (0.380377)
> Mean: 1213.52 (0.296275)
> Standard deviation: 95.3054 (0.0232683)
>
> Octave's values for min and max are: 12384 and 24928. These are obtained from multiplying the corresponding numbers in parentheses from the "identify" output by 65536.
Hmmm, that's a bit odd isn't it? It seems that
0.188968 * (2^12 - 1) = 774
and
0.188968 * (2^16 - 1) = 12384
So, this is somehow related to the fact that the image is 12 bit but is
read as 16 bit. Should the minimum value be 774 (as ImageMagick reports)
or should it be 12384 (as Octave reports) ? I mean, who's right?
Søren
More information about the Help-octave
mailing list