word_renderer.py 文件源码

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

项目:text-renderer 作者: cjnolet 项目源码 文件源码
def sample_transformation(self, imsz):
        theta = math.radians(self.rotation[1]*n.random.randn() + self.rotation[0])
        ca = math.cos(theta)
        sa = math.sin(theta)
        R = n.zeros((3,3))
        R[0,0] = ca
        R[0,1] = -sa
        R[1,0] = sa
        R[1,1] = ca
        R[2,2] = 1
        S = n.eye(3,3)
        S[0,1] = math.tan(math.radians(self.skew[1]*n.random.randn() + self.skew[0]))
        A = matrix_mult(R,S)
        x = imsz[1]/2
        y = imsz[0]/2
        return (A[0,0], A[0,1], -x*A[0,0] - y*A[0,1] + x,
            A[1,0], A[1,1], -x*A[1,0] - y*A[1,1] + y)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号