How can I count the color pixels in each partition of the image

I have a image of 1000 x 1000 pixels of which I have made 5 x 5 partitions. After that I am looking for a way to count number of color pixels in each partition. Thanks in advance for help.


I got the following partitions:

partition image