Reputation: 10996
I was looking at some code in python skimage toolkit regarding representing affine transformations in 2D and there is an AffineTransform
class which is defined as:
Parameters
----------
matrix : (3, 3) array, optional
Homogeneous transformation matrix.
scale : (sx, sy) as array, list or tuple, optional
Scale factors.
rotation : float, optional
Rotation angle in counter-clockwise direction as radians.
shear : float, optional
Shear angle in counter-clockwise direction as radians.
translation : (tx, ty) as array, list or tuple, optional
Translation parameters.
I notice that the shearing only takes one parameter (shearing angle in counter-clockwise direction). However, why should this not be two parameters? I can shear in x AND in y direction. How come these two operations map into one free parameter in 2D?
Upvotes: 0
Views: 1444
Reputation: 7253
Currently in the code we have, for the transformation matrix:
[sx * math.cos(rotation), -sy * math.sin(rotation + shear), 0],
[sx * math.sin(rotation), sy * math.cos(rotation + shear), 0],
[ 0, 0, 1]
I wonder if this is indeed the most intuitive way to specify shear. I have opened an issue: https://github.com/scikit-image/scikit-image/issues/1779
Upvotes: 1