[gdal-dev] Problem using image bands
jcurru
jcurru at yahoo.es
Fri Oct 19 07:12:54 PDT 2012
Ouch!
Thank you very much, Even. I should have asked sooner, instead of going to bed at 5 in the morning... :-)
Yes, I have to read into a RGB buffer, but your solution would increase a lot the loading time for other images that are working well.
I have read this: http://trac.osgeo.org/gdal/changeset/25107. So, do you recommend me to change the code in ecwdataset.cpp and rebuild the library?
Thanks again!
José Antonio Carmena Flores
>________________________________
> De: Even Rouault [via OSGeo.org] <ml-node+s1560n5009874h37 at n6.nabble.com>
>Para: jcurru <jcurru at yahoo.es>
>Enviado: Viernes 19 de octubre de 2012 14:42
>Asunto: Re: Problem using image bands
>
>
>Selon jcurru <[hidden email]>:
>
>
>> Hello!
>>
>> I have a problem reading an ECW image. I want to read the image using only
>> the first band. So I use:
>> int bmap[3] = {1,1,1};
>> GDALImage->RasterIO(
>> GF_Read,
>> x, // int nXOff,
>> y, // int nYOff,
>> dx, // int nXSize,
>> dy, // int nXSize,
>> buffer, // void* pData,
>> xBufSize, // int nBufXSize,
>> yBufSize, // int nBufYSize,
>> GDT_Byte, // GDALDataType eBufType,
>> 3, // int nBandCount,
>> bmap, // int* panBandMap,
>> 3, // int nPixelSpace,
>> xBufSize * 3, // int nLineSpace,
>> 1 // int nBandSpace
>> );
>> This is working well with some ECW images (they show as grayscale) but it
>> does not with another, big ECW. It shows in full RGB color, exactly the same
>> as if I had written int bmap[3] = {1,2,3};
>I suppose you are using the 3.3 version of the ECW SDK ? Then, it is a known
>issue in the SDK itself. See http://trac.osgeo.org/gdal/ticket/4234 . A work
>around has been committed in the GDAL 2.0dev version just a few days ago.
>
>For currently released GDAL versions, if you only want to read one band, you
>could just use RasterIO() on the band object, instead of the whole dataset. If
>you need to read it into a RGB buffer, you just need to keep the pixel space and
>line space you've used in the above call, and after calling RasterIO() on the
>band, do a loop to copy each buffer[3*i] value into buffer[3*i+1] and
>buffer[3*i+2]
>
>
>>
>> Any idea?
>> Thanks in advance!
>>
>>
>>
>> --
>> View this message in context:
>> http://osgeo-org.1560.n6.nabble.com/Problem-using-image-bands-tp5009873.html
>> Sent from the GDAL - Dev mailing list archive at Nabble.com.
>> _______________________________________________
>> gdal-dev mailing list
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
>_______________________________________________
>gdal-dev mailing list
>[hidden email]
>http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>>________________________________
>
>If you reply to this email, your message will be added to the discussion below:http://osgeo-org.1560.n6.nabble.com/Problem-using-image-bands-tp5009873p5009874.html
>To unsubscribe from Problem using image bands, click here.
>NAML
>
>
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Problem-using-image-bands-tp5009873p5009885.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121019/328d0f9b/attachment.html>
More information about the gdal-dev
mailing list