[Gdal-dev] GDAL RGB PIXEL READING
William Hughes
whughes at nb.sympatico.ca
Wed Jan 17 08:40:11 EST 2007
SriRam Prasad Bhasker wrote:
>hi.
>
>has anyone got some source code to print the RGB values from an RGB Image.
>
>I have an RGB Image (3 Band Image)
>
>i need to programaticlaly create a new Image (swapping the Values of RGB
>as BGR)
>
>any help is welcome
>
>cheers
>s.p.bhasker
>
>
>
>
I would do this by
breaking up the image into three bands A, B and C.
creating a new image with the bands C, B and A
(add projection and georeferencing if needed)
To get the bands I would use dataset.GetRasterBand( 1 | 2 | 3 )
To create the new image I would write these bands to disk
as temporary files and use vrtutils from OpenEV to
create a virtual three band image and open this as
a gdal dataset.
I suspect
-you do not want to import the whole of OpenEV
to do this (on the other hand, if OpenEV is
available (e.g. you are working in python and
import vrtutils works), this may be of some use).
-I am doing things the hard way (even taking into
account that I already have OpenEV available)
I don't have any code that does exactly what you
want. but the functions I use are
vrtutils.VRTDatasetConstructor
.AddSimpleBand
- William Hughes
>------------------------------------------------------------------------
>
>_______________________________________________
>Gdal-dev mailing list
>Gdal-dev at lists.maptools.org
>http://lists.maptools.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070117/354b3d27/attachment.html
More information about the Gdal-dev
mailing list