help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pngread does not read 12bit gray images


From: Søren Hauberg
Subject: Re: pngread does not read 12bit gray images
Date: Sun, 06 Jul 2008 09:25:30 +0200

lør, 05 07 2008 kl. 13:41 -0400, skrev de Almeida, Valmor F.:
> I am using imread() to read 12-bit png images. The result of 
> 
> Y = imread("foo.png");
> class(I);
> 
> is uint16. However the max and min values of Y are not correct. I
> tracked the problem down to this section of pngread.cc in the
> octave-forge package image-1.06
> 
>   // For now, use 8-bit only
>   if (bit_depth == 16) {
>       png_set_strip_16(png_ptr);
>   }
> 
> Is there a simple fix for this so that I do get all gray values into the
> matrix Y? The issue here is that after the 8-bit strip, the image loses
> critical information; in particular contrast details that are important
> for the image processing code I am writing.

The first thing I would do is to see if ImageMagick can read the file
for you. The current 'imread' function works something like this for png
files

  if (have_pngread)
    I = pngread (filename)
  elseif (have_magickread)
    I = __magick_read__ (filename)
  else
    # try to do it using the 'convert' utility, I think
  endif

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.

Søren



reply via email to

[Prev in Thread] Current Thread [Next in Thread]