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)
评论列表
文章目录