#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
//#include
#include
using namespace cv;
using namespace std;
int main()
{
Mat mat_src = Mat::eye(3, 4, CV_32F);
cout << "mat_src :" << endl;
cout << mat_src << endl;
cout << endl;
cout << "Rows : " << mat_src.rows << endl;
cout << "Cols : " << mat_src.cols << endl;
mat_src.at(0, 2) = 9000000;
mat_src.at(2, 0) = 4000000;
Mat B;
sqrt(mat_src,B);
cout << "B " << endl << B << endl;
cout << endl;
cout << "mat_src :" << endl;
cout << mat_src << endl;
int k = mat_src.at(0, 2);
cout << " k = " << k <
之前 sqrt 运算写成 Mat B = sqrt ( mat_str, B )结果报错
注意 : sqrt( A, B)的解释为将矩阵A开平方结果放到矩阵B中,不需要重新赋值。