[Gdal-dev] NITF and colorinterp
fwarmerdam at gmail.com
Thu Mar 17 14:01:03 EST 2005
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
> 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?
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
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.
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