Tag Archives: count black pixels

Count pixels of different colors in C#

The following CountPixels method counts pixels in an image that match a target color. // Return the number of matching pixels. private int CountPixels(Bitmap bm, Color target_color) { // Loop through the pixels. int matches = 0; for (int y … Continue reading

Posted in algorithms, graphics, image processing | Tagged , , , , , , , , , , | 6 Comments