OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Sat, 28 Jul 2018 11:05:02 -0500Calculate Mean and StdDev for the whole RGB imagehttp://answers.opencv.org/question/196552/calculate-mean-and-stddev-for-the-whole-rgb-image/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.
milosgajdosSat, 28 Jul 2018 11:05:02 -0500http://answers.opencv.org/question/196552/Problem with meanStdDevhttp://answers.opencv.org/question/6501/problem-with-meanstddev/I seem to be having a problem trying to compute the mean and standard deviation of pixels in an image. Can someone look at my code and point out what I am doing wrong? I am unable to get correct results.
cv::Mat img;
cv::Mat mean;
cv::Mat stddev;
cv::meanStdDev ( img, mean, stddev );
uchar mean_pxl = mean.data[0];
uchar stddev_pxl = stddev.data[0];
I have also tried to get the data using `mean.at<uchar>(0)` without success.
Thanks for your help.unxnutFri, 25 Jan 2013 14:14:51 -0600http://answers.opencv.org/question/6501/