summing of pixels the wellknown gather problem :-(

I do some image processing and need to sum pixels up.

In detail, I detect edges of an image and now i need to count all edge pixels and some values from another texture.

There is no really easy example in sdk folder for this kind of stuff.
atomic operations are not supported through my hardware.

Anybody has an example of summing up pixels of a texture?

thanks in advance

Look again. Hint: prefix sum

You might start looking at the block-internal sum and then at the larger examples. Hey, noone said fast solutions are always simple - but the prefix sum is not too hard to understand… :geek:


You solution will be even simpler than prefix sums, since you’re only computing the sum (you don’t need all the other (n-1) sums). This has been discussed on a previous thread: sum of all elements of a matrix