public int count(float value) { int count = 0; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { if (getPixel(x, y) == value) count++; } } return count; }