[gdal-dev] Problem with 4 bands Jpeg2000 files using GDAL + Erdas ECW4.3 Read-only

victor fomin victor.fomin.1 at gmail.com
Wed Oct 9 00:42:26 PDT 2013


Dear gdal-developers,

I noticed a strange behaviour while reading Pleaides Jpeg2000 4 bands EO
products using overviews. I use GDAL 1.10.1 with Erdas ECW4.3 to support
jpeg2000 files. The following code

GDALDataset * dataset = static_cast<GDALDataset *>(GDALOpen(inputFilename,
GA_ReadOnly));

< Image has : 4 bands, and WxH : 10296, 6573>
< Image DataType : GDT_UInt16>
<define parameters : offset={0,0}, desiredNbOfSamples=167424,
data.width=500, data.height=400>

// Just get and show twice the same data :
for (int index = 0; index < 2; index++)
{
int pixelSizeInBytes = nbBands * 8;
int rowSizeInBytes = pixelSizeInBytes * data.width;
for (int band=1;band<=nbBands;band++)

{

     GDALRasterBand* rasterBand = dataset->GetRasterBand(band)->
GetRasterSampleOverview(desiredNbOfSamples);
     rasterBand->RasterIO( GF_Read, offset[0], offset[1], data.width, data.
height,
                              data.buffer + 8*(band - 1), data.width, data.
height, GDT_Float64, pixelSizeInBytes, rowSizeInBytes );
}
showData(data);

}
GDALClose(dataset);

The result of the code is intended to show twice the same data, however the
result is that the first shown image is correct and the second image is
horizontally distorted (compressed) as 1/4 of the good width.
Could anyone, please explain me whether I missed something ?

Cheers,
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20131009/16559470/attachment.html>


More information about the gdal-dev mailing list