OpenCV的cv::normalize函数

 1 #include<opencv2/opencv.hpp>
 2 #include<iostream>
 3 
 4 using namespace std;
 5 using namespace cv;
 6 
 7 int main()
 8 {
 9     Mat mat1 = Mat(2, 2, CV_32FC1);
10     mat1.at<float>(0, 0) = 1.0f;
11     mat1.at<float>(0, 1) = 2.0f;
12     mat1.at<float>(1, 0) = 3.0f;
13     mat1.at<float>(1, 1) = 4.0f;
14     // 对于这种小矩阵,还有更简单的赋值方式,找时间再改
15     cout << "Mat 1:" << endl;
16     cout << mat1 << endl;
17 
18     normalize(mat1, mat1, 1.0, 0.0, NORM_MINMAX);
19     cout << "Mat 2:" << endl;
20     cout << mat1 << endl;
21 }
View Code

 

参考:

https://windrocblog.sinaapp.com/?p=486

https://blog.csdn.net/cosmispower/article/details/64457406

猜你喜欢

转载自www.cnblogs.com/thebreakofdawn/p/9469263.html