我是否在OpenCV中有任何函数,该调用告诉我最大的X和Y位置或我的Ycbcr帧的平均值。我已经完成了从RGB的转换,我可以找到最大值和最小值,但是使用for循环,我只需要太多内存
提前致谢
答案 0 :(得分:2)
minMaxLoc
功能可以帮助您做到这一点。
更新:例如:
Mat src = imread("image.jpg"), tmp;
cvtColor(src, tmp, CV_BGR2YCrCb);
//extract Y
extractChannel(tmp, tmp, 0);
Point min, max;
double minV, maxV;
minMaxLoc(tmp, &minV, &maxV, &min, &max);
cout << "Max value is " << maxV << " at position " << max << endl
<< "Min value is " << minV << " at position " << min << endl;
输出:
Max value is 255 at position [52, 19]
Min value is 0 at position [28, 1]