<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
SriRam Prasad Bhasker wrote:
<blockquote
 cite="midOFCCD729DF.6423A63B-ON65257266.002B72A7-65257266.002B901D@rmsi.com"
 type="cite">
  <pre wrap="">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


  </pre>
</blockquote>
<br>
<br>
I would do this by<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; breaking up the image into three bands A, B and C.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; creating a new image with the bands C, B and A<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (add projection and georeferencing if needed)<br>
<br>
To get the bands I would use dataset.GetRasterBand( 1 | 2 | 3 )<br>
<br>
To create the new image I would write these bands to disk<br>
as temporary files and use vrtutils from OpenEV to<br>
create a virtual three band image and open this as<br>
a gdal dataset.<br>
<br>
I suspect<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -you do not want to import the whole of OpenEV<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to do this (on the other hand, if OpenEV is<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; available (e.g. you are working in python and<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import vrtutils works), this may be of some use).<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; -I am doing things the hard way&nbsp; (even taking into<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; account that I already have OpenEV available)<br>
<br>
I don't have any code that does exactly what you<br>
want. but the functions I use are<br>
&nbsp;&nbsp;&nbsp; vrtutils.VRTDatasetConstructor<br>
&nbsp;&nbsp;&nbsp; .AddSimpleBand<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - William Hughes<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; <br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<blockquote
 cite="midOFCCD729DF.6423A63B-ON65257266.002B72A7-65257266.002B901D@rmsi.com"
 type="cite">
  <pre wrap=""></pre>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Gdal-dev@lists.maptools.org">Gdal-dev@lists.maptools.org</a>
<a class="moz-txt-link-freetext" href="http://lists.maptools.org/mailman/listinfo/gdal-dev">http://lists.maptools.org/mailman/listinfo/gdal-dev</a></pre>
</blockquote>
<br>
</body>
</html>