I need to find the mean value and the standard deviation of pixel values by mask on mobile devices with OpenGL ES 3.0 support. (I'm trying to write something like meanStdDev from OpenCV.)
But OpenGL ES doesn't provide any global pixel operations like sum. Actually it is the only global operation i need, because I can subtract or find squares with fragment shaders.
At the moment I compute sums with two nested for loops but I believe it is wrong way.
I've read about hacks with mip-mapping but as far as I understand it is applicable only to images which size is equal to power of two. And I don't know how to use it with mask.
What's the fastest way to solve the problem?
P.S. I'm a beginner in OpenGL.