You are on page 1of 34
DIGITAL IMAGE PROCESSING ASSIGNMENT COURSE CODE : CSE-407 Submitted By: Musfika Jahan Id-345 BSC(Hons.)4th year 1st semester Department of Computer Science & Engineering Submitted To: Dr. Liton Jude Rozario Professor Department of Computer Science & Engineering Jahangirnagar University a Ala) Define image and then classify mage on -the basis of represemation Scheme > Image: An image is a single preluire that represents some thing + TL may be plelurce of Q& person, people. ore animals, an outdoor Scene , a micrcophotograph of wcleclronic. component or the result of medical rmaging . i An image is defined as a two-dimensiona] function, FOUy) »whene x and iy ace épatial co-ordinates Th Animage. brightness values can be any reeol numbers in tha range 0-0(black) to 4.Olwhite) By An image ig a matrix of the Aree] Values of its pixels. Timage me presentation schemes ¢ @) Chain code an) Polygonal apprcoximation . Cin) Signaturce ay) Boundarey. segments Cv) Skeleton (medial axis) 1:(b) Draw a flow diagram of image. preec essing Scheme. fore meq reocogni2 ing: an object ead they, divide the diagram mte Incee megions . low-level, amid -level and high - level image. processing > low level -pourtpub of these preecess ane image Mertphalogical Preecess Keowledge Re presertati on Deserciption Classification Recognition ynid-level- output of Lhese preocess are Comme generally image alphabates 2 Low level preocessing! involves opercation such as Image preprocessing to reduce noice y contrast enhancement, shaping ele. In low-level wale beth input? and oulpud are images 2 Mid-level Preecessing & Invelves be task such as image Segmentation, desertiption of image, object necemition ete. In mid-level inputs are. image but Outputs arte. generally atributes of image. > High level_preecessing? twelve s making Ses sense from a qnoup of ‘ecognisect. objects. Normally ascociatect with Computer. vision. co) A 5-bit greayscale image of reesolstion 7X6 is shown below Fig. 1)Dreaus ils histogram and CpF.cCommenl on the quality of this Image If iLis represented using &-bit(on tne basis of a tinea scale) then express J Opinion Regan regarding the image - EE 4 |10| 10] o| o c|s|7[4|4lalo o| 20| 2| 2 ala 20) 0\ 2 | 2 4[a | oloj|2|2 ala o| a0| 2| 2 | 20] 34] © > [i Jo |2]a]a]=le [20] 2 30] 31] vy {20 )9{2\ 30] 3/473 2) a] 2] ni 20) ) 8 3 6- a- 4 % 2 2 + yt 'T if - | fr 01234562939 30°: + 20- 30 31 i Figure {Histogram of the image cor? : nt cpr ° 4o jo 2 9 19 3 2 24 4 40 34 5 > 34 6 4 35 40. 3 38 20 2 40 soled aa 34 1 42 ® 2:Ca) Suppose an R&G Cire. true color) tmage cLwins.Png "5 given, Gircite = A media’ program to seperate the Rig, channels (components > Ctkwines.png?) 4 D= tmreead Deer = OC. 314), Dgreen= b(t» 1925 Dene = DCI949 DS Suvplot (2,2, 1)-5 inshow(b) 3 axis image ; subplot (2, 2/2); imshow( Pred); vtle (trced’) 5 subplot C2,2/3)5 imShore(Dgneen)> title (‘green’) subplot C2/2,4)5 inshow (Petue)5 fle (' ticeD 2-Ce) Define? CG) 2-D moment Gi) central moment Gi) mereratized central moment (of order [6+ v) f(x,y) of size MXN) of a digital Image SS Ci 2-D moment 3 he 2-0 ynoment of omen (P+1) of a digital Imoge Sly) of site MXN is defied as- wi ee Nod bgt eS RY F G4) WO deo where P= 0,4,2,----- and 4 =0,3,2,-- are integers. © Cii) Central Mementt she corercespersing centreal moment of onder Cera) is defined as> m-4 NA Hpa = HS &-7FG “precy HzO yee for PeOd2o--- ANA Y= O42 r- es where , Ke Mie and 5 = ™os Moo Moo Cait) Noemalized Cenleal Mewmentt she normalized. contrat rmoment of order “Cere) is defined. 25 eee N eq, = —>— Coy voheree , ye Cas z fon, Prt= 2139° 2-C2) worcile the equations fore the set of seven 2-D moment invercdionts . > A set of seven 2-D moment imvariants that are. imsensitive. to tromslation, scale change / anircreo ti ng Cle withim a minus sign)? amd rotation con be derived freom these equations. they are @ listed below in ‘a table $ Memenll Eg preession ] a .= Neo “lon > | #2 =(ao Noa)” t Amn > $5 = CAyon 212) Ores “Nos” : G4 = (go+ May" + Clas toa)” ° #5 = C30 ~Pm12) Mao? Nie) Mao * i)” 3a" Moa) + Casas) Chas os) [2Qot Way Cla Mos)” J 6 | Fe = (Mas os) CMgot Mia) lar? Mos) | + 4M yo" Nz) Cer * 02) a | Oe = (Mar Mos) CTsot ME C1304 Mia)” =3(Mg,* Mos)" * Ort “"l20)(a1* 03) [2(go* Wiz) ~ Clear "039° table: A set of sever moment invariants. 2:4) Explain: (1) Monphelogical dilation operatort Gi Morepholagical escosion opercetom. > (i) Morcpholgical dilation operotor* Az A general image - Be An arckitreorey struc turcing element. Heree., we. speak of the dilation of A byB. te Percforerm da dilation of a binary image » Wwe successively place the cenlre pixel of the streucturcing element on each background pixel. rf ony. of the neighbourhood pixels arte fomeguaun fonegreound pixels (value 4)» then the beckground Pixel is Switched to foneqreound : Foremally ° the dilation of image A by Structuring element B ie denoted AGB. f= 1 =0 Figure: The dilation of a simple binary image - paca Gi) Morphological _exosion operator + A= A general image - B= An arcbitreacy structurting element of Hetee, we speak athe ercosion of A by B we To percform erosion of a bmarcy image pixel of the successively place the cenine each foreground pixel! structuring element on Cvaluet)- Tf ary of the neighbourhood, pixels arce background pixels (value 0), then the forcegreouna pixel is Switched to background : Formally > the ercosion of image A by structuring element Bis dencted A OB 3 - 1 [=o S e o|+lo ele [> lO] =| Il jo |: 4 ; f Figunet The erosion of a simple binany image - @ 3.Ca) Describe HSV color ~mode| /4 pace > pev stands fore Hue » saturation and value, these terms have the following meaning + Igy Hue! athe “ true, color” attribute expressed as a number from © te B60 degrees. Red: falls belween 0 and GOdegrree Yellow: falls belween 641 and 20 degree @reen, falls between 124 and igo degreee Cyans falls belween 1841 and 240 degree Blues falls between 244 and 300 degree Magenta: falls between 301 and 360° degree Magents : Op saturcation Figure 2 A color space HSVas acone. mm : ‘ Gatureation’ The amount by which the color [ageabseminabniasAl hos been diluted with white. the more lower satunation tight cshi te yn color, the red Cpinkish color) has low saturcation ff) Values The odnee of bretghiness + a welltit color has high intensity » a dark colon has x) low in tensity : Uses of HSV4 also comtributes slo 4. HEV color wheel quality graphics. 2. Designers Use the HSV colore model for Paint or ink because HSV better reap resets jhew people. relate to color than the Rae color model does. 3:0) Suppose a S-bit qreayscale image (so the gray values are 0-7) with the following Prrobabilities are givent Gregveeelo[s |2 |3 la [s Je |s Peckability jo (0-25 |021 0-16 [0.08] ‘0.06 Sesttor| WD Caleulate the entropy Gi) Obtain the Huffman code fore the above image. 2a) we Know , entropy, H = - & rleg, cP) im ® He £9.10 40g, (0-19) + 0-25 0g (0:25)+ 0.2.1 dag (0:21) 40-16Leg,,Co-16) + 0.08 log (0.08) +0 0G log (0-06) + 6-0310g, (0-03) + 0.0210 (0 -02)} = 2.6508 Cit) Huffman code: Forming she huffmen code tree and assigning 0's ard 4'5 40 the branches we qet: We obtain the codes fore each Arey value, stamting at dhe 4 on the top Tights and work backwands to the ary value . This preeduces ¢ Garcay value Hutfman code eee ero a o1 410 —}— 1110 —— 11110 411110 HO RD yp pre 1442114 |4:Ca) Define i) Image cestorcation (11) Noise (in images) Image restoration concenns tohich > a Image restoration * the removal orf reduction of degradations nove occured ducing the acquisition of the image | Suen degradations using may include noise. lott) Noises Noise im images is defined to be any | ae radation in the image signal al disturbance - » caused by | extern @a j4-Cb) Describe a model of image degradation . > In the spatial demain ,we might have an image flan)» and a spatial filtere him y) fore which convolution with tne image rcesuells in some form of degradation. For exemple, if h(xy) Consists of a smgle line of ones, re eeu Sf convolution usill be @ anction blur im tne dircection of Ine. Thus we MAY wsrite qe) = For) + haw for degnaded image, where the symbol ¥ teepreesents spatial filtercing: However, we. must considert moise. If ny) ree presents trandem — ercizores ushich 7 occur, we have our degraded image : 4 Gag) -S@y) # hg) trea We can perform athe same operations in the frequency domam , where. convolution Is replaced ication . Ths, & Cipi)= CCI) HOJ)+ nCisj) represents 4 general image de; nadeation, whene e,H and N are the Fourier transform of by multipl fh and ™ respectively Tf we know the values of H and N we could recover F by wreiting dhe above equation 45 — F Ci, 5D=COLi9)-NC559)/ACi3) @ Canyeney a A:Co) Witite A short nole ons,(ijWiener Filtecing Gi) Removal of Perciodic Noise Ciii) Motion Deblurercing + a) D> Wienen Filleving? Inverse filtering cles not preeduce pleasing meeults. This situation is even worse if the original image has been Corrupted by noise. flere we have 2” image. K fillerced wilh a filtere F and corrupted by Moise NJ 7 noise is additive, then the linearity of the ourcrere toto fo rem given ast Y Gr) =X C9) PUI) + NCI) ana 50, KCI) = ling) -NCbID FCO) Herre, we have the preblem of dividing. by the filtere and deating usith Noise Given a degraded image m/ of Some original oe ond of restored version R,we would like R to be 35 Close a5 Possible to the “connect “ image M. One wen of measuring the, Closeness of Rto M's by adding the squtanes of 26 all differcences + ® where the sum is taken overt all pixels of R and M:- Wis sum can be taken 4S a measure of che. Closeness of A toM. Filterts which opercate on this preinciple of leask Squanes ope ese wienen Geet “oe can 1 ESD X13) & [a5 G3) em | ey oo vortiance TY 2rv cn be obtam x bys where Kis @ of the noise is Known then KF use . WA can easily implement -this equation: K= 0.045 whf = fftehife (454 2 (wha) 3 ee ur eee Ce) 62 Cabs) *9+%):/2)5 wia «abs (ifft 2(w4))3 imshow (mot 2 gray (#14) ie (2) Define 4(i) $e parcable filtere ¢ iv) ROI Filkening Ciii) Non-lineare filter . > Ci) Separcabre fillex Some filters can be” implemented by successive application of 2. re fillers, fern exemple: at SU)¢6 4 Simple @ The 3X3 averaging fillere can be implemented by final applying a 3x1 averaging. filtere and then applying a 4x3 avercaging, filter Le re. result, So the 3x3 avercaging filtere is separtable imto two Smaller -filker. Cii)_Kot filkerting: Small wegions Within an entine image, where. we wart te apply filter are calleel Regions of Interest oF FOls, che processing of ROI, 16 called Region of Interest Preecessing, Rol Masia will be aw binary Image of same si2@ as the Original image usith 1's for SOL and 0's fore elsewhere . Suppose , the matrix fore Fmoge a matrix for. ROL is R the. te of image merkriz, after filtering reesu ° is Ms then the result We went is! Mar MG-R) Citi) Non- lineare Filler: A non-lineare filter is obtaimed by a non-linear function of the qrayscale values im the mask. Enampes: The maximum fi tker, Coven hae (Ls ouput the maximum value unden the mesk and corenesponding mmimum -filten, which has Hs output the minimum fiber values under ee Gel are on oe diltens are reank -order 4iltens . Implementme a-maximum filter overt 3x3 neighbourchood i Poe en le fue yimar (2(9)') 5 5-Cb) Describe didfercent appreoaches to deal with obvious preoblem in image where the mask oe applying fFiltere at tne borden of the. Parity. falls ovlside the image - > here ts am obvious Preoblem in applying a | filter at the borden of the images coherre the. mash partly falls outside the image Im such Case Mustreated below: Figure A mask at the berder of an imag e Tm such case thee. will be a lack of: area values te use tm the filler function Te dealing. with this Preoblem , differrent pre i | approaches aice. qivet below: oO Ignore, Lhe edges! “That is, dhe mask 1s only. applied Lo those pixels in dhe image for with the. mask will be dally within the. image sthig means all the. pixels except for the edges trig appreach Tesulk in output image coke k is Srnallern. than the. original T{ the. masi, te VE large , signiticonl amount of inforemation mag. be, lest by this method - Q@* fad! with zerost In this methods we assun® values Outside. the eee oe Lhad all necessarty- all values to work ustth- Zens . This aive us se will return an oulput frmage of the sme size as the erdginal . But if May have the effect of introducing unwanted arctfacts (for examples edges) around the mage . (2) 5 (2) Explain . Ci Geassran {ileows (i) Wah — boost filterting . DC) Guassian filler L. Guassian filleng are low pass fillers based on Gauesian Prro bebeilitey ( distribution fuction, which is v 4) = | a whene OY is Lhe. sLanderd devicction A large value of of, preoduces % flatlem curve and * Small value mesullg in © pomtber cunve, @=9 C= Fig. 2D Guassians v for 1D Guagsian function is. -F0 fex)= e A G@uassian tenction is, _. . vo 4A) =e ter Guascian fillers arte important fore many TCEASONG 1 weg arre $ (hh Mathematically. verty well behaved . Pourcien transform of & gaussian filler fs another, Gaussian. fy Colationally. symmelitic « So there. a as Bieemyg pots tag) ee 2ig6 detection algorilms §R) The y- are. soparcable So tk is very. too implemertactions . Tay he conveluction of 2 quassian is ancthen Getarssian . have hanreing eHects similar to the standard large without Gaussian fillers neighberchood averaging. tf we let f qaussian Filter to gree veraging filters - able for. blunring thon deviation © bound ,we get * traussian fHibere Is Tore. sui avertaging ‘ qt -ferecial Ce 1, [5»5]22)5 Tmshow Cifilter (641) 5 Here, 24 parcometere (55) is optional . Tt gives the Aefaute this value 16 9X3 ged parcarneters 32 d deviation value eize of filter. By 16 standart by default Ce, Also optional @ HIgh filLereing® Alli CiD Nigh Boost filterseYs Allied to UNshucp masking fiver, are the high beost filers which ane ebtained by: high boost = ACoriginal) —Clowe pass) where A zamplification factor - 3h Acts then the. high boost filler. becomes an ordinary. high pass filter. geeda te low pees filter the BXx3 avenagirg If we kake as the have the form ce high beost fillers coil! Seed 2] Aa {22 2 [8 where 278 put Ze-11,then we get filkering similar fitter, Lnen Tf we te unshare filtering . the. commends $<[-! a cipot U -tg4 aj\/ 3 xf 2 fier 2(%/5) > ‘nmshow (eF/ 80) 3 obtained by trial and error he velue 80 wa: with Similan irlensity produce an image to to the orciginal . oe, can wrile dhe high boast formula as: 2 A Cortiginal ) —Crowe pass) igh boost inti ~ (Corciginaly -bigh pass) Lortiginal = lowpass + high pass] =A (original >- (oreginal) * Chigh pass) = @-1) original) + Chigh pass) -2 low pass) Using the. identity and averaging filter high boost tilter Obtained by ‘ yy ofoo 0,0105 000), f- [ fspecial (tavercage’) ; hbi = 2 id - aa f Applying. hb. Le am oniginal tage. Cx) eth Filkerw 2 > yg = filkeez (nb4 9) 5 imshow {Xa /255) his will have enhanced the edges « that’s how high boost fillers wwoork - 6.(@) What is segmentation? Explain the thresholding method of segmentation . segmentation refers to the openedior > Segmentation: inage imto component Parts, of parcitionng on or into separate objects. the thresholding method of segmentation: Tnnesholding is a vital port of image segmentation, where we wich to isolate objects fream the background Tt is also on tmportant component in robot vision. sheeshelding can be done in the following methods: Single thresholding? A gray scale, nage is turned inte a binary-(black and white) Image by first choosing ai gray level T in the origimal image , ard hen turening everty- Pixel black oft white according, to whether its grag value is greeatere than or less than Tt white Hits gig level is > Es be ‘6 Agel become pick its gray fe cy @ Double Thresholding! Here we choose -Lwo values T Seer re eceeereayT 1 and TT, and apply @ thiesholding opercetion as’ A pixel becomes white if ile gray level is belwen Ty andty black if ide greay- level is otherwise 6.Cb) Discuss the applications of darcesholding : a > Trrresholding- can be. useful in the following. situations: Coren we want te memove unnecessary details from on image: Ci) To breing out hidden detail - Cin) When we want to remove * varying background freom tezt or a dreawing- 6: (2) Define (i) Zero Crossings (ji) Laplacian 52 ji SY Zerco crossings: Zero crossings in a filtered image is defined by the pixels which satisfy either of the follousing ¢ Gy They have ao negative grey value and are nezt te (by four adjacency ) a pixel whose grey value is positive - [Bj The have 2 value of zero ,and are betwen megative and positive valued pixels - @® Laplacian “The cum of second denivatives in beth directions is called. the Laplacian 5 it is eee VF - BL. ~ Bxr Og” and if can be mmplemented by the filter o 1 0 4 4 4 © 1.0 6.(d) eireite Preeesitt » Roberts sand Sobel operators. | the prewitt filleres are? Roberts cross gradient filtercs are! 1.0 oo oo the, Sobel fillers are 3 aa “1-2 4 egg ar and|o 0 0 4248 Ours ) BtAYou are given an image - Explain the lightness , amd. brightness , contrast and alse rosolution of that Image. D Image lightness: Lightness also Known as representation of colour’s brei ghtness. It’s aa pertameter of ony Colour, Appearance model. If the value is O then it’s purce ieee ond if fe ts 2 then ite pure Ghibe | Greightnes ¢ It means overtall darkness ort ligh mess of the tmage. It can be som increased ore. decreased by- Simple Addition orn Subtraction . Contrast! Contrast is the difference of breight ness between objects om regions + Reeslutiont Resolutions refers to the number Resolution? of pixels mM an image. Tf an image has 2oug pixels wide and 1536 Pixels high , shen it will be 2048 X15 36 pixel. orn 324 mega 7-Cb> Desercibe threee ways of handling. the boun dary situation of an image. in Pereforeming SPatial ofertaction. 3 Spatial opercation has threa steps: Q) Position the. mask over the pixel. C1) Multiply mask €lement with all the neig neighbouring element of the Pixel. Cm) Add all multiplication velue . Te solve the boundary Problem, there. are ditfercent appreoaches ¢- (1) tgnorne the edges: Tgnore borders pixel so cthet filtered Prages size will be reduced. Cn) Pad with zeros: Fill up all the values Fit ac which ane outside of image. boreden , Gn) Replacing, the image? Fitting image al) dinections $° thet the, mask always tn Nes over the, values Civ) Reflecting. the image Repeat the tmege Se that there 16 mo unwanted change. @ F:Cc) Estimate tne zerro-orden -moment Moo and second - onder mement m,, of the image shown in Fig. 2 eR [> we know that, mig= 2 2 xe yi t@y) x S$ ..m (0,0) = z [= sed] 5 = -2 [24560] el Oe! = Conosorssart (ora tstors) +(o+4 pororayt(saiadtd4d) ms (4a4dto4aat) es 24 3+R+er4A s 16 () m(22)5 & aerate eae 7D] xeixo)+ (axox0) 4 (Ax dGK I) 4X25 RA) + Cx Axo) + CAXAK DD + (AKOX prc xroxoyr(4r25st) + (ox1xo) + (9 XARD + (9X9 x0) 4 (OX1EXD) 1(9x25xi) + (rex x1 + (16X41) 400 xox rt extent) + (62541) +(25xin ) +(25x4x1) + (25%9 xo) + (25 R1XY) +(25825x1) = Gxixo)+Ca erordetser OF 100 = Orotoricta stle+e4 + 1444256 +Ot3Et OO +2 256 +400T 25 + 400+0 tHOOt 625° = 2484 . M99 = 16 ond ™M,,= 2484 CB Ba Wnite the names of at least foure cornmonly used iwayelets im image. preocessing - > “ haar” 4 Haare wavelet “Moym” 4 Symlets wu meyrt” $ Meyers wavelet wgaus” % Gaussian wavelets 8.() Explain usith figures > the basic preinciple and “multilevel decomposition usith wavelet transform. > Approximate r Leakass | Horizontal Tage (LY) 1 Fillere ont 7 Approxirnation SN 1 Rows py Tet ae Vertical a Detail(LH) Oniginel pet ed Horcizental | D etailCHL) Tmage igh ase” Diagonal Detail(un) Figure: Basie- Principle of wavelet ‘transformation : Diserrele Wwavelel eomalysts is usually computed usin Ane concept of fillen banks.If a signal I's put aa High pass filler oma Lowe pass filer then the. signal ie decomposed inte two parts — a detailed pant Chigh$requency, and an approximation parc Clow -dnequency ) + The approximation subsignal Can be put through a fitters bamk> and this is mepeated until the reequined level of decomposition has Leen rceached. these jdeas atre. shown im the. figure, above .AL every level, foure subimages are obtained + the approi- Mation » the, vertical details the horizontal detail » and the diagonal detail. the preocess can be furlhere repeated until a certain set of criteria is ynek » With each decomposition ,a nev Appreoximation is obtained that is Much smaller Pattern fore images is shown in the figure below + in sige» the decomposition Luy | Aba igure : Multilevel decomposition «sith wavelet Lrcansforrms B:©) Suppose a Jrreyscale image photo. tif is given. Write a MATLAB preegram to display. the given image and its DFT. D £ zimtead (‘phototif’); Figune > Imshoto(x) 5 Xe = f£42 (x, 1024 53024) 5 Xams (abs(XQ)) 5 figuree 5 imshow (Xam # 0-00005) ; XGQMS = SFlehitt (KAM) 5 figure 5 imshov (XG 5 # 0.00005) 5

You might also like