How can I get estimated coordinates after performing transformation?

I have a set of 15 matched points as below.
base_points= [202.5 198.5; 3998.5 198.5; 4002.5 2602.5; 202.5 2602.5; 1002.5 198.5; 3202.5 198.5; 3202.5 2602.5; 1002.5 2602.5; 1802.5 198.5; 2402.5 198.5; 2402.5 2602.5; 1802.5 2602.5; 202.5 802.5; 4002.5 802.5; 4002.5 2002.5];
input_points= [278.5 246.5; 4038.5 170.5; 4162.5 2702.5; 170.5 2622.5; 994.5 194.5; 3250.5 146.5; 3322.5 2730.5; 922.5 2678.5; 1790.5 154.5; 2414.5 138.5; 2430.5 2738.5; 1766.5 2722.5; 226.5 810.5; 4102.5 766.5; 4162.5 2050.5];
I would like to perform 2 types of transformations, one with 2nd order polynomial and another one with piecewise linear transformation. I am using cp2tfrom as shown below.
t_poly_ord2 = cp2tform(input_points, base_points,'polynomial',2);
t_piecewise_l = cp2tform(input_points, base_points,'piecewise linear');
Is there any way to get the estimated coordinates of the both transformations?

답변 (1개)

Matt Fig
Matt Fig 2012년 10월 9일
편집: Matt Fig 2012년 10월 9일

0 개 추천

Have you looked at TFORMFWD?

댓글 수: 2

Liew
Liew 2012년 10월 9일
편집: Liew 2012년 10월 9일
Yes, I have tried but same error prompted when I run as below.
estm_poly2 = tformfwd(t_poly_ord2, input_points);
estm_pwl = tformfwd(t_piecewise_l, input_points);
Error displayed:
??? Error using ==> tform>checkTform at 109 Function TFORMFWD expected T's forward_fcn field to be non-empty.
Error in ==> tform at 30 [t, A] = checkTform(f, numout, varargin{:});
Error in ==> tformfwd at 68 varargout = tform('fwd', nargout, varargin{:});
I checked the tform struct of the both transformations and found out that both forward_fcn are empty. Anything I did it wrongly? However, I still can get the transformed images if I perform imtransfrom like this:
imtrans_poly2 = imtransform(I_input,t_poly_ord2,... 'XData',[1 info.Width], 'YData',[1 info.Height]);
imtrans_pwl = imtransform(I_input,t_piecewise_l,... 'XData',[1 info.Width], 'YData',[1 info.Height]);
Is it correct if I use fliptform to convert inverse_fcn into forward_fcn as shown below?
ft_poly_ord2 = fliptform(t_poly_ord2);
ft_pwl = fliptform(t_piecewise_l);
I have tried to use fliptform to convert inverse_fcn into forward_fcn and then use tformfwd. The coordinates are not correct, not match with the points' position on the image after transformed.

댓글을 달려면 로그인하십시오.

카테고리

질문:

2012년 10월 9일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by