Silvia,

As far as I know, the GDAL API doesn't have a function to read direct from a multi-band to 3D matrix.

The GDALRasterBand::RasterIO()[1] and GDALRasterBand::ReadBlock()[2] reads from one band at the time.

The GDALDataset::RasterIO()[3] does support multi-band reading but I believe that it will not going to word generically for whatever input you have and that is usually a import goal when programming with GDAL.

That will depend on the interleave mode and the returning buffer is not going to be exactly a 3D matrix but it could be interpreted as one with simple math. I guess.

But that doesn't mean that you cannot use the GDALRasterBand methods and write your on code to mount a 3D matrix. I don't know about the others but I feel safer with this approach instead of the GDALDAtaset one.

Anyway, Take a look in some C++ code, that doesn't do multi-band, but a least can give you one idea of how you can use GDAL in C++ to manipulate pixel values.[4]

1)http://www.gdal.org/classGDALDataset.html#e077c53268d2272eebed10b891a05743
2)http://www.gdal.org/classGDALRasterBand.html#09e1d83971ddff0b43deffd54ef25eef
3)http://www.gdal.org/classGDALDataset.html#e077c53268d2272eebed10b891a05743
4)http://perrygeo.googlecode.com/svn/trunk/demtools/

Best regards,

Ivan


Silvia Marchesi wrote:
Hi everybody,
 I'm a new user of gdal library and functions and I would like to know how
can I read a multiband image putting in a matrix (i.e. A[x][y][b]) the
values of the DN.

Thanks a lot,
Silvia



------------------------------------------------------------------------

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to