Solved

tformfwd() ?

Posted on 2008-10-20
629 Views
Hi,

I have a set of 3 point pairs. A point is defined like:

pt = { x, y, scale, rotation }

I want to find the affine transformation that maps the 3 points to their point matches. Is there any way to do this in matlab? I know there is the tformfwd() function which looked promising but I don't know if it can handle a 3rd and 4th parameter attached to each point (scale and rotation). Any thoughts?

Thanks
0
Question by:DJ_AM_Juicebox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 27

Expert Comment

ID: 22792985
I am not really an expert in matlab, but I can try to help. What do you mean by point matches?
0

LVL 4

Accepted Solution

SyfAldeen earned 500 total points
ID: 22895724
DJ_AM_Juicebox,
Yes, you are quite right. maketform and tformfwd are the suitable functions to find and validate the affine transformation. However, you can't use them when your points are represented in this form. You can use the function below to convert your points to the proper form.

``````function [x y] = applytrans(p)
%   applytrans converts points from pt = { x, y, scale, rotation }
%                     to equivalent pt = { x, y}
%   By applying the scale and rotation transformation to original x, y.
%   For example:
%   A =[
%     1.0000    2.0000    3.0000    3.1416;
%     5.0000    6.0000    7.0000    1.5708;
%     4.0000    3.0000    1.0000   -1.5708;
%   ];
%
%   [x y]=applytrans(A)
%
%   Gives
%   x =
%    -3.0000
%   -42.0001
%     3.0000
%   y =
%    -6.0000
%    34.9998
%    -4.0000
x=p(:,1).*cos(p(:,4))-p(:,2).*sin(p(:,4));
y=p(:,1).*sin(p(:,4))+p(:,2).*cos(p(:,4));
x=p(:,3).*x;
y=p(:,3).*y;
``````
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This video teaches viewers about errors in exception handling.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses
Course of the Month9 days, 5 hours left to enroll