I have a 128 by 128 pixel image.
It's broken down into an 8 by 8 grid.
Each grid block contains 16 by 16 pixels.
Requirement
I want to count how many black pixels my image contains.
The straight forward way:
I could do this by going row by row, column by column, over the whole image and checking if the pixel was black or not.
The GPU way
...but I'd like to know if using the GPU, I could break down the image into chunks/blocks and count all pixels in each block and then sum the results.
For example:
If you look at the top left of the image:
First block, 'A1' (Row A, Column 1) contains a grid of 16 by 16 pixels, I know by counting them manually, there are 16 blacks pixels.
Second block: 'A2', (Row A, Column 2) contains a grid of 16 by 16 pixels, I know by counting them manually, there are 62 blacks pixels.
All other blocks for this example are blank/empty.
If I ran my image through my program, I should get the answer: 16 + 62 = 78 Black pixels.
Reasoning
It's my understanding that the GPU can operate on a lot of data in parallel, effectively running a small program on a chunk of data spread across multiple GPU threads. I'm not worried about speed/performance, I'd just like to know if this is something the GPU can/could do?

