1 | initial version |
you could use meanStdDev for this.
Mat m(5,5,CV_8U);
randu(m,0,100);
cerr << m << endl;
cerr << sum(m) << endl;
Scalar mea,dev;
meanStdDev( m,mea,dev );
cerr << mea << endl;
cerr << dev << endl;
[ 6, 97, 39, 29, 97;
10, 86, 93, 76, 29;
51, 38, 7, 38, 75;
23, 18, 1, 17, 3;
53, 43, 75, 64, 48]
[1116, 0, 0, 0]
[44.64, 0, 0, 0]
[30.4353, 0, 0, 0]
2 | No.2 Revision |
you could use meanStdDev for this.
Mat m(5,5,CV_8U);
randu(m,0,100);
Rect roi(2,2,2,2);
cerr << m << endl;
cerr << sum(m) m(roi) << endl;
Scalar mea,dev;
meanStdDev( m,mea,dev m(roi), mea, dev );
cerr << mea << endl;
cerr << dev << endl;
[ 6, 97, 39, 29, 97;
10, 86, 93, 76, 29;
51, 38, 7, 38, 75;
23, 18, 1, 17, 3;
53, 43, 75, 64, 48]
[1116, [ 7, 38;
1, 17]
[15.75, 0, 0, 0]
[44.64, 0, 0, 0]
[30.4353, [14.0601, 0, 0, 0]