Affine.py 文件源码

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

项目:nimo 作者: wolfram2012 项目源码 文件源码
def AffineRotate(theta,new_size,center=None,filter=BILINEAR):
    '''
    Create a rotation about the origin.

    @param theta: the angle to rotate the image in radians.
    @param new_size: new size for the image.
    @param filter: PIL filter to use.
    '''
    matrix = array([[math.cos(theta),-math.sin(theta),0],[math.sin(theta),math.cos(theta),0],[0,0,1]],'d')

    rotate = AffineTransform(matrix,new_size,filter)
    if center == None:
        return rotate
    else:
        return AffineTranslate(center.X(),center.Y(),new_size)*rotate*AffineTranslate(-center.X(),-center.Y(),new_size)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号