#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgcodecs/imgcodecs.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
int main() {
cout << CV_VERSION << endl;
Mat lena = imread("1.jpg");
Mat lenaGray = imread("1.jpg",0);
double min, max;
Point minLoc, maxLoc;
minMaxLoc(lenaGray, &min, &max, &minLoc, &maxLoc);
cout << "最小值:" << min << ", 位于:" << minLoc << endl;
cout << "最大值:" << max << ",位于:" << maxLoc << endl;
Scalar scalar = mean(lena);
cout << "平均值:" << scalar << endl;
Mat meanMat,stdDevMat;
meanStdDev(lena, meanMat, stdDevMat);
cout << "平均值:" << meanMat << endl;
cout << "标准差:" << stdDevMat << endl;
waitKey(0);
return 0;
}
C++ Opencv 求灰度图像的 最大值 最小值 均值 均差 等
最新推荐文章于 2024-08-16 18:47:02 发布