Edge Detecton n Nosy Images Usng the Support Vector Machnes Hlaro Gómez-Moreno, Saturnno Maldonado-Bascón, Francsco López-Ferreras Sgnal Theory and Communcatons Department. Unversty of Alcalá Crta. Madrd-Barcelona km. 33,600 D.P. 28871 Alcalá de Henares - Madrd (Span) {hlaro.gomez, saturnno.maldonado, francsco.lopez}@uah.es Abstract. In ths paper, a new method for edge detecton n presence of mpulsve nose based nto the use of Support Vector Machnes (SVM) s presented. Ths method shows how the SVM can detect edge n an effcent way. The nosy mages are processed n two ways, frst reducng the nose by usng the SVM regresson and then performng the classfcaton usng the SVM classfcaton. The results presented show that ths method s better than the classcal ones when the mages are affected by mpulsve nose and, besdes, t s well suted when the mages are not nosy. 1 Introducton The edge detecton methods are an mportant ssue for a complete understandng of the mage. The most usual classcal methods search for several ways to perform an approxmaton to the local dervatves and they mark the edges by searchng the maxmum of these dervatves. The Sobel, Prewtt or Roberts flters are some of these approxmatons [1]. Other approaches are based n a prevously smoothng acton n order to mprove the edge detecton and to reduce the effect of nose (bascally Gaussan nose) [2]. Ths pre-flterng process seems to be not adequate when the nose s mpulsve and most edge detectors are very senstve to the pulses of nose. In ths paper we present a way to detect the edges by usng a new pont of vew. We do not try to approxmate the dervatve or to use other mathematcs methods. The man dea n ths work s to tran the computer to recognze the presence of edges nto an mage. In order to perform ths dea we use the Support Vector Machnes (SVM) tool that s gven good results n other classfcaton problems. The tranng s performed usng a few own-created mages that represents a clearly defned edges wth the edges easly located. The nose reducton process s performed usng the SVM. In ths case we use the nformaton n a 3x3 neghborhood of each pxel to make a regresson process and then replace the pxel value wth the regressed value. The results obtaned wth no nose are smlar to those from prevous methods and clearly superor when compared to some classcal methods n nosy mages.
2 SVM Classfcaton and Regresson There are several ways to classfy, Bayesan decson, neural networks or support vector machnes, for example. In ths work we use the SVM classfer snce ths method provdes good results wth a reduced set of data and then we do not requre an ntensve tranng lke another methods. Thus the SVM gves us a smple way to obtan good classfcaton results wth a reduced knowledge of the problem. The prncples of SVM have been developed by Vapnk [3] and they are very smple. In the decson problem we have a number of vectors dvded nto two sets, and we must fnd the optmal decson fronter to dvde the sets. The fronter chosen may be anyone that dvdes the sets but only one s the optmal electon. Ths optmal electon wll be the one that maxmzes the dstance from the fronter to the data. In the two dmensonal case, the fronter wll be a lne, n a multdmensonal space the fronter wll be an hyperplane. The decson functon that we are searchng has the next form, f () w x + b = w x b x = +. n =1 In (1), x s a vector wth n components that must be classfed. We must fnd the vector w and the constant b that makes optmal the decson fronter. The basc classfcaton process s made by obtanng the sgn of the decson functon appled to the gven vector, a postve value represents the assgnment to one class and a negatve one represents the assgnment to the another class. Normally, we use another form of ths decson functon that ncludes the tranng nput and output vectors nformaton [4]. Ths new form s, l () = f x α y x x + b. = 1 The y values that appear nto ths expresson are +1 for postve classfcaton tranng vectors and 1 for the negatve tranng vectors. Besdes, the nner product s performed between each tranng nput and the vector that must be classfed. Thus, we need a set of tranng data (x,y) n order to fnd the classfcaton functon and the α values that makes t optmal. The l value wll be the number of vectors that n the tranng process contrbute n a hgh quantty to form the decson fronter. The electon of these vectors s made by lookng at the α values, f the value s low the vector s not sgnfcant. The vectors elected are known as support vectors. Normally the data are not lnearly separable and ths scheme can not be used drectly. To avod ths problem, the SVM can map the nput data nto a hgh dmensonal feature space. The SVM constructs an optmal hyperplane n the hgh dmensonal space and then returns to the orgnal space transformng ths hyperplane n a non-lnear decson fronter. The non-lnear expresson for the classfcaton functon s gven n (3) where K s the non-lnear mappng functon. (1) (2)
l () = y K( x x) f x α + b. = 1 (3) The choce of ths non-lnear mappng functon or kernel s very mportant n the performance of the SVM. The SVM appled uses the radal bass functon to perform the mappng, snce the others proved do not work approprately. Ths functon has the expresson gven n (4). K 2 ( ) ( x, y) exp ( x y) = γ. The γ parameter n (4) must be chosen to reflect the degree of generalzaton that s appled to the data used. The more data s obtaned the less generalzaton needed n the SVM. A lttle γ reflects more generalzaton and a bg one represents less generalzaton. Besdes, when the nput data s not normalzed, ths parameter performs a normalzaton task. When some data nto the sets can not be separated, the SVM can nclude a penalty term (C) that makes more or less mportant the msmatch classfcaton. The more lttle s ths parameter the more mportant s the msclassfcaton error. Ths term and the kernel are the only parameters that must be chosen to obtan the SVM. The classfcaton scheme may be easly extended to the case of regresson. In ths case the dea s to tran the SVM by usng y values dfferent from +1 and 1. The values used are the values known from the functon to be obtaned. Then, we search for an approxmaton functon that fts approxmately the known values [4]. (4) 3 Nose Reducton Tranng In ths secton, we explan how the SVM regresson may be used to reduce the mpulse nose nto the mages n order to apply an edge detecton algorthm wthout nose nterferences. The man dea s to replace the pxels nto nosy mage wth a new value avodng the nose. In order to obtan the new pxel value we use the SVM regresson. The regresson tranng process s shown n Fg. 1. x-1,y-1 x-1,y x-1,y+1 x,y-1 x,y x,y+1 x,y x+1,y-1 x+1,y x+1,y+1 Nosy Image Orgnal Image Fg. 1. Pxel regresson
Fg. 2. Example of nosy tranng mages For each pxel (x,y) of the nosy mage we form a vector contanng the values of the pxels around t (ncludng the pxel tself). Ths vector wll be the nput to the regresson functon. The output wll be the value of the pxel (x,y) of the orgnal mage. The next step s to fnd the mages to be used nto the tranng process. The mages elected must be smple to avod an excessve tranng tme but sgnfcant enough to gve good results. The opton elected was to make controlled mages gven a gray scale and wth random nose n a known poston. In Fg. 2 an example s presented. In ths tranng mages we must control the sze and the nose rato. The mages n Fg. 2 have a 32x32 sze and a 20 percent nose (20 percent pxels of the mage are nose). If we use these two mages n the tranng process the number of vectors processed wll be 1953. The number of support vectors after the tranng process s 634 n ths case. 4 Edge Detecton Tranng In ths secton we present a way to detect edges by usng the SVM classfcaton. In ths case, the decson needed s between "the pxel s part of an edge" or "the pxel s not part of an edge". In order to obtan ths decson we must extract the nformaton needed from the mages. In ths work a vector s formed for each pxel, gven the dfference between ths one and the pxels n a 3x3 neghborhood around t. Ths way an eght components vector s calculated at each pxel except for the border of the mage, because n ths case the dfferences can not be calculated. The vectors formed are used as nputs to the SVM tranng. Fg. 3. Tranng mages for edge detecton
The mages used to tran the SVM are shown n Fg. 3. They are mages created by tryng to obtan a good model for the detecton. The only edges used n the tranng are vertcal, horzontal and dagonal ones and we expect that the other edges wll be generalzed by the SVM. The pxels consdered as edges are those nto each mage that are n the border between brght and dark zones,.e. the ponts n the dark zone near the brght one and vce versa. The dark and brght zones are not homogenous but the ntensty at each pxel s a random value (gaussan values). The values at each zone never reach those of the other zone. By usng these random values we try to smulate the no homogenous surface nto a real mage. The random nature of the tranng mages makes random the SVM tranng, for example, the number of support vector may change every tme we use dfferent mages. But the results obtaned are very smlar n all cases. A value that must be set n the tranng process s the mean dfference between dark and brght zones, snce ths parameter controls the sensblty of the edge detector. A lttle dfference makes the detector more sensble and a greater one reduces ths sensblty. 5 Edge detecton method When we apply the traned SVM (3) to an mage, a value for each pxel nto the mage s obtaned. Ths value must be (deally) a value postve or negatve near 1. We can use the sgn of these values to say when a pxel s an edge or not but, ths way, a lost of nformaton s produced. It s better to use the values obtaned and say that there s a gradual change between no edge and edge. Then, the value obtaned ndcates a probablty of beng an edge or not. After the process above we must decde the pxels that are consdered as edges. Ths task can be smplfed when we have the edges separated nto vertcal and horzontal drectons. In ths case we search for the pxels that are local maxmum n both drectons and the edge mage s obtaned. The method proposed s able to obtan these vertcal and horzontal edges by usng vectors formed only wth the horzontal and vertcal dfferences as nput to the SVM (Fg. 4). x-1,y-1 x-1,y x-1,y+1 x,y-1 x,y x,y+1 x+1,y-1 x+1,y x+1,y+1 Fg. 4. Vectors for vertcal and horzontal detecton
Fg. 5 shows and example of the process. The orgnal mage house s a 256x256 eght bts gray-scaled mage. The edge mages presented are gray-scaled mages where the values from SVM have been translated to gray values, 255 represents edge detecton and 0 represents no edge detecton. The ntermedate values show a gradaton between these extreme values. The parameters set for ths edge detecton were γ = 8e-4, C = 1000, and the mean dfference between dark and brght zones n the tranng mages was 50. Besdes, n order to reduces the solated ponts consdered as edges we use only the values above a gven threshold. In the examples the threshold s set at 32 n an eght bts gray scale. Fg. 5. Horzontal and vertcal edge detecton example. Fg. 6 shows a comparson between the Canny edge detector and the detector proposed here. The mage used as example presents a complex texture n the walls due to brcks. Thus, the parameters of the Canny detector have been set tryng to reduce the false edge detecton of ths brcks. We can see how the performance of the method proposed s smlar to the Canny edge detector (consdered as an standard) although the SVM method s not usng any blurrng flter lke n the Canny edge detector. Fg. 6. Comparson of edge detecton. (a) Canny edge detector. (b) SVM edge detector.
Fg. 7. Example of nose reducton. (a) Nosy mage (b) No nose mage Fg. 8. Comparson of edge detectors. (a) SVM detector (b) Canny edge detector. 6 Results The results presented here have been obtaned by usng the LIBSVM [5] as mplementaton for the SVM. The programs used were wrtten n C++ and compled usng the Vsual C++ 6.0 compler. The computer used has a Pentum III processor wth 128 Mbytes RAM. Frst we show how the nose reducton process performs. The tranng process uses mages lke n Fg. 2, 32x32 gray-scaled mages wth a 20 % mpulsve nose. In ths case the mpulsve nose has whte pulses only but the method may be appled n a smlar way to salt&pepper nose. The γ parameter of the kernel s elected to obtan the best results, n ths case the value elected s γ = 3e-5. The C parameter must be elected to obtan accurate results wth a reduced number of support vectors. In ths work the parameter has a value C = 1000. A greater value ncreases the tranng tme
and a more lttle value decreases the accuracy of the process. The tranng process takes about 10 mnutes n the case presented. The nose reducton process can be vewed n Fg. 7. Fg. 7-a shows a corrupted mage wth mpulsve nose of 10 % and Fg. 7-b shows the mage after the nose reducton process explaned here. The example shows that ths reducton process s not well suted for denosng snce the recovered mage s blurred. However, the mpulsve nose dsappears from the mage and the edge detecton process can be performed. Besdes, the blurrng s useful n the edge detecton snce the textures nto the mages are more unform after blurrng and the false detecton s reduced. The next step s to perform the edge detecton lke prevously explaned. The kernel parameter n ths case was γ = 8e-4 and the parameter C = 1000 lke n the prevous case. The threshold used n ths case s 16. In Fg. 8 s shown a comparson between the SVM method and the Canny edge detector. The parameters of the Canny edge detector have been set n order to reduce to the maxmum the detecton of the mpulsve nose lke edges. It s clearly that the SVM method s superor n ths case. The only drawback of the method proposed s that the executon takes over 15 seconds whle the Canny method takes 1 second. 7 Conclusons Ths work shows how the SVM performs the edge detecton n presence of mpulsve nose n an effcent way and gven good results. The comparson between the edge detecton method proposed here wth other known methods shows that the SVM method s superor when the mpulsve nose s present and t s smlar (although slghtly nferor) when the mage s not nosy. We thnk that the method may be mproved n executon speed and performance by optmzng the C++ programs and by usng more dfferences between adjacent pxels to make edge detecton, e.g. usng 5x5 wndows around a pxel. References 1. A.K. Jan. "Fundamentals of Dgtal Image Processng". Englewood Clffs, NJ, Prentce Hall, 1989. 2. J.F. Canny. A computatonal Approach to Edge Detecton. IEEE Trans. On Pattern Analyss and Machne Intellgence, vol. 8, pp. 679-698. 1986. 3. V. Vapnk. "The Nature of Statstcal Learnng Theory". New York, Sprnger-Verlag, 1995. 4. N. Crstann and J. Shawe-Taylor. "An ntroducton to Support Vector Machnes and other kernel-based methods". Cambrdge, Cambrdge Unversty Press, 2000. 5. C.C. Chang and C.J. Ln. "Lbsvm: Introducton and benchmarks". http://www.cse.ntu.edu.tw/~cjln/papers.