[Gdal-dev] NITF and colorinterp

Peng Gao pgao at esri.com
Thu Mar 17 14:16:39 EST 2005


Thanks Frank.

Converting to RGB is what I am hoping for. Seems like the null pixel block
is caused by compression. I can't find compression info. Here is
the dump from gdalinfo:

F:\ArcGIS>gdalinfo  house.ntf
Driver: NITF/National Imagery Transmission Format
Size is 640, 480
Coordinate System is `'
GCP Projection = GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,29
257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG",
"6
6"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329
25
9433,AUTHORITY["EPSG","9108"]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY
["
SG","4326"]]
GCP[  0]: Id=UpperLeft, Info=
          (0,0) -> (-121.978,36.9569,0)
GCP[  1]: Id=UpperRight, Info=
          (640,0) -> (-121.961,36.905,0)
GCP[  2]: Id=LowerLeft, Info=
          (0,480) -> (-122.024,36.9356,0)
GCP[  3]: Id=LowerRight, Info=
          (640,480) -> (-122.014,36.9058,0)
Metadata:
  NITF_FHDR=NITF02.00
  NITF_CLEVEL=03
  NITF_STYPE=
  NITF_OSTAID=TCS
  NITF_FDT=11215408ZJun99
  NITF_FTITLE=
             U
  NITF_FSCLAS=U
  NITF_FSCODE=
  NITF_FSCTLH=
  NITF_FSREL=
  NITF_FSCAUT=
  NITF_FSCTLN=
  NITF_FSDWNG=
  NITF_FSCOP=
  NITF_FSCPYS=
  NITF_ENCRYP=0
  NITF_ONAME=
  NITF_OPHONE=
  NITF_IID1=0000000000
  NITF_IDATIM=11215408ZJun99
  NITF_TGTID=
  NITF_ITITLE=
  NITF_ISCLAS=U
  NITF_ISCODE=
  NITF_ISCTLH=NOFORN
  NITF_ISREL=
  NITF_ISCAUT=DOD S-5210.51 (M-1)
  NITF_ISCTLN=
  NITF_ISDWNG=999999
  NITF_ISORCE=12345678
  NITF_PVTYPE=INT
  NITF_IREP=YCbCr601
  NITF_ICAT=VIS
  NITF_ABPP=08
  NITF_PJUST=R
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  480.0)
Upper Right (  640.0,    0.0)
Lower Right (  640.0,  480.0)
Center      (  320.0,  240.0)
Band 1 Block=640x480 Type=Byte, ColorInterp=YCbCr_Y
Band 2 Block=640x480 Type=Byte, ColorInterp=YCbCr_Cb
Band 3 Block=640x480 Type=Byte, ColorInterp=YCbCr_Cr
 

> -----Original Message-----
> From: Frank Warmerdam [mailto:fwarmerdam at gmail.com]
> Sent: Thursday, March 17, 2005 11:01 AM
> To: Peng Gao
> Cc: GDAL-dev list
> Subject: Re: [Gdal-dev] NITF and colorinterp
> 
> 
> On Thu, 17 Mar 2005 09:48:50 -0800, Peng Gao <pgao at esri.com> wrote:
> > I have a NITF image that has the following
> > colorinterp:
> > 
> > Band 1 Block=640x480 Type=Byte, ColorInterp=YCbCr_Y
> > Band 2 Block=640x480 Type=Byte, ColorInterp=YCbCr_Cb
> > Band 3 Block=640x480 Type=Byte, ColorInterp=YCbCr_Cr
> > 
> > and GDALRasterBand::GetBlockRef(0,0) returns a null
> > block. Is this type of colorinterp supported?
> 
> Peng, 
> 
> What compression type is in use?  Currently the GDAL NITF 
> driver does not have any support for decompressing JPEG
> compressed NITF files, and given that it is a YCbCr color
> space, I suspect that is what you are running into. 
> 
> Some work was done recently to allow JPEG2000 images
> in the YCbCr colorspace in NITF to be returned to the 
> application still in the YCbCr color space.  I think this depends
> on the CPL configuration option CONVERT_YCBCR_TO_RGB
> being set to NO.  Othewise YCbCr images are automatically
> converted to RGB internally.  
> 
> However, even in the (default) case where YCbCr images
> are converted to RGB internally I *think* that the NITFDataset
> will still return the YCbCr band types.  This is a bug, and if
> you want it fixed please file a bug. 
> 
> Generally speaking, color space issues get murky with regard
> to YCbCr and especially NITF.  Also, some differences may
> be encountered depending on whether the ECW or Kakadu
> based JPEG2000 readers are in use.  In fact, I don't know
> what the JasPer and MrSID JPEG2000 interfaces do with
> YCbCr files. 
> 
> Finally, when you ask "is this type of colorinterp supported", 
> keep in mind that in adding support for YCbCr color mode, 
> essentially all I did was prevent it from being reprocessed into
> RGB internally in some cases.  GDAL provides no higher level
> support for doing anything intelligent with YCbCr images.  It just
> tries to return the data unchanged with the correct band color
> interpretation information attached. 
> 
> Best regards,
> -- 
> ---------------------------------------+----------------------
> ----------------
> I set the clouds in motion - turn up   | Frank Warmerdam, 
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial 
> Programmer for Rent
> 



More information about the Gdal-dev mailing list