[gdal-dev] Failing to read a JPEG2000
Frank Warmerdam
warmerdam at pobox.com
Tue Feb 26 11:57:09 EST 2008
Chris Eustace wrote:
> Hi there.
>
> I have built GDAL V1.4.4 using jasper-1.900.1.uuid so as to read
> georeferenced JPEG2000 files. This has been done on Solaris, various
> forms of Linux and Windows using various C++ compilers (g++ on *nix).
>
> This has worked very well, except for one particular JP2 file. The
> georeferencing information can be determined without a problem, but when
> it comes to reading the ColorInterpretation for each of the three colour
> bands in the file, I get an error in jpc_dec_decodepkts() (a JasPer low
> level call).
>
> This image can be successfully read and displayed by (some) other
> packages (eg. GlobalMapper).
>
> The image (38MB) can be found at:
> ftp://ftp.petrosys.com.au/pub/support/data/aust_jp2.jp2
>
> I am not sure whether it is a problem with GDAL or with JasPer. I did
> try and update some of the GDAL code with the V1.5.0 GDAL jpeg2000 code,
> but this did not help.
>
> The built gdalinfo executable also returns the relevant georeference
> information, but errors are seen when trying to determine the color
> information.
Chris,
I tried it too, and it does seem problematic. I ran gdalinfo against
the file and got the following errors:
Corner Coordinates:
Upper Left ( 108.0000000, -8.0000000) (108d 0'0.00"E, 8d 0'0.00"S)
Lower Left ( 108.0000000, -44.0000000) (108d 0'0.00"E, 44d 0'0.00"S)
Upper Right ( 156.0006000, -8.0000000) (156d 0'2.16"E, 8d 0'0.00"S)
Lower Right ( 156.0006000, -44.0000000) (156d 0'2.16"E, 44d 0'0.00"S)
Center ( 132.0003000, -26.0000000) (132d 0'1.08"E, 26d 0'0.00"S)
jpc_dec_decodepkts failed
error: cannot decode code stream
JPEG2000: Unable to decode image. Format: jp2, 4
Band 1 Block=256x256 Type=Byte, ColorInterp=Undefined
error: cannot get box
I should add this was after the process ballooned to 1.8GB of
RAM (and I think roughly 3GB of total process space). So it isn't
entirely clear to me if the problem was an out-of-memory one
that was poorly reported, or as you suggest something about the
color model. Given the pain I incurred trying the image, I'm not
inclined to try again. :-)
You could file a ticket on the issue, and perhaps Andrey would be
inclined to look into it.
I will note that the image works with the JP2KAK driver, but comes
in with odd colors. I suspect it is in an unusual color model and
this isn't being addressed by some or all drivers.
....
Actually, I see it comes in oddly colored with the JP2KAK driver,
but not the JP2ECW driver. So it seems the ECW SDK driver takes care
of the color conversion internally while the Kakadu library must
leave it up to the application.
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 | President OSGeo, http://osgeo.org
More information about the gdal-dev
mailing list