Re: [kakadu_jpeg2000] Support for GeoJPEG2000 needed

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [kakadu_jpeg2000] Support for GeoJPEG2000 needed

Julien Demaria
Greg,

If your need is only to read/write GeoTIFF and GeoJPEG2000 you should use
this library/utilities : http://www.gdal.org/ (I send a copy of this post
to the GDAL's mailing list)
It's a "Geospatial Data Abstraction Library" widely used which can
read/write many (~ 50) raster formats in a same generic way.
GDAL read/write GeoTIFF and has a GeoJPEG2000 driver using the Kakadu
library which allows to read/write GeoJPEG2000 files.
For example with GAL utilities you can create a GeoJPEG2000 from a GeoTIFF :
gdal_translate -of GTiff geojp2.jp2 geotiff.tif
the inverse operation is :
gdal_translate -of JP2KAK -co "QUALITY=10" geotiff.tif geojp2.jp2     for
create a GeoJP2 file (with size 10% of the original file) using Kakadu library.

If your really need to implement GeoTIFF geolocation in Kakadu TIFF and JP2
support, maybe you should also based your work on GDAL library.
But to my mind I think GDAL already do what you want...

Regards,


Julien

At 21:27 15/06/2005, greg_coatman wrote:

>Professor Taubman has advised me that the Kakadu Software does not read
>nor write
>GeoTIFF and GeoJPEG2000 images, and he asked me to post a public message here.
>Has anyone documented all of the changes necessary to the Kakadu Software
>so that it
>can read and write GeoTIFF and GeoJPEG2000 images?
>
>
>
>
>
>
>
>
>For problems with your subscription in this group please email
>[hidden email].
>
>Yahoo! Groups Links
>
><*> To visit your group on the web, go to:
>     http://groups.yahoo.com/group/kakadu_jpeg2000/
>
><*> To unsubscribe from this group, send an email to:
>     [hidden email]
>
><*> Your use of Yahoo! Groups is subject to:
>     http://docs.yahoo.com/info/terms/
>

_______________________________________________
Gdal-dev mailing list
[hidden email]
http://xserve.flids.com/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: [kakadu_jpeg2000] Support for GeoJPEG2000 needed

Julien Demaria
At 05:03 17/06/2005, Greg Coats wrote:

>Julien,
>Thanks for your message, unfortunately it leaves me confused.
>
>Under the heading Building GDAL From Source, External Libraries this web
>page http://www.gdal.org/gdal_building.html#libraries says that GDAL's
>JPEG2000 support is based on JasPer.  I suspect this web page has out of
>date information.  JasPer was superseded about two years ago by
>GeoJasPer.  GeoJasPer is fully aware of georeferencing info.
>GeoJasPer correctly transcodes between GeoTIFF and GeoJPEG2000 files.
>If GDAL is using GeoJasPer to support GeoTIFF and GeoJPEG2000 files, then
>GDAL does not have to do anything.

In fact GDAL support GeoJPEG2000 by several way :
         - the first driver is implemented with Jasper :
http://www.gdal.org/frmt_jpeg2000.html
           but I believe Jasper is less performant than Kakadu (and I
believe it read ALL the image in memory)
         - another driver is based on Kakadu :
http://www.gdal.org/frmt_jp2kak.html
         - now there is 2 other drivers supporting (Geo)JPEG2000 :
                 - with proprietary MrSID SDK which now can read/write JP2
too (I believe they use Kakadu internally)
                 - with the new free ErMapper ECW SDK, which also support
JP2 http://www.ermapper.com/downloads/download_view.aspx?PRODUCT_VERSION_ID=266


>A GeoJPEG2000 file begins with the standard JPEG2000 boxes, then adds a
>uuid box with georeferencing info, and concludes with the usual JPEG2000
>code stream.  A GeoJPEG2000 file could be made from a JPEG2000 file by
>inserting a uuid box with georeferencing info between the standard
>JPEG2000 boxes and the JPEG2000 code stream.

Yes I know and I GDAL do that very well : next the part in GDAL sources
which write the GeoTIFF informations in the jp2 uuid box :

/************************************************************************/
/*                       JP2KAKWriteGeoTIFFInfo()                       */
/************************************************************************/

void JP2KAKWriteGeoTIFFInfo( jp2_target *jp2_out, GDALDataset *poSrcDS )

{
/* -------------------------------------------------------------------- */
/*      Prepare the memory buffer containing the degenerate GeoTIFF     */
/*      file.                                                           */
/* -------------------------------------------------------------------- */
     const char *pszWKT;
     double      adfGeoTransform[6];
     int         nGTBufSize = 0;
     unsigned char *pabyGTBuf = NULL;

     if( GDALGetGCPCount( poSrcDS ) > 0 )
         pszWKT = poSrcDS->GetGCPProjection();
     else
         pszWKT = poSrcDS->GetProjectionRef();

     poSrcDS->GetGeoTransform(adfGeoTransform);

     if( GTIFMemBufFromWkt( pszWKT, adfGeoTransform,
                            poSrcDS->GetGCPCount(), poSrcDS->GetGCPs(),
                            &nGTBufSize, &pabyGTBuf ) != CE_None )
         return;

     if( nGTBufSize == 0 )
         return;

/* -------------------------------------------------------------------- */
/*      Write to a box on the JP2 file.                                 */
/* -------------------------------------------------------------------- */
#ifdef KAKADU4
     jp2_out->open_next( jp2_uuid_box_type );

     jp2_out->write( (kdu_byte *) msi_uuid2, sizeof(msi_uuid2) );

     jp2_out->write( (kdu_byte *) pabyGTBuf, nGTBufSize );

     jp2_out->close();
#else
     jp2_output_box &uuid_box = jp2_out->open_box( jp2_uuid_box_type );

     uuid_box.write( (kdu_byte *) msi_uuid2, sizeof(msi_uuid2) );

     uuid_box.write( (kdu_byte *) pabyGTBuf, nGTBufSize );

     uuid_box.close();
#endif

     CPLFree( pabyGTBuf );
}



>Given a losslessly compressed, archived GeoJPEG2000 file as input to be
>transcoded into a lossy GeoJPEG2000 image as output, all JPEG2000
>transcoders read the size of the uuid box and then read the georeferencing
>info.  If the JPEG2000 transcoder is not geo-aware, then it essentially
>discards the geo-info it just read in the uuid box.  If the JPEG2000
>transcoder is geo-aware, then it simply copies/writes the geo-info into a
>uuid box identical to the uuid box it just read.

I think a transcoder not geo-aware should copying all jp2 uuid box from
input to output. It hasn't to know what is it in the box, only to copy it
to copy the maximum of inputs informations, isn't it ?


>Since the Kakadu Software is the basis from many other JPEG2000
>transcoders, and frequently updated, it makes sense to include the copying
>of the georeferencing uuid box in Kakadu, rather than requiring each
>developer to reinvent this process.

Yes I like the idea Kakadu utilities copies the geo information from
geojp2/geotiff to geojp2/geotiff, why not.

>I got the impression from Professor Taubman that several Kakadu developers
>have already incorporated support for GeoJPEG2000 and GeoTIFF in their
>products.  If they will publicly document this, then that would be
>great.  If not, since I think it is to everyone's advantage to add
>GeoJPEG2000 and GeoTIFF support to Kakadu Software, then I volunteer to do so.

You should see the GDAL source code of the kakadu and geotiff drivers.

Best Regards,

Julien

>Greg
>
>
>On Jun 16, 2005, at 3:44 AM, Julien Demaria wrote:
>>Greg,
>>If your need is only to read/write GeoTIFF and GeoJPEG2000 you should use
>>this library/utilities : http://www.gdal.org/ (I send a separate copy of
>>this post to the GDAL's mailing list).
>>It's a "Geospatial Data Abstraction Library" widely used which can
>>read/write many (~ 50) raster formats in a same generic way.
>>GDAL read/write GeoTIFF and has a GeoJPEG2000 driver using the Kakadu
>>library which allows to read/write GeoJPEG2000 files.
>>For example with GAL utilities you can create a GeoJPEG2000 from a GeoTIFF :
>>gdal_translate -of GTiff geojp2.jp2 geotiff.tif
>>the inverse operation is :
>>gdal_translate -of JP2KAK -co "QUALITY=10" geotiff.tif geojp2.jp2
>>for create a GeoJP2 file (with size 10% of the original file) using
>>Kakadu library.
>>
>>If your really need to implement GeoTIFF geolocation in Kakadu TIFF and
>>JP2 support, maybe you should also based your work on GDAL library.
>>But to my mind I think GDAL already do what you want...
>>Regards,
>>Julien
>>
>>At 21:27 15/06/2005, greg_coatman wrote:
>>>Professor Taubman has advised me that the Kakadu Software does not read
>>>nor write
>>>GeoTIFF and GeoJPEG2000 images, and he asked me to post a public message
>>>here.
>>>Has anyone documented all of the changes necessary to the Kakadu
>>>Software so that it
>>>can read and write GeoTIFF and GeoJPEG2000 images?

_______________________________________________
Gdal-dev mailing list
[hidden email]
http://xserve.flids.com/mailman/listinfo/gdal-dev