Computer Practical File Object Oriented Programming with C++
Full description
CBSE Class 12 and 11 Practical Programs FileFull description
class 12 chemistry practical file completedFull description
Full description
FCPIT Practical File
class 12 chemistry practical file completedFull description
visual basic fileFull description
Full description
Full description
It is a file which includes all programs of matlab which are basis of matlab.I made it during my matlab course in B.tech.
Descripción: Derecho
Practical File of Computer Graphics for B.Tech Computer Science Students.Full description
Physics Activity FileFull description
Full description
Descripción completa
Examen Derecho Internacional PúblicoDescripción completa
Deskripsi lengkap
For NIEC student..by LEn of CSE (NIEC)
IP CLASS 12 PRACTICAL FILE NETBEANSFull description
Enjoy man! ;)
Lab Manual ECS 702 Digital Image Processing
Even Semester 2013 B.ec! "CSE# $II Semester
Prere%uisite & Stu'ent !as (no)le'ge about t!e c an' matlab. !e* s!oul' be able to )rite an' im+lement t!e +rograms in c language )it! turbo c com+ilers. !e basic ,unctional as+ect o, Matlab s!oul' be (no)n b* t!e stu'ents.
-utcomes& ,ter (no)ing all t!e mentione' belo) +rograms eit!er in C or in Matlab t!e stu'ents )ill become to 'o researc! b* a++l*ing 'i,,erent tec!ni%ues o, +roblem i'enti,ication an' t!eir solution )it! innovative met!o'ologies.
List -, Programs "Practicals#
Sl /o. Program /ame
Language
1
C or Matlab
Program in Matlab for digital Negative.
2
C or Matlab A. Program For Mean Filter
B. Program for Median Filter
C or Matlab
3
Program for Histogram Equiliation
Matlab
!
Program for "o# Pass Filter
Matlab
$
Program for Hig% Pass Filter
Matlab
&
Program for Boundar' E(tra)tion
Matlab
*
Program for +ra%m,s -)an "ine Algorit%m
Matlab
Program For Edge /ete)tion
Matlab
0
Program for "ine /ete)tion
Matlab
Program 1. Im+lement t!e +rogram in Matlab ,or 'igital /egative. clear all, close all
e)%o on 1. load a gra' s)ale image (iind45imread67images89&!.bm97:; n%nv45sie6(i:; sie of t%e image (5ind2gra'6(iind:; 9i(el value in < 2$$4 figure61: ims%o#6(:title67original image7: 9osi5get6179osition7:; a 1 ( ! ve)tor gives lo#er left )orner and sie of image set6179osition7< $!< 9osi63=!:4: >mage negatives= ?6r: 5 "@1@r "52$& (neg52$$@(; figure62:ims%o#6(neg:title67image negatives7: 9osi5get6279osition7:; a 1 ( ! ve)tor gives lo#er left )orner and sie of image set6279osition71&< $!< 9osi63=!:4: 9ause "et us no# )onsider some transformation fun)tion r5<=<.<1=14; s5<.$r6find6r<.2:: <.11.$6r6find6<.2 5 r D r 5 <.*::@<.2:... 1<.$6r6find6r<.*::@1:4; figure6*:sub9lot6131:9lot6rs7@7:title67mid@range stre)%7: set6*79osition72*$ 2&$ *12 10!4: (15double6(:2$$; (1 range to < and 1 '56<.$(1:.(1<.246<.11.$6(1@<.2::.<.2 5 (1 D (1 5 <.*4 ... 61<.$6(1@1::.(1 <.*4; (midind'45)munique6':; figure63:ims%o#6(midind':title67mid@range stret)%ed7: 9osi5get6379osition7:; a 1 ( ! ve)tor gives lo#er left )orner and sie of image set6379osition732< $!< 9osi63=!:4: 9ause ) 5 2$$log1<612$$:; ) is )%osen to ensure onl' 2$& gra' levels after transform r5<=2$$4; s5)log1<61abs6r::; figure6*:sub9lot6132:9lot6rs7@7:title67logarit%m )om9ression7: a(is6< 2$& < 2$&4: (log5uint6round6)log1<61double6(::::; figure6!:ims%o#6(log:title67log@transformed7: 9osi5get6!79osition7:; a 1 ( ! ve)tor gives lo#er left )orner and sie of image set6!79osition7!< $!< 9osi63=!:4:
Program 2a. Mean ilter )it! 3 3 mas(
)lear all; )lose all; a5imread67)ar.G9g7:; i5rgb2gra'6a:; sub9lot6321:; ims%o#6i: title67org image7:; n5imnoise6i7salt D 9e99er7<.<$:;adding salt D 9e99er noise sub9lot6322:; ims%o#6n:; title67#it% noise7: 5medfilt26n:;a99l'ing mean filter sub9lot6323:; ims%o#6:; title67mean filter7: % 5 fs9e)ial67average7$:;averager of $($ 9i(el dimension %15 uint6filter26%n::;a99l'ing 2/ filter over t%e noise image 7n7 #it% t%e averager 7%7 and t%en )onverting double to uint sub9lot632!:; ims%o#6%1:; title67avg7:; m5#iener26n:;a99l'ing #iener filter sub9lot632$:; ims%o#6m:; title67#iener7:; rms15sqrt6sum6sum6n@i:.I2::lengt%6n:;a99l'ing root mean square P-NJ1noise52< log1<62$$rms1:;finding 9ea signal to noise ratio rms25sqrt6sum6sum6i@:.I2::lengt%6n:; P-NJ2mean52< log1<62$$rms2:; rms35sqrt6sum6sum6i@m:.I2::lengt%6n:; P-NJ3#einer52< log1<62$$rms3:; rms!5sqrt6sum6sum6i@%1:.I2::lengt%6n:; P-NJavg52< log1<62$$rms!:;
Program 2b. Me'ian ilter )it! 3 3 mas(
fun)tion img2 4 5 MedianFilter6 img : Kidt%Heig%t45sie6img:; img2 5 eros6Kidt%Heig%t:; for ()oord51=1=Kidt% leftbound5()oord@1; rig%tbound5()oord1; if leftbound1 leftbound51; end if rig%tboundKidt% rig%tbound5Kidt%; end for ')oord51=1=Heig%t to9bound5')oord@1; bottombound5')oord1; if to9bound1 to9bound51; end if bottomboundHeig%t bottombound5Heig%t; end arrsie 5 6bottombound@to9bound:6rig%tbound@leftbound:; arr 5 eros6arrsie:; (inde(5leftbound; 'inde(5bottombound; inde(51; #%ile inde(arrsie arr6inde(:5img26(inde('inde(:; (inde(5(inde(1; if (inde( rig%tbound (inde(51; 'inde(5'inde(1; end if 'inde(bottombound brea end end sortedarr 5 -ele)tion-ort6arr:; img26()oord')oord1:5sortedarr6)eil66arrsie:2::; end end end
fun)tion numbers 4 5 -ele)tion-ort6 numbers :
lengt%5sie6numbers:; for i 5 lengt%= @1= 1 ma( 5 i; for G 5 i@1=@1=1 if numbers6ma(: numbers6G: ma( 5 G; end end tem9 5 numbers6ma(:; numbers6ma(: 5 numbers6i:; numbers6i: 5 tem9; end end
Program 3. Plot t!e regular !istogram o, M / Image o, 3 bits in Matlab. lso e%ualie an' +lot t!e lat !istogram. )lear all )lose all load 9&!int.t(t; &! ( &! image " 5 2$& (<59&!int; "52$&; mn45sie6(<:; len5mn; (5res%a9e6(<len1:; (9df5%ist6(<="@14:; 9df 1 ( " tr5round6(9dftriu6ones6"::6"@1:len:; )df range from < to "@1 '<5eros6mn:; for i51=" if (9df6i:< '<5'<(<55i@14tr6i:; end end '9df5%ist6res%a9e6'<len1:<="@14:; 9df of ' 1 ( " figure61:sub9lot6211:stem6<="@14(9df:title67%istogram original7: a(is6< 2$& < $<<4: sub9lot6212:stem6<="@14'9df:title67%istogram equalied7:a(is6< 2$& < $<<4: figure62:sub9lot6121:image6(<:)olorma967gra'7: sub9lot6122:image6'<:)olorma967gra'7: figure62:sub9lot6121:ims%o#6uint6(<::title67before7: sub9lot6122:ims%o#6uint6'<::title67after7: figure63: stairs6<="@14tr:title67transformation7:a(is6< 2$& < 2$&4:
Algorit%m= 1. )om9ute t%e P/F and t%en C/F 6?6r::of (< 2. 9oint@#ise gra'@level transform a))ording to ?6r: if nargin3 mode5<; end default not 9lotting figures if nargin2 "52$&; end default "52$&
bins5<="@14; mn45sie6(<:; len5mn; (5res%a9e6(<len1:; (9df5%ist6(bins:; 9df 1 ( " tr5round6(9dftriu6ones6"::6"@1:len:; )df range from < to "@1 '<5eros6mn:; for i51=" if (9df6i:< '<5'<(<55i@14tr6i:; end end '9df5%ist6res%a9e6'<len1:<="@14:; 9df of ' 1 ( " if mode551 figure61: sub9lot6211:stem6<="@14(9df:title67%istogram original7: a(is6< 2$& < $<<4: sub9lot6212:stem6<="@14'9df:title67%istogram equalied7: a(is6< 2$& < $<<4: figure62: stairs6<="@14tr:title67transformation7: a(is6< 2$& < 2$&4: figure63:sub9lot6121:images)6uint6(<::title67before7:)olorma967gra'7: sub9lot6122:images)6uint6'<::title67after7:)olorma967gra'7: end
Program . 4rite a +rogram to im+lement t!e lo) +ass ,ilter in Matlab. Luestion No=$ >/EA" "K@PA-- F>"?EJ fun)tion idealfilter6P: f5imread6:; MN45sie6f:; F5fft26double6f::; u5<=6M@1:; v5<=6N@1:; id(5find6uM2:; u6id(:5u6id(:@M; id'5find6vN2:; v6id':5v6id':@N; O45mes%grid6vu:; /5sqrt6.I2O.I2:; H5double6/5P:; +5F; for i 5 1= +6==i: 5 H.F6==i:; end g5uint6real6ifft26double6+::::; ims%o#6f:figureims%o#6g:; end
Program 5. 4rite a +rogram to im+lement t!e !ig! +ass ,ilter in Matlab. fun)tion g4 5 FF?PF1/6 binsie f P: M5lengt%6:; get t%e fft 9osition of )utoff frequen)e 6referen)e frequen)': f 5 f binsie; (id(51=1=M; fftref 5 abs6fft6sin6(id( . 2 . 9i .f:::; bounder 5 find6 6ma(6fftref: @ fftref: 6ma(6fftref: . 1<<< ::; do t%e filter fft( 5 fft6: if 6 P : fft(6bounder61:=1=bounder62::5< else fft(61=1=bounder61:: 5 <; fft(6bounder62:=1=M: 5 <; end g5real6ifft6fft(::; end
Program 6. 4rite a +rogram to im+lement t!e boun'ar* etraction algorit!m in Matlab. boundar' demo.m 6C: 2<<& b' Qu Hen Hu )reated= /e). 10 2<<& demonstrate mor9%ologi)al boundar' e(tra)tion )lear all )lose all A<5imread67m's%a9!.bm97:; ims%o#6A<:; a %eart s%a9e %and dra#ing title67original image7:; 9ause A< )ontains mostl' 1s and t%e dra#ing )ontains
Program 7. 4rite a +rogram to im+lement t!e gra!ms scan line algorit!m in Matlab. >n9ut= a set of 9oints - 5 RP 5 6P.(P.':S -ele)t t%e rig%tmost lo#est 9oint P < in -. -ort - angularl' about P < as a )enter. For ties dis)ard t%e )loser 9oints. "et PN4 be t%e sorted arra' of 9oints. Pus% P<45P< and P14 onto a sta) K. #%ile i N R "et P?1 5 t%e to9 9oint on K "et P?2 5 t%e se)ond to9 9oint on K if 6Pi4 is stri)tl' left of t%e line P ?2 to P?1: R Pus% Pi4 onto K i in)rement i S else Po9 t%e to9 9oint P ?1 off t%e sta) S ut9ut= K 5 t%e )onve( %ull of -.
Program 8. 4rite a +rogram ,or e'ge 'etection algorit!m in Matlab 9rogram for edge dete)tion )l); )lear all; )lose all; read an image
filename 9at%name filterinde(4 5 uigetfile6 ... R 7.G9g77TPE+ 6.G9g:7; ... 7.bm977Kindo#s Bitma9 6.bm9:7; ... 7.fig77Figures 6.fig:7; ... 7.7 7All Files 6.:7S ... 7C%oose image6s: to be 9ro)essed7 ... 7Multi-ele)t7 7off7:; if filterinde(55< brea;end filename5)ellstr6filename:; '5 imread6%or)at69at%name)%ar6filename:::; '5imread67)ar3.G9g7:; mm5in9ut67>n9ut 'our t%res%old bet#een < and 2$$ )onvert )olor image to gra' s)ale (5 rgb2gra'6':; ims%o#6(:; r)45sie6(:; ma(5<; min5<;
for G52=r@1 for i52=)@1 95i@1; q5i1; a5G@1; b5G1; d15abs6(6Gi:@(6G9::; d25(6Gi:@(6Gq:; e15(6Gi:@(6ai:; e25(6Gi:@(6bi:; f15(6Gi:@(6a9:; f25(6Gi:@(6bq:;
7:;
g15(6Gi:@(6aq:; g25(6Gi:@(6b9:; if 6d1 <: d15d16@1:; end if 6d2 <: d25d26@1:; end if 6e1 <: e15e16@1:; end if 6e2 <: e25e26@1:; end if 6f1 <: f15f16@1:; end if 6f2 <: f25f26@1:; end if 6g1 <: g15g16@1:; end if 6g2 <: g25g26@1:; end
end end end figure ims%o#6(:; BK 5 im2b#6( <.$:; figure ims%o#6BK:
Program 9. 4rite a Program ,or line 'etection algorit!m in Matlab. fun)tion /ra#"inesU2Ends6lineseg varargin: /ra# line segments 9arameteried as 6(1 (2 '1 '2: on gra9% /ra#"inesU2Ends6lineseg varargin: A sim9le fun)tion for dra#ing line segments on gra9%. Made as an au(iliar' tool for fun)tion 7...4 5 Houg%U+rd6...:7. >NP?= 6lineseg 9ro9erties: lineseg= Parameters 6(1 (2 '1 '2: of line segments to dra#. >s a Ns@b'@! matri( #it% ea)% ro# )ontains t%e 9arameters 6(1 (2 '1 '2: t%at define t%e t#o ends of a line segment. ?%e out9ut 7lineseg7 from t%e fun)tion 7...4 5 Houg%U+rd6...:7 )an be 9ut %ere dire)tl'. 9ro9erties= 69tional: A string of line dra#ing 9ro9erties. Kill be transferred to fun)tion 79lot7 #it%out modifi)ation for line dra#ing. ?P?= None B+ JEPJ?= Please send 'our bug re9orts )omments and suggestions to 9engtaoVglue.umd.edu . ?%ans. Aut%or= ?ao Peng /e9artment of Me)%ani)al Engineering niversit' of Mar'land College Par Mar'land 2<*!2 -A 9engtaoVglue.umd.edu Oersion= al9%a Jevision= /e). <2 2<<$
%old on; for 5 1 = sie6lineseg 1: ?%e image origin defined in fun)tion 7...4 5 Houg%U+rd6...:7 is different from #%at is defined in Matlab off b' 6<.$ <.$:. if nargin 1 9lot6lineseg61=2:<.$ lineseg63=!:<.$ vararginR1S:; else 9lot6lineseg61=2:<.$ lineseg63=!:<.$ 7"ineKidt%7 2:; end end %old off;