Page 1 of 1

Method to analyze pixels

Posted: Tue Jan 04, 2011 6:09 pm
by BenV
Hey there

Is there a way to count the number of black pixels in an area? For example: In a 400 X 300 B/W image, I would like to count the number of black pixels in an area that's 15 by 15 pixels and in the bottom right corner. Is this possible? I have been looking in the Pixel Access methods but found nothing. I did try the GetPixelIntegerArray() or something like that but I can't figure out the values it puts in the array.

Re: Method to analyze pixels

Posted: Tue Jan 04, 2011 7:56 pm
by Elodie
Hi Ben,

You can easiliy do that using the CountColor method.

Just set the region of interest using the SetROI method, then call CountColor() method which will returns the number if pixel with the specified color.

See: https://www.gdpicture.com/guides/gdpicture/v7/html/con ... Color.html

Kind regards.

Re: Method to analyze pixels

Posted: Wed Jan 05, 2011 9:18 am
by BenV
Oke, thanks. Totally overlooked that method.