[Gdal-dev] 12 bit Jp2k image questions.

Frank Warmerdam warmerdam at pobox.com
Thu Dec 7 12:00:21 EST 2006


Daniele Romagnoli wrote:
> Hi List,
> after my last exam, I'm back working on GDAL ImageIO integration proposal.

Daniele,

That's great news!

> I have some questions...
> I'm using a 12 bit Jpeg2k sample, which shows up fine in Java using the 
> ImageIO pure Java reader based on JJ2000.
> 
> When opening this image with OpenEV or using gdalinfo, it says that the 
> image is 8 bit.
> When using JAVA GDAL Bindings the image seems to be 16 bit since the 
> Data Type we get is /GDT_UInt16/ . With no surprise the displayed image 
> is darker than expected.

I can see no obvious reason for gdalinfo reporting something different
than you get from the bindings unless the builds are really quite
different.  Can you point me to the sample file in question?

As for darker/lighter that can be highly affected by how the application
chooses to scale the 16bit image to 8bit.  In particular OpenEV has
some fairly fancy logic for computing a default scaling.

> As an aside, is it normal that I do not get any metadata back using the 
> Java Bindings for this jp2 image? I iwas hoping to get information about 
> the image type directly from metadata.

Metadata generally contains information beyond the basic structural
information such as datatype, pixels and lines, geolocation, coordinate
system.  In any event, there isn't currently a mechanism for capturing
metadata from jpeg2000 in the various jpeg2000 drivers as far as I am
aware.  The exception is fhat if you read a GMLJP2 file, and you request
metadata from the "GML" domain you should get the gmlcoverage XML document
back from the metadata api.

> What can I do to know in advance from GDAL that this image is 12 bit?

Consulting the band data type should be the right way, and it should
report GDT_UInt16 from gdalinfo, openev and your calls to the bindings
if you are really using the same library version in all cases.

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