stream_data.py 文件源码

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

项目:Two-Stream-Convolutional-Networks 作者: Yorwxue 项目源码 文件源码
def draw_flow(img, flow, step=16):
    h, w = img.shape[:2]
    y, x = np.mgrid[step/2:h:step, step/2:w:step].reshape(2, -1).astype(int)  # ????????????????????????16?reshape?2??array
    fx, fy = flow[y, x].T  # ???????????????
    lines = np.vstack([x, y, x+fx, y+fy]).T.reshape(-1, 2, 2)  # ????????????2*2???
    lines = np.int32(lines + 0.5)  # ????????????
    vis = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
    cv2.polylines(vis, lines, 0, (0, 255, 0))  # ???????????????
    for (x1, y1), (x2, y2) in lines:
        cv2.circle(vis, (x1, y1), 1, (0, 255, 0), -1)  # ???????????????????
    return vis
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号