[gdal-dev] 16bit Pixel Arrangement?

M Lewis Martin.Lewis at euro.ngc.com
Fri Oct 10 01:12:14 PDT 2014


I am trying to read a NITF image that has a single band with a data type of
UInt16 and a ColorInterp of 'Undefined' as show below in some details taken
from the gdalinfo dump:

NITF_IMODE=B
NITF_IREP=MONO
NITF_ISCLAS=U
NITF_OSTAID=DG
NITF_PJUST=R
NITF_PVTYPE=INT
Corner Coordinates:
Upper Left  (  774731.700, 2060246.300) ( 72d23'46.92"W, 18d36'54.78"N)
Lower Left  (  774731.700, 2046011.700) ( 72d23'53.93"W, 18d29'12.10"N)
Upper Right (  788966.300, 2060246.300) ( 72d15'41.67"W, 18d36'47.89"N)
Lower Right (  788966.300, 2046011.700) ( 72d15'49.05"W, 18d29' 5.26"N)
Center      (  781849.000, 2053129.000) ( 72d19'47.89"W, 18d33' 0.05"N)
Band 1 Block=1024x1024 Type=UInt16, ColorInterp=Undefined

I am trying to create a corresponding 16bit bitmap for display but having
trouble as it appears this is a mono image but its coming out 'blue/green'
so it appears a shift somewhere in the pixel data

Can any one tell me, for a UInt16, what is the likely pixel data arrangement
that is returned in the RasterIO call as 'Undefined' doesn't help much i.e:

Is it 5 bits for R, 5 for B etc?
If it is, is it ABGR or RGBA?
Or is it none of the above and something else?
Should there be any further clues in the NITF metadata?

I have looked at the bytes coming back from the RasterIO call and they make
little sense; all the bottom bits are loaded and the top 5 bits 0 but for a 
mono image I would expect a more even pattern of bits set across all the 16
bits.

I have simplified the call to RasterIO using the following parameters:

eBufType = GDT_UInt16
nBandCount = 1
pBandMap = NULL   - so it reads just the first band
nPixelSpace = 0
nLineSpace = 0
nBandSpace = 0

For other things e.g. YCbCR, I understand that RasterIO does some
translation to RGB, is that what is going on here? If it is, what is the
translation likely to produce?

QGIS seems to be able to display the image correctly.

Thanks (sorry its a bit waffly)

Martin



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/16bit-Pixel-Arrangement-tp5166812.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list