Ask Your Question

Revision history [back]

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.