[gdal-dev] JPEG2000 / GMLJP2: parameters seem to be ignored (offset location)
Even Rouault
even.rouault at spatialys.com
Fri Mar 29 06:34:01 PDT 2024
This might be tricky, because JPEG2000 itself has a concept of a image
space origin which is not necessarily (0,0) with the (XOSiz, YOSiz)
fields of the SIZ marker, although most of the time it is 0,0. I don't
remember how the GDAL JPEG2000 drivers behave regarding that, if they
ignore it (that is the GDAL 0,0 pixel is the one at (XOSiz,YOSiz)), of
if the first valid pixel in GDAL image space is actually (XOSiz, YOSiz)
and you have padding pixels between 0 and XOSiz/YOSiz.
You can get the XOSiz, YOSiz value with the
https://github.com/OSGeo/gdal/blob/master/swig/python/gdal-utils/osgeo_utils/samples/dump_jp2.py
script
Depending on how drivers behave, the combination of this JPEG2000
imaging (XOSiz, YOSiz) concept with the gml:low shift from GMLJP2 might
actually cancel and lead to the right result...
In any case data producers are calling for troubles by using any of
those mechanisms...
Le 29/03/2024 à 09:45, Philippe Ghesquiere via gdal-dev a écrit :
> Hi all,
>
> I have some questions about GMLJP2 parameters concerning location.
>
> *1) Description
> *Some JP2K images have a pixel origin different than (0 ; 0) (DIMAP
> products for example).
>
> In such cases, the GML header looks like like:
> <gml:GridEnvelope>
> *<gml:low>7 7</gml:low> <========== Different than "0 0"*
> <gml:high>1000 1000</gml:high>
> </gml:GridEnvelope>
>
> This origin coordinate should be taken into account for pixel location
> (See OGC 05-047r3 p93):
> <element name="startPoint" type="gml:integerList" minOccurs="0">
> <annotation>
> <documentation>
> Index position of the first grid post, which
> shall lie somwhere in the GridEnvelope. If absent, the
> startPoint is equal
> to the value of gridEnvelope::low from the grid definition.
> </documentation>
> </annotation>
> </element>
>
> It seems that this offset is not taken into account by GDAL location
> function.
>
> *2) How to reproduce*
> 2.1) Data creation
> Reference (no offset) image:
> gdal_create -of JP2OpenJPEG -co GMLJP2=YES -outsize 100 100 -bands 3
> -burn 0 -burn 255 -burn 0 -a_srs epsg:32632 -a_ullr 500000 500100
> 500100 500000 Offset_0.jp2
>
> Image with offset:
> sed s/"<gml:low>0 0"/"<gml:low>7 7"/g Offset_0.jp2 > Offset_7.jp2
>
> 2.2) Location test
> echo "0 0" | gdaltransform Offset_0.jp2 Offset_7.jp2
> 0 0 0
>
> *3) Question:*
> Shouldn't we have a 7 pixels offset between the 2 images
>
> Cheers
> Philippe
>
>
> The information in this e-mail is confidential. The contents may not
> be disclosed or used by anyone other than the addressee. Access to
> this e-mail by anyone else is unauthorised.
> If you are not the intended recipient, please notify Airbus
> immediately and delete this e-mail.
> Airbus cannot accept any responsibility for the accuracy or
> completeness of this e-mail as it has been sent over public networks.
> If you have any concerns over the content of this message or its
> Accuracy or Integrity, please contact Airbus immediately.
> All outgoing e-mails from Airbus are checked using regularly updated
> virus scanning software but you should take whatever measures you deem
> to be appropriate to ensure that this message and any attachments are
> virus free.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240329/9684b20b/attachment.htm>
More information about the gdal-dev
mailing list