You are on page 1of 52
from @ 3) 0 G3) + ae and (ii) (1, 3), (1, 2) 2s 2) a8 3M shown in (2s Fig. P. 1.6.3(0) |.7__ DISTANCE MEASURES + In image processing for some operations distance between the pixels needs to be calculated. And so Distance transform is introduced, In distance measure, if two pixels namely p and q are taken with (x, y) and (s, ) as their respective Coordinates, then there are various methods to calculate distance between p and q are as follows : Euclidean UQ. Explain Euclidean distance, istance Dg, Dg. and. , distance by taking a suitable example. TEES GOS Denoted as D, (Pq). Itis distance measure between 2 pixels in straight line path given by the following formula. Delo = (6-5) +(y 1! Ex, 1.7.1 : Find the QD. © son. : Given: P(3,2) = (x, y)) QI) = yo) Using Buclidean distance formula, @ = V(G2-xt)+G2-y1)) PQ = VU4-3)+(1-2)) ; 2 pt PQ = VK) +E] a PQ = units D ‘The Euclidean distance between points A (3, 2) and & 4, 1) is V2 units, B. City Block Distance The distance measures are calculated through neighbours and so denoted as D, (p, q) It isthe addition absolute value of the distance between 2 pixels given 8} following formula & 40.9) = ie * Rg 2 Ry 24 2 24012 s 201 2 (MU-New Syllabus wef academic Year 21-22) (M109) tinage Processing (MU - Sem 6 - IT) x, 1.7.2: Suppose Point A has coordinates (0, 3, 4. 5) and 3, 4, Oo) an Ei point B has coordinates (7, 6, 3, — 1). soln. The City Block Distance between point A and B is 17 ag shown below dpa = (0-71+ 13-614 4-31+15 + II 74+34+1+6=17 Cc. Chess Board Distance The distance between the pixel is measured through 8 - neighbors and so denotes as Dg (p, q).It is the maximum yalue of absolute values of difference between 2 coordinates given by formula: Dg (p,q) = max (Ix- sl, ly - tl) 2 2 2 2 2 211 1 2 1 0 1 2 211 1 2 2 2 2 2 2 (1a2e)Fig. 1.7.3 : Distance of path is through 8-neighbors Ex. 1 and a P3 ca adjac » QD m-Adjacency It is a Mixed Adjacency hence the name m-adjacency, When pixels in an image can follow many paths ang can be connected by 4 adjacency as well as 8-adjacency then it creates ambiguity. In such case, 4 adjency wil] be used to connect the pixels as shown in Fig. 1.6.5. 1—1 0 1-1 7, | ‘So 0 1 \! Oo oO 1 0.6000 614 (a) Ambiguity in path (b) Path selected through selection m-adjacency (1A20)Fig. 1.6.5 ¢ Two pixels p and q with values from v are m-adjacent if: q is in Ng (p) or q is in Np (P) and the set Ng (p) 9 Ng (q) has no pixel whose values are from v. Two image subsets S; and S5 are adjacent if some pixel in S, is adjacent to some pixel in Sy. Ce oa 4 STEPS AND COMPONENTS OF IMAGE PROCESSING With neat block diagram, explain fundamental steps in digital Image processing. : MU - Q: 3(b); Dec. 2015, 8 Marks, Q. 5(c), Dec. 2016, 10 Marks, Q. 2(b), May 2017, 10 Marks) stages or operations for performing enhancement are as shown in Fig. 1.4.1 Image image Morphological domain acauisition =>) enhancement (==>| restoration [==> processing Imag segmentation Up ° @e>-~7n 7 i 1 Image 1 f processing | | Compression | 1 (1a1)Fig. 1.4.1 : Fundamental Steps of Image Processing Y For Pictorial Representation, refer Appendix A at the end of the book. (MUNew Sylabus we.f academic year 21-22) (M6-108) [el Tech-Neo Publications..A SACHIN SHAH Venture Je Processing (MU - Sem 6 - IT) Image Acquisition : This is the first stage of Processing Images. The process of acquiring images or capturing them through various sources e.g. Camera, Sensors, etc, are done in this stage, The captured image may not be in digital form, which can be further converted to its digital form. Image can be scaled or Color formatted as per the application requirements. Image Enhancement : In this stage. the Enhancement of an image is made through improving the quality of pixel intensities, or some features are extracted which are not easily visible. Pixel manipulation through various operations can be done in this stage to highlight details of an Image. Image Enhancement can be done both in spatial as well as frequency domain. Image Restoration : In the Acquisition process sometimes, some sort of image details are lost or degraded, It can be due to various reasons like blurring of an image due to focus of the camera, sensor noise, atmospheric condition while capturing an image, movement of the camera, etc, so the technique to reduce or remove such degradation is called the Restoration method, which can be done through a set of mathematical models. Morphological processing : It makes use of tools which extracts important features and components from an image which needed for representation and description of shape of an image such as boundaries, skeleton etc. 6. 8. (Introduction to Image Proce: Image Segmentation : It is a process of dividing the image pixels into particular set of groups in order to extract hidden information or area of interest from an ize which in turn helps to analyze the information ima more clearly. Object recognition : It checks for various properties of an image like color, shape, texture etc. It recognizes by assigning labels to an object based on its descriptors, Representation and Description : An image object can be represented by its external or internal qualities like boundaries or texture respectively. Description of an image object is done by mentioning length of its boundaries or the direction of boundary. Output of Segmentation phase is used for _ providing representation and description. Image Compression : Compression techniques are used on image for reducing the size required for saving and transmission purpose. Various techniques like Lossless and Lossy data Compression are used. Color Image Processing : There has been significant advancement in the usage of digital color images and thus it leads to need for processing of color images. It works on color information like red, green and blue matrix values of an image. (B) Neighbourhood Processing jecewise linear Fig. 2.2.1 : Classification of Point processing techniques V For Pictorial Representation, refer Appendix A at the end of the book. « The Intensity values are changed as per the applications requirements. Intensity enhanced at particular point in an image depends only on gray level at that point itself is called Point Processing. * Spatial Domain Techniques are mostly based on following form : ayy) = Ty) Where g(x, y) is output image and f(x, y) is input image values and T is Gray level Transformation or point processing operation is performed. apply T —_ image after processing original image Fig. 2.2.2 : Image Transformation process & Tech-Neo Publications...A SACHIN SHAH Venture ia Image Processing (MU - Som 6 - IT) This form is also represented by S=T©) ‘Where S is output processed image and ris Input image and T is Transformation. "© Piecewise Linear transformation functions are classified as * (A) Contrast stretching, thresholding (B) Gray-tevel slicing (C) Biplane slicing %_ 2.2.1 Basic Intensity Transformations 1 UQ_ Explain the types of grey level transformation used t for image enhancement : (MQ: 1(), Dec. 2017, 10 Marks 1 4Q. Identity transform and their application, : 0 May 2018, 3Marks) (A) Linear Functions ~ (© Negative Transformation Gi) Identity Transformation (B) Logarithmic Functions (Log Transformation (Dynamic Range Compression) fi) Inverse-log Transformation (©) Power-Law Functions h ® n" power transformation Gn” r00t transformation 3 2.2.2 Linear Transformation '* (i) Image Negative This Sis In intel Mat Moai arey i s —__] (MU-New Sylabus wef academic year 21-22) (M6-108) denote by: Ss (L-I-r Where L is maximum Gray level ris input pixel value and (li) Identity transformation | (Imago Enhancement). is the simplest form of point processing « corresponding output pixel this Output intensities are identical 10 ing nsites as shown in graph below, thematical expres 125---- | Modified | srey level / S40] : | | 5 | 0 10 125225 Original grey level r Fig. 2.2.3: Identity Graph 255, fied | level | j Ql ° Original grey level §— 225 Fig.2.2.4; 82.2.4 : Image negative Graph (MU ~ Sem 6 - IT) Negati When r © 0,86 or Inge \ | Pcueeeere © pnensity value and Vice-Versa, Ponds 10 285 | op j » For Jdentily transformation, when r = 0, 5 , neg corresponds to O intensity Value and Vice-versa 8 also oe muh EX. 2.2.1 Obtain Digital Negative of following 8-Rits p ¢ 3 per pixel Image * z 200 | 155 | 100 ime I 141 | 152 | 99 ith 215 | 115 | 145 © soln.: Per pixel is represented by 8-bits as given. Sono. of levels = 24 8 = 256 Therefore, L = 256 L-1-1=256-1 -r=255-r As per formula s So whenr = 200 (Ist pixel) s = 255-200=55 Substituting each r input values given in image we get following output. 55 | 100 | 155 114 | 103 | 156 40 | 140 | 110 ( Y& 2.2.3 Logarithmic Functions (i) Log Transformation (Dynamic Range Compression) (ii) Inverse-log Transformation t= (i) Dynamic range Compression / Log Transformation « Log transformation is also known as Dynamic Range Compression. Dynamic range Compression is the ratio of the largest to the smallest value of a measured signal also refers to the ratio of the brightest element of a scene to the darkest. ¢ Log Transformation curve maps a narrow range of low gray-level values in the input image into a wider range of the output levels. It is used to’ expand the values of dark pixels in an image while compressing the higher-level values. le Tech-Neo Publications...A SACHIN SHAH Venture "Jog (1 + Maximum pixel value from th Soin. : Jog (1 + Maximum pixel value from the Image Processing (MU - Sem 6- IT) + Teeompresses the dyramic range of images with lage variations in pixel values. Log funetions a particularly useful when the input grey level valves may have an extremely large range of values. The general form of the log transformation : s = clog(l+n) Where ‘s'is the output image * ris the input image, and r 20 ‘eis aconstant © When we apply log transformation in an image and any pixel value is ‘O° then its log value will become infinite. That's why we are adding ‘I” to each pixel value at the time of log transformation so that; if any pixel value is “0°, it will become “I” and its log will be ‘0° + The logarithmic transformation also scales down the brighter intensity values to lower values. However, the brighter intensity values are not scaled down to the extent the darker intensity values are scaled up. ‘e’ is the scaling constant, + Fora digital image with intensity values ranging from 0 to 285 the transformation log(r + 1) produces values in the range of 0 to 2.41. Representing pixel values in a smaller range of values from 0 to 2.41 is difficult to comprehend. Hence, a scaling operation is required to epresent the logarithmically transformed intensity values in a bigger range. The scaling constant ‘c’ does this. The scaling constant is provided by 255 Using the equation 255 108 (1 + Maximum pixel value fom te Tapat image) input is = log (1 +256) = 2.41 pt fase) (MU-New Syllabus w.ef academic year 21-22) (6.106) Therefore, © = Zaz * 106 Now using Log Transformation equation ty pixel s = clg(l+r We get, following output image 224 | 247 | 255 : vas[ or [223 2 228 | 231 | 233 MATLAB Code cle; clear all; lose all : FFimread('image.jpe! forx = 1:M fory = LN m=double(g(x,y)): 2{x,y)=e.*loglO( +m); end end 4 imshow(f, figure, imshow(2): Original Image ‘Transformed Image Fig, Ex, 2.2, (Inverse Log Transformation : Does oppost Jog transformations. It is used to expand the val high pixels in an image while ‘compressing the level values, cy Tech-Neo Publications. 8 SackiN SHAM processing (MU - Som 6-17) {imag Enhancomont)..Page no (2-7) oe YB _2.2.4 Power-Law Functlons (0 a" power transformation Gi) nf root transformation Tis expres #1eMaps a narrow range of dark Input values Into ayy ay fodule zl wider output values or vice versa. For . ceahancement can be obtained. This technique is quite 16) commonly called Gamma Correction, used ia monitor Fad displays, og © Varying gives a whole family of curves, © and 7 are positive constants, Power-law curves with fractional ry values of gamma maps a narrow range of dark input values into a wider range of output values, with the ‘opposite being (rue for higher values of input levels. = [ Identity function, We usually set eto 1. 0 a2 8 96 128 100 102 224 If gamma < 1: the mapping is weighted toward Fig. Ex. 2.2.20) : Log and Inverse Log transform Graph tigen output vaca © If gamma = 1 (default): the mapping is linear. If gamma > 1: the mapping is weighted toward darker output values, tioh_outf gamma <4 gamma > 1 lowout lowing owin high town ——ighLin 1206 ys04 7 7 309 209. B08 2 3 qos for for 206 20s Bos Bos Eo4 E04 $o3 gos p02 02 Fol For ° of oo 0406 08 1|| a oz Oi nonsties costal iienios | Fig, 2.2.5 : Power law graph with various gamma values WU.Nen 5 = abus wed a ‘ilabus weet academic year 21-22) (M6-108) TbrecnteoPubeaons_A SACHIN SHAH Ventre Imago Processing (MU - Som 6 -!T) Cathode ray tube (CRT) devices have an intensity-t0- voltage response that is a power function, with T varying from 1,8 to 2.5. ‘The picture will become darker. © Gamma correction is done by pre-processing the image before inputting it to the monitor. © When the gamma is reduced too much, the image begins to reduce contrast to the point where, the image starts to have a very slight washed-out look, especially in the background. nit graytevehs Input ay ever Fig. 2.2.6: Varying y gives a whole family of curves 3: For given Image with values as © gamma =0.2 calculate power law transformations | 110 | 120 | 90 a1 | o4 [og 90 {91 | 99 © son. : Using Formula: s = cry = r= 110, we gets = 1. 110.402 = 256 (MU-New Splabus wel academic year 21-22) (6.209) (Imago Enhancoment)..P rmilarly, solving for all values we get fy oput image: ! afaf2 1 24243 2/2/3 "= MATLAB Code clear al: close all; cle: imread(image.png); % read the image = double(a)/255; % normalise the image % constant gamma = 0.6; 9% to make image dark take value of gamma > 1, to make image bright take value of gamma <1 5 = 6().* gamma; % formula to implement power Law transformation subplot(1,2,1)i how (uint8(a) title Original Image’); subplot(1,2,2),imshow(s) title(Power Law Transformed. Image’); "3° Output Image Output gray level, = & processing (MU - Som 6-17) 5S. Input gary level, + +: Graph for all Transformations (image Enhancement 70, %. 2.2.5 Plecewise Linear Transformation Functions ¥UQ. Describe in short the following point processing ? image enhancement techniques. ‘ @ Log Transformation, i) Power-Law transformation Gi) Contrast Stretching (iv) Gray Level slicing, ‘ © Some important transformations can be formulated only as a piecewise function. It is used for manipulation of an image so that the result is more suitable than the original for a specific application. "5 Types of Piecewise transformations are: (A) Contrast stretching, thresholding (B) Gray-level slicing (©) Biplane slicing % 2.2.6 Contrast Stretching One of the simplest piecewise linear functions is a contrast-stretching transformation, which is used to enhance the low contrast images, Low contrast images may result from: Poor illumination, wrong setting of lens aperture during image acquisition or due to nonlinearly or small dynamic range of an imaging sensor. It increases the dynamic range of grey levels in the image. Dark =T) Dak <—+ Light sete) Light Dark Date + Light Fig. 2.2.7: Transformation graph Tech-Neo Publications..A SACHIN SHAH Venture Module. no. (2-11 i | aR802 Prooszsng My Soms-iT) ra ‘stretching’ the . ies le image entaneemint technique that improves the contrat It ah 7 “alues: It contains to span adesived range of values. tion to every pixel of F to . transformation fen, the Form as shown inte fre ew, the effet of plying the a by darkening the levels | EeHerae the corresp e original image, nding pixels in g would: Produce higher contrast than the original 1 al imo betow inal image and brightening the levels above m inthe original image. min the origi "© Contrast stretching transformation j ] i 10, b= 180, m = 100 if ris above 180, it become | have the following intensities: a 8 0. If is between 90 and 180 , T applies as follows: ] When <100,s closes to zero (darker) when r > 100, s closes to 255 (brighter). ‘This is called contrast stretching, Pixels will become darker, this mea 5=T 1 jghter and the dark Which means that the bright pixels in the image will become brighter an igher contrast image. Dark =—= Light 7 mb ‘ Dark <> Light Dak <—» Light Fig. 2.2.8: Transformation Graph Contrast Stretching Transform is given by: | SeLrOcerea } S=m(r-a)+v,a<=sreb j S=n(r-b)+wb<=r examples based on contrast stretching For, $= 24r~3) +2, deoned Fa 2A + For Given 3 bit Image Perform Contrast 3 ssuvtching with values 13, 12, 92=6, ate a]2 - : For, S=05(r-5)+6, Sexte7 Fay) 1f2[4 - s{ife a 2|3|s|o 65 7 MW soin, : Let us Compare the values in the standard roam - Contrast Stretching Transformation Graph : ‘Therefore output image will be 288 4 [2 [ix[oos Identity 7 4 transformation 2 [oo] 132] 4 6 [066 | 65 | 132 12] 2 | 6 | 6s Medifed eee Rounding off values gives final output: afa[ufa u fifa ° ab 288 6fifzt Original grey level tel Fig. Ex. 2.2.4 Given: 1) =a=3, 2=b=5, 5, Using above values , we get slope of each range as: 0.5 (remember, itis 3 bit image so Max "= MATLAB Code clear all; le: 4 = ivead(image.jpg); Seread the image ati b= minG)s 9% find the min, value of pixels in all the calutns (row veetor) rnnin = min(b}; 9% find the min. value of pixel in the image b= max(i): —% find the max. value of pixels in all the columns (row vector) intensity is 7) Using Formula and substituting given values we get, | tmx = max(b); find the max, value of pixel in the For, $ =0,666., Ob will be amplified i the output image. After n successive applications, te pixel value will become "255". That means that after n repeated applications of t contrast stretching transformation function, we get i [ebrech-neo Publications,..A SACHIN SHAH Venti mn image having only two grey le is athresholding. since Thresholding Ty gives a binary output image, ‘Thresholding Function is defined as, s= 285 itr 100 05 otherwise |A special case of contrast stretching is thresholding where | = m= t ICs also used for noise reduction. It preserves the grey levels beyond r1.Image 4s Thresholding simply means setting an intensity value for intensity value lower than a certain value (Threshold value) and another intensity value for intensity value higher than the threshold value. ‘+ Here, Threshold value acts as a point of intensity value which separates the intensity values of pixels into two parts. Threshold value can be selected by different methods and Image © Thresholding can also be done by different ways. In this context, we are only taking a gray scale image. © Thresholding is a phenomenon which occurs due to extreme contrast stretching. In the contrast stretching diagram if we make the first and the last slope zero (rj = 12 = 0) and we increase the center slope, we will get a thresholding transformation +The intensity transformation function, convert the pixels with dark intensities into black and the bright pixels into white, Pixels above threshold are considered bright and below itis considered dark, and this process is called thresholding. © The formula for achieving thresholding is as follows: ifr seL-l; ifr> Where Lis the number of grey levels Dark Light Dark <—* Light Fig. 2.2.10 : Thresholding wn Gray Level Image, perform Ex. 2.25 : For Thresholding with threshold value 175. 37 | 180] 7 | 200 0 | 105 | 201 | 113 241 | 243 | 72 | 5 121 | 29 | 44 | 55 © soin.: Given: ‘T= 175 Input image ranges between 0 to 255 so L = 256 Using Thresholding Formula: ; ifr= 175 =I, © output Image 0 | 255} 0 | 255 255 | 0 2s5| 0 | 0 MATLAB Code lose allselear allscle a=intead(rice,pmg)s imshow(a}; (MU-New Syllabus wef academic year 21-22) (M6-108) [ehrech-teo Publications. SACHIN SHAH Venture imnage Processing (MU -Som 6 17) {man =ize(a)s bassin wine oto m and co fori=1em $1 tom forj=lin Gel tom if (ij) <=128 Sepinel value less than 128 DG) hse So threshold image will be O image will he 255 ‘lig) =255: Sather value — threshold image will he 2 end end end figure(1)imshow(a):figure(2)imshow(b); Thwshld ae 2 2.2.7 Grey Level Slicing + Grey level slicing is equivalent to band pass filtering. It manipulates group of intensity levels in an image up to specific range by diminishing rest ot by leaving them alone, * This Wansformation is applicable in medical images and satellite images such as X-ray flaws, CT scan, * This technique is used to highlight a specific range of gray levels in a given image, (thresholding. Other levels can by ‘maintained and it is useful for highli an image. It is. similar to © suppressed or ighting features in "3 Two different approaches are adopted for grey level slicing, Case: Grey evel sicing without background To display a high value of interest, for all grey levels in the range (MU-New Syllabus wef academic Year 21-22) (Mé-108) ‘enhancamn mage, - - ne for all grey Fevels val @ Todisplay a1 Jjeimg with background fevel slic Hs Grey vel. a ange of erey le : ighten the desired rang mac serve the bt ne "oe 1 slicing without backe ms « specific region of igh values cic raion 94 oe displays TY fave co other os ee Fie 7.2.10 highlights rang aed background, Ta yall others co a const Jovels by reducing ve a Fig. 2.2.10 : Grey level slicing without Background ge with a= 3 and b = Ex, 2.266 : Given a 3 bit Image : Perform Intensity level slicing without background 1f4]2]}7 3} 2}4]5 2|6|s5|7 o}2 © son. : Given that: Sand b=6, Therefore, r input pixel v; alues between a and b ie, and 6 will be rept ‘aced to maximum intensity 3 \e. 8 2'=8 for3 bitimagey -1 Phel values between 3 and 6 will intensity levels Seine Hs atked to perforin Gray level slicing without backgro Antensity lewd und, the remaining pixel val (MU - Sen 6 = weslad above F © 6 will be made 0, “The outpot image is: o {7 {o fo 7{o}7 |7 o}7{7 Io o jo}7 [o ‘Q. 1(e), Dec. 2016, 4 Man Forte piven 3-bit, 4 x4 size image perform {Intensity level slicing with background for = 2,1 = 4f2]3j}o 1fafs|7 5 1 2}afe]7 (Gi Negation © sotn, (@ Intensity level sl n=5 Given =r nSrsr 1STSt Otherwise Lis maximum gray level intensity 1 is background intensity. So output is, 7\ 7] 70 t}7}7|7 a{7|7f1 7{7/6|7 @) Grey level slicing with background Fig. 2.1.12 highlights range (A, B] by preserving all other levels. Fig. 8 displays high values in specific region of an image and original grey level to other region by Preserving background. Fig. Ex. 2.2.7 Ex, 2.2.8 : Given a 3 bit Image with a = 3 and b= 6, Perform Intensity level slicing without background T a | © son. : Given that a Band b= 6. Therefore, + input pixel values between a and b ie 3 and 6 will be replaced to maximum intensity ie. 8 (2° 3 =8 for 3 bit image). § Replaced to maximum intensity level ~ 1 ie. 8- =7 Therefore, r input pixel values between 3 and 6 will be replaced by (L~ 1) intensity levels Since it is asked to perform Gray level / Intensity level slicing with background , the remaining pixel values below r=3 and above r= 6 will maintain the same values. The output image is: 1|7 7 7\2\|7 47 2\7]74]7 (MUsNew sylabus wes academic year 21-22) (M6-108) Tech-Neo Publications..A SACHIN SHAH Venture 2. 2.2.8 Bit Plane Slicing / Extraction Pixels are digital numbers, each one composed of bits. | Instead of highlighting gray-level range, we could | highlight the contribution made by each bit. This method is useful and used in image compression. An 8-bit image can be represented in the form of bit | plane. Each plane represents one bit of all pixel values. Bit plane 7 contains the most significant bit (MSB) and bit plane 0 contains least significant bit (LSB). The 4 MSB planes contain most of visually significant data. This technique is useful for image compression and [al rech-Neo Publications...A SACHIN SHAH Venture provossing (MU - Sem 6-1) rrayanngraphy. Often by isolating particular bis of the pitt vals ian tnage we can highlight interesting opens of tht image, Higher order bits usually antain most of the significant visual information Lower order bits contain subtle del Bit plane 7 one Bote, (most significant) Bitplane 0 (east significant) Fig. 2.2.11 : Bit plane Slicing ‘« Bit plane slicing is a method of representing an image ‘with one or more bits of the byte used for each pixel, ‘¢The gray level of each pixel in a digital image is stored as one or more bytes in a computer. ‘© Foran 8-bit image, 0 is encoded as 00000000 and 255 is encoded as 11111111. Any number between 0 to 255 is encoded as one byte. ‘© One can use only MSB to represent the pixel, which reduces the original gray level to a binary image. form Bit Plane slicing on Given Image 6 {7 {6 |6|7 o fofo ji}2 rfafa [2}3 4|5|5 [4|2 6 fe fe |7|7 @ soin. : Since the given image has a maximum grey level of 7, it is a 3-bit image. We convert the image to binary and © The three main goals of bit plane slicing | separate the bit planes a 110} 111 | 110 | 110 | 111 © Converting a gray level image to a binary image, 1000 | 000 | 000 | 001 | o10 © Representing an image with fewer bits and 001 | 001 | 001 | o10 J oun corresponding the image to a smaller size ‘© Enhancing the image by focussing. [F201 ELON} 2100) (010 110 [10 | 110 fant | at ‘Separating the bit planes, we obtain T}tfapaya Hyijiiaqa o}l ot o}ojolo}o ojo;o}o}1 ojo 1]0 ofofofolo| fofofoli i} (afi fs folt 1{ijijijo ojojojoji 1}1{0/0 mp) bbb ofofifi MSB plane Centre bit plane LSB plane (MU-New Syllabus wef academic year 21-22) (M6-108) Tl recn-neo Publcatons.A SACHIN SHAK Venture Processing (MU- Sem Fig. 2.2.14 : Original Image with Reconstructed Image 2.2.9 Neighbourhood / Mask Processing Operations «In point Processing. pixel operations were independent on the neighbour pixels. This principle has many useful applications, but it cannot be applied to find the relationship between neighbouring pixels. + For example, if a significant change in intensity value ‘occurs this could indicate the boundary of an object and by finding the boundary pixels the object is located. « Inneighbourhood processing a number of methods are presented where the neighbouring pixels play a role when determining the output value of a pixel. All filtering algorithms involve so called neighbourhood processing because they are based on the relationship between neighbouring pixels rather than a single pixel in point operations. %® 2.2.10 Comparison of Point Operation and Neighbourhood Operation ‘operation and; Differentiate between point neighborhood operations. rma 10g, More) 1. Transformation function: * In point operation, transformation function T (.) works only on single input pixel value say r In Neighbouring operation, Transformation function orks on group of input values. 3. (image Enhancement)... ro (2-11 It isa group operation, Number of Input values selected for processing depends on window size. ‘Memory requirement: Point operation is a zero memory operation. Output pixel value at (x, y) position depends on a single input At (X, y) position, No memory space is required to store intermediate results, In Neighbourhood operation output pixel valve at (x, y) position depends on many more input pixel values, memory space is required to store intermediate results In Neighbourhood operation output pixel value at (x. y) position depends on many more input pixel values, therefore to calculate single output pixel value memory space is required to store the intermediate results. Examples of Operation Examples of point operation include: Contrast Stretching Transformation Clipping and Thresholding Digital Negative LOG Transformation Power Law Transformation Intensity Level Slicing Bit Level Slicing Examples of Neighbouring Operation are spatial filtering, ‘Smoothing Spatial Filters: LPF, Weighted Average filter, Trimmed Average Filter, Median, Max, Min filters. Sharpening Filters : Derivative filters, HPP, High Boost Filters Output Pixel Value In point operation, the output pixel value s at (x,y) position is given by s = Tir) Where r is input pixel value at (x,y) position, In neighbourhood operations . the output pixel value at (xy) position is obtained by masking operation (MU-New Syllabus we academic year 21-22) (M6-108) [adrecr-ieo publications. SACHIN HAH Venture Module (MU- Sem 6+ IT) Sant z oS 2 (oo) 0,047. DLO. HH. 2) 2 3 i < 5 - (1, 0)(1, 1) Dt p(t 1} oo Ss 6 Sa ° 2.101, DF fe 12) Fig. 5.3.7 15.4 REGION BASED SEGMENTATION Explain region based and boundary-based ! ‘segmentations. Explain the use of thresholding both the.cases. : rage In this section we discuss segmentation techniques that are based on finding regions directly. 5.4.1 Region Growing (by pixel aggregation) © In this method we start with a seed pixel and from the seed we start growing regions by including the neighbouring pixels which are similar in some sense (ay gray level) to the seed. * To understand the procedure, consider a 4 x 4 image with 8 gray levels. 0123 0 {7{o[ifo tawy 1 [7{7fafi 2 |o}7}2{1 3 [6|7[3]2 min gray level in f(x, y)=0 max gray level in f(x, y) =7 (ear (sar is chosen as 10% of | level in | - iin} fay) f(xy) 10 qe ie, (7-01x7997 07! We take a seed pixel say with co-ordinate (2, 1, y, check the absolute difference in the intensity of yy seed and its 4 neighbours (oF 8 neighbours) if it je, than or equal to Th then append that neighbour ig yp seed. Inthe above image the pixels with a Dg distance 1 from pixel (2,1) are (2, 2) 2, 0) (1, 1)] and (3, 1) ‘The pixels with absolute difference in intensity < 7 are {(1, 1) 2, 0) and (3, 1)) therefore these pixels are appended to the seed. Now the Dg distance from the seed is increased to 2 Now pixels under consideration are [(2, 3), (0, 1)] ‘The pixels with an absolute difference in intensity afefala 2} sto] 4] stele] Following sequence of transformation is used c£.c Where Cis transformation matrix and (° is its Transpose Matrix {isinpot image Mubipying all Matrix as C.£.C° a [os] os | os | ay42] [os 02705 0.653 | 0.2708 | - 0.2705 | - 0.653 dio] 8 [3 Os - 0653 os -05 -05 os 2{ 8s] 10] 4 Os 0.653 02705 |=0.653| 0.653 | 0.2708 sislel2] [es = 0.2705 © DCT Output = 0.2705 -8 0.653 0.2498 }087 0.8957, 1.4645, Ls — 1.6885, 0.0327 | - 1.6022 | - 0.9562 — 0.2448 "@ MATLAB Code mok= [11110000 si 11100000 "5 inead(cameraman.tif); 08 ee 000 1 inane); 1100 Ts 10000000 etmt(8}; #The funetion detmtx returns the N- ‘ransiorm matrix, 00000000 tas 0000 ic Glock struct) T* block_structdata * T; 0, 0 9. 0 0.9, Nockproe(L,[8 8) det 00000000 00000000 Silabus w.ef academic year 21-22) (M6-108) rech-Neo PublicationsA SACHIN SHAH ana Image Processing (MU - Sem 6 - IT) (Image Transforms) Final DCT output, 10 -1.84 -2 0.765 S060 0-070 c0 0 0 0 0 -18 0 0 0 3.3.1 Properties of the DCT Transform ‘The cosine transform is real and orthogonal. ‘The cosine transform is not a real part of the unitary DFT. The cosine transform of a sequence is related to the DFT of its anti symmetric extension The cosine transform is a fast transform The basis vectors of the cosine transform are the Eigen vectors of the symmetric tridiagonal of Toeplitz matrix a AF PP The cosine transform is close to the KL transform of first order Markov sequences. 7. The cosine transform has very good to excellent energy compaction property of images. The DCT is a real transform. This property makes it attractive in comparison to the Fourier transform. The DCT has excellent energy compaction Properties. For that reason, it is widely used in image compression standards (as for example JPEG standards). There are fast algorithms to compute the DCT, similar to the FFT for computing the DFT. (Image Compression)....Page no. (4-1 4.5.6 LZW Coding Lzw stands for Lempel-Ziv-Welch, LZW is integrated in various image formats GIF, TIFF, PDF. * To understand LZW coding, consider a 4 x 4, 8-bit image, 20 20 20 20 sees 60 60 20 20 60 e 20 20 60 60 © We process the image left to right and top to bottom manner. So the complete image becomes a I- dimensional array. [20, 20, 60, 60, 20, 20, 60, 60, 20, 20, 60, 60, 20, 20, 60, 60] © Image gray levels possible are 2° i.e. 256 (0 to 255). The initial entries in the dictionary are 8-bit ie. 1 byte entries corresponding to pixel intensities inthe image. ¢ From the 256"" entry in the dictionary we search for patterns, Say 20 the first number in the 1-dimensional array is already there in the dictionary. So we concatenate is with the next number to form a pattern 2020. ‘The next number in the 1-dimensional array is again 20 it already exists in the list so itis concatenated with the next entry 20 60 to form a new pattern. Next number in is already there in the 1-dimensional array is 60 since the dictionary we concatenate it with the next number to form a pattern 60 60. ‘The next number in the 1-dimansional array is 60 this is already present in the dictionary so it is concatenated with the next number to get a pattern 60 20. xt number in the 1-dimansional array is 20 we «The ne get a pattern 20 20 concatenate it with the next entry to but this pattern is already present in the dictionary so we concatenate the next number to this pattern to get & pattern 20 20 60. We continue this procedure till the end of the 1- diemensioanl array. Module 0 i 10 25 30 100 200 255 256 20.20 257 20-60 258 60-60 259 60.20 260 20-20-60 261 60-60-20 262 | 20-20-60-60 263, 60-20-20 264 20-60-60 ‘The encode output isthe largest run i.e. 20-20-60-60 * The dictionary has entries il 262. We can employ a 9- bite, 512 word dictionary for coding, * The encoded output 20 20 60 60 256 257 258 259 260 261 262 263 264 * + Thememory required for the orginal image = 4x4x8= 128 bits ‘The memory required for the encoded image is = 13x9=117 bits us weef academic year 21-22) (Mg 03) coding we need only the enced date de ‘@ | In LZW for dec ‘and not the dictionary. show how to decode the 13 encoded values, We show how is 20, This value i in the encoded data is 20 The fet en 0 Felemet inthe encoded Oupu i i xt iv taken ast is. The ne in the dictionary, the 256 is asi is and, in 20. We take th is )-20. entry is made 20- / t is 60 we take it as it is ang rhe next encoder output eee 257! entry in dictionary is made 20-60. The next entry in the encoded output is 60. th entry i ne «We take it as it is and the 258" entry in the dictionary coder output is 20, the de as 60-60. The next en u 2s" entry is made 60-20. This procedure is continued till we get the entire "=F Encoding © The initial dictionary for LZW encoding for the given sequence is Index Entry 1 a 2 b * The encoder first encounters the letter a, This “pattern” is in the dictionary so we concatenate the next letter to it, forming the pattern ab, * This pattem is not in the dictionary, so we encode a With its dictionary index 1, add the pattern ab to the dictionary as the third element of the dictionary, and begin a new pattern starting withthe letter b. Jndex | | Entry a 1 a 7 b a ab AS b is in the dictionary, we concatenate the next Clement a to form the Pattern b sch-Neo Publications..A SACHIN ‘SHAH Venture mago Processing (MU - Som This pattern is not in the dictionary, so we encode b with its dictionary index value 2, add the pattern ba to the dictionary as the fourth element of the dictionary, ‘and start constructing a new pattern with the letter a. Index |" Entry © 1 a 2 b 3 ab 4 ba «As ais in the dictionary, we concatenate the next clement b to form the pattern ab. This pattern is also in the dictionary, so we concatenate the next element a to form the pattern aba and we encode ab with its dictionary index value 3, add the pattern aba to the dictionary as the fifth element of the dictionary, and start constructing a new pattern with the letter a. Index| Entry 1 a 2 b 3 ab 4 ba 5 aba + Asa is in the dictionary, we concatenate the next ‘element b to form the pattern ab, This pattern is also in the dictionary, so we concatenate the next element @ to form the pattern aba. ‘+ This pattern is also in the dictionary, so we concatenate the next element b to form the pattern abab and we ‘encode aba with its dictionary index value 5, add the pattern abab to the dictionary as the sixth element of the dictionary, and start constructing a new pattern with the letter b, ‘Entry 1 a 2 b 3 ab 4 ba 5 6 ‘aba abab (MU-New Sylabus w.ef academic year 21-22) (M6-108) (Image Comprossion). 10. (4-4! As b is in the dictionary, we concatenate the next element a to form the pattern ba, This pattern is also in the dictionary, so we concatenate the next element “eof” {0 form the pattern ba ‘eof’, ‘eof indicates the end of file, This pattern is not in the dictionary, so encode ba with its dictionary index value 4, add the pattern ba ‘eof” to the dictionary as the seventh element of the dictionary. Final dictionary Index Entry a b ab ba aba abab ba ‘eof ‘The encoder output is the sequence: 12354 Decoding ‘The encoder output sequence was 1235 4. This becomes the decoder input sequence. The decoder starts with the same initial dictionary as the encoder. ‘Index Entry 1 a 2 b The index value 1 corresponds to the letter a, so we decode a as the first element of our sequence. At the same time, to mimic the dictionary construction procedure of the encoder, we begin construction of the next element of the dictionary. We start with the letter a. This pattern exists in the dictionary, so we do not add it to the dictionary and continue with the decoding process. ‘The next decoder input is 2, which is the index corresponding to the letter b, We decode a b and concatenate it with our current pattern to form the pattern ab. H Tech-Neo Publications..A SACHIN SHAH Venture Modul 4] add ‘As this does not exist in te dona, we nae third element of the dictionary and st beginning withthe letter b. ‘The next decoder input is 3, which is bale corresponding to the pattern ab. We decode zi ses ‘ab and concatenate the first character of the i pies wth ur eoent panto foe the ptism ba. AS Oi does not exist in the dictionary, we add it as the a element of the dictionary and start a new pal beginning with the etter a, the index Remember that we also have another character ‘b" os the previously decoded pattern ab. We concatenate with our curent pattem a to form ab as our current patter, This pattern already exists inthe dictionary, so we can't add itto the dictionary. We go ahead with decoding the next decoder input, ‘The next decoder input is 5, which is the index Corresponding to the pattern aba. We decode the Patter aba and concatenate the first character ‘a’ of the pattern with our current patter to form the pattem taba. As this does not exist in the dictionary, we add it 4s the fifth element of the dictionary and start a new Pattern beginning with the a, Remember that we also have another two characters ‘ba’ form the previously decoded pattern aba, We Concatenate ba with our current pattern a to form aba 8 our current pattern, ‘This pattern already exists in the di ‘add it to the dictionary. We go ah next decoder input, ictionary, so we can’t read with decoding the The next decoder input is 4, soresponding tothe pattern ba, We decode the Pattern ba and concatenate the fist character ‘py with our current pattern to form this does not exist in the di sixth element of the diction beginning with the 6, which is the index the pattern abab, Ag tionary, we add it as the MY and start a new pati Remember that we also have another character jecoded ro eee pattern b to form ba ay nate ain This pate already exist in the diet eaaervt add it othe dictionary. As there ate no fn ve at the dictionary, we concatenate thy input ter to our current pattern to form the pa add it as the seventh entry of the diction” «= Final dictionary Index Entry 1 a 2 b 3 ab 4 ba 5 aba 6 abab 1 ba ‘cof” Final Decoded sequence: ababababa % 4.5.7. Lossless Predictive Coding '@’ form (MU-New Syllabus wef academic year 21-2) 6-109 Lossless predictive coding works by extracting and coding only the new information in each pit, removing the interpixel redundancies of closely spaced pixels. The difference between a pixel’s actual and anticipated value is defined as new information forth Biel. The main components of a lossless pred Coding system are shown in Fig. 45.4, The sytem made up of an encoder and a decoder, both of which have the same pre or. The predictor Subsequent pix itis introduc on a number Benerates the anticipated value of eict 1 of the input picture, abbreviated fy ed to the encoder. This value is dependet of previous inputs, The predictor’s outpet SS then rounded to the nearest integer, denoted fy a Used to create thy ih aw difference or prediction error, Wi" the ge tUeMlY coded using a variable-length oll rr tol encoder) to build the next eemett of Compressed data stream, 4.54 Arithmetic Coding Consider the following alphabets (hi, 1 ya, following probabilities the h 0.2 0.0, 0.2) i 04 | 2,06) ! 04 | 06,10) If the message to be sent is hil oe 0.12 0.6: 0.088. i i 02 ” 0.056. . mm h 0+ ———_ 0 0.04 (WroBig. 4.5.2 * Any number in the range (0.088, 0.12) represents the whole message hil * Consider an image with intensities a, b,c. blelela QA = ype Bre. ‘Neo Publications..a SACHIN SHAH Ven" (0, 0.25) 2 os (0.25, 0.75) 1 0.25 (0.75, 1) 4 ‘Consider the following alphabets (h, i, 1) with the following probabilities Range (0.2, 0.6) t 04 | 6.1.0) 1 0.25 1875 9.15626 0.4875] 0.18625] ~ 0.140625 0.0625 0.09975 craig. 45.3 * Any number in the range [0.140625, 0.15625] represents the first row. * Ithe number used to represent the second row beca is 0.143, We need to know the probabilities of each grey level 0.143 lies between 0 and 0.25 which represents ‘b’ In the new scale b, 0.143 lies between 0.0625 and 0.1875 which represents ‘c’. In the new scale for ‘c’ 0.143 lies between 0.9375 and 0.15625. which ‘presents ‘c' and finally 0.143 lies between 0.140625 404 0.15625 which represents ‘a. eens ce (MU-New Sylabus w.e§ academic year 21-22) (M6-108) Ex. 5.2.1: Apply Horizontal and vertical line detection mask on the following 8 bits per pixel image F. Use appropriate threshold value. Assume virtual rows and column by repeating border pixel values. | | lo | 15 | 10 F= | 200 | 200 | 200 5_|20 | 10 | M som. : e R=2x200+2 x 200 +2x200 | a “ji aa 15 10 tt e -1x10-1x15-1x10 2 2) 2 — 200 od) 200 -1x5-1x20-1x10 -1 -1 -1 5 20 10 = 1130 Horizontal mask WRi=1130 (MU-New Syllabus w.e.f academic year 21-22) (M6-108) Tech-Neo Publications...A SACHIN SHAH Venture 10 200 GI 0 a 15 | 10 2 2 zoo | 200 a[a | 0 | Horizontal mask a[ [4 7 | 0 | 0 2 |@/2 {a0 | 200 200 +[=[4 Ce [@ [oe [2 Horizontal mask ° 4,2] | * | (la | — [20 || 2 af2[4 3 | »| 0 Horizontal mask * We find that the horizontal mask yields a hig! * +. Weconclude thatthe line is in the second row. Threshold value R fn value of IRI when iti Re2x1042%15 42% 10 = 110-1 15— 110 = 1% 200-1 200-1 «200 ~ 565 565 WRI R=2x5+2x20+2%10 = 1200-1 200-1 x 200 =1x5-1%20-1%10 =-565 WRN=565 R=2X200+2x 200 +2 x 200 = 1x 10-1 x 10-115 =1x5-1x5-1%20 R =1135 WRU= 1135 R=2x200 +2 200+2 x 200 =1x 15-1 10-1x10 =1x20-1 10-110 R =1125 WR=1125 R=2x15+2%2004+2%20 = 1x 10-1 200-1%5 =1x10-1%200-1x 10 R=35 WRI=35 in the second row ofthe image. 21125 (MU-New Syllabus we, academic year 21-22) (M6-108) [al rech-eo Pubications.A SACHIN SHAH Venture sogmontation and Representation) _ (i "F_Detection of 1 Pixel Thick Breaks ina Line " 10 10 w | wo [0 | o | o | 200 | ofo lo 200 200 100 200 ® 1 200 | 200 | 2 0 10 | 4 10 10 ee Le * “ oO 0 0 10 a 7 0 i 10 10 10 10 10 ‘A bright line in the second row * When mask is placed on the second low at the break (0) R = 200x2-2x10=380 MRI = 380 ‘* When mask is placed on pixel with value 200 on the eft of the break (@)and on the pixel with value 200 on the right of the break R = ~2x200+10+200= RM = 190 190 ++ Atall other location the resulting IIR Il= 0 Only on second row Ofolo} o | of o Jolo 0 {0 {0} 190 | 380 | 190) 0 | 0 "Rt=lolololo lo] o lolo Sto}of of of o Jolo * + When the mask is centred at the break the inten other masks which can detect / pixel thick disconti i 2 times thi intensity of the pixels of its horizontal neighbours nuities are Olt fo} jofo Jy 1}0 Jo } [o}-2]o] fo O11 lo =2}0 olo |i Vertical 45° ‘The masks which ean detect one pixel thick breaks in Vertical » inclined at 45° an %. 5.2.3 Edge Detection 'd — 45° lines is shown above. Page no. (6-8) jical Image Processing). Joe Peceeing MY-sens-my _enocp es mee ee Ex.6.5.1 : For the original above, this gives ofofo}o{ojojojojo ofololofofolijolo ofolofo{1}ifsafofo ololofojofolijofo ofofololojolijofo o}ololofololilo ofolofolopi|2fo ololola, ofofo ofolo fo ojo Using only Dj, Dz, Ds and Dy Biuitively. this corresponds to a skA@iM of the ima length but reducing thickness, ue has been used in one project to find out gration @ in a fluid. Images of the Jaken andffcir centres where found by a ed above, the basis of movement estimation. hod similar to the one deseri er useful operat is granule sizing and ‘counting. How 'y widgets are there currently om the production line ? How hig are the chocolate blobs on the conveyer bell? One approach might be to use norphological techniques a follows. 4 6.6 _HIT-OR-MISS TRANSFORMATION aan a 1 UQ. Explain HIT and Miss Transform ; (MU - Q. 2(b), May 2016, > EIR UQ. White shor notes on ; {© tog Transom and Went tanto ang thet apgton ; 9) Wee shor oes on hit and Miss wanatorm, * “This method is appropriate for determining centain specified configurations of pixels (MU-New Sylabus wef academic year 21-22) 146-108) A@B = (ACB)O(ACB) Where, B= (By. Bn) Suppose we want to find locations of cross shaped pixel configurations o10 9 p= 1 [i]t and B= o[o]o 010 1 04 1 ryt 1 iif ih 1 LT \ Aoby= ] [Blrecn ‘Neo Publications, “A SACHIN SHAH Venture ws. 5.5.1 Chain Code i UQ. Explain the ee Descriptors: Shape Numbers. 1 i UENO Leer Ree) 1 e¢ A boundary may be represented by a ‘chain’ of connected steps of known direction and length, thus the ‘chain code’ is a concise way of recording a shape contour. e In a _ two-dimensional orthogonal image, array movement from one pixel to an adjoining pixel can only be undertaken in one of eight directions - thus the [el rech-Neo Publications...A SACHIN SHAH Venture (image Sogmentation and Bi Image Processing (MU - Sem 6-17) eight compass points can be used as direction vectors. By giving a number to each direction, as defined in Fig, 5.5.1, the outline of an object can be traced and coded as a sequence of numbers. ) © 2 ° -L 3 8- Directional 4. Directional 8-directional 4-directional (onFig. 5.5.1 : Chain code direction convention ‘© In operation the chain code works best with binary edge maps. The sequence of illustrations is given in Fig. 5.5.1. ‘* It shows the chain code derived by raster scanning 70-6 7058 5 ° en a Ge. scanning in strips from left to right and from top 10 bottom) and edge map until the first boundary pixel of the object is found. ‘© The coordinates of this pixel are recorded as the start point of the contour, S-in this case (2, 1). From this point on the cursor follows the contour, usually in a clockwise direction, the first step being in a south-east direction, coded as direction 7 according to the convection of Fig. 5.5.1. ‘The second step is due east, coded direction 0; the third step, is due south, coded as direction 6, etc. ‘This procedure is followed until the final step, direction 1, returns the cursor to the start point, S. This yields the chain code 70654321 which has a chain length, or chain count, of 8 vectors. If the starting point of the boundary cannot be regained then the contour is not complete (closed) and the code sequence is invalid and must be discounted. This could result from incomplete result from incomplete boundary refining, or objects which cross the edge of the field of view. Toss 2 TOE 1 ” 0 oaFig. 5.5.2 @ Ex. 5.5.1 : Show that redefining the starting point of a chain code so that the resulting sequence of numbers forms an integer of minimum magnitude makes the code independent of the initial starting point on the boundary. © son. : Consider the object shown below : startig point (c9Fig. P. 5.5.1 Its 4-directional chain code : 10103322 Its first difference 3133030 Its circular first difference 33133030 ‘cullahuis wee academic year 21-22) (M6-108) [eal rech-Neo Publications A SACHIN SHAH Veu® i Processing (MU - Sem 6 - IT) ‘%. 5.5.3 Boundary Descriptors Length - number of pixels along the contour Xam? Xun? Youu? Yoig ~ maximum and minimom coordinates ofthe contour Xecntroid? Yeentria ~ X and Y coordinates of the center of the region Boundary diameter - maximum distance between wo Points on the boundary Curvature - rate of change of slope (example: the Gifference between the slopes of adjacent boundary segments) Shape order (chain count) - number of elements in the chain ‘Shape number - first difference of smallest magnitude %_5.5.3(A) Moments ‘The moment transforms of an image function (2-D ‘continuous function) f(x, y), is given by J J Pa yacey for pg = 01,2 ‘Therefore we can think of the image function f(x, y) as an infinite set of transform coefficients, tpg, which are derived from projecting the image onto a set of 2D polynomial basis functions. But practically the application Of the transform requires that we employ a finite number of coefficients, m,q, to represent the image In case of spatially discretized M x N image the ‘moment transform is given by MoINeL = 5 Lv ytay x20 y= Zero and first-order moments can be defined as Continuous case (MU-New Syllabus we academic year 21-22) (M6-108) = J J te. yaxay mo = J J 23° tte, yacay - J J xt yacay my = J J x°yteyardy = J J ytmyaray "= Discrete case M9 = PEP Ka.» -=d xy ZZ my y fix, y) my = 2 stim ny oy x yflay) =z xy ZZ vay xy For an object R in the image. If we assume thatthe region R that is present in a binary image has an intensity “V" then for region R. ‘Moo is the total number of points in the region R oF the area of region R, ig And mo, gives the centroid, The centroid is Tech-Neo Publications..A SACHIN SHAH Venture vine Besid 8 mip ang invariant to teanstatog the higher order moments are not The trans jon and recent”, the origin to the centroid of the Fe Og tho cenra mores gives and 7 oe ™o0 | @ cominuourene ma J IG-5yG5)eayuney ‘@ Discrete case te = ZZ (3) 3) Sy) Hoo = ZE(x-2)"-3)" nen = 22.3) ey xy zz = xf, y-2 Zz Ky) xy xy LEE m0 y = mo x y (x, y) z y = mo- Bo Y, mo x y 0 10 Fe 0) = 1 Fah gy “0 ‘Te central moments fore ute 3 ae re, FES acy mig = my ~-20, 1° gg 00) =0 Hn BE (3)! (9-3) fa.yy = 0 wo = ZEON ey oat a? ; mn gee = mye =mp- es Hon = RECs) (y-3) fay , - = ™ 2p 398 to = ZZ (x3) (y-7) tay xy 2 = myy-3¥ myo +2% mo 1 2 = wp = 2 (x-3)' (y-3) toy ZZ (x-z)"(y-¥) ‘tan a Pe a “ , = myq—2-2y my, -¥ Mg) + 2¥ Mg Ee 2, st | = 22 (5-7) te» — BE (9) ee xy * = my — 2K my —¥ My9 + 2K “Mo = 22 yf, )- => F tex») = my nee : - “ tgs = 2% (x-3) (9-9) y m1 SE 7 % = M1 Tog 7 f(x, y) floes Venture [Blrech-neo Publications..A SACHIN SHAH Vent Hw Sylabus wie,f academic year 21-22) (M6-108) m1 -¥ Mo 0 tho = =? Hyp = myo 3K myo + 2moX Hor = 0 _ oh _2 My2—2V my —K mon +27 mq be Hoo = Mz9—-K mo Hay = may ~ 2m ~Fimgo +28? mo oq ~ Yo, Hos = mo)~3¥ mga + 25 mo We find that the central moments are still sensitive 10 Rotation and Scale transformation. We can make the central moments scale invariant by again normalizing fp the central moment. ae The normalized central moment, denoted by pg is defined as —n __ fe] From these normalized central moments, we can develop a set of invariant moments {$} which is defined as Derived invariant moments $1 = Mo + Noo 22 (M20 + Moa) +4n4 = 2 2 $3 = (M39 + 3nj2) + Gna - Nos) = (nso# mia) + (a + nos)” 5 = (30-312) (Ns0# M12) (30 + Ma) =a +163) + Gra No) as +e) {3(39 + M12) - (May + Nos) ) 6 = (n20~Mox) {M30 + M12)"= (nay + es)” +411 (M30 + M2) (Mar + hos) $1 = Gmi2—Ms0) (Ngo + M12) {30 + Mia)” a -3 (mai + M3) + (n21 ~Mhos) (nay + Thos) (3(ns0 + M42)" ~ (may +o") et of moments is invariant translation, rogyoe and scale change. Note that éy is actually scale and transIation invainy Ikt.changes sign for a reflection. ‘This set of invariant moments makes a useful feature ‘vector for the recognition of objects which must be regardless of position, size or orientation. They have been applied to character recognition, aircraft identification ang ‘scene matching applications. retation of Centr: "= Geometric Inter Moments ‘The significance of moments is not immediatly apparent from the algebra. To relate the moment approach tp other geometric descriptors, the following interpretations of several low-order central moments for a region R are shown to have a direct analogy with the mechanics of bodies, Central Interpretation moment, asia, at SSS io _ | “Horizontal centralness” Hog _| “Vertical centralness” bir | “Diagonality”; indication of quadrant wart centroid where R has more ‘mass’. iz | “Horizontal divergence”; indicates the relative extent of the left of R compared to the right. Ha, | “Vertical divergence”; indicates the relative extent of the bottom of R compared to the top. ig _| “Horizontal imbalance"; location of the center of gravity with respect to half horizontal extent. Hos | “*Vertical imbalance”; location of the center of gravity with respect to half vertical extent. [For detailed explanation refer to Giuliano V.E. et Automatic pattern recognition by a gestalt method Information and Control, (1961)]. ues see disdain sn sssessadtesdsssSERSOEEEOOEEE ESE Ex. 5.5.8 : Show for a square of dimensions a, with center 1 arbitrary, the moment feature 9, = g, that is, it is independent of a and therefore scale invariant. aca © sotn. : Consider the square region of dime spatial units and intensity 1. (MU-New Syllabus wes academic year 21-22) (6-108) Tech-Neo Publications... SACHIN SHAH Ventu® Fig. 7.10.1 shows a K-point digital boundary in the xy- plane. Starting at an arbitrary point (Xp, Yo), coordinating pairs (Xo, Yo)» (X1s Y1)s (2s Yo)s om OK, Yx - 1) are encountered in traversing the boundary, say, in the counter clockwise direction. These coordinates can be expressed in the form x(k) = x, and y(k) = y,., With this notation, the boundary itself can be represented as the sequence of coordinates s(k) = [x(k), yk], for k = 0, 1, 2, .. K — 1. Moreover, each coordinate pair can be treated as a complex number so that s&) = x(k) +jy®) (3.6.1) Fork=0, I, 2,..., K~1. That is, the x-axis is treated as the real axis and the y-axis as the imaginary axis of a sequence of complex numbers. Although the interpretation of the sequence was recast, the nature of the boundary itself was not changed. Of course, this representation has one great advantages : it reduces a 2-D to a 1-D problem. The discrete Fourier transform (DFT) of s(k) is K-1 —j2nuk/K a(u) = x skye w(5.6.2) Real axis oakie 561 +A digital boundary and its representation ‘asa complex sequence, The points (xo, y4) and (xy, y,) shown are (arbitrarily) the first two points in the sequence Foru=0, 1,2, K~1. The complex coefficients a(u) are called the Fourier descriptors of the boundary. The inverse Fourier transform of these coefficients restores s(k). Tats, KA a = E ayy (563) « Fork =0, 1, 2, ..., K — 1. Suppose, however, that instead of all the Fourier coefficients, only the first P coefficients are used. This is equivalent to setting a(u) = 0 for u > P - J in Equation (5.6.3). The result is the following approximation to s(k) Ke tw = 5 awe =0 (564) * Fork =0, 1,2, .., K~ 1. Although only P terms are used to obtain each component of $(k) , k still ranges from 0 to K ~ 1. That is, the same number of points ‘exists in the approximate boundary, but not as many {erms are used in the reconstruction of each point. Recall from discussions of the Fourier transform in | , Chapter 3 that high-frequency components account for fine detail, and low-frequency components determine lobal shape. Thus, the smaller P becomes, the more detail that is lost on the boundary. The following example demonstrates this clearly. =» es | MiNew Syabus wes academic year 21-22) (M6208) ‘morphological operations in detal. Let A and B be two subsets in two dimensional space E? representing two object regions containing elements {a= (a, ‘ay)} and {b= (by, by) respectively here, a, and a, denote x and y co-ordinates of the element a and b is called the structuring element. ‘Then the erosion of A and B, is denoted by A ~B, is defined as A-B = (ceE Ic+be A forevery be B} ‘The erosion operation has the effect of deleting spiky edges. Ex. 6.3.1 : Consider the image A, LEE V3 elifel* wfafel= Let the structuring element B=|@|1 The circle on the 1 indicates the position of origin, Perform ACB. M1 son. : A = (,1),(1, 1), (1,2), (1, 3), 2,1), GD} B = ((0,0),,1))} Then A@B = {ce E'lc+beA forevery, be B} ctb ctbeA (0, 0) ) 1) (0,2) (0,0) (0.3) (0,3) @ al (1,0) an a) (1,2) a2) a3) (3) ad) 2.0) 0 0 @ at ce) 2.3) (2,3) 24 (3, 0) 6.0) 3.0) (3,2) , 3.2) G,2)+0,1 3.3), GB,3+0,0= GB al B.3+OD= G4). AOB = {(1,0) (11.049) ‘This operation can ‘also be done by A-B = {xl SA} ic. set of all points x such that B t contained in A. Va ee (MU-New Syllabus wef ace ademic year 21-22) (M6- cHbe a forevery beB translated by x is 108) (Morphologloat Imai i tI ‘Template/Structuring Element B=|O|1 ‘The structuring element is stepped over the image but this time only in positions where the whole of the structuring element lies on top of the image stepped position in the image the structuring element is ‘compared with the corresponding window to the image. If the structuring element and the image window is exactly same then the element corresponding to the origin in the structuring element in the resulting image is setto 1. )} 1)| 1} 1 | Result elifel* Result aft OD) Result Lo We find that he structuring comesponding window to the i element is same as the image only in the above 3 position. ‘The eroded image is ia fl Pll Mo ‘ltd ‘ [Bb rech-neo Publications. SACHIN SHAH Venture clear with the template containing a * as follows, Image Template elo Tete cates ieelene none ttre eee ee On eee eer re)erae ‘eee pariiid see erties eee rarriid eee rrrraidids Procossing (MU - Sem 8-11) Creation of the template is done as per dilation, The template is stepped over the image but this time only in positions where the whole of the template lies on top of the image, ie. it is now allowed to go off the edge. ‘This means that the resulting matrix will be smaller than the image (unless the template is 1x 1). For every stepped positon in the image the template is ‘compared withthe corresponding window to the image. If the template is exactly the same window, then the element corresponding to the template origin in the resulting matrix is set to a 1 This is particularly useful when the template is all 1s. is also effectively equivalent to correlation. This is ‘The first ‘match’ is at (6, 3), there being only two other ‘matches, so the result is oe ee ee Cunused ow t Unused column This shows that the template matches the image in only three places. However, with a ‘all 1s’ template the spike removal becomes apparent. For example, with the same image and the template. ‘The result is ee ee ee unused row see ep eens eeoerriaie?® eee prises eeewrrrriie T unused column , ulting Out the spiky © This clearly reduces the image edges ‘The techniques above have been applied to normal grey-level images. One way is to associate all the elements that have a constant grey-level value with binary 1 and all other pixels with * or binary 0. A better approach uses the actual values in grey-level ‘morphological operations defined slightly differently to the binary / unary operations defined above. Refer to Haralick et al. (1987) for further details 16.4 OPENING AND CLOSING ug Explain folowing morphological operations with | Gi) Opening suitable examples (v) Closing 1 ‘* Dilation and erosion are dual operation ie. dilation expands an image while erosion shrinks it but itis not possible to reconstruct an image set by first applying erosion and then dilating the image. ‘* The dilation operation will only be able to reconstitute the essential features of the structure of the object 2s ‘modified by the structuring element. * The opening of set a by structuring element B, is denoted by AoB = (AB) ®Bie, erode then dilate * The closing of set A by structuring element B, is denoted by AB and is defined as A®B = (A@B)O Bice. dilate then erode * Opening smooths object ‘coastlines’, eliminates small ‘islands’ and cuts narrow ‘isthmuses’ (MU-New Syflabus wef academic year 21-22) (Mé-108) Bhrech-veo Publications..A SACHIN SHAH Venture (Mor ago Pi mm J Thus, IC isolates object which may be just touching one anoter. A@B = (A@BOB ‘¢ Closing blocks up narrow ‘ereeks* and small or thin Hetepetiteye stakes’ inside the object and links nearby obj : oe i ks nearby objects, Thhbhht ‘sThis simplifies the process of assessin of particles. 8 she seperation aose=[ififafififi|s 4 ‘These are dilating after eroding (OPEN) and eroding rafefefatafa after dilating (CLOSING). Milnil «These two operations are more useful as means to an end rater than useful in themselves, Thebes 6.4.1 Opening aepos=| Ey Pe Trepp fafa 1 it 111 [1] | 6 closing is used to remove small holes, to fuse narrow az] falafefafafafifa ifofi breaks, etc. raft ala 1]1 [1] | x 6.4.3. Properties of Open and Closed Operations Pantone ‘©The open operation forces the shape of the template (structuring element) on the convex parts of an edge. ©The close operation forces its shape on the convex parts of an edge. The close operation forces ts shape on the A 1 1 concave parts of an edge. + tis possible to combine the erode and open operations to produce a skeleton operation. «This is useful to reduce a region to a basic edge that corresponds tothe region shape. fat 1fafa ra raft 5 SKELETON OPERATIONS (aesyeB=| |! als fafa + Toccreate skeleton of a region. This will consist ofa set of lines corresponding to complete thinning of the 7" region without losing the essential shape. 5 i rect two + Opening removes narrow bridges which conn Let Dy, Dy «. Dy be structuring templates that are regions or removes thin protrusions square, with sides 1x 1, 2X 2, .... m xn, all of them with Is. We 6.4.2 Closing o s With image I, using templates Dj, Da, ... Dy in tur, evaluate r 1 aint noe x : Result = E(l)— OPEN (E()) ash PEPE Pe Ep] |e tesetermine Trepp SK () = maximum (result) for alli amen a cacinuSniinensr — Ted rech-Neo Pubications a SACHIN SHAH Venue ee i -22) (M6-108) (MU-New Syllabus w.es academic ¥°2" 2-22)" ar - Explain following morphol logical suitable examples : Dilation (UTERO noe ne Q. 4(b), Dec. 2016, 5 Marks) 1 What is. morphology? Describe various + morphological operations, in detail. ‘ (COM er | ‘SOMOS : Let A and B be two subsets in two-dimensional space 2 7 . E Es E’ representing two object regions containing elements {a= (aj, a)} and (b= (bj, b,)}, respectively. Here, ay and a) denote x and y co-ordinates of the element A and B is called the structuring element. Then the dilation of A and B denoted by A @B, is defined as (ce E-le=a+b; for some aeA, be B) A@B = Whereatb = {(a) + by), (a2 + by)} etc. The dilation operation has the effect of filling in the valleys between spiky regions edges. Ex. 6.2.1: Consider the image A elil*|- Sit | tii. rletel* (e) Tech-Neo Publications...A SACHIN SHAH Venture se circle 00 the 1 indicates th original Perform A@ B Seni A = 1.1.0, D2, 0,2, 2.8, 0)) i B = ((0,0.(1)) c 2 oR {ee F le=a+b: forsome a eA, be B) © pop = (0.1.00. 2 0.2, : (0.2.1, 262.2). efifale wA@B=[*[t]t]* efifata fife his operation can be done by A@B = (xIBkOAFO) A@B = {xI[BOAICA) 1d the set of all x displacements such | je. shift B by x am orBand A overlap by atleast ne non-zero element “Till* azletilel* elilaile itel [+ ‘Template / structuring element B=|® +The origin of the structuring element is stepped over cvery element in the whole of the image where the origin of the structuring element corresponds toa 1 in the image, the structuring element is ‘unioned with that partof the image. + The first 1 in the image is on the tOP line tie E + When the structuring element is applied to this 1, the following results tiie “1 The second 1 occurs at “Minow sytabus w.es academic year 21-22) (m6-108) urn Daisies eee ser ole @ & " (A@B en yen’. > ® = 0 (MU-New Syllabus we. academic year 21-22) (M6-108) x ee rT xf dx] [4 BI B + Don't care x x x xf [x A-A@p) x x x 7 BS B B B Each successive structuring element are obtained by rotating the previous the previous structuring element clockwise consider an 8 x 8 image shown below: A@B' = A-(AoB)) Tech-Neo Publications...A SACHIN SHAH Venture %® 6.8.2 Thickening (B] = (BBB BY) A@{B) = (ABD OR, OB?.. Structuring elements for B have the same form as Structuring elements for thinning with all 1s and 0s interchange.

You might also like