[Gdal-dev] Unable to open JasPer JPEG2000 images
Steve Rawlinson
steve2 at rawlinson.ca
Sat Nov 25 13:12:21 EST 2006
Greetings,
I'm not able to open JPEG2000 JasPer images that were created by JasPer
itself using gdal_translate.
For example, if I convert a GeoTiff to jp2 (with CPL_DEBUG=ON):
D:\devel\gdal-1.3.2\apps>gdal_translate -of JPEG2000 testiq.tif test.jp2
GDAL: GDALOpen(testiq.tif) succeeds as GTiff.
Input file size is 500, 450
0...10...20...30...40...50...60...70...80...90...100 - done.
JPEG2000: Parameters, delivered to the JasPer library:
JPEG2000:
JPEG2000: IHDR box found. Dump: width=14, height=500, numcmpts=450,
bpp=1
GDAL: GDALClose()
JPEG2000: Unable to read JP2 header boxes.
ERROR 4: `test.jp2' not recognised as a supported file format.
GDAL: GDALClose(testiq.tif)
GDAL: GDALDeregister_GTiff() called.
[Despite the error, the image test.jp2 that was created seems fine and I
can view it in other programs.]
D:\devel\gdal-1.3.2\apps>gdalinfo test.jp2
JPEG2000: IHDR box found. Dump: width=14, height=500, numcmpts=450,
bpp=1
GDAL: GDALClose()
JPEG2000: Unable to read JP2 header boxes.
ERROR 4: `test.jp2' not recognised as a supported file format.
GDALOpen failed - 4
`test.jp2' not recognised as a supported file format.
GDAL: GDALDeregister_GTiff() called.
I built GDAL version 1.3.2 using Microsoft Visual C++ 2005 Express
Edition. I built JasPer from the recommended source
ftp://ftp.remotesensing.org/gdal/jasper-1.701.0.uuid.tar.gz. And set the
build opt flags to match the GDAL build opt flags (using /MD). gdalinfo
--formats reports "JPEG2000 (rw): JPEG-2000 part 1 (ISO/IEC 15444-1)".
I'm not using any other external libraries/formats.
Using some printfs in jpeg2000dataset.cpp the problem seems to be that
box->data.ihdr.bpc=0 (at line 659), so the paiDepth and pabSignedness
variables are not getting set. You can see this from the CPL Debug
messages as well, the IHDR box is found, but the next debug statement
inside the if statement, "Component bpp signedness" is never reached.
The test Jasper image I created above is available if anyone is interested
at http://www.rawlinson.ca/test.jp2. You may also be able to replicate
the problem yourself by using gdal_translate to create a .jp2 images, and
then trying to open it using gdalinfo.
Searching this mailing list it looks like others have had this same
problem in the past but no resolution was reported.
http://lists.maptools.org/pipermail/gdal-dev/2004-April/002469.html
http://lists.maptools.org/pipermail/gdal-dev/2005-December/007449.html
If anyone can provide any insight I would greatly appreciate it. I am
also be curious to know if anyone else can replicate this problem to
determine if there is a bug in jpeg2000dataset.cpp or something in my
build environment that may be causing the problem.
Thanks!
Steve
--
Steve Rawlinson
Rawlinson Geospatial Inc.
http://www.rawlinson.ca/
More information about the Gdal-dev
mailing list