Python skimage package has a function transform.AffineTransform() where one of the options is shear which does horizontal shear.
Obviously, I can do a vertical shear by switching axes back and forth. This is what I do:
from skimage import data, transform
import matplotlib.pyplot as plt
import numpy as np
img = data.astronaut()/255
v = 0.3
tf = transform.AffineTransform(shear=-v)
img2 = transform.warp(img, tf, order=1, preserve_range=True, mode='constant')
img3 = np.swapaxes(img, 0, 1)
img3 = transform.warp(img3, tf, order=1, preserve_range=True, mode='constant')
img3 = np.swapaxes(img3, 0, 1)
plt.imshow(np.hstack([img, img2, img3]))
plt.show()
Anyway, I am surprised there is no more direct way to define a vertical shear option... Am I mistaken?
