preview_dataset.py 文件源码

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

项目:ego-lane-analysis-system 作者: rodrigoberriel 项目源码 文件源码
def apply_ipm(img, config, ys):
    # IPM
    y_top, y_bottom = min(ys), max(ys)
    ipm_pts = config['dataset']['ipm_points']
    roi = config['dataset']['region_of_interest']

    src = np.array([
        [ipm_pts['@top_left'], y_top],
        [ipm_pts['@top_right'], y_top],
        [ipm_pts['@bottom_right'], y_bottom],
        [ipm_pts['@bottom_left'], y_bottom],

       ], dtype="float32")

    dst = np.array([
        [ipm_pts['@top_left'], 0],
        [ipm_pts['@top_right'], 0],
        [ipm_pts['@top_right'], roi['@height']],
        [ipm_pts['@top_left'], roi['@height']],
       ], dtype="float32")

    M = cv2.getPerspectiveTransform(src, dst)
    return cv2.warpPerspective(img, M, (roi['@width'], roi['@height']))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号