Calculate Mean and StdDev for the whole RGB image

asked 2018-07-28 11:05:02 -0500

opencv provides convenient function such as cv::mean and cv::meanStdDev which return mean and standard deviation vectors with particular values for each channel of the supplied RGB image.

Is there any way/function that I might be missing, to calculate mean and standard deviation of a whole RGB image i.e. not per channel values? In other words, what I'm looking for is a way or a function that would return a single mean value for the whole RGB image and equally a single stddev value for the whole image.

It's easy to calculate the mean for the whole RGB image as I can simply calculate mean of the returned channel mean(s), however I can't do the same thing with standard deviation.

edit retag flag offensive close merge delete

Comments

there is no "single" mean or stddev value for a multi channel image.

I can simply calculate mean of the returned channel mean(s), however I can't do the same thing with standard deviation.

why not ?

berak gravatar imageberak ( 2018-07-28 11:10:04 -0500 )edit

What is the formula for overall Std Dev? You can't simply do (stddev_r + stddev_g + stddev_b)/3

That's clear from the mathematical definition of stddev, you can however do that using particular means - again that's possible due to how the mean is mathematically defined

milosgajdos gravatar imagemilosgajdos ( 2018-07-28 11:13:14 -0500 )edit