I've an image and its pixels are in grid blocks. each pixel occupy 20x20px block of a grid . here is the image
I want to read color of each block of that grid. Here is the code which i tried.
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.abc);
for(int y=0; y<bmp.getHeight(); y=y+20){
for(int x=0; x<bmp.getWidth(); x=x+20){
pixelColor = bmp.getPixel(x,y);
}
}
The problem is now that, colors which are being read are of very slight difference and in result it is picking too many colors. For example in black color case it picks almost 10 black colors which slightly varies from each other. Please help me to pick all unique colors. any help would be much appreciated. Thank you