1. 程式人生 > >OpenCV中矩陣的歸一化

OpenCV中矩陣的歸一化

cv::Mat mat1=Mat(2,2,CV_32FC1);
mat1.at<float>(0,0) = 1.0f;
mat1.at<float>(0,1) = 2.0f;
mat1.at<float>(1,0) = 3.0f;
mat1.at<float>(1,1) = 4.0f;
// 對於這種小矩陣,還有更簡單的賦值方式,找時間再改
cout<<"Mat 1:"<<endl;
cout<<mat1<<endl;
normalize(mat1,mat1,1.0,0.0,NORM_MINMAX);
cout<<"Mat 2:"
<<endl; cout<<mat1<<endl;