You are on page 1of 4

2/3/12

Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink
Uni ed S a e Accele a ing he pace of enginee ing and cience C ea e Acco n Con ac U Soe

Products & Services P od c & Se ice >

Solutions Image P oce

Academ ia ing Toolbo >

Support

User Com m unit

Events

Com pan

E ample and Webina

Image Processing Toolbo


E amples and Webinars Finding the Rotation and Scale of a Distorted Image
If o kno ha one image i di o ed ela i e o ano he onl b a o a ion and cale change, o can e c2f m p o o find he o a ion angle and cale fac o . Yo can hen an fo m he di o ed image o eco e he o iginal image. TRY OR BUY
Con ac Sale P od c T ial P icing and Licen ing

Contents
S ep 1: Read Image S ep 2: Re i e he Image S ep 3: Ro a e he Image S ep 4: Selec Con ol Poin S ep 5: Infe T an fo m S ep 6: Sol e fo Scale and Angle S ep 7: Reco e O iginal Image

Step 1: Read Image


B ing o fa o i e image in o he o k pace.

I=i ed'aeaa.i'; m a(cm mn f) i h () m o I; e (ieI2,ieI1+5 .. (,) (,)1, . 'mg c Iae o e o M ah e f a c I i n eo Tcnlg' .. f ehoo , . 'o S e,,H io aAine ''ih'; Fn i '7'o n llgmn , g )

Step 2: Resi e the Image


cl =06 ae .; J=i eieI cl) %T m (, ae; a ig h cl fco. n e ae a

Step 3: Rotate the Image


h a=3; e 0 K=i oaeJ h a;%T m (, e ) a ig h age h a n e nl, e .

www.mathworks.in/products/image/demos.html?file=/products/demos/ship

1/4

2/3/12
fg e i h () i , K

Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink

Step 4: Select Control Points


U e he Con ol Poin Selec ion Tool o pick a lea i _ i o pai of con ol poin .

=[2.7 112;126 6.5; 198 4.5 1.3 77] =[3.6 201;103 7.0; 152 0.5 7.0 93] of he demo i h he e p e-picked poin , b picking o o n poin o ee ho he e l

b e i a _ Yo can a . c ee (,, c KIi Sa e con ol poin o e n he e

_ i

,ae i b _

) ;

b choo ing he File men , hen he Sa e Points to Workspace op ion. Sa e he poin , _ i and b e i a _ .

i ing a iable i

Step 5: Infer Transform


Find a T O M FR =c2f Af e c e ha i con i en ( i _ i ih o con ol poin . , ' e e ie iiai '; f c ) ing 'affine' in ead of 'non eflec i e imila i '.

,ae i b _

o ha e done S ep 6 and 7, epea S ep 5 h o gh 7 b l a good a he ee

Wha happen ? A e he e

i h 'non eflec i e imila i '?

Step 6: Sol e for Scale and Angle


The T O M FR incl de onl L e L e c e, , con ain a an fo ma ion ma i in . d a T . Since o kno a .i ela i el ha he an fo ma ion o a ion and caling, he ma h i imple o eco e he cale and angle.

c= * (h a c e ) = *i(h a e ) = .d aT a .i =[c0 ; c 0 ; 1 ]

Te,T h i

h e e

ad

ae

ad

ai

, e e ie . c

= .d aT (,) a .i 21; c= .d aT (,) a .i 11; c e e ee = a _ c d ( * + c c * ) h a e ee =aa2 ,c*8/i e _ c d ( )10 saerc ee = cl_eo rd

www.mathworks.in/products/image/demos.html?file=/products/demos/ship

2/4

2/3/12
060 .00

Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink

tearc ee = ht_eo rd 2.69 939

The a e f s a e r c v r d h cl_eoee f tearcvrd h ht_eoee d be 3 0

d be 0 6 .

ha e e s a e cl

ed i Step 2: Resi e the Image. The a e

ha e e t e a ht

ed i Step 3: Rotate the Image.

Step 7: Recover Original Image


Rec e he ab I e i igi a i age b he i e f I . ice ha he e i g-a de i f i ai i ha a g he da i he igi a i age I Thi i d e . i g ed ce he be he f i e a f i g K he , a ed-a d- ca ed i age, i g TOM FR c e ta d ha

he r c v r di age, eoee e ce he i age K a

hich i c ded h i i effec i e ha

a i g he g

i g-a d-

a i g. Sh i

igi a i age I . f he a f ai . If ee ic e i

The a ifac

d he edge a e d e

he i i ed acc ac f ai d be

i Step 4: Select Control Points, he a D=s eI; i ()

e acc a e.

rcvrd=itasomKt'Dt'[ D2]'Dt'[ D1]; eoee mrnfr(,,Xaa,1 (),Yaa,1 ()) %Cmaercvrdt I opr eoee o . fgr,iso() iue mhwI tte'' il(I) fgr,iso(eoee) iue mhwrcvrd tte'eoee' il(rcvrd)

www.mathworks.in/products/image/demos.html?file=/products/demos/ship

3/4

2/3/12

Examples and Webinars - Image Processing Toolbox for MATLAB & Simulink

1994-2011 The MathWorks, Inc.

Site Help

Patents

Trademarks

Privacy Policy

Preventing Piracy

www.mathworks.in/products/image/demos.html?file=/products/demos/ship

4/4

You might also like