Opened 12 years ago

Closed 11 years ago

#4339 closed defect (fixed)

OpenJPEG driver does not open ERDAS ECW/JP2 SDK created JPEG2000s

Reported by: lpinner Owned by: warmerdam
Priority: normal Milestone: 1.10.0
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: openjpeg
Cc:

Description (last modified by lpinner)

Greetings,

I thought I’d give the new OpenJPEG driver a whirl and discovered that it will not open _any_ of my ~500GB of RGB+alpha JP2’s which were all generated using ER Mapper (both the ERDAS 3.3 & 4.2 ECW/JP2 SDKs). I’ve tried both the 32&64bit builds of the GDAL binaries (MSVC2008) from gisinternals.com/sdk. However the driver will open JP2's I've created using ENVI (uses Kakadu v4.5.2 library).

Output from gdalinfo below.

I've attached the test images I used. Both images are MODIS data from the USGS LP DAAC and have no restrictions on subsequent use, sale, or redistribution - https://lpdaac.usgs.gov/products/modis_policies

$ gdalinfo --version
GDAL 1.9dev, released 2011/01/18

$ gdalinfo --formats|grep JP2
JP2ECW (rw+v): ERDAS JPEG2000 (SDK 3.x)
JP2OpenJPEG (rwv): JPEG-2000 driver based on OpenJPEG library

$ gdalinfo test_erdas.jp2
Driver: JP2ECW/ERDAS JPEG2000 (SDK 3.x)
Files: test_erdas.jp2
Size is 219, 198
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (144.195272781219100,-37.528262376234096)
Pixel Size = (0.005000000000000,-0.005000000000000)
Corner Coordinates:
Upper Left  ( 144.1952728, -37.5282624) (144d11'42.98"E, 37d31'41.74"S)
Lower Left  ( 144.1952728, -38.5182624) (144d11'42.98"E, 38d31' 5.74"S)
Upper Right ( 145.2902728, -37.5282624) (145d17'24.98"E, 37d31'41.74"S)
Lower Right ( 145.2902728, -38.5182624) (145d17'24.98"E, 38d31' 5.74"S)
Center      ( 144.7427728, -38.0232624) (144d44'33.98"E, 38d 1'23.74"S)
Band 1 Block=219x1 Type=Byte, ColorInterp=Red
  Overviews: arbitrary
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=219x1 Type=Byte, ColorInterp=Green
  Overviews: arbitrary
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=219x1 Type=Byte, ColorInterp=Blue
  Overviews: arbitrary
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=219x1 Type=Byte, ColorInterp=Alpha
  Overviews: arbitrary
  Image Structure Metadata:

$ export GDAL_SKIP=JP2ECW
$ gdalinfo --formats|grep -i jp2
  JP2OpenJPEG (rwv): JPEG-2000 driver based on OpenJPEG library

$ gdalinfo test_erdas.jp2
ERROR 4: `test_erdas.jp2' not recognised as a supported file format.
gdalinfo failed - unable to open 'test_erdas.jp2'.

$ gdalinfo test_kakadu.jp2
Driver: JP2OpenJPEG/JPEG-2000 driver based on OpenJPEG library
Files: test_kakadu.jp2
Size is 219, 198
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (144.195272781219100,-37.528262376234096)
Pixel Size = (0.005000000000000,-0.005000000000000)
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  ( 144.1952728, -37.5282624) (144d11'42.98"E, 37d31'41.74"S)
Lower Left  ( 144.1952728, -38.5182624) (144d11'42.98"E, 38d31' 5.74"S)
Upper Right ( 145.2902728, -37.5282624) (145d17'24.98"E, 37d31'41.74"S)
Lower Right ( 145.2902728, -38.5182624) (145d17'24.98"E, 38d31' 5.74"S)
Center      ( 144.7427728, -38.0232624) (144d44'33.98"E, 38d 1'23.74"S)
Band 1 Block=219x198 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=219x198 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=219x198 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=219x198 Type=Byte, ColorInterp=Alpha

Attachments (1)

test_jp2s.zip (56.3 KB ) - added by lpinner 12 years ago.
ERDAS and Kakadu JP2 test images

Download all attachments as: .zip

Change History (4)

by lpinner, 12 years ago

Attachment: test_jp2s.zip added

ERDAS and Kakadu JP2 test images

comment:1 by lpinner, 12 years ago

Description: modified (diff)

comment:2 by Even Rouault, 12 years ago

Keywords: openjpeg added

I've investigated a bit and I've found the difference between the 2 images. The kakadu one uses 8 bit for each of the R,G,B and A componants, whereas the erdas one use 8 bit for the R,G,B components and 1 bit for the alpha componant. There's a safety check in the openjpeg driver currently to only address cases where all bands have the same bit depth. This should perhaps be relaxed, but it is likely there's some specific processing to do in th case of heterogeneous bit depths. I'm a bit hesitating trying to fix that now, because the openjpeg team is trying to merge the content of their v2 branch into their trunk, but there will be significant API changes between the trunk and the v2 branch, so it will better going back at this, once the dust has settled and the driver has been migrating to the new API

comment:3 by Even Rouault, 11 years ago

Milestone: 1.10.0
Resolution: fixed
Status: newclosed

Latest openjpeg driver in trunk can now handle test_erdas.jp2

Note: See TracTickets for help on using tickets.