w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
python: skimage.transform.AffineTransform rotation center

This is currently possible by combining the following transformations:

  1. Shift the image so that the centre is around the origin
  2. Rotate with N degrees
  3. Shift the image back

However, a single parameter would make this much easier! Would you please file an issue on GitHub so that we can implement this?

In the meantime, the code:

from skimage import data
from skimage import transform
import numpy as np
import matplotlib.pyplot as plt

image = data.chelsea()

shift_y, shift_x = np.array(image.shape[:2]) / 2.
tf_rotate = transform.SimilarityTransform(rotation=np.deg2rad(30))
tf_shift = transform.SimilarityTransform(translation=[-shift_x, -shift_y])
tf_shift_inv = transform.SimilarityTransform(translation=[shift_x,

image_rotated = transform.warp(image, (tf_shift + (tf_rotate +


© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.