RE: [gdal-dev] Proper parameters for GDALBeginAsyncReader() for RGB images
Thanks Frank! It made a lot of sense. My last comment concerning this function is how would you be able to Acquire a smaller image size of a larger image using GDALBeginAsyncReader() for RGB images? I can get it to work for Grayscale, but using the same parameters for RGB gives me an AccessViolation Error. Example: Example not exact: Assume: ImageWidth = 800 ImageHeight = 400 BufferXSize = 150 BufferYSize = 150 colorScheme = 3 (For RGB) Bandmap[0] = 1, Bandmap[1] = 2, Bandmap[2] = 3 BYTE* JPIP_Buffer = (BYTE*)CLPMalloc(BufferXSize * BufferYSize * colorScheme) Call to function: GDALBeginAsyncReader(fileDataset, 0, 0, //Start at top-left position ImageWidth, ImageHeight,//Note, I am requesting whole image. JPIP_Buffer, BufferXSize, BufferYSize, GDT_Byte, colorScheme, Bandmap, 0, 0, 0, 0); Under the hood, how does the function take the original image size and scale it down to fit Into the a size much smaller than original? For some reason, when I do this for RGB color Images, it gives a AccessViolation error when it calls GDALARGetNextUpdatedRegion(). However, For Grayscale images, it works fine. What would you think might be the problem? Thanks, Robert -Original Message- From: fwarmer...@gmail.com [mailto:fwarmer...@gmail.com] On Behalf Of Frank Warmerdam Sent: Wednesday, June 16, 2010 10:05 To: Zermeno, Robert J CIV NAVAIR, 472100D Cc: gdal-dev@lists.osgeo.org Subject: Re: [gdal-dev] Proper parameters for GDALBeginAsyncReader() for RGB images On Wed, Jun 16, 2010 at 12:51 PM, Zermeno, Robert J CIV NAVAIR, 472100D robert.zerm...@navy.mil wrote: Do I call GDALBeginAsyncReader() three times like RasterIO? One call for Red, one for Blue, and Green? Robert, The AsyncReader API allows reading multiple bands in one pass, much like the RasterIO call on the GDALDataset. 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) ) This is correct, On to GDALBeginAsyncReader(fileDataset, 0, 0, //Start at top-left position BufferXSize, BufferYSize, JPIP_Buffer, BufferXSize * colorScheme, BufferYSize, GDT_Byte, colorScheme, Bandmap, 0, 0, 0, 0); I think the problem is your passing of BufferXSize * colorScheme. That arguments should be the number of pixels in X, but not taking in account the number of bands. How is the image data stored in JPIP_Buffer. Whould it be: 1.rgbrgbrgbrgb 2. 3.bgrbgrbgrbgr By default (if all zero for the interleaving options) the image will be returned in band sequential form. So option '2' above. Best regards, -- ---+ ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush| Geospatial Programmer for Rent smime.p7s Description: S/MIME cryptographic signature ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Proper parameters for GDALBeginAsyncReader() for RGB images
On Thu, Jun 17, 2010 at 11:03 AM, Zermeno, Robert J CIV NAVAIR, 472100D robert.zerm...@navy.mil wrote: GDALBeginAsyncReader(fileDataset, 0, 0, //Start at top-left position ImageWidth, ImageHeight, //Note, I am requesting whole image. JPIP_Buffer, BufferXSize, BufferYSize, GDT_Byte, colorScheme, Bandmap, 0, 0, 0, 0); Under the hood, how does the function take the original image size and scale it down to fit Into the a size much smaller than original? For some reason, when I do this for RGB color Images, it gives a AccessViolation error when it calls GDALARGetNextUpdatedRegion(). However, For Grayscale images, it works fine. What would you think might be the problem? Robert, Your call parameters seem fine. I do not understand why you are having problems. If you are unable to get it to work, feel free to file a ticket with a small compilable code example demonstrating the problem, and setup to access a public server or data source. You asked how does the function take the original image and scale it down to fit in a much smaller image. I'm not sure if you are looking for internal details or just whether you are requesting this properly from the outside. If you need details about the internals I can try to provide. Best regards, -- ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush| Geospatial Programmer for Rent ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] Proper parameters for GDALBeginAsyncReader() for RGB images
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. 3.bgrbgrbgrbgr Thanks in advanced!! smime.p7s Description: S/MIME cryptographic signature ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Proper parameters for GDALBeginAsyncReader() for RGB images
On Wed, Jun 16, 2010 at 12:51 PM, Zermeno, Robert J CIV NAVAIR, 472100D robert.zerm...@navy.mil wrote: Do I call GDALBeginAsyncReader() three times like RasterIO? One call for Red, one for Blue, and Green? Robert, The AsyncReader API allows reading multiple bands in one pass, much like the RasterIO call on the GDALDataset. 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) ) This is correct, On to GDALBeginAsyncReader(fileDataset, 0, 0, //Start at top-left position BufferXSize, BufferYSize, JPIP_Buffer, BufferXSize * colorScheme, BufferYSize, GDT_Byte, colorScheme, Bandmap, 0, 0, 0, 0); I think the problem is your passing of BufferXSize * colorScheme. That arguments should be the number of pixels in X, but not taking in account the number of bands. How is the image data stored in JPIP_Buffer. Whould it be: 1.rgbrgbrgbrgb 2. 3.bgrbgrbgrbgr By default (if all zero for the interleaving options) the image will be returned in band sequential form. So option '2' above. Best regards, -- ---+-- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush| Geospatial Programmer for Rent ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev