data.py 文件源码

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

项目:tefla 作者: openAGI 项目源码 文件源码
def build_center_uncenter_transforms(image_shape):
    """Center Unceter transform

    These are used to ensure that zooming and rotation happens around the center of the image.
    Use these transforms to center and uncenter the image around such a transform.

    Args:
        image_shape: tuple(rows, cols), input image shape

    Returns:
        a center and an uncenter transform instance
    """
    center_shift = np.array(
        [image_shape[1], image_shape[0]]) / 2.0 - 0.5  # need to swap rows and cols here apparently! confusing!
    tform_uncenter = skimage.transform.SimilarityTransform(
        translation=-center_shift)
    tform_center = skimage.transform.SimilarityTransform(
        translation=center_shift)
    return tform_center, tform_uncenter
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号