Skip to main content
 首页 » 编程设计

python之我如何在 opencv 3 中运行 CV_DIST_L2

2025年02月15日8lhb25

代码:Detect Lines Opencv in object -> 在响应中

案例一:

for xxx in contours: 
   [vx,vy,x,y] = cv2.fitLine(xxx,cv2.cv.CV_DIST_L2,0,0.01,0.01) 

它抛出错误 -

AttributeError: module 'cv2' has no attribute 'cv'

案例2:

for xxx in contours: 
   [vx,vy,x,y] = cv2.fitLine(xxx,cv2.CV_DIST_L2,0,0.01,0.01) 

它抛出错误 -

AttributeError: module 'cv2' has no attribute 'CV_DIST_L2'

我的机器上安装了 opencv 3。我无法调试此错误。请让我知道我在做什么错误?

请您参考如下方法:

只需尝试不使用 CV 的 DIST_L2 就可以了