【问题标题】:Canny Edge Detector thresh2 > thresh1Canny 边缘检测器 thresh2 > thresh1
【发布时间】:2018-01-18 08:44:18
【问题描述】:

我目前正在使用 cv2 及其函数 canny() 在 python 中编写程序。为了找到两个好的阈值,我正在使用这个代码

http://mathalope.co.uk/2015/06/03/canny-edge-detection-app-with-opencv-python/

我的问题是:如果下阈值大于上阈值,程序如何“确定”哪个像素是边缘像素?我知道它对upper>lower 是如何工作的,但是如果反过来就无法掌握这个过程。

谢谢!

【问题讨论】:

    标签: python opencv cv2


    【解决方案1】:

    如果低阈值较高,则交换两个阈值。

    OpenCV是开源的,可以看source code

    if (low_thresh > high_thresh)
        std::swap(low_thresh, high_thresh);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-30
      • 2012-04-16
      • 1970-01-01
      • 2017-04-22
      • 1970-01-01
      • 1970-01-01
      • 2019-01-29
      • 1970-01-01
      相关资源
      最近更新 更多