【问题标题】:How to find max and min lightness values of an image in opencv?如何在opencv中找到图像的最大和最小亮度值?
【发布时间】:2013-02-06 07:52:24
【问题描述】:

我需要计算图像的动态范围。所以我需要计算图像的最大和最小亮度值。我需要使用opencv来做到这一点。知道如何在 opencv 中执行此操作吗?

【问题讨论】:

  • 你可以在这里找到答案:stackoverflow.com/questions/7253589/…
  • @OneManCrew 那么第 4 和第 5 个参数将是图像的最小值和最大值?
  • @OneManCrew 我正在使用您提到的问题的第二个答案。但是我的断言失败了。
  • @OneManCrew 断言失败 ((cn == 1 && (mask.empty() || mask.type() == CV_8U)) || (cn >= 1 && mask.empty() && !minIdx && !maxIdx)) 在 minMaxIdx 中。

标签: image-processing opencv computer-vision


【解决方案1】:

这可能会有所帮助:

 // find minimum intensity and location of minimum intensiy
void min_Loc(Mat* img, Point* minloc, double* minVal)
{
    Mat dst2gray;
    double maxVal;
    Point maxloc;
    cvtColor(*img, *img, CV_RGB2GRAY);
    minMaxLoc(*img, minVal, &maxVal,minloc,&maxloc); //find minimum and maximum intensities and their positions

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-04
    • 2019-09-16
    • 2014-02-02
    • 2011-11-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多