Inverse 2D rotation with negative parameters

Click For Summary
SUMMARY

The discussion centers on the challenge of performing inverse 2D transformations on images using rigid body transformations defined by parameters p = [p1, p2, p3], where p1 is the rotation angle and p2 and p3 are the x and y translations, respectively. The main issue arises when attempting to reverse the transformation of an image I' back to its original state I using negative parameters -p. The participants conclude that while translations can be easily inverted, rotations complicate the process due to the changing center of rotation after transformations. A proposed solution involves creating two separate routines: one for forward transformations and another for backward transformations, which first restores the image center before applying the inverse rotation.

PREREQUISITES
  • Understanding of 2D rigid body transformations
  • Familiarity with rotation matrices in homogeneous coordinates
  • Knowledge of image transformation techniques
  • Basic concepts of translation and rotation in coordinate systems
NEXT STEPS
  • Research the implementation of 2D rotation matrices in image processing
  • Explore homogeneous coordinates and their application in transformations
  • Learn about the effects of transformation sequences on image centers
  • Investigate methods for efficiently managing multiple transformation routines
USEFUL FOR

This discussion is beneficial for computer graphics developers, image processing engineers, and anyone involved in implementing 2D transformations in software applications.

atrus_ovis
Messages
99
Reaction score
0

Homework Statement


Say we have a 2D rigid body transform, with parameters p = [ p_1,p_2,p_3] for rotation, x translation and y translation respectively.
I'm using the transform to .. transform an image.

Is there a way to have:
For a point x , y : x',y' = transform(x,y,p) <=> x,y = transform(x',y',-p) , meaning trasforming the transformed point with negative parameters of the initial transformation, gives us the initial point.
Expanding to the image, , i'd want for an image I:
I' = transform(I,p) <=> I = transform(I',-p)

This works simply for transforms that include only translations, but not for rotations.

The rotation is done by rotating the points by the center of ther image.
So by using a 2D rotation matrix with homogenous coordinates to include translation , i have to ,prior to rotation , translate the image by -cx,-cy where cx,cy are the coordinates of the image center , rotate , and then applying the translation.
By this way though , i'd have to know all prior transformations done to the image to know the (now changed) "location" of the image center.

So in short:
I have an image I', transformed by coordinates p.I want a transformation method to yield I when transforming I' with parameters -p.

Any ideas for this to work? Is it even possible?
 
Physics news on Phys.org
I take it that p2 and p3 are the x and y translations but what is p1? The angle through which the figure rotated? But rotated about what point? The center? One corner?

Yes, translate the center of rotation to the origin, perform the rotation, then translate back again.

That is, taking (x_0, y_0) as the center of rotation, you want to go through a list of points defining the figure, each being (x, y), translate to (x- x_0, y- y_0), then rotate through angle \theta, using, perhaps, the matrix
\begin{bmatrix}cos(\theta) &amp; -sin(\theta) \\ sin(\theta) &amp; cos(\theta)\end{bmatrix}
then translate back, (x+ x_0, y+ y_0).
 
As i said, i rotate around the image center.
p1 is the rotation angle,p2 and p3 the x ,y translations respectively.

I am doing what you describe , but the problem is the following:
Say i have an image I', its center located at cx,cy, and it's transformed by p1,p2,p3.
(These parameters are unknown to me).
But by that transformation, the new image center ( that corresponds visually and logically to the initial image center) is now at cx + p2 , cy + p3.

If i use the same routine to apply a new transformation , i will rotate around cx,cy which is not the current image centre, but the initial one, so i won't get the initial image with parameters -p1 -p2 -p3.

A possible solution, is that i could have 2 routines, one for the "forward" transform that behaves the way you described, and one for the "backwards" transform, that firstly translates by -p2 -p3, and then applies the transformation. In that way, the image center will firstly get restored to its proper position and the rotation will be done "correctly".

But having two routines is undesirable.
 

Similar threads

  • · Replies 16 ·
Replies
16
Views
5K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
24
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
20
Views
4K
  • · Replies 51 ·
2
Replies
51
Views
6K
  • · Replies 22 ·
Replies
22
Views
2K
Replies
8
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K