OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.85k stars 2.53k forks source link

JPEG2000 compressed NITF not returning me the default amount of resolutions. #11035

Open chuck1987 opened 6 days ago

chuck1987 commented 6 days ago

What is the bug?

When compressing a NITF using JPEG2000 compression, I expect to get the 'DEFAULT' amount of resolutions and indicated by the driver.

RESOLUTIONS=: Number of resolution levels. Default value is selected such the smallest overview of a tile is no bigger than 128x128.

However, it seems I get at most 3 overviews and they never get as small as 128x128.

eg.

Band 1 Block=1024x1024 Type=Byte, ColorInterp=YCbCr_Cb Overviews: 4608x3584, 2304x1792, 1152x896 Overviews: arbitrary Image Structure Metadata: COMPRESSION=JPEG2000 Band 2 Block=1024x1024 Type=Byte, ColorInterp=Blue Overviews: 4608x3584, 2304x1792, 1152x896 Overviews: arbitrary Image Structure Metadata: COMPRESSION=JPEG2000 Band 3 Block=1024x1024 Type=Byte, ColorInterp=Green Overviews: 4608x3584, 2304x1792, 1152x896 Overviews: arbitrary Image Structure Metadata: COMPRESSION=JPEG2000 Band 4 Block=1024x1024 Type=Byte, ColorInterp=Undefined Overviews: 4608x3584, 2304x1792, 1152x896 Overviews: arbitrary Image Structure Metadata: COMPRESSION=JPEG2000 Band 5 Block=1024x1024 Type=Byte, ColorInterp=Red Overviews: 4608x3584, 2304x1792, 1152x896 Overviews: arbitrary Image Structure Metadata: COMPRESSION=JPEG2000 Band 6 Block=1024x1024 Type=Byte, ColorInterp=Undefined Overviews: 4608x3584, 2304x1792, 1152x896 Overviews: arbitrary Image Structure Metadata: COMPRESSION=JPEG2000 Band 7 Block=1024x1024 Type=Byte, ColorInterp=Undefined Overviews: 4608x3584, 2304x1792, 1152x896 Overviews: arbitrary Image Structure Metadata: COMPRESSION=JPEG2000 Band 8 Block=1024x1024 Type=Byte, ColorInterp=Undefined Overviews: 4608x3584, 2304x1792, 1152x896

Ideally, it would be nice to be able to control the resolutions with the RESOLUTIONS creation option.

Steps to reproduce the issue

Perform gdal_translate {input.ntf} {output.ntf} -co IC=C3 on a large dataset, and note the number of overviews.

Versions and provenance

Windows/Linux GDAL 3.10

Additional context

No response

rouault commented 6 days ago

However, it seems I get at most 3 overviews and they never get as small as 128x128.

"Default value is selected such the smallest overview of a tile is no bigger than 128x128."

Here your tiles are 1024x1024 large, hence 3 overview levels 512x512, 256x256, 128x128 at the tile level. Which also translate to 3 overview levels at the dataset level

I agree it could be nice to offer a RESOLUTIONS creation option at the NITF driver level (although some checks with the NITF spec should be done)

To be honest, given the specificity of the domain (people choosing NITF are self-inflicting themselves pain :-)), NITF related work easily leans on non-community support and you might want to reach a service provider