Find maximum value of a cv::Mat

后端 未结 1 1687
终归单人心
终归单人心 2021-02-07 01:05

I am trying to find the maximum pixel value of a cv::Mat.

The Problem : *maxValue is always returning 0.

From this S.O. th

相关标签:
1条回答
  • 2021-02-07 01:21

    You should use the OpenCV built-in function minMaxLoc instead of std function.

    Mat m;
    //Initialize m
    double minVal; 
    double maxVal; 
    Point minLoc; 
    Point maxLoc;
    
    minMaxLoc( m, &minVal, &maxVal, &minLoc, &maxLoc );
    
    cout << "min val: " << minVal << endl;
    cout << "max val: " << maxVal << endl;
    
    0 讨论(0)
提交回复
热议问题