Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Get the new coordinate after rotation

Solved!
Go to solution

hello master:

  i had thought about this question and try to calculate it for two days. but i still can't get the right coordinate.

picture 1.bmp, the coordinate of point "P" and point "Q" is known.

after we rotated with 337.96289 degree, i took a picture 2.bmp, the coordinate of point "Q" in 2.bmp is known. now how can i calculate the coordinate of point "P" in 2.bmp? this problem was suffering me. it will be very appreciated for any help or suggestion. thanks.

Download All
0 Kudos
Message 1 of 7
(4,297 Views)
knowing one point coordinate will not help you to find other points based on that point
for 2D area you need at least two known point or one point +rotation angle (theta) to find other points positions and for 3D you need at least 3 point or one point +two vertical rotation angle
0 Kudos
Message 2 of 7
(4,271 Views)
Solution
Accepted by Time_Walker

Something like this:

 

Create vector from first points which is distance from Q to P:  V(x,y) = P(x,y) - Q(x,y)

Create rotation matrix M using T=rotation angle:  First row = cos(T) sin(T)  Second row = -sin(T) cos(T).

Multiply matrix times vector:  Vnew(x,y) = M[2*2] * V(x,y)

Add Vnew to Qnew to get Pnew: Pnew(x,y) = Qnew(x,y) + Vnew(x,y)

 

I may have negative sine in wrong position, because I didn't look it up.  If the rotation is in the wrong direction, move the negative to the other sine.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 3 of 7
(4,255 Views)
Solution
Accepted by Time_Walker

hi Bruce

I always use bellow vi for this reason 

but as I told in my first post you can do this just when you have 

position of two points in one  2d plate ot you have position of one point + rotation angle of 2d plate 
with just one point it is impossible to find other point position based on that point 

rot.jpg

Message 4 of 7
(4,242 Views)

BruceAmmons 已写:

Something like this:

 

Create vector from first points which is distance from Q to P:  V(x,y) = P(x,y) - Q(x,y)

Create rotation matrix M using T=rotation angle:  First row = cos(T) sin(T)  Second row = -sin(T) cos(T).

Multiply matrix times vector:  Vnew(x,y) = M[2*2] * V(x,y)

Add Vnew to Qnew to get Pnew: Pnew(x,y) = Qnew(x,y) + Vnew(x,y)

 

I may have negative sine in wrong position, because I didn't look it up.  If the rotation is in the wrong direction, move the negative to the other sine.

 

Bruce


0 Kudos
Message 5 of 7
(4,192 Views)

Hatef.fouladi 已写:

hi Bruce

I always use bellow vi for this reason 

but as I told in my first post you can do this just when you have 

position of two points in one  2d plate ot you have position of one point + rotation angle of 2d plate 
with just one point it is impossible to find other point position based on that point 

rot.jpg


hello master:

  yes. i used the way which Bruse talked about. and then i used 2D Cartesian rotation.vi to finish the code. you are in the same way~ thanks for your reply.~

0 Kudos
Message 6 of 7
(4,190 Views)

this.pngyour welcome ,also you can use above vis for geometric calculation in image 

0 Kudos
Message 7 of 7
(4,182 Views)