Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink1
Transcript of Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink1
-
8/3/2019 Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink1
1/4
3/12 Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink
ww.mathworks.in/products/image/demos.html?file=/products/demos/ship
Uni ed Sae Conac U Soe
Ceae A
Products & Services Solutions Academia Support User Communit Events Compan
Podc & Seice > Image Poceing Toolbo > Eample and Webina
Image Processing Toolbo
Eamples and Webinars
Finding the Rotation and Scale of a Distorted Image
If o kno ha one im age i dioed elaie o anohe onl b a oaion and cale change, o can e cp2fom
o find he oaion angle and cale faco. Yo can hen anfom he di oed image o ecoe he oiginal im age.
Contents
Sep 1: Read Image
Sep 2: Reie he Image
Sep 3: Roae he Image
Sep 4: Selec Conol Poin
Sep 5: Infe Tanfom
Sep 6: Sole fo Scale and Angle
Sep 7: Recoe Oiginal Image
Step 1: Read Image
Bing o faoie image ino he okpace.
I = imead('cameaman.if');
imho(I);
e(ie(I,2),ie(I,1)+15, ...
'Image coe of Maache Inie of Technolog', ...
'FonSie',7,'HoionalAlignmen','igh');
Step 2: Resie the Image
cale = 0.6;
J = imeie(I,cale); % T aing he cale faco.
Step 3: Rotate the Image
hea = 30;
K = imoae(J,hea); % T aing he angle, hea.
TRY OR BU
Conac Sale
Podc Tia
Picing and
Acceleaing he pace of engineeing and cience
-
8/3/2019 Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink1
2/4
3/12 Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink
ww.mathworks.in/products/image/demos.html?file=/products/demos/ship
fige, ih(K)
Step 4: Select Control Points
Ue he Conol Poin Selecion Tool o pick a lea o pai of conol poin.
i_i = [129.87 141.25; 112.63 67.75];
bae_i = [135.26 200.15; 170.30 79.30];
Yo can n he e of he demo ih hee pe-picked poin, b picking o on poin o ee ho he e l
a.
ceec(K,I,i_i,bae_i);
Sae conol poin b chooing he File men, hen he Sae Points to Workspace opion. Sae he poin,
oeiing aiable i_i and bae_i.
Step 5: Infer Transform
Find a TFORM ce ha i conien ih o conol poin .
= c2f(i_i,bae_i,'efecie iiai');
Afe o hae done Sep 6 and 7, epea Sep 5 hogh 7 b ing 'affine' inead of 'noneflecie imilai'.
Wha happen? Ae he el a good a he ee ih 'noneflecie imilai'?
Step 6: Sole for Scale and Angle
The TFORM ce,, conain a anfomaion m ai in .daa.Ti. Since o kno ha he anfomaion
inclde onl oaion and caling, he mah i elaiel im ple o ecoe he cale and angle.
Le c = *c(hea)
Le = *i(hea)
The, Ti = .daa.Ti = [c - 0;
c 0;
1]
hee ad ae ad aai, eecie.
= .daa.Ti(2,1);
c = .daa.Ti(1,1);
cae_eceed = (* + c*c)
hea_eceed = aa2(,c)*180/i
scale_recoered =
-
8/3/2019 Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink1
3/4
3/12 Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink
ww.mathworks.in/products/image/demos.html?file=/products/demos/ship
0.6000
theta_recoered =
29.3699
The ae fscale_recovered hd be 0.6 haeescale ed i Step 2: Resie the Image . The ae
ftheta_recovered hd be 30 haeetheta ed i Step 3: Rotate the Image.
Step 7: Recover Original Image
Rece he igia i age b afig K, he aed-ad-caed iage, ig TFORM ce t ad ha
ab he ie fI.
I he recovered iage, ice ha he ei i a gd a i he igia iage I. Thi i de he
eece hich icded hiig-ad-aig he gig-ad-aig. Shiig edce he be f ie
i he iage K i effecie ha e ifai ha he igia i age I.
The aifac ad he edge ae de he i ied accac f he afai. If ee ic e i
i Step 4: Select Control Points, he afai d be e accae.
D = sie(I);
recovered = imtransform(K,t,'XData',[1 D(2)],'YData',[1 D(1)]);
% Compare recovered to I.
figure, imshow(I)
title('I')
figure, imshow(recovered)
title('recovered')
-
8/3/2019 Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink1
4/4
3/12 Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink
ww.mathworks.in/products/image/demos.html?file=/products/demos/ship
Preventing PiracyPrivacy PolicyTrademarksPatentsSite Help 1994-2011 The MathWorks, Inc.