【问题标题】:Probabilistic Hough transform in OpenCV 2.4.9 (Python)OpenCV 2.4.9 (Python) 中的概率霍夫变换
【发布时间】:2014-08-30 12:49:58
【问题描述】:

我的问题是关于 OpenCV 2.4.9 (Python) 中的霍夫变换。

这是教程的摘录:

cv2.HoughLinesP(image, rho, theta, threshold[, lines[, minLineLength[, maxLineGap]]]) → 线条

我不太明白“行[”是什么意思。我以以下方式使用该功能:

lines = cv2.HoughLinesP(edges, 1, np.pi/180, 25, 2,25,115)

但是这里的参数“2”到底是什么意思呢?当我为该参数分配不同的值时,似乎没有任何变化。

坦克..

【问题讨论】:

    标签: python opencv hough-transform


    【解决方案1】:

    你必须这样使用它

    lines = cv2.HoughLinesP(edge_image, rho=1.0, theta=math.pi/180.0,
                                        threshold=thresholdVal,
                                        minLineLength=minlinelengthVal,
                                        maxLineGap=maxlinegapVal)
    

    如果您阅读有关 Hough Transforms 和概率霍夫变换的信息,您会意识到累加器用于累加所有边缘点。 rho 是以像素为单位的累加器的距离分辨率,theta 是以弧度为单位的累加器的角度分辨率。

    cv2.HoughLinesP(image, rho, theta, threshold[, lines[, minLineLength[, maxLineGap]]]) → lines docs 而言,它是一种函数重载,但由于python 提供了可选参数,因此使用了它。 lines[ 只是意味着您可以传递一个 numpy 数组来存储行。所以现在,如果你想传递其他参数并跳过lines,你必须通过参数名称来传递它们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-05-17
      • 1970-01-01
      • 1970-01-01
      • 2021-02-03
      • 1970-01-01
      • 1970-01-01
      • 2017-08-20
      相关资源
      最近更新 更多