0

所以我在 OpenCV 的 C++ 版本中使用了 cvThreshold,当使用 CV_THRESHOLD_OTSU 时,我得到一个双倍的回报,告诉我使用的阈值是什么。

在 OpenCVSharp 中,该函数被定义为仅返回 void。是我在滥用它还是我们不再获得该选项?

4

1 回答 1

0

OpenCVsharp 中的 Threshold 函数调用被编写为返回不会处理 thresholdType_Otsu 的 void。

它需要修改为

public static double Threshold( CvArr src, CvArr dst, double threshold, double max_value, ThresholdType threshold_type )
    {
        if (src == null)
            throw new ArgumentNullException("src");
        if (dst == null)
            throw new ArgumentNullException("dst");
        return CvInvoke.cvThreshold(src.CvPtr, dst.CvPtr, threshold, max_value, threshold_type);
    }

这适用于返回阈值以及返回无效的其他情况。

于 2012-05-07T16:48:23.777 回答