tform function in matlab

15 visualizzazioni (ultimi 30 giorni)
Satarupa Khamaru
Satarupa Khamaru il 28 Nov 2017
Risposto: Qing il 6 Gen 2018
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

Risposte (1)

Qing
Qing il 6 Gen 2018
Here is a Matlab document that explains each element in the tform matrix.

Community Treasure Hunt

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

Start Hunting!

Translated by