[gdal-dev] JP2OpenJPEG Driver Reads 4th Band of NITF as Alpha
Even Rouault
even.rouault at spatialys.com
Wed May 20 01:24:57 PDT 2015
Le mercredi 20 mai 2015 01:06:27, EVANS, JAMES R GS-13 USAF ACC 84 RADES/SCZE
a écrit :
> Claire,
> About a year ago I had a similar issue reading NAIP imagery. I was able to
> use Global Mapper to convert the images. After that MapServer using GDAL
> could serve the images correctly. I don't know if that will help you, but
> it worked for me. Converting 4.3 TB of imagery took a while....
This has been fixed in GDAL 2.0dev. Try beta1 :
http://download.osgeo.org/gdal/2.0.0beta1/
Otherwise a workaround to avoid creating geotiffs is to gdal_translate to a
VRT, and remove the Alpha color interpretation from the 4th band.
>
> -----Original Message-----
> From: gdal-dev-bounces at lists.osgeo.org
> [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Claire Porter Sent:
> Tuesday, May 19, 2015 4:54 PM
> To: gdal-dev at lists.osgeo.org
> Subject: [gdal-dev] JP2OpenJPEG Driver Reads 4th Band of NITF as Alpha
>
> Hello,
>
> I use the OpenJPEG 2.0 driver to decode the JP2 images within NITF files
> (1B level NITF images from DigitalGlobe). For 4 band images, the driver
> interprets the 4th band as Alpha. When I warp the imagery using gdalwarp,
> the 4th band in the output is all zeros. If I convert the image using
> gdal_translate, the 11 bit values in the 4th band are truncated to 255.
> Using GTiff creation options of PHOTOMETRIC=RGB or MINISBLACK and ALPHA=NO
> do not change the results.
>
> I found this only occurs with the OpenJPEG driver. The Jasper, Kakadu, and
> ECW drivers interpret the 4th band as Undefined and the 4th band behaves
> normally in gdalwarp and gdal_translate. I've tried gdal versions from
> 1.9.0 to 1.11.1. I thought perhaps the issue would be solved in OpenJPEG
> 2.1, and so I tried compiling GDAL 1.11.1 with OpenJPEG 2.1.0. But, that
> still resulted in the 4th band being read as Alpha.
>
> I'd really like to continue using OpenJPEG since it will be so well
> supported in GDAL 2.0. Anyone know a work around for this? Is this a
> GDAL issue or an OpenJPEG issue?
>
> Thanks,
> Claire
>
>
> gdalinfo using the OpenJPEG driver and GDAL 1.11.1:
>
>
> OPENJPEG: info: Start to read j2k main header (0).
> OPENJPEG: info: Main header has been correctly decoded.
> GDAL:
> GDALOpen(/vsisubfile/3935_198497332,output/WV02_12OCT082110317-M1BS-103001
> 001B68B600.ntf, this=0x948760) succeeds as JP2OpenJPEG. GDAL:
> NITFDataset::Open() wasn't able to derive a first order geotransform. It
> will be returned as GCPs. GDAL: GDALDefaultOverviews::OverviewScan()
> GDAL: GDALOpen(output/WV02_12OCT082110317-M1BS-103001001B68B600.ntf,
> this=0x8bfd10) succeeds as NITF. Driver: NITF/National Imagery
> Transmission Format
> Files: output/WV02_12OCT082110317-M1BS-103001001B68B600.ntf
> output/WV02_12OCT082110317-M1BS-103001001B68B600.xml
> Size is 9216, 8192
> Coordinate System is `'
> GCP Projection =
> GEOGCS["WGS 84",
> DATUM["WGS_1984",
> SPHEROID["WGS 84",6378137,298.257223563, ...........
> SAMP_OFF=4409
> SAMP_SCALE=4410
> Corner Coordinates:
> Upper Left ( 0.0, 0.0)
> Lower Left ( 0.0, 8192.0)
> Upper Right ( 9216.0, 0.0)
> Lower Right ( 9216.0, 8192.0)
> Center ( 4608.0, 4096.0)
> Band 1 Block=1024x1024 Type=UInt16, ColorInterp=Blue
> Overviews: 4608x4096, 2304x2048, 1152x1024, 576x512, 288x256
> Overviews: arbitrary
> Image Structure Metadata:
> NBITS=11
> Band 2 Block=1024x1024 Type=UInt16, ColorInterp=Green
> Overviews: 4608x4096, 2304x2048, 1152x1024, 576x512, 288x256
> Overviews: arbitrary
> Image Structure Metadata:
> NBITS=11
> Band 3 Block=1024x1024 Type=UInt16, ColorInterp=Red
> Overviews: 4608x4096, 2304x2048, 1152x1024, 576x512, 288x256
> Overviews: arbitrary
> Image Structure Metadata:
> NBITS=11
> Band 4 Block=1024x1024 Type=UInt16, ColorInterp=Alpha
> Overviews: 4608x4096, 2304x2048, 1152x1024, 576x512, 288x256
> Overviews: arbitrary
> Image Structure Metadata:
> NBITS=11
> GDAL:
> GDALClose(/vsisubfile/3935_198497332,output/WV02_12OCT082110317-M1BS-10300
> 1001B68B600.ntf, this=0x94d3f0) GDAL:
> GDALClose(/vsisubfile/3935_198497332,output/WV02_12OCT082110317-M1BS-10300
> 1001B68B600.ntf, this=0x948760) GDAL:
> GDALClose(output/WV02_12OCT082110317-M1BS-103001001B68B600.ntf,
> this=0x8bfd10)
>
>
> gdalinfo using ECW and 1.11.1 (Jasper and Kakadu are similar):
>
> ECW:
> NCScbmOpenFileView(/vsisubfile/3935_198497332,Z:\claire\debug_ortho\output
> 2\WV02_12OCT082110317-M1BS-103001001B68B600.ntf): eErr=2, will try VSIL
> stream. ECW: Got mutex.
> ECW: Using filename 'C:\Users\porte254\AppData\Local\Temp\99544_0.ntf' for
> temporary directory determination purposes. ECW: Using filename
> 'C:\Users\porte254\AppData\Local\Temp\99544_1.ntf' for temporary directory
> determination purposes. ECW: Using filename
> 'C:\Users\porte254\AppData\Local\Temp\99544_2.ntf' for temporary directory
> determination purposes. ECW: Using filename
> 'C:\Users\porte254\AppData\Local\Temp\99544_3.ntf' for temporary directory
> determination purposes. ECW: Using filename
> 'C:\Users\porte254\AppData\Local\Temp\99544_4.ntf' for temporary directory
> determination purposes. ECW: Using filename
> 'C:\Users\porte254\AppData\Local\Temp\99544_5.ntf' for temporary directory
> determination purposes. ECW: Using filename
> 'C:\Users\porte254\AppData\Local\Temp\99544_6.ntf' for temporary directory
> determination purposes. ECW: Using filename
> 'C:\Users\porte254\AppData\Local\Temp\99544_7.ntf' for temporary directory
> determination purposes. ECW: Using filename
> 'C:\Users\porte254\AppData\Local\Temp\99544_8.ntf' for temporary directory
> determination purposes. ECW: FileInfo: SizeXY=9216,8192 Bands=4
> OriginXY=0,0 CellIncrementXY=1,1
> ColorSpace=3, eCellType=1
>
>
> GDAL:
> GDALOpen(/vsisubfile/3935_198497332,Z:\claire\debug_ortho\output2\WV02_12O
> CT082110317-M1BS-103001001B68B600.ntf, this=000000000032FBA0) succeeds as
> JP2ECW. GDAL: NITFDataset::Open() wasn't able to derive a first order
> geotransform. It will be returned as GCPs.
> GDAL: GDALDefaultOverviews::OverviewScan()
> GDAL:
> GDALOpen(Z:\claire\debug_ortho\output2\WV02_12OCT082110317-M1BS-103001001B
> 68B600.ntf, this=000000000031EC40) succeeds as NITF. Driver: NITF/National
> Imagery Transmission Format
> Files: output2\WV02_12OCT082110317-M1BS-103001001B68B600.ntf
> output2\WV02_12OCT082110317-M1BS-103001001B68B600.XML
> Size is 9216, 8192
> Coordinate System is `'
> GCP Projection =
> GEOGCS["WGS 84",
> DATUM["WGS_1984",
> SPHEROID["WGS 84",6378137,298.257223563,
> .....................................................
> SAMP_OFF=4409
> SAMP_SCALE=4410
> Corner Coordinates:
> Upper Left ( 0.0, 0.0)
> Lower Left ( 0.0, 8192.0)
> Upper Right ( 9216.0, 0.0)
> Lower Right ( 9216.0, 8192.0)
> Center ( 4608.0, 4096.0)
> Band 1 Block=256x256 Type=UInt16, ColorInterp=Blue
> Overviews: 4608x4096, 2304x2048, 1152x1024, 576x512, 288x256
> Image Structure Metadata:
> NBITS=11
> Band 2 Block=256x256 Type=UInt16, ColorInterp=Green
> Overviews: 4608x4096, 2304x2048, 1152x1024, 576x512, 288x256
> Image Structure Metadata:
> NBITS=11
> Band 3 Block=256x256 Type=UInt16, ColorInterp=Red
> Overviews: 4608x4096, 2304x2048, 1152x1024, 576x512, 288x256
> Image Structure Metadata:
> NBITS=11
> Band 4 Block=256x256 Type=UInt16, ColorInterp=Undefined
> Overviews: 4608x4096, 2304x2048, 1152x1024, 576x512, 288x256
> Image Structure Metadata:
> NBITS=11
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list