oencv学习(9)--cvsum()求矩阵和以及全部额平均数

1 double m[4][4] = {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0};   
2 Mat M = Mat(4, 4, CV_64F ,m); 
3 
4 Scalar sca=sum(M);
5 double sum= sca.val[0]; 
6 cout<<sum<<endl;
7 cout<<sum/(M.rows*M.cols)<<endl;

 

相当于matlab两次means()
posted on 2013-05-26 18:17  happycaoyue  阅读(524)  评论(0编辑  收藏  举报