Skip to content

Fix matrix calculation for shear angle in AffineTransform - #6717

Merged
stefanv merged 10 commits into
scikit-image:mainfrom
i-aki-y:fix-shear-transform
Apr 6, 2023
Merged

stefanv merged 10 commits into
scikit-image:mainfrom
i-aki-y:fix-shear-transform

Conversation

@i-aki-y

@i-aki-y i-aki-y commented Jan 31, 2023 •

Copy link
Copy Markdown
Contributor

Description

In this PR, I would like to fix #3239.

I think the following document is not correct for the shear parameter.

Has the following form::
X = a0*x + a1*y + a2 =
= sx*x*cos(rotation) - sy*y*sin(rotation + shear) + a2
Y = b0*x + b1*y + b2 =
= sx*x*sin(rotation) + sy*y*cos(rotation + shear) + b2

I rewrote the code with the following fixed equations:

X = sx * x * cos(rotation) - sy * y * (tan(shear) * sin(rotation) + sin(rotation)) + a2
Y = sx * x * sin(rotation) - sy * y * (tan(shear) * sin(rotation) - cos(rotation)) + b2

I would appreciate if you review this PR.

Derivation

For simplicity, ignoring the scale and translation, we can rewrite the original equations:

X = x * cos(rotation) - y * sin(rotation + shear)
Y = x * sin(rotation) + y * cos(rotation + shear)

However, the transformation matrix of rotation and shear should be the followings:

X = x * cos(rotation) - y * (tan(shear) * sin(rotation) + sin(rotation))
Y = x * sin(rotation) - y * (tan(shear) * sin(rotation) - cos(rotation)

Here is a derivation:

$$R_{\theta} S_{\phi_x} \begin{pmatrix} x \\\ y \end{pmatrix} = \begin{pmatrix} \cos\theta & -\sin\theta\\\ \sin\theta & \cos\theta \end{pmatrix} \begin{pmatrix} 1 & -\tan\phi_{x} \\\ 0 & 1 \end{pmatrix} \begin{pmatrix} x \\\ y \end{pmatrix}\\\ = \begin{pmatrix} \cos\theta & -(\tan\phi_x \cos\theta + \sin\theta)\\\ \sin\theta & -(\tan\phi_x \sin\theta - \cos\theta) \end{pmatrix} \begin{pmatrix} x \\\ y \end{pmatrix} \\\ = \begin{pmatrix} x \cos\theta - y \left( \tan\phi_x \cos\theta + \sin\theta \right) \\\ x \sin\theta - y \left( \tan\phi_x \sin\theta - \cos\theta \right) \end{pmatrix},$$

where the $\theta$ and $\phi_x$ correspond to rotation and shear, and $R_\theta$ and $S_{\phi_x}$ depict rotation and shear matrices.

So, the full expressions that include scale and translation will be:

X = sx * x * cos(rotation) - sy * y * (tan(shear) * sin(rotation) + sin(rotation)) + a2
Y = sx * x * sin(rotation) - sy * y * (tan(shear) * sin(rotation) - cos(rotation)) + b2

In this PR, I rewrote the code by using the above equations.

Example

This is an example of a comparison between current and fixed shear transform.

affine_shear

Checklist

  • Docstrings for all functions
  • Gallery example in ./doc/examples (new features only)
  • Benchmark in ./benchmarks, if your changes aren't covered by an
    existing benchmark
  • Unit tests
  • Clean style in the spirit of PEP8
  • Descriptive commit messages (see below)

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.
  • There is a bot to help automate backporting a PR to an older branch. For
    example, to backport to v0.19.x after merging, add the following in a PR
    comment: @meeseeksdev backport to v0.19.x
  • To run benchmarks on a PR, add the run-benchmark label. To rerun, the label
    can be removed and then added again. The benchmark output can be checked in
    the "Actions" tab.

@stefanv stefanv added this to the 0.20 milestone Feb 2, 2023
@jarrodmillman
jarrodmillman requested a review from lagru February 6, 2023 18:47

@lagru lagru left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @i-aki-y for tackling this!

In #3239 (comment) @hmaarrfk notes

Shear should not be a 1D parameter should it? I feel like you should have shear_x shear_y?

I'm a bit new to the math behind Affine transformations but if I follow your equation correctly $S_{\phi_x}$ only enables shearing in the x-dimension. We should probably extend this in the y-dimension as well to make this a complete fix? Wikipedia's article on Affine transformation also hints at the convention of horizontal and vertical shear being available.

And we should think about how bring users of the former behavior up to speed. Maybe we can raise an error or FutureWarning if only a scalar is provided as the shear parameter and expect a tuple of both shear angles from now on...

Comment thread skimage/transform/_geometric.py Resolved
return np.sqrt(np.sum(self.params ** 2, axis=0))[:self.dimensionality]
else:
ss = np.sum(self.params ** 2, axis=0)[:self.dimensionality]
ss[1] = ss[1] / (math.tan(self.shear)**2 + 1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you help me understand what is happening here? Why do we suddenly need a different calculation for the 2D case? If the matrix in self.params is correct, the dimensionality shouldn't matter?

Also you have moved the the indexing with [:self.dimensionality] into the square root's argument; was that intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not allowed to access self.shear in other dimensionality since the shear parameter is supported only in the case of the 2D version.
See:

@property
def shear(self):
if self.dimensionality != 2:
raise NotImplementedError(
'The shear property is only implemented for 2D transforms.'
)
beta = math.atan2(- self.params[0, 1], self.params[1, 1])
return beta - self.rotation

Also you have moved the the indexing with [:self.dimensionality] into the square root's argument; was that intentional?

The result is identical. But I fixed this not to be confusing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't notice that self.shear was only accessed in one case. However, I'm still confused. Why doesn't the

np.sqrt(np.sum(self.params ** 2, axis=0))[:self.dimensionality]

work for the 2D case? Testing with

t = ski.transform.AffineTransform(translation=(3, 4), rotation=1, scale=(5, 6), shear=0.2)
np.sqrt(np.sum(t.params ** 2, axis=0))[:t.dimensionality]
# array([5.        , 6.12203307])

seems to return a wrong factor, although it's suspiciously not far off. t.scale (your calculation in 2a5e6f9) returns the correct result. I'm asking myself if the calculation is even correct for the other non-2D cases... 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. With the new definition of the self.params, I used the following equations:

# (pseudo code)

# For sx
params[0, 0] := sx * cos(rot)
params[1, 0] := sx * sin(rot)

# Calc square sum
sum(params[:, 0]**2) 
-> sx**2 (cos(rot)**2 + sin(rot)**2)
-> sx**2

# Solving by sx
sx = sqrt(sum(params[:, 0]**2))

# For sy
params[0, 1] := -sy * (tan(shear) * cos(rot) + sin(rot))
params[1, 1] := -sy * (tan(shear) * sin(rot) - cos(rot))

# the square sum:
sum(params[:, 1]**2)
-> sy**2 (cos(rot)**2 + sin(rot)**2 + tan(shear)**2(cos(rot)**2 + sin(rot)**2))
-> sy**2 (1 + tan(shear)**2)

# Solving by sy
sy = sqrt(sum(params[:, 1]**2) / (1 + tan(shear**2)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That deduction seems correct. 👍

However, that the calculation for the 2D case is different from the "general ND" case leads me to believe that the latter may be wrong? Additionally, this property doesn't seem to be tested at all for non-2D cases.

@jni, you seem to have added ND support in #5188. Do you have more context concerning this calculation for ND matrices?

return np.sqrt(np.sum(self.params ** 2, axis=0))[:self.dimensionality]

I don't consider this blocking for this PR. For the 2D case at least, I'm reasonably sure that this PR is "more" correct. For other cases it leaves the old behavior unchanged.

Comment thread skimage/transform/_geometric.py Resolved
@lagru lagru added 🩹 type: Bug fix Fixes unexpected or incorrect behavior and removed 🐛 Bug labels Feb 7, 2023
@i-aki-y

i-aki-y commented Feb 8, 2023

Copy link
Copy Markdown
Contributor Author

@lagru Hi, thank you for your review!

I fixed some code and documentation.

We should probably extend this in the y-dimension as well to make this a complete fix?

I agree. Adding support for a y-direction shear is a nice idea, but I think the current implementation tries to support only the x-direction, so adding a shear_y is a new feature.
I think it would be better to make a separate PR for the feature, and I would like to focus on the bug fix here.
I will try this feature near future.

And we should think about how bring users of the former behavior up to speed. Maybe we can raise an error or FutureWarning if only a scalar is provided as the shear parameter and expect a tuple of both shear angles from now on…

Yes, and I think we should care about the order of operations because matrix multiplication is generally noncommutative.
(for example, $S_{\phi_y} S_{\phi_x} \neq S_{\phi_x} S_{\phi_y}$)
I also added documentation about the operation order to clarify what is going on in the current implementation. I think this is helpful for users.

@lagru

lagru commented Feb 8, 2023

Copy link
Copy Markdown
Member

@i-aki-y do you anticipate adding a second shear direction to be a lot more work?

but I think the current implementation tries to support only the x-direction, so adding a shear_y is a new feature.
I think it would be better to make a separate PR for the feature, and I would like to focus on the bug fix here.
I will try this feature near future.

After some back and forth I tend to agree with you and would be totally fine to split it into different PRs.

I was already anticipating how we would adapt our API to support a second shear angle. If the goal is to be consistent with the other parameters, passing in a single scalar value would translate as passing in the same angle for horizontal and vertical shear. Migrating our API towards that behavior is difficult without going through a tedious deprecation cycle for users. We don't do warnings for bug fixes, so I was looking to avoid that by doing both fix and new feature in one sweep.

But we could also just fix the old behavior, and only do the second shear transformation if two values are passed to shear. That would avoid changing existing API behavior. Though shear's behavior would be different from other parameters until we can fix it in skimage2.

@i-aki-y

i-aki-y commented Feb 9, 2023

Copy link
Copy Markdown
Contributor Author

@lagru I expect that the modification for the new feature is small. So if you prefer to include the feature in this PR, I can.
But I think a little discussion is needed to decide how to behave when adding the new shear parameter.

Translating the single shear as x and y shears with the same value (shear_x, shear_y == (shear, shear)) is intuitive and consistent with the current scale parameter's behavior.
But this fix will break the backward compatibility because the user assumes the shear as an x-directional shear. Some users emulate the y-directional shear in the following way:

 M_shear_x = AffineTransform(shear=shear_x)
 M_shear_y = AffineTransform(rotation=-pi / 4) + AffineTransform(shear=shear_y) + AffineTransform(rotation=pi / 4)

ex. https://github.com/albumentations-team/albumentations/blob/1eceb794ccbf52a02b09e630833f61366bef1149/albumentations/augmentations/geometric/transforms.py#L735-L737

I am not sure this is a common case, but I am concerned that it causes some confusion.

But we could also just fix the old behavior, and only do the second shear transformation if two values are passed to shear.

So, I prefer this scenario.

Though shear's behavior would be different from other parameters until we can fix it in skimage2.

This may be off-topic. I am not sure about skimage2, but if possible, I think the construction by method chaining is a good API that the matlibplot employed.

See https://matplotlib.org/stable/api/transformations.html#matplotlib.transforms.Affine2D

This allows the user to change the operation order, which is a matter for affine transform because the different operation order makes different transforms even if all parameters are the same.
Unfortunately, in the current skimage's API, the operation order is static, as I added in the document in this PR.
For example, in the following style, users can naturally encode the operation order and parameter without ambiguity.

trans = AffineTransform().translate(tx, ty).rotate(r).scale(sx, sy).shear(shx, shy)...

I think this could be added without conflict with the current implementation, but different method names are needed because some of them are already used for the properties scale, shear.

@lagru

lagru commented Feb 10, 2023 •

Copy link
Copy Markdown
Member

Wow, thanks for the great write-up! I really hadn't considered an API that allows successive application of transformation. I really like the concept of chaining operations. It's both explicit and flexible. And I also learned something new from your example on emulating y-shear with rotation.

So if you prefer to include the feature in this PR, I can.
But I think a little discussion is needed to decide how to behave when adding the new shear parameter.

No it's fine to keep it for another PR. You make a good argument to focus on the fix here, and to keep the behavior that a single scalar is interpreted as a shear in x-direction. We can worry about how and when to support the second dimension after that in another PR. Though I'd really like to add the functionality even if the API is gonna be a little awkward in the meantime. 🙏

@i-aki-y

i-aki-y commented Feb 13, 2023 •

Copy link
Copy Markdown
Contributor Author

@lagru Thank you for your comments.
I added some comments to your questions.

@jarrodmillman jarrodmillman modified the milestones: 0.20, 0.21 Feb 13, 2023
@lagru
lagru self-requested a review February 15, 2023 11:11
@lagru
lagru removed their request for review March 6, 2023 15:00
@i-aki-y

i-aki-y commented Mar 9, 2023 •

Copy link
Copy Markdown
Contributor Author

@lagru To clarify, I made a summary of the shear angle definition between the skimage and the Wikipedia definition.

affine_shear

I missed the last step $\tan(-\phi') = -\tan(\phi')$

@lagru
lagru self-requested a review March 16, 2023 08:54
@lagru

lagru commented Mar 16, 2023

Copy link
Copy Markdown
Member

Sorry for taking my sweet time here. 🙏

@lagru lagru left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving this. https://github.com/scikit-image/scikit-image/pull/6717/files#r1126511731 is still unresolved, but I don't consider it blocking for this PR which is a clear fix and improvement in my book! I've left a few suggestions, but none of them critical.

Thank you @i-aki-y. Your thorough and clear explanations were really useful and appreciated while reviewing this. 👌 Looking forward to #6752.

Comment thread skimage/transform/_geometric.py Resolved
Comment thread skimage/transform/_geometric.py Resolved
@lagru lagru changed the title Fix shear transform Fix matrix calculation for shear angle in AffineTransform Mar 31, 2023
@lagru

lagru commented Mar 31, 2023

Copy link
Copy Markdown
Member

I renamed to issue and PR title to be a bit more specific. Feel welcome to update, if you can think of a more expressive description.

@stefanv

stefanv commented Apr 4, 2023

Copy link
Copy Markdown
Member

Thanks for looking into this @i-aki-y!

It gets messy pretty quickly. Some of this comes down to the order in which operations are performed, but the current shear equation must be incorrect, just looking at the output:

import skimage as ski
import numpy as np
import matplotlib.pyplot as plt
 
tf = ski.transform.AffineTransform(shear=np.deg2rad(45))

image = ski.data.cat()
out = ski.transform.warp(image, tf.inverse)

f, (ax0, ax1) = plt.subplots(1, 2)
ax0.imshow(image)
ax1.imshow(out)
plt.show()

This is a good set of notes: https://people.computing.clemson.edu/~dhouse/courses/401/notes/affines-matrices.pdf

Very similarly: http://www.cs.cmu.edu/~16385/s18/lectures/lecture7.pdf

I had a hard time trying to come up with the formulation given in this PR, though:

        X = a0*x + a1*y + a2 =
          = sx*x*cos(rotation) - sy*y*(tan(shear) * sin(rotation) + sin(rotation)) + a2

        Y = b0*x + b1*y + b2 =
          = sx*x*sin(rotation) - sy*y*(tan(shear) * sin(rotation) - cos(rotation)) + b2

This does not follow clearly from the Wikipedia article, or from the above. Minor, but also in the above formulation I think a2 and b2 should be translation_x, translation_y.

I've implemented the different transformations in SymPy. If you can show me how the above formulation comes out of the below, I think we'd be in good shape to merge:

import sympy as sp

s_x, s_y, theta, h_x, h_y, x, y = sp.var(['S_x', 'S_y', 'theta', 'h_x', 'h_y', 'x', 'y'])

scale = sp.Matrix([[S_x, 0, 0], [0, S_y, 0], [0, 0, 1]])
shear = sp.Matrix([[1, h_x, 0], [h_y, 1, 0], [0, 0, 1]])
rotate = sp.Matrix([[sp.cos(theta), -sp.sin(theta), 0], [sp.sin(theta), sp.cos(theta), 0], [0, 0, 1]])

p = sp.Matrix([[x], [y], [1]])

rotate * shear * scale * p

Yields:

[S_x*x*(-h_y*sin(theta) + cos(theta)) + S_y*y*(h_x*cos(theta) - sin(theta))]
[ S_x*x*(h_y*cos(theta) + sin(theta)) + S_y*y*(h_x*sin(theta) + cos(theta))]

I would love to get this in for the next release that is due within a few days. @i-aki-y if you can work with me over the next day or two, I'm confident we can get it in.

/cc @ahojnnes, in case you wanted to take a look.
/cc @jarrodmillman

@i-aki-y

i-aki-y commented Apr 5, 2023

Copy link
Copy Markdown
Contributor Author

@stefanv Thank you for your review.

I think you can get the same form by replacing the variables:

# h_x = -tan(phi_x)
# h_y = 0
shear = sp.Matrix([[1, -sp.tan(phi_x), 0], [0, 1, 0], [0, 0, 1]])

The relation between phi_x and h_x is explained in the article https://en.wikipedia.org/wiki/Shear_mapping , and see also the diagram of my previous comment, where h_x = $m$ and phi_x = $\phi'$.

The h_y was set to zero because it is not supported yet. But if you set h_y = -tan(phi_y), the result would be equivalent to my next PR version(#6752).

This is my interpretation of your example.

affine_shear

I think it is consistent with the documented definition:

shear : float, optional
    The shear angle is the counter-clockwise radians by which the former y-axis is
    rotated around the origin [2]. Only available for 2D.

Note that the angle direction is slightly confusing, but we should take into account that the y-axis is vertically flipped.

Comment thread skimage/transform/_geometric.py Outdated
Comment on lines +818 to +822
X = a0*x + a1*y + a2 =
= sx*x*cos(rotation) - sy*y*sin(rotation + shear) + a2
= sx*x*cos(rotation) - sy*y*(tan(shear) * sin(rotation) + sin(rotation)) + a2

Y = b0*x + b1*y + b2 =
= sx*x*sin(rotation) + sy*y*cos(rotation + shear) + b2
= sx*x*sin(rotation) - sy*y*(tan(shear) * sin(rotation) - cos(rotation)) + b2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifying @stefanv's snippet according to #6717 (comment), I get the following:

import sympy as sp

s_x, s_y, theta, phi_x, h_x, h_y, x, y = sp.var(['S_x', 'S_y', 'theta', 'phi_x', 'h_x', 'h_y', 'x', 'y'])

scale = sp.Matrix([
    [S_x, 0, 0],
    [0, S_y, 0],
    [0, 0, 1],
])
shear = sp.Matrix([
    [1, -sp.tan(phi_x), 0],
    [0, 1, 0],
    [0, 0, 1],
])
rotate = sp.Matrix([
    [sp.cos(theta), -sp.sin(theta), 0],
    [sp.sin(theta), sp.cos(theta), 0],
    [0, 0, 1],
])

p = sp.Matrix([[x], [y], [1]])

rotate * shear * scale * p  # gives
# [S_x*x*cos(theta) + S_y*y*(-sin(theta) - cos(theta)*tan(phi_x))]
# [S_x*x*sin(theta) + S_y*y*(-sin(theta)*tan(phi_x) + cos(theta))]

It seems to me that the only difference is the cos(theta)*tan(phi_x) / tan(shear) * sin(rotation) part in the first equation. You actually got this result in your original description #6717 (comment): the last part of the rendered equation seems correct while you than don't carry over the cos... 🤔

@i-aki-y

i-aki-y commented Apr 5, 2023

Copy link
Copy Markdown
Contributor Author

@stefanv @lagru Ah, I see. You are right.
This is my mistake!

- sx*x*cos(rotation) - sy*y*(tan(shear) * sin(rotation) + sin(rotation))
+ sx*x*cos(rotation) - sy*y*(tan(shear) * cos(rotation) + sin(rotation))

I fixed this and the namings of (a2 -> translation_x, b2 -> translation_y).
Note the implementation uses the correct equation.

Thanks.

@stefanv

stefanv commented Apr 5, 2023 •

Copy link
Copy Markdown
Member

From the sources given in my last comment, it can be seen that adding y-shear is trivial, and adding 3D shear is quite feasible. I will get this in for now, but let's add that in a follow-up PR for completion (issue).

@stefanv
stefanv force-pushed the fix-shear-transform branch from d8326bf to a86064f Compare April 5, 2023 20:17
@stefanv

stefanv commented Apr 5, 2023

Copy link
Copy Markdown
Member

🤯 We've been stating that the rotation angle is anti-clockwise for many releases, but that is not the case.

import skimage as ski
import numpy as np
import matplotlib.pyplot as plt
 
tf = ski.transform.SimilarityTransform(rotation=np.deg2rad(10))

image = ski.data.cat()
out = ski.transform.warp(image, tf.inverse)

f, (ax0, ax1) = plt.subplots(1, 2)
ax0.imshow(image)
ax1.imshow(out)
plt.show()

Now, I think the updated docstrings are consistent: clockwise everywhere, including shear.

@stefanv

stefanv commented Apr 5, 2023

Copy link
Copy Markdown
Member

I think it is consistent with the documented definition:

I consider this to be a clockwise rotation of the y-axis.

@stefanv

stefanv commented Apr 5, 2023

Copy link
Copy Markdown
Member

@i-aki-y If you can confirm that the angle descriptions are now correct, we can go ahead and merge.

@i-aki-y

i-aki-y commented Apr 6, 2023

Copy link
Copy Markdown
Contributor Author

@stefanv OK. I checked some other methods that have a rotation parameter:

  • skimage.draw.ellipse
  • skimage.transform.rotate

And I confirmed that the results are consistent with your definition. In this case, the direction is clockwise.

From the sources given in my last comment, it can be seen that adding y-shear is trivial, and adding 3D shear is quite feasible. I will get this in for now, but let's add that in a follow-up PR for completion (issue).

I agree.

@stefanv
stefanv merged commit 54c2148 into scikit-image:main Apr 6, 2023
@stefanv

stefanv commented Apr 6, 2023

Copy link
Copy Markdown
Member

Thanks very much for this contribution @i-aki-y; it wasn't trivial to get all the details right, and I appreciate you doing all the necessary footwork.

rapids-bot Bot pushed a commit to rapidsai/cucim that referenced this pull request Jul 11, 2023
# Description

This MR ports several recent changes implemented upstream in scikit-image 0.21rc0. Some are just minor refactoring or documentation fixes, but I have commented on the more significant changes below so we can reuse that for the release note.

If preferred, I can split the items below into separate small PRs.

## API Changes / Deprecations
- The `random_state` argument of `medial_axis` and `unsupervised_wiener` is now deprecated and will be removed in the future. The new argument name, `seed`, should be used instead.

- The formerly private function `_invariant_denoise` has been renamed `denoise_invariant` and is now part of the public `cucim.skimage.restoration` API.

- The existing function `cucim.skimage.color.get_xyz_coords` has been renamed `cucim.skimage.color.xyz_tristimulus_values`. The former function name is deprecated and will be removed in the future.

## Enhancements
- A new `return_mapping` option was added to `join_segmentations`. This provides an additional output with a mapping between the labels in the joined segmentation and the original ones.

- Added support for y-axis shear to the [2D AffineTransform](scikit-image/scikit-image#6752)

## Backwards Incompatible Changes
- A bug fix to the energy calculation in `chan_vese` may result in different output from previous versions.

## Bug Fixes
- Fixed [bug in energy calculation in Chan-Vese](scikit-image/scikit-image#6902)

- Fixed a [bug in 2D shear calculations for `AffineTransform`](scikit-image/scikit-image#6717)

Authors:
  - Gregory Lee (https://github.com/grlee77)
  - https://github.com/jakirkham

Approvers:
  - Gigon Bae (https://github.com/gigony)

URL: #573
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🩹 type: Bug fix Fixes unexpected or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong matrix calculation for shear angle in AffineTransform

4 participants