tform function in matlab

조회 수: 15 (최근 30일)
Satarupa Khamaru
Satarupa Khamaru 2017년 11월 28일
답변: Qing 2018년 1월 6일
Could anyone please help me to understand the value of tform matrix generated in this code? I got the tform matrix value as
tform.T =
0.9280 -0.0019 0
0.0019 0.9280 0
-90.8909 -31.3300 1.0000
I want to get the value of rotation matrix (2X2) and translation parameters tx and ty. Below is the code:
Image1 = imread('lineseg_left.jpg');
figure(9), imshow(Image1), title('Original image');
[xFixed, yFixed] = getpts;
fixedPoints(:,1) = xFixed;
fixedPoints(:,2) = yFixed;
% Choose points interactively in the displayed image using the mouse.
% Double-click to complete your selection. When you are done, getpts
% returns the position of your points.
Image2 = imread('lineseg_right.jpg');
figure(10), imshow(Image2),title('distorted image');
[xMoving, yMoving] = getpts;
movingPoints(:,1) = xMoving;
movingPoints(:,2) = yMoving; figure(11),imshowpair(Image1,Image2,'montage'),title('Original and distorted image');
%Nonreflective similarity transformations may include a rotation, a scale
% and a translation. Shapes and angles are preserved. Parallel lines remain
% parallel. straight lines remain straight.
% Recover the transformation
tform = fitgeotrans(movingPoints,fixedPoints,'NonreflectiveSimilarity');
% Use the tform estimate to resample the rotated imageto register it with
% the fixed image. The regions of color(green and magenta)in the false
% color overlay image indicate error inthe registration. This eror come
% form a lack of precise correspondance in the control points.
Image2Registered = imwarp(Image2,tform,'OutputView',imref2d(size(Image1)));
figure(12)
imshowpair(Image1,Image2Registered),title('Original image and Registered image');
tform.T %show the transform
  댓글 수: 1
Satarupa Khamaru
Satarupa Khamaru 2017년 11월 30일
Anyone to help?

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

답변 (1개)

Qing
Qing 2018년 1월 6일
Here is a Matlab document that explains each element in the tform matrix.

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by