Getting started with matlab image processing

Embed Size (px)

Citation preview

  • 8/9/2019 Getting started with matlab image processing

    1/140

    Two dayWorkshop onMatlab

  • 8/9/2019 Getting started with matlab image processing

    2/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    IntroductionCleve molar in 1984, Mathworks incIntroduced as a simulation tool

    Supports Graphical ProgrammingCan e inter!aced with other "igh#evel languages

  • 8/9/2019 Getting started with matlab image processing

    3/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Applications $erospace %iometrics

    Medical &inance Control S'stem Signal,Image,$udio and (ideo )eural networks,&u**' logic $nimation

  • 8/9/2019 Getting started with matlab image processing

    4/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    List of Companies $+ %- .Photoshop/ )$S$

    G- #0 2 %-2 % SC" P-PSI , C C$C #$ .)euro Marketing/

  • 8/9/2019 Getting started with matlab image processing

    5/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    ile !"tensions3!ig

    M$ #$% &igure 3m

    M$ #$% !unction, script, or class3mat M$ #$% inar' !ile !or storing varia les3me

    M$ #$% e ecuta le .plat!orm speci!ic, e3g3 53me mac5 !or theMac, 53me gl 5 !or#inu , etc3/ 3p

    M$ #$% content6o scured 3m !ile .result o! pcode./ /

    http://en.wikipedia.org/wiki/Macintoshhttp://en.wikipedia.org/wiki/Linuxhttp://en.wikipedia.org/wiki/Linuxhttp://en.wikipedia.org/wiki/Macintosh
  • 8/9/2019 Getting started with matlab image processing

    6/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Difference between C and Matlab

    Matla is Proprietar' compiler,C has open source3 In uilt &unctions in Matla .$pplication riented/3

    7ser !riendl' s'nta 3 &ourth generation Programming #anguage tool3

  • 8/9/2019 Getting started with matlab image processing

    7/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Desktop Tools Command indow

    t'pe commands

    orkspace view program varia les

    clear to clear dou le click on a varia le to see it in the $rra' -ditor

    Command "istor' view past commands

    save a whole session using diary

    #aunch Pad access tools, demos and documentation

  • 8/9/2019 Getting started with matlab image processing

    8/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Command window

  • 8/9/2019 Getting started with matlab image processing

    9/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Change the current working

    directory

  • 8/9/2019 Getting started with matlab image processing

    10/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Arithmetic operators

    1) plus - Plus +2) uplus - Unary plus +3) minus - Minus -4) uminus - Unary minus -5) mtimes - Matrix multiply *6) times - Array multiply .*7) mpo er - Matrix po er !") po er - Array po er .!#) ml$i%i$e - &a'(slas or le t matrix $i%i$e 1,) mr$i%i$e - las or ri t matrix $i%i$e /11) l$i%i$e - 0e t array $i%i$e .12) r$i%i$e - i t array $i%i$e ./

  • 8/9/2019 Getting started with matlab image processing

    11/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #elational operators1) e - ual 2) ne - ot e ual 3) lt - 0ess t an

    4) t - 8reater t an 95) le - 0ess t an or e ual 6) e - 8reater t an or e ual 9

  • 8/9/2019 Getting started with matlab image processing

    12/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Logical operators

    1/ Short6circuit logical $)+ 00/ Short6circuit logical 2 ::;/ and 6 -lement6wise logical $)+ 04/ or 6 -lement6wise logical 2 :/ or 6 #ogical -?C#7SI(- 2@/ an' 6 rue i! an' element o! vector is non*ero8/ all 6 rue i! all elements o! vector are non*ero

  • 8/9/2019 Getting started with matlab image processing

    13/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    $ITWI%! &'!#AT%1) :itan$ - &it- ise A ;.2) :it'mp - = .6) :itset - et :it.7) :it et - 8et :it.") :its i t - &it- ise s i t.

  • 8/9/2019 Getting started with matlab image processing

    14/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    (ectorsa A B1 ; 4 < > 9 8 @ D

    t A EF F Et = 0 2 4 6 8 10 12 14 16 18 20

    A a

    b = 3 4 5 6 7 8 11 10 9

    c A a c = 4 6 8 10 12 14 20 18 16

  • 8/9/2019 Getting started with matlab image processing

    15/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Matrices& ?1 2 3 4@5 6 7 "@# 1, 11 12 @

    & 1 2 3 4

    5 6 7 "

    # 1, 11 12

    < &B

    < 1 5 #2 6 1,

    3 7 11

    4 " 12

  • 8/9/2019 Getting started with matlab image processing

    16/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    $asic matri" operators> in%C ) @DE F =G HI MAH E>?AJI ei C ) Dei en %alue K%e'tor p polyC ) Dpolynomial' a:sCy) @

    ; minCa)@; maxCa)@

  • 8/9/2019 Getting started with matlab image processing

    17/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    'L&T

    tAEFE3

  • 8/9/2019 Getting started with matlab image processing

    18/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    I L&&'a 6@

    i a 9 6

    $ispCBa is reaterB)@ elsei a ,

    $ispCBa is LeroB)@ else

    $ispCBa is smallerB)@ en$

  • 8/9/2019 Getting started with matlab image processing

    19/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    L&&'a 5@

    or i 1 5

    a a+1 en$

    $ispCa)@

    $)S a A1E

  • 8/9/2019 Getting started with matlab image processing

    20/140Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    While Loop

    a 5@

    ile a 1,

    a a+1@

    en$

    $ispCa)@$ns a A1E

  • 8/9/2019 Getting started with matlab image processing

    21/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    unction

    !unction cAadd.a, /DcAa Dreturn

    MainaADcAadd.a, /D

    disp.c/DdAmul.a, /Ddisp.d/D

    function c=mul(a,b);c=a*b;return

  • 8/9/2019 Getting started with matlab image processing

    22/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    %WITC) CA%! met o$ B&ilinearB@ s it' lo erCM HI=;) 'ase NBlinearBJB:ilinearBO $ispCBMet o$ is linearB) 'ase B'u:i'B $ispCBMet o$ is 'u:i'B) 'ase BnearestB $ispCBMet o$ is nearestB) ot er ise

    $ispCBUn(no n met o$.B) en$

    $ns Method is linear

  • 8/9/2019 Getting started with matlab image processing

    23/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    %WITC) *+,M!#ICAL-a inputCBenter----9B)@s it' a 'ase 1 print CBoneB)@

    'ase 2 print CBt oB)@ 'ase 3 print CBt reeB)@ 'ase 4 print CB ourB)@ ot er ise print CBot er iseB)@en$

  • 8/9/2019 Getting started with matlab image processing

    24/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    )ow to read an imagea =imread('cameraman.tif');imshow(a);

    pixval on;

    a =imread('flowers.tif');imshow(a);

    pixval on;

  • 8/9/2019 Getting started with matlab image processing

    25/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    )ow to read an audio file

    a a%rea$CBtest. a%B)@a%playCaJ441,,)@PlotCa)@

  • 8/9/2019 Getting started with matlab image processing

    26/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    )ow to read an .ideo file

    a=aviread('movie.avi');movie(a);

  • 8/9/2019 Getting started with matlab image processing

    27/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Add two images

    I A imread.Hrice3ti!H/D A imread.Hcameraman3ti!H/DJ A imadd.I, ,Huint1>H/Dimshow.J,B /

    I = imread('rice.tif'); J = imadd(I, !); subplot(",#,"), imshow(I) subplot(",#,#), imshow(J)

  • 8/9/2019 Getting started with matlab image processing

    28/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    %ubtract two images

    I A imread.Hrice3ti!H/D IK A imsu tract.I,

  • 8/9/2019 Getting started with matlab image processing

    29/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Con.ert image to gray and binaryclc;

    clear;close alla= imread('flowers.tif');subplot(#,#,");

    imshow(a);subplot(#,#,#); b=imresi$e(a,%# & # & );imshow(b);subplot(#,#, );c=r b# ra (b);imshow(c);subplot(#,#,+);d=im#bw(c);

    imshow(d);

  • 8/9/2019 Getting started with matlab image processing

    30/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #/$ componenta=imread('flowers.tif');subplot(#,#,");imshow(a);=a;-=a;=a;

    (/,/,#/ )=!;subplot(#,#,#);imshow( );-(/,/,")=!;-(/,/, )=!;subplot(#,#, );imshow(-);(/,/,")=!;(/,/,#)=!;subplot(#,#,+);imshow( );

  • 8/9/2019 Getting started with matlab image processing

    31/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Con.ert Image into &ne dimensional

    a A imread.Hcameraman3ti!H/D

    Br c Asi*e.a/D

    #enArLcD

    Areshape.a,B1 #en /D

  • 8/9/2019 Getting started with matlab image processing

    32/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C&+(!# M&(I! T& #AM!%

    !ileAaviin!o.Hmovie13aviH/D to get in!oramtaion a t video !ile!rmNcntA!ile3)um&rames )o3o! !rames in the video !ilestr AH3 mpH h A wait ar.E,HPlease wait333H/D!or iA1F!rmNcnt !rm.i/Aaviread.!ilename,i/D read the (ideo !ile !rmNnameA!rame im.!rm.i//D Convert &rame to image !ile

    !rmNnameArg gra'.!rmNname/D convert gra'!ilename1Astrcat.strcat.num str.i//,str /D

    imwrite.!rmNname,!ilename1/D rite image !ile wait ar.iO!rmNcnt,h/

    endclose.h/

  • 8/9/2019 Getting started with matlab image processing

    33/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C&+(!#T #AM!% T& M&(I!%!rmNcntA

  • 8/9/2019 Getting started with matlab image processing

    34/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    )ow to read a te"t file!id A !open.Hmessage3t tH,HrH/Dice1A !read.!id/Ds A char.ice1H/D!close.!id/Ddisp.s/D

    $ns hello

  • 8/9/2019 Getting started with matlab image processing

    35/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    )ow to write a te"t file

    txt=%& &0 &1 &2 ;fid = fopen('output.txt','wb');

    fwrite(fid,char(txt),'char');fclose(fid);

    345 =3678

  • 8/9/2019 Getting started with matlab image processing

    36/140

  • 8/9/2019 Getting started with matlab image processing

    37/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    %A(! A+D L&AD T)! (A#IA$L!

    $A

  • 8/9/2019 Getting started with matlab image processing

    38/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Wa.elet transform

    a =imread('cameraman.tif');

    %99 9: :9 :: =dwt#(a,'haar');

    7ec=%... 99,9: :9,:: ... ;

    imshow(7ec,% );

  • 8/9/2019 Getting started with matlab image processing

    39/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    DCT transform

    a=imread('cameraman.tif');subplot(", ,");imshow(a,% );

    b=dct#(a);subplot(", ,#);imshow(b,% );title('76 ');c=idct#(b);subplot(", , );imshow(c,% );title('I76 ');

  • 8/9/2019 Getting started with matlab image processing

    40/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    +&I%! A+D ILT!#

    I = imread('ei ht.tif'); J = imnoise(I,'salt < pepper',!.!#); = medfilt#(J); subplot(",#,");imshow(J)subplot(",#,#);imshow( )

  • 8/9/2019 Getting started with matlab image processing

    41/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    /,I

  • 8/9/2019 Getting started with matlab image processing

    42/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    DIAL&/ $&1

    warndl ('hello'); helpdl ('hello'); errordl ('hello');

    ms box('hello');

  • 8/9/2019 Getting started with matlab image processing

    43/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    %utton)ameAKuestdlg.H hat is 'our wishQH, 333 HGenie RuestionH, 333 H&oodH,HClothingH,HMone'H,HMone'H/D

    switch %utton)ame, case H&oodH,

    disp.H&ood is deliveredH/D case HClothingH, disp.H he -mperorHHs new clothes have arrived3H/ case HMone'H, disp.H$ ton o! mone' !alls out the sk'3H/D end switch

  • 8/9/2019 Getting started with matlab image processing

    44/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    ,%!# I+T!# AC! /!T IL!B!ilename, pathname A uiget!ile.HL3mH, HPick an M6!ileH/D i! iseKual.!ilename,E/ : iseKual.pathname,E/ disp.H7ser pressed cancelH/ else disp.BH7ser selected H, !ull!ile.pathname, !ilename/ / end

  • 8/9/2019 Getting started with matlab image processing

    45/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    ,%!# I+T!# AC! ',T IL!

    %filename, pathname = uiputfile('*.m', '>ic? an @Afile'); if iseBual(filename,!) C iseBual(pathname,!) disp('Dser pressed cancel') else disp(%'Dser selected ', fullfile(pathname, filename) ) end

  • 8/9/2019 Getting started with matlab image processing

    46/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    /,I

  • 8/9/2019 Getting started with matlab image processing

    47/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    /,I2

  • 8/9/2019 Getting started with matlab image processing

    48/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    M!+, $A#

  • 8/9/2019 Getting started with matlab image processing

    49/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    ',%) $,TT&+

  • 8/9/2019 Getting started with matlab image processing

    50/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    T&//L! $,TT&+

  • 8/9/2019 Getting started with matlab image processing

    51/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #ADI& $,TT&+

  • 8/9/2019 Getting started with matlab image processing

    52/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C)!C3$&1

  • 8/9/2019 Getting started with matlab image processing

    53/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    !DIT T!1T

  • 8/9/2019 Getting started with matlab image processing

    54/140

  • 8/9/2019 Getting started with matlab image processing

    55/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    %LID!#

  • 8/9/2019 Getting started with matlab image processing

    56/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #AM!

  • 8/9/2019 Getting started with matlab image processing

    57/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    LI%T$&1

  • 8/9/2019 Getting started with matlab image processing

    58/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    '&',' M!+,

  • 8/9/2019 Getting started with matlab image processing

    59/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    A1!%

  • 8/9/2019 Getting started with matlab image processing

    60/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    ALI/+ &$4!CT%

  • 8/9/2019 Getting started with matlab image processing

    61/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    M!+, !DIT

  • 8/9/2019 Getting started with matlab image processing

    62/140

  • 8/9/2019 Getting started with matlab image processing

    63/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    '#&'!#T5 I+%'!CT

  • 8/9/2019 Getting started with matlab image processing

    64/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

  • 8/9/2019 Getting started with matlab image processing

    65/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #,+

  • 8/9/2019 Getting started with matlab image processing

    66/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    !M'T5 /,I

  • 8/9/2019 Getting started with matlab image processing

    67/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    /!+!#AT!D M IL!

  • 8/9/2019 Getting started with matlab image processing

    68/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    ',%) $,TT&+

  • 8/9/2019 Getting started with matlab image processing

    69/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 ',%) $,TT&+ 6 /&

    '#&'!#T5 I+%'!CT

  • 8/9/2019 Getting started with matlab image processing

    70/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C)A+/! T)! %T#I+/ A+D TA/

    (AL,!

  • 8/9/2019 Getting started with matlab image processing

    71/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C)A+/! T)! %T#I+/ A+D TA/

    (AL,!

  • 8/9/2019 Getting started with matlab image processing

    72/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 ',%) $,TT&+ 6 /&

    M IL! !DIT

  • 8/9/2019 Getting started with matlab image processing

    73/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    /& CALL$AC3

  • 8/9/2019 Getting started with matlab image processing

    74/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D! $!L&W T)!

    CALL$AC3a =imread('cameraman.tif');

    imshow(a);

  • 8/9/2019 Getting started with matlab image processing

    75/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #,+ T)! '#&/#AM '#!%% 7

  • 8/9/2019 Getting started with matlab image processing

    76/140

  • 8/9/2019 Getting started with matlab image processing

    77/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C)&&%! A1!%

  • 8/9/2019 Getting started with matlab image processing

    78/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 A1!% 6 /&

    '#&'!#T5 I+%'!CT

  • 8/9/2019 Getting started with matlab image processing

    79/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C)A+/! T)! %T#I+/ A+D TA/

    (AL,!

  • 8/9/2019 Getting started with matlab image processing

    80/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D! $!L&W T)!

    CALL$AC3a =imread('cameraman.tif');axes(handles.one);

    imshow(a);

  • 8/9/2019 Getting started with matlab image processing

    81/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #,+ T)! '#&/#AM

  • 8/9/2019 Getting started with matlab image processing

    82/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C&D!

    a =imread('cameraman.tif');

    axes(handles.one);

    imshow(a);

  • 8/9/2019 Getting started with matlab image processing

    83/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    T&//L! $,TT&+

  • 8/9/2019 Getting started with matlab image processing

    84/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 T&//L! 6 /&

    '#&'!#T5 I+%'!CT

  • 8/9/2019 Getting started with matlab image processing

    85/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C)A+/! T)! %T#I+/ A+D TA/

    (AL,!

  • 8/9/2019 Getting started with matlab image processing

    86/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 T&//L! 6 /& M

    IL! !DIT

  • 8/9/2019 Getting started with matlab image processing

    87/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D! $!L&W T)!

    CALL$AC3a=get(hObject,'Value');

    if a ==1

    a =imread('cameraman.tif');

    axes(handles.one);

    imshow(a); else a =imread('greens.j g');

    axes(handles.one);

    imshow(a); end

  • 8/9/2019 Getting started with matlab image processing

    88/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #,+ T)! '#&/#AM

  • 8/9/2019 Getting started with matlab image processing

    89/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 #ADI& $,TT&+ 6 /&

    '#&'!#T5 I+%'!CT

  • 8/9/2019 Getting started with matlab image processing

    90/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C)A+/! T)! %T#I+/ A+D TA/

    (AL,!

  • 8/9/2019 Getting started with matlab image processing

    91/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 C)!C3 $&1 6 /&

    M IL! !DIT

  • 8/9/2019 Getting started with matlab image processing

    92/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D! $!L&W T)!

    CALL$AC3

  • 8/9/2019 Getting started with matlab image processing

    93/140

  • 8/9/2019 Getting started with matlab image processing

    94/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 C)!C3 $&1 6 /&

    '#&'!#T5 I+%'!CT

  • 8/9/2019 Getting started with matlab image processing

    95/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C)A+/! T)! %T#I+/ A+D TA/

    (AL,!

  • 8/9/2019 Getting started with matlab image processing

    96/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 C)!C3 $&1 6 /&

    M IL! !DIT

  • 8/9/2019 Getting started with matlab image processing

    97/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D! $!L&W T)!

    CALL$AC3

  • 8/9/2019 Getting started with matlab image processing

    98/140

  • 8/9/2019 Getting started with matlab image processing

    99/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 #AM! 6 %!+D T&

    $AC3

  • 8/9/2019 Getting started with matlab image processing

    100/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #,+ T)! '#&/#AM

  • 8/9/2019 Getting started with matlab image processing

    101/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 LI%T $&1 6 /&

    '#&'!#T5 I+%'!CT

  • 8/9/2019 Getting started with matlab image processing

    102/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    !DIT T)! %T#I+/ &'TI&+%

  • 8/9/2019 Getting started with matlab image processing

    103/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 LI%T $&1 6 /& M

    IL! !DIT

  • 8/9/2019 Getting started with matlab image processing

    104/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D! $!L&W T)!

    CALL$AC3contents = et(hEbFect,'Galue')switch contents

    case " a =imread('cameraman.tif'); axes(handles.one); imshow(a); case # a =imread('flowers.tif'); axes(handles.one); imshow(a); case a =imread('rice.tif'); axes(handles.one); imshow(a); otherwise a =imread('mri.tif'); axes(handles.one); imshow(a); end

  • 8/9/2019 Getting started with matlab image processing

    105/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C)&&%! '&','M!+,

  • 8/9/2019 Getting started with matlab image processing

    106/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 '&',' M!+, 6 /&

    '#&'!#T5 I+%'!CT

  • 8/9/2019 Getting started with matlab image processing

    107/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    !DIT T)! %T#I+/ &'TI&+%

  • 8/9/2019 Getting started with matlab image processing

    108/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D!contents = et(hEbFect,'Galue')

    switch contents

    case " a =imread('cameraman.tif'); axes(handles.one); imshow(a); case # a =imread('flowers.tif'); axes(handles.one); imshow(a); case a =imread('rice.tif'); axes(handles.one); imshow(a); otherwise a =imread('mri.tif'); axes(handles.one); imshow(a); end

  • 8/9/2019 Getting started with matlab image processing

    109/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 !DIT T!1T 6 /&

    '#&'!#T5 I+%'!CT

  • 8/9/2019 Getting started with matlab image processing

    110/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    !DIT %T#I+/ A+D TA/

  • 8/9/2019 Getting started with matlab image processing

    111/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 !DIT T!1T 6 /&

    M IL! !DIT

  • 8/9/2019 Getting started with matlab image processing

    112/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 A1!% 6 /&

    '#&'!#T5 I+%'!CT

  • 8/9/2019 Getting started with matlab image processing

    113/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

  • 8/9/2019 Getting started with matlab image processing

    114/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D! $!L&W T)!

    CALL$AC3

  • 8/9/2019 Getting started with matlab image processing

    115/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D! $!L&W T)!

    CALL$AC3

    a= et(hEbFect,'5trin ') ; b=char(a);c=imread(b);axes(handles.one);imshow(c);

  • 8/9/2019 Getting started with matlab image processing

    116/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 %TATIC T!1T 6 /&

    '#&'!#T5 I+%'!CT

    ) )

  • 8/9/2019 Getting started with matlab image processing

    117/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C)A+/! T)! %T#I+/ A+D TA/

    (AL,!

    ) $ )

  • 8/9/2019 Getting started with matlab image processing

    118/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D! $!L&W T)!

    CALL$AC3a= et(hEbFect,'5trin ') ;set(handles.t",'5trin ',a);

    b=char(a);c=imread(b);axes(handles.one);imshow(c);

  • 8/9/2019 Getting started with matlab image processing

    119/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    %LID!#

  • 8/9/2019 Getting started with matlab image processing

    120/140

  • 8/9/2019 Getting started with matlab image processing

    121/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    D#&' TW& A1!%

  • 8/9/2019 Getting started with matlab image processing

    122/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    D#&' ',%) $,TT&+

    C)A+/! T)! %T#I+/ A+D TA/

  • 8/9/2019 Getting started with matlab image processing

    123/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    C)A+/! T)! %T#I+/ A+D TA/

    (AL,!

  • 8/9/2019 Getting started with matlab image processing

    124/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    /& CALL$AC3

    W#IT! T)! C&D! $!L&W T)!

  • 8/9/2019 Getting started with matlab image processing

    125/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D! $!L&W T)!

    CALL$AC3%filename, pathname = ui etfile('*.bmp', '>ic? a n Ima e');

    if iseBual(filename,!) C iseBual(pathname,!)

    warndl ('Dser pressed cancel') else

    a=imread(filename); axes(handles.axes"); imshow(a); handles.filename=filename; uidata(hEbFect, handles);

    end

    #I/)T CLIC3 %LID!# 6 /& M

  • 8/9/2019 Getting started with matlab image processing

    126/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #I/)T CLIC3 %LID!# 6 /& MIL! !DIT

  • 8/9/2019 Getting started with matlab image processing

    127/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D! $!L&W T)!

  • 8/9/2019 Getting started with matlab image processing

    128/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    W#IT! T)! C&D! $!L&W T)!CALL$AC3

  • 8/9/2019 Getting started with matlab image processing

    129/140

  • 8/9/2019 Getting started with matlab image processing

    130/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    M!+, !DIT

  • 8/9/2019 Getting started with matlab image processing

    131/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

  • 8/9/2019 Getting started with matlab image processing

    132/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    !DIT %T#I+/ A+D TA/

  • 8/9/2019 Getting started with matlab image processing

    133/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    #,+

  • 8/9/2019 Getting started with matlab image processing

    134/140

    Thresholding $ased %egmentation9C

  • 8/9/2019 Getting started with matlab image processing

    135/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Con : clc;

    clear; close all; InputImage=imread('"$.bmp'); figure; imshow(InputImage); !olour*pace!on+ersion=rgb2hs+(InputImage); imshow(!olour*pace!on+ersion); -ra *caleImage=rgb2gra (!olour*pace!on+ersion); -ra *caleImage=!olour*pace!on+ersion( , ,1); %rows columns planes =si e(-ra *caleImage); Binar /as0= -ra *caleImage .3;

    figure; imshow(Binar /as0); Impi4elinfo h = waitbar( ,'5lease wait...'); *egmentedImage=% ;

    Cont ;

  • 8/9/2019 Getting started with matlab image processing

    136/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    for i=1 rows for 6=1 columns

    if Binar /as0(i,6) == 1 *egmentedImage(i,6,1)=InputImage(i,6,1); *egmentedImage(i,6,2)=InputImage(i,6,2); *egmentedImage(i,6,")=InputImage(i,6,"); else *egmentedImage(i,6,1)= ;

    *egmentedImage(i,6,2)= ; *egmentedImage(i,6,")= ; end end waitbar(i7rows,h)end *egmentedImage=uint8(*egmentedImage);figure;imshow(*egmentedImage);impi4elinfo;

    Image usion

  • 8/9/2019 Getting started with matlab image processing

    137/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    gclc;clear;close all;/1=imread('mri.6pg');/2=imread('ct.6pg');subplot(2,2,1);imshow(/1);title('/9I');subplot(2,2,2);imshow(/2);title('!:');

    %9 ! 5 =si e(/1);for i=1 9 for 6=1 ! if /1(i,6) /2(i,6) usedImage(i,6)=/1(i,6);

    else

    usedImage(i,6)=/2(i,6);end

    endend

  • 8/9/2019 Getting started with matlab image processing

    138/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

    Image fusion9Cont ;subplot(2,2,");imshow( usedImage);title('/a4');for i=1 9 for 6=1 !

    if /1(i,6) /2(i,6) usedImage(i,6)=/2(i,6);

    else usedImage(i,6)=/1(i,6);

    end endendsubplot(2,2,$);imshow( usedImage);title('/in');

  • 8/9/2019 Getting started with matlab image processing

    139/140

    Technology beyond the Dreams Copyright 2006 Pantech Solutions Pvt

  • 8/9/2019 Getting started with matlab image processing

    140/140

    or more details www3pantechsolutions3net httpFOOwww3slideshare3netOpantechsolutions httpFOOwww3scri d3comOpantechsolutions httpFOOwww3'outu e3comOpantechsolutions

    http://www.pantechsolutions.net/http://www.slideshare.net/pantechsolutionshttp://www.scribd.com/pantechsolutionshttp://www.youtube.net/pantechsolutionshttp://www.youtube.net/pantechsolutionshttp://www.scribd.com/pantechsolutionshttp://www.slideshare.net/pantechsolutionshttp://www.pantechsolutions.net/