can not read unsigned char three channels data into otb::Image<unsigned char,2> properly
Mantis Issue 5, reported by jmichel, assigned to gpasero, created: 2008-09-11
When reading an unsigned char three channels data into otb::Image<unsigned char,2> , the output make no sense at all..
This is not hapenning with otb::Image<double,2>, so there might be a problem with the use of ITK buffer conversion tools, maybe with the precision used to compute the luminance value from the 3 input channels.
1276873422 - aurelienThe issue is due to itk::ConvertPixelBuffer::ConvertRGBAToGray that converts an otbVectorImage<unsigned char, 2> to an otbImage<unsigned char, 2> using the formula:
((2125.0 * static_castChanel_R + 7154.0 * static_castChanel_G + 0721.0 * static_castChanel_B) / 1000.0)
- static_castChanel_A
According to the fact that default value for a A chanel pixel is 255 , the resulting value is not reasonably castable into an unsigned char.
This bug will be transmitted to ITK dev team asap.
1291292276 - aurelienThis bug has been fixed by ITK:
http://public.kitware.com/Bug/view.php?id=10917
1291481328 - christopWe should cherry-pick the fix to include it in OTB, no?
1291622517 - aurelienOTB does not use ITK IO to read/write png anymore.
1291654834 - christophttp://itk.org/gitweb?p=ITK.git;a=commit;h=54e364b981f351a3acbbbcaa0eec332a5218b119
the issue look like it is in the itk::ConvertPixelBuffer.
There might be other places