我目前正在学习OpenCV和AI对象检测。对于我的小项目,我想用一条线连接bboxes的中点,以创建一些模式。为此,我尝试使用HoughLinesPointSet()函数,但在我的测试代码中,它返回一个空的“lines”对象。源代码:
points = np.array([[ 0.0, 369.0 ], [ 10.0, 364.0 ], [ 20.0, 358.0 ], [ 30.0, 352.0 ],
[ 40.0, 346.0 ], [ 50.0, 341.0 ], [ 60.0, 335.0 ], [ 70.0, 329.0 ],
[ 80.0, 323.0 ], [ 90.0, 318.0 ], [ 100.0, 312.0 ], [ 110.0, 306.0 ],
[ 120.0, 300.0 ], [ 130.0, 295.0 ], [ 140.0, 289.0 ], [ 150.0, 284.0 ],
[ 160.0, 277.0 ], [ 170.0, 271.0 ], [ 180.0, 266.0 ], [ 190.0, 260.0 ]], np.float32)
points = points.reshape(1, -1, 2)
lines = []
cv2.HoughLinesPointSet(_point=points, _lines=np.float32(lines), lines_max=100, threshold=1, min_rho=0, max_rho=360, rho_step=1,
min_theta=0, max_theta=np.pi/2, theta_step=np.pi/180)
print(lines)
结果:
C:\Users\Fotoacc\anaconda3\python.exe C:/Users/Fotoacc/pythonProject/train_yolo_3.2/test.py
[]
Process finished with exit code 0
有人有这方面的经验吗?任何帮助都将不胜感激
目前没有回答
相关问题 更多 >
编程相关推荐