[gdal-dev] how to get pixel vlaue of specific color

Chaitanya kumar CH chaitanya.ch at gmail.com
Wed Jun 23 09:00:37 EDT 2010


Vajram,

There is no way to refer the pixel value by a color. In fact, a color
can be assigned to muliple pixel values.

You will have to iterate throuh the color entries to look for your color.

On 6/23/10, mail2vajram <mail2vajram at gmail.com> wrote:
>
> My image having pixel values between 0 to 8(classified image). The following
> code is used to read the colors of the image. Here i want know the pixel
> value of the specific color.
>
> Band band = ds.GetRasterBand(1);
>             ColorTable ct = band.GetRasterColorTable();
>
>             for (int i = 0; i < ct.GetCount(); i++)
>             {
>                 ColorEntry ce = ct.GetColorEntry(i);
>                 Color cr1 = Color.FromArgb(ce.c4, ce.c1, ce.c2, ce.c3);
>
>             }
>
> suppose here i am getting yellow, brown,blue,.......i want to know pixel
> value of the image where yellow color is located, like this brown,blue
> etc...............
>
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/how-to-get-pixel-vlaue-of-specific-color-tp5212348p5212348.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>

-- 
Sent from my mobile device

Best regards,
Chaitanya kumar CH.
/tʃaɪθənjə/ /kʊmɑr/
+91-9494447584
17.2416N 80.1426E


More information about the gdal-dev mailing list