[gdal-dev] Proper parameters for GDALBeginAsyncReader() for RGB images

Zermeno, Robert J CIV NAVAIR, 472100D robert.zermeno at navy.mil
Wed Jun 16 12:51:38 EDT 2010


Hi everyone,

I hope someone can clarify my issue when it comes to an RGB jpeg2000 image call
Using GDALBeginAsyncReader().  I can use this function already for Grayscale images, but
Having problems getting RGB colors to work.

In streaming jpeg2000 images (JPIP),How do you properly use GDALBeginAsyncReader() parameters in conjunction with GDALARGetNextUpdatedRegion().

So far, I usually get a AccessViolation which fails on the GDALARGetNextUpdatedRegion() call.  That 
would mean the way I provide the parameter information is not correct.

Do I call GDALBeginAsyncReader() three times like RasterIO?  One call for Red, one for Blue, 
and Green?

If I am correct, GDALBeginAsyncReader only needs to be called once.  This function asks for
the BandCount (1 for GrayScale, 3 for RGB) and Bandmap (Where 1 is GrayScale, and when in
case for RGB, 1 == Red Band 2 == Blue Band 3 == Green Band).

Am I correct so far?  For the Length of Buffer where I want to place the bytes, Should I have the
parameter as  (xSize * GDALGetRasterCount(fileDataset) )


On top of this, can someone give me an example call to GDALBeginAsyncReader() with parameters
for an RGB image.
Example not exact: 
Assume:
ImageWidth = 800
ImageHeight = 400
BufferXSize = 400
BufferYSize = 400
colorScheme = 3 (For RGB)
Bandmap[0] = 1, Bandmap[1] = 2, Bandmap[2] = 3
BYTE* JPIP_Buffer = (BYTE*)CLPMalloc(BufferXSize * BufferYSize * colorScheme)

Now, would I call the function as:

GDALBeginAsyncReader(fileDataset,
	0, 0, 				//Start at top-left position
	BufferXSize, BufferYSize,	
	JPIP_Buffer,
	BufferXSize * colorScheme,
	BufferYSize,
	GDT_Byte,
	colorScheme,
	Bandmap,
	0,
	0,
	0,
	0);

How is the image data stored in JPIP_Buffer. Whould it be:
1.rgbrgbrgbrgb
2.rrrrggggbbbb
3.bgrbgrbgrbgr

Thanks in advanced!!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4926 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100616/5de9fc17/smime.bin


More information about the gdal-dev mailing list