cpp
QString appPath = QCoreApplication::applicationDirPath();
imagePath = appPath + "/A.jpg";
img = cv::imread(imagePath.toStdString());
if (img.empty())
return;
double minv, maxv;
Point minLoc, maxLoc;
std::vector<Mat> mv;
split(img, mv);
for (int i = 0; i < mv.size(); i++)
{
//图像必须单通道
minMaxLoc(mv[i], &minv, &maxv, &minLoc, &maxLoc, cv::Mat());
std::cout << "channel" << i << "min value" << minv << "max value" << maxv<<std::endl ;
}
Mat mean, stddev;
//计算均值方差
meanStdDev(img,mean,stddev);
std::cout << "mean" << mean << "stddev" << stddev << std::endl;
推荐一个零声学院项目课,个人觉得老师讲得不错,分享给大家:
零声白金学习卡(含基础架构/高性能存储/golang云原生/音视频/Linux内核)
https://xxetb.xet.tech/s/3Zqhgt