perspective_transform.py 文件源码

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

项目:ml-traffic 作者: Zepheus 项目源码 文件源码
def process(self, im):
        # if side is right flip so it becomes right
        if self.side != 'left':
            im = np.fliplr(im)

        # slope of the perspective
        slope = tan(radians(self.degrees))
        (h, w, _) = im.shape

        matrix_trans = np.array([[1, 0, 0],
                                [-slope/2, 1, slope * h / 2],
                                [-slope/w, 0, 1 + slope]])

        trans = ProjectiveTransform(matrix_trans)
        img_trans = warp(im, trans)
        if self.side != 'left':
            img_trans = np.fliplr(img_trans)
        return img_trans
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号