1

我目前正在研究一个自动驾驶汽车的项目,但我遇到了 HoughLinesP 函数的问题。当汽车在转弯时,它会检测到一条“鬼线”。Bellow是我的函数的代码,这些是参数:

边缘:边缘检测器的输出。

lines:一个向量,用于存储线的起点和终点的坐标。

rho:分辨率参数\rho,以像素为单位。

theta:参数 \theta 的分辨率,单位为弧度。

阈值:检测一条线的最小交叉点数。

我增加了阈值参数,但它对直线有负面影响。

欢迎任何解决方案。

#Line segment detection
def detect_line_segments(cropped_edges):
    rho = 1  #Precision in pixel, i.e. 1 pixel
    angle = np.pi / 180  #Degree in radian, i.e. 1 degree
    min_threshold = 10  #Minimal of votes
line_segments = cv2.HoughLinesP(cropped_edges, rho, angle, min_threshold, np.array([]),
                                minLineLength=5, maxLineGap=4)

return line_segments

初始帧

提取边缘

车道线段

4

0 回答 0