main.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:Simple-Lane-Detection-System 作者: shivamsardana 项目源码 文件源码
def draw_lines(img, lines, color=[255, 0, 0], thickness=2):
    """
    averaging 
    &
    extrapolating 
    lines points achieved.
    """

    if len(img.shape) == 2:  # grayscale image -> make a "color" image out of it
        img = np.dstack((img, img, img))

    for line in lines:
        for x1, y1, x2, y2 in line:
            if x1 >= 0 and x1 < img.shape[1] and \
                            y1 >= 0 and y1 < img.shape[0] and \
                            x2 >= 0 and x2 < img.shape[1] and \
                            y2 >= 0 and y2 < img.shape[0]:
                cv2.line(img, (x1, y1), (x2, y2), color, thickness)
            else:
                print('BAD LINE (%d, %d, %d, %d)' % (x1, y1, x2, y2))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号