tform function in matlab
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
Siehe auch
Kategorien
Mehr zu Geometric Transformation and Image Registration finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!