[Insight-users] Cannot read a RGBA png file into itk::Image<unsigned char, 2> properly
Dženan Zukić
dzenanz at gmail.com
Wed Jun 30 08:06:22 EDT 2010
Yes, you should report it here: http://public.kitware.com/Bug/
Regards,
Dženan
On Tue, Jun 22, 2010 at 13:39, Aurelien Bricier <aurelien.bricier at c-s.fr>wrote:
> Hello ITK users,
>
> I tried to read a 4 channels (RGBA) png image file into an
> itk:Image<unsigned char, 2> and the output image makes no sense. It
> appears that it works fine with RGB png images. In fact, I located the
> issue in ConvertPixelBuffer::ConvertRGBAToGray() that computes the
> grayscale pixel value by applying the following formula:
>
> ((2125.0 * static_cast<double>RedPixelValue +
> 7154.0 * static_cast<double>GreenPixelValue +
> 0721.0 * static_cast<double>BluePixelValue)/1000.0) //OK
> * static_cast<double>AlphaPixelValue
> //Here is the issue
>
> In a RGBA png image, the range of AlphaPixelValue is [0,255]. The
> resulting grayscale value is no longer reasonably allowed to be casted
> into an unsigned char. That's why the reader output doesn't make any
> sense. I isolated this behavior in the attachment. Is there another
> place where I should report this bug?
>
> Regards,
> Aurelien.
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100630/f9bd7a9f/attachment.htm>
More information about the Insight-users
mailing list