测试灰度图在Mask下,三种均值统计方法,结果一样
灰度图 tempGray
二值Mask tempROIBinary
方法一:
//用meanStdDev求均值
Mat MeanMat,StddevMat;
meanStdDev(tempGray,MeanMat,StddevMat,tempROIBinary);
double dtempMean = MeanMat.at(0, 0);
double dtempStd = StddevMat.at(0, 0);
方法二:
//用mean求均值
Scalar fScalarMean = mean(tempGray,tempROIBinary);
dtempMean = fScalarMean [0];
方法三:
//自己算均值
tempGray = tempROIBinary.mul(tempGray )/255;
Scalar fScalarSum = sum(tempGray);
dtempMean = fScalarSum[0]/countNonZero(tempGray);
版权声明:本文为weixin_43387285原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。