[gdal-dev] Re: Reading RGB jpeg2000 image using Kakadu...proper order

Frank Warmerdam warmerdam at pobox.com
Mon May 10 14:21:07 EDT 2010


Zermeno, Robert J CIV NAVAIR, 472100D wrote:
> Frank,
> 
> Is there a specific order needed to read in the image pixels?  Meaning, you typically need to use the combination functions of:
> 1. 
> Redband  = GDALRasterBand(dataset,1)
> Blueband = GDALRasterBand(dataset,2)
> Greenband= GDALRasterBand(dataset,3)
> 2. 
> GDALRasterIO(redBand)
> GDALRasterIO(Blueand)
> GDALRasterIO(GreenBand)
> 
> 3. Depending on if Band 1 is Red, then store image data as:
> Image[0] = BlueBand
> Image[1] = GreenBand
> Image[2] = RedBand
> 
> This is a very general sense.  I have noticed if I switch the order of GDALRasterband, I am provided with an image that is not displayed correctly (certain colors of off).

Robert,

It should not matter which order the bands are read in.  That is to
say, reading Band 3 into buffer 3, band2 into buffer 2, and band1 into
buffer 1 should give the same result as reading band1 into buffer,
band2 into buffer2 and band 3 into buffer 3.

I will note that normally band 1 is red, band 2 is green and band 3
is blue.  I'm not sure why you seem to be mapping things differently
above.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list