I have computed mean and standart deviation values of a region in the image. The code:
Mat img=imread("a.jpg"); Mat hsv1; Mat mean, stdev; cvtColor(img, hsv1, CV_BGR2HSV); cv::meanStdDev(hsv1, mean, stdev, superpixel_mask); cout << "mean: " << mean << endl << "standard deviation: " << stdev << endl;
The output is:
mean: [150.8399251737039; 103.6980224478888; 226.161411010155] standard deviation: [23.98981564590477; 46.73491195049309; 34.41166394765997]
I would like to access those numbers. I wrote that code:
float Mi = mean.at<float>(0,0); cout << Mi << endl;
It gives that error:
OpenCV Error: Assertion failed (dims <= 2 && data && (unsigned)i0 < (unsigned)si ze.p[0] && (unsigned)(i1*DataType<_Tp>::channels) < (unsigned)(size.p[1]*channel s()) && ((((sizeof(size_t)<<28)|0x8442211) >> ((DataType<_Tp>::depth) & ((1 << 3 ) - 1))*4) & 15) == elemSize1()) in cv::Mat::at, file C:\OpenCV249\opencv\build\ include\opencv2/core/mat.hpp, line 537