# What does it mean to rotate an image by 0.1 degrees?

In the old Tangent Prop paper (you don't need to know this paper), the tangent vector of the rotation transformation (think of this as a vector-valued function) at some input image is approximated by (1) rotating this input image by a very small amount, (2) subtracting this rotated image from the original image and (3) dividing the result of subtraction by the degree rotated.

However, I'm not understanding what it means to rotate an image (i.e., a matrix) by a very small amount (less than one degree).

Also, how can this be implemented in Python using libraries like Python / Scipy / Skimage?

In addition, how am I supposed to know that the image has actually been rotated, since the rotation is so small?

Note: I tried to do rotation with Skimage, but it seems like Skimage allows rotations of at least 1 degree.

Since I'm new to these concepts, I wouldn't mind if someone points me to some resources or references since it might be hard to provide a succinct answer.

• I must admit I don't understand the question: You know what it means to rotate an image, right? – Marcus Müller May 27 '20 at 10:17
• The matrix will be the same M*N when we apply the transform only the values will be different. I suggest to read on image spatial transforms from youtube.com/watch?v=-vpJ_juSX7Q – MimSaad Jun 27 '20 at 9:57

## 2 Answers

From the article:

First the image is rotated by an infinitesimal amount $$\alpha$$. This is done by computing the rotated coordinates of each pixel and interpolating the gray level values at the new coordinates.

Interpolation is key to very small rotations. It allows to sample the image between the pixel center points as if it was a smooth 2-dimensional function. You can choose the interpolation method in skimage.transform.rotate using the parameter order. It controls the order of the interpolation method which (I think) is an interpolating cardinal B-spline. Higher orders give better results but are slower to compute.

If the tangent vector calculated by rotation, subtraction and division is increasingly non-zero as you go further away from the center, then that is an expected result and you can conclude that some rotation took place.

• +1... I was going to say the same – MimSaad Jun 27 '20 at 9:50

Your equation is essentially the definition of a derivative. As far as I can see, your definition is equivalent to finding the directional derivative at each point in the direction of the rotation (tangential to a circle centered at your rotation). A directional derivative can be found as the dot of the gradient and a unit direction vector. Thus, your problem is the equivalent of finding the gradient of a discretely sampled surface. There are various techniques for this.

You don't actually need to rotate the image to perform the calculation. The two approaches should be close approximations for each other for very small angles. For larger angles, the two approaches will diverge. This is very much like trying to estimate a derivative from differences.

I forgot to mention that you'll need to multiply by the radius as well.