Adaptve ose Reducton for Engneerng Drawngs Based on Prmtves and ose Assessment Jng Zhang Wan Zhang Lu Wenyn Department of Computer Scence, Cty Unversty of Hong Kong, Hong Kong SAR, PR Chna {jzhang,wanzhang, csluwy}@ctyu.edu.hk Abstract In ths paper, a novel, adaptve nose reducton method for engneerng drawngs s proposed based on assessment of both prmtves and nose. Unlke the current approaches, our method takes nto account the specal features of engneerng drawngs and assesses the characterstcs of prmtves and nose such that adaptve procedures and parameters are appled for nose reducton. For ths purpose, we frst analyze and categorze varous types of nose n engneerng drawngs. Algorthms for lnewdth assessment, nose dstrbuton assessment and nose level assessment are then proposed. These three assessments are combned to descrbe the features of nose of each ndvdual engneerng drawng. Fnally, medan flters and morphologcal flters, whch can adjust ther template sze and structural element adaptvely accordng to dfferent nose level and type, are used for adaptve nose reducton. Expermental results show that our approach s effectve for reducng most nose n engneerng drawngs. Keywords: Adaptve ose Reducton, Engneerng Drawngs, Lnewdth Assessment, ose Assessment 1. Introducton ose reducton s a fundamental problem ([1], [2], and [3]) of mage processng and pattern recognton, whch attempts to recover an underlyng perfect mage from a degraded copy. It plays an mportant role n automatc engneerng drawngs analyss snce engneerng drawngs are usually scanned from paper drawngs or blueprnts, n whch many factors may generate nosy document mages. The noses n engneerng drawngs can be n dfferent types and levels, whch greatly affect the results of vectorzaton, recognton, and other processng, and hence, dramatcally reduce the overall performance of engneerng drawngs analyss. Current approaches to nose reducton can be broadly classfed nto order statstcal methods, transform doman methods, and fuzzy methods. In order statstcal methods, medan flter [4] and rank order flter [5] are representatves, whch use statstcal theory to detect and reduce nose n mages. Transform doman methods apply sgnal processng methods to nose reducton by usng transformaton methods, such as Fourer Transform and Wavelet Transform [6]. Fuzzy methods seek to use nonlnear flters and learnng theores, such as fuzzy flters [7] and neural networks [8], to reduce nose. Although many approaches have been proposed to varous nose reducton problems, engneerng drawngs were not pad much attenton to. Current approaches gnore the specal features of engneerng drawngs and dfferent types and levels of nose. They employ general mage processng methods to reduce nose n engneerng drawngs. Although they do acheve some promsng results, nose reducton for engneerng drawngs s stll not always satsfactory. In ths paper, we assess the nose of engneerng drawngs from two aspects: 1) lnewdth of prmtves, and 2) dstrbuton and level of nose, based on whch we can apply adaptve nose reducton. The arrangement of the paper s as follows: In Secton 2, we analyze the specal features of engneerng drawngs and categorze the nose nto dfferent types and levels. In Secton 3, we present our lnewdth assessment algorthm based on medal axs transform. In Secton 4, we dscuss our methods used to assess nose dstrbuton and nose level.
The adaptve nose reducton (AR) method s proposed n Secton 5. Some expermental results are shown n Secton 6 and conclusons are shown n Secton 7. 2. Features & ose n Engneerng Drawngs Engneerng drawngs have certan specal features: 1) the possble lnewdths are lmted to several dscrete values; 2) the edge of prmtves (e.g., lnes and arcs) s smooth; 3) the background and the prmtves are monochrome. Fgure 1 shows four engneerng drawngs wth dfferent qualtes. From Fgure 1(a) we see that the lnewdth of prmtves s nearly equal and the edge of prmtves s smooth. There s no nosy pont on ether background or prmtves. However, the qualtes of the other three are not so good due to dfferent types and levels of nose. (a) (b) (c) (d) Fgure 1. An example of engneerng drawngs There are varous types and levels of nose n engneerng drawngs, as classfed and modelled by exstng researchers. Pavlds [9] enumerated three types of dstorton nose generated by scanners. Kannugo et al. [10] explored a nonlnear global and local document degradaton model. Zha et al. [11] summarzed four types of common nose n engneerng drawngs (.e., Gaussan nose, hgh frequency nose, hard pencl nose, and moton blur nose) and valdated ther models. For bnary engneerng drawngs, we categorze the nose nto three basc types: 1) Gaussan nose, 2) hgh frequency nose, 3) hard pencl nose. In addton to types, the nose n engneerng drawngs can be at dfferent levels, whch ndcate how nosy the mages are. ext, we wll dscuss the assessment of mage qualty n terms of both prmtves and nose. 3. Lnewdth Assessment of Prmtves In ths secton, we dscuss the detal of our proposed method for lnewdth assessment. As we mentoned prevously, the lnewdths of prmtves, such as lnes and arcs, n engneerng drawngs are lmted to several values. Although dfferent types of nose are generated wth dfferent levels, the lnewdth s nearly unchanged and the dstance between prmtves s usually much greater than ther lnewdths, otherwse human cannot dstngush the gap between prmtves. In addton, the sze of a nosy regon s usually smaller than lnewdth, otherwse even human cannot dstngush useful data from nosy data. Hence, lnewdth s very mportant nformaton for both preservng useful features and removng nose. We use a thnnng algorthm based on Medal Axs Transform (MAT) [12] to calculate the average lnewdth. MAT uses a recursve method to extract the skeletons of prmtves from a bnary mage. In each teraton, the ponts satsfyng certan condtons are removed from the prmtves. The skeleton obtaned by MAT conssts of the set of ponts that are equally dstant from two closest ponts of the boundary of prmtves. Assume that the total number of teraton requred s I, the lnewdth after the th teraton s d, and the number of ponts that have just been removed from the prmtves durng the th teraton s. The lnes are thnned at
both sdes when d >= 2, that s, d = d 2. When d = 2, the lnes are only thnned by one pxel, that s, d + 1 = d 1, [ 1, I 1]. + 1 (a) (b) (c) (d) (e) (f) (g) (h) Fgure 2. Examples of thnnng procedure (a) s the orgnal mage; (b) and (c) are the thnned mages of (a) after the 4 th and 5 th teraton, respectvely; (d) s the skeleton mage of (a). (e) s (a) wth some nose added; (f) and (g) are the thnned mage of (e) after the 4 th and 5 th teraton, respectvely; (h) s the skeleton mage of (e). Obvously, becomes smaller when ncreases. Fnally, when = 0, t means the skeleton s extracted from the prmtve successfully. As mentoned n Secton 2, a characterstc of engneerng drawngs s that the lnewdths are almost equal. It means that lnewdths of most prmtves become one pxel at the same tme durng the thnnng procedure. Hence, n the frst several teratons, the change of s small but at some teratons t dramatcally drops. In Fgure 2, (a) s an orgnal mage, (b), (c) and (d) llustrate the thnned mages of (a) at dfferent teraton. In Fgure 3, (a) and (b) llustrate the curves of and ( ) / + 1 1 durng the thnnng process of Fgure 2(a). We can see that has sharp drops at the 4 th and 5 th teratons. Correspondngly, nearly all lnes become one pxel wde after the 5 th teraton except the part where the crcle and lne touch together, as shown n Fgure 2(b) and (c). All the 6 th to 11 th teratons are used to thn ths conjont part only, whose wdth cannot reflect the real lnewdths of prmtves. Hence, the changes of between the 6 th to 11 th teratons become small and these teratons should not be taken nto account when we assess the average lnewdth of prmtves. Accordng to the analyss above, we know that the bgger the change of at one teraton, the more lnes reach one pxel wde at that teraton. When the change of s bgger than a threshold T, that s ( + 1) >= T, [ 1, I 1], we use ( + 1 ) / and to calculate the average lnewdth of prmtves. Let S ={ ( + 1) >= T at th teraton, [ 1, I 1] }. Assume S =L. S (l), l = [ 1, L], s the l th element n S. Take Fgure 2(a) for example, f we let T = 0. 25, ( ) + 1 >= T when teraton tmes =4 and =5, as shown n Fgure 3(b), hence S =2, S(1)=4 and S(2)=5. When I = 1, t means that the lnewdth of prmtves s already one pxel wde. When I=2, t means that the lnes are only thnned
once by ether 1 or 2 pxels before they become one pxel wde, we use average value 1.5 pxel to ndcate t. Of course, the fnally obtaned skeleton s one pxel wde. Hence, the lnewdth of prmtves s 1.5+1=2.5 pxels and the possble error s less than only 0.5 pxel. When I>2, we can use followng equatons to calculate the average lnewdth W : lne sum = L l= 1 (, S ( l) S ( l ) + 1) I L ( = S ( l) S ( l) + 1 avg l= 1 sum W 2 I +1, lne = avg ) S( l), where, we frst calculate I avg, whch s the average number of teratons the prmtves have undergone. It s calculated as the weghted sum of all teratons whch result sgnfcant change of + 1, wth an teraton s weght beng the percentage of the removed nosy ponts at such teraton. The lnewdth s just twce the average teraton number plus 1. (a) (b) Fgure 3. Curves of and ( ) / 1 1 of Fgure 2(a) and (e) + Meanwhle, the proposed lnewdth assessment method s robust to nose, as we shown n Fgure 2(e)-(h). In Fgure 2, (e) s a nosy verson of (a). We can see that most lnes of (a) and (e) become one pxel wde at the same teraton and the curves of and ( + 1 ) / of Fgure 2(a) and (e) are much smlar, as shown n Fgure 3. The largest dfference s caused by the nose whch s thnned n the frst several teratons. The average lnewdths of prmtves of Fgure 2(a) and (e) computed by the proposed method are 9.79 and 9.76, respectvely. Usng the proposed method, when T = 0. 25, the average lnewdths of the four mages n Fgure 1 are 6.30, 5.78, 3.00, and 2.50, respectvely. Experments show that we can obtan more precse lnewdths usng ths method.
4. ose Dstrbuton and Level Assessment After we obtan the average lnewdth, we need to assess the detal of the nose. Images (b), (c) and (d) n Fgure 1 show some typcal forms of nosy mages. For ths purpose, we descrbe the nose from two aspects: 1) nose dstrbuton whch s assessed by block method and 2) nose level whch s assessed by sgnal to nose rato. 4.1 ose Dstrbuton Assessment In engneerng drawngs, there are manly two knds of dstrbuton of nose: 1) the nose dstrbutes evenly n the whole drawngs, as shown n Fgure 1(b); 2) the nose manly dstrbutes at surroundng of the prmtves, as shown n Fgure 1(c). We call them as TYPE I and TYPE II respectvely. In ths paper, we use block medan flter to dstngush these two types of nose. We dvde the document mage nto local blocks by the sze about 10 10 pxels, as llustrated n Fgure 4. Because we only need to detect nose rather than to remove nose at ths stage, we use a 3 3 medan flter to detect nose n all blocks one by one. When a nosy pont s removed by the medan flter n a block, ths block s a nosy block. Assume there are M blocks n one mage, among whch Z blocks are nosy. We can calculate the dstrbuton of the nose D as follows: D Z = nose M. nose Fgure 4. The block method for analyss of nose dstrbuton Gven a pre-set threshold T dstrbuton, the nose type s TYPE I f D nose >= T dstrbut on, and TYPE II otherwse. For Fgure 1(b) and (c), f let T dstrbuton = 0. 5, the obtaned values of D nose are 0.7769 and 0.4250 respectvely. Ths means that the nose dstrbuton of Fgure 1(c) (TYPE II) s more concentratve than that of Fgure 1(b) (TYPE I). 4.2 ose Level Assessment ext, we assess the nose level. For dfferent nose level, we should use dfferent de-nose method to obtan the best qualty, because mproper use of nose flter can reduce both nose and useful nformaton of prmtves greatly. We use the sgnal to nose rato (SR) to descrbe the nose level of an mage. We employ a medan flter whose template sze s 1.5 Wlne 1. 5 Wlne to compute SR. Such flter can reduce nose whle preservng the prmtves. Assume the prmtves to be black and the background whte. Frst, we count the number of all black pxels n the mage and denote t as Q. Then the medan flter s used once to wpe off nose and we
count the number of the remanng black pxels agan. We denote ths number as P. P s the number of prmtve ponts and reflects the sgnal level. Q P s the number of nosy ponts that have been removed by the flter and reflects the nose level. If Q P = 0, t means that there s no nose n the mage. When Q P 0, We defne the SR of an mage as: P SR = ; Q P Usually, lower SR means hgher nose level. For nstance, the SR of Fgure 1(b) and (c) are 2.399 and 1.443, respectvely. It means that the nose level of (c) s hgher than that of (b). However, there s another form of degradaton of engneerng drawngs, as shown n Fgure 1(d), where the prmtves are too thn and dscontnuous. When the medan flter s appled, the prmtves are also regarded as the nose and therefore wped off from the mage. As a result, ts SR s very small (only 0.285). For these dfferent cases, dfferent methods should be employed for nose reducton, as we wll explan n the next secton. 5. Adaptve ose Reducton Many technques for nose reducton replace each pxel wth certan functon of the pxel's neghborhood. Because useful features and many noses usually have common frequency components, they are not separable n the frequency doman. Hence, lnear flters tend to ether amplfy the nose along wth useful features, or smooth out the nose and reduce useful features smultaneously. To mnmze the conflct between useful features and nose, researchers have ntroduced a number of adaptve nose reducton algorthms, whch essentally attempt to preserve or amplfy useful features whle reducng noses. Medan flter and morphologcal flters are, perhaps, the most well-known and popular flters for adaptve nose reducton. The medan flter s very good at reducng some types of nose (e.g., Gaussan nose and salt and pepper nose), whle preservng some useful features (e.g., edges). It s not so good, however, at removng dense nose, and t degrades thn lnes and those features smaller than half the sze of ts template. The morphologcal flters nclude erosons, dlatons, openngs, closngs, and ther combnatons. The acton of a morphologcal flter depends on ts structural element, whch s a small pattern that defnes the operatonal neghborhood of a pxel. The effectveness of the medan flters and morphologcal flters greatly reles on the sze of the template and the structural element. Hence, t s very mportant to carefully choose them. Based on the assessment results of prmtves and nose we obtaned n Secton 3 and 4, we develop an adaptve nose reducton (AR) method. We choose the medan and morphologcal flters to reduce nose but also adjust the sze of the template and the structural element adaptvely accordng to the assessed lnewdth and nose nformaton. Let W lne, D nose and SR denote the lnewdth, nose dstrbuton and nose level of one mage, W deal s a gven lnewdth, T dstrbuton and T level are pre-set thresholds for D nose and SR, d SE s dameter of the crcle structural element. (1) If D nose >= T dstrbut on and SR >= Tlevel, the man nose s Gaussan nose combned wth some hgh frequency nose, we frst use a medan flter wth a 1.5 Wlne 1. 5 W lne template to remove Gaussan nose. Then an open morphologcal flter wth a crcle structural element, d = 0. 8 W, to reduce hgh frequency nose and smooth prmtves. (2) If SE lne D nose < T dstrbuton and SR >= Tlevel, the nose dstrbutes surroundng the prmtves concentratvely and the man nose s hard pencl nose and hgh frequency nose combned wth some Gaussan nose. Hence, we use a close morphologcal flter wth a crcle structural element, d SE = 0. 5 Wlne, to remove gaps caused by hard pencl nose n prmtves and an open morphologcal flter wth a crcle structural element, d SE = 0. 8 Wlne, to reduce hgh frequency nose and dense Gaussan nose and smooth prmtves. (3) If SR < T, t means the level
prmtves are too thn and maybe dscontnuous. In ths condton, we frst use a close morphologcal flter wth a crcle structural element, d SE = Wlne, to connect prmtves, then n order to avod losng useful nformaton, we apply a specal 3 3 flter to remove nose, whch, for a bnary mage, can change the value of the centre element only when the values of all other 8 neghbour elements are dfferent from t. In ths way, all sngle nosy ponts can be removed whle the prmtves can be preserved, even they are one pxel wde. After removng the nose from the mage, accordng to W lne, we use an eroson or dlaton morphologcal flter to adjust the lnewdth to the gven wdth W deal, so that all de-nosed mages may have smlar lnewdth to the orgnal noseless mages wth Wdeal beng ther deal lnewdth. Fgure 5 shows the flowchart of our AR method. Input Image W Calculate lne, Dnose, SR Tdstrbuton, T level (1) (2) (3) Medan Flter & Open Morphologcal Flter Close & Open Morphologcal Flter Close Morphologcal Flter & Specal 3 3 Flter > W deal Y Eroson Morphologcal Flter Dlaton Morphologcal Flter Output Image Fgure 5. The flowchart of AR 6. Expermental Results We have mplemented a prototype system based on our proposed method. We use some nosy mages of engneerng drawngs chosen from the Symbol Recognton Contest of GREC 03 [13] for testng. Fgure 6 and Fgure 7 show the expermental results of four mages. In Fgure 6, the top row contans the mages wth dfferent types and levels of nose and the bottom row are the results of our adaptve nose reducton approach
wth T = 0. 25, T dstrbuton = 0. 5, Tlevel = 1. 0 and W deal = 5. Fgure 7 ncludes curves of and ( 1 ) / of the four mages. We can see that there s a sharp drop on each curve, where the ordnal number of the teraton reflects the lnewdth. Table 1 shows the results of W lne, D nose and SR calculated by the proposed method. From the expermental results, we can see that our proposed methods can effectvely reduce most nose n engneerng drawngs whle preservng the useful features (e.g., smoothng edges of prmtves and adjustng average lnewdth). These nose reducton results provde us a good bass for vectorzaton and recognton of the contest symbols. (a) (b) (c) (d) Fgure 6. Comparson between orgnal mages and de-nosed mages (a) (b) Fgure 7. Lnewdth assesment of the top four mages of Fgure 6. ote that there are only two teratons for Fgure 6(d), hence there s only one pont for t n Fgure 7(b). Table 1. The results of nose assessment on certan mages
W lne D SR nose Fgure 6(a) 5.70 0.646 3.678 Fgure 6(b) 9.77 0.648 7.937 Fgure 6(c) 3.00 0.386 1.414 Fgure 6(d) 2.50 0.229 0.285 7. Concluson and Future Works In ths paper, we analyzed the specal features and varous types and levels of nose n engneerng drawngs and proposed an adaptve nose reducton (AR) method based on lnewdth assessment, nose dstrbuton assessment and nose level assessment. Compared wth other nose reducton method, the proposed method can adjust the template sze of medan flter and structural element of morphologcal flter adaptvely accordng to dfferent types and levels of nose. The method can remove the nose whle keepng the useful nformaton of prmtves. Expermental results proved effectveness of our proposed methods. However, some problems stll need to be solved, such as how to deal wth prmtves wth varous lnewdths n a sngle engneerng drawng and how to smooth or sharp edges further whle keepng much smaller features of prmtves. We wll contnue our research on these problems and enhance the performance of our proposed adaptve nose reducton method for engneerng drawngs. Acknowledgement The work descrbed n ths paper s fully supported by a grant from the Research Grants Councl of the Hong Kong Specal Admnstratve Regon, Chna [Project o. CtyU 1073/02E]. References [1]. H. C. Andrews, Monochrome Dgtal Image Enhancement, Appled Optcs, Vol. 15, o. 2, pp. 495-503, 1976. [2]. A. Lev and S. W. Zucker, and A. Rosenfeld, Interactve Enhancement of osy Images, IEEE Trans. on Systems, Man and Cybernetcs, Vol. 7, o. 6, pp. 435-422, 1977. [3]. G. A. Mastn, Adaptve Flters for Dgtal Image ose Smoothng: An Evaluaton, Computer Vson, Graphcs and Image Processng, Vol. 31, o. 1, pp. 103-121, 1985. [4]. J. Ishhara, M. Meguro, and. Hamada, Adaptve Weghted Medan Flter Utlzng Impulsve ose Detecton, Applcaton of Dgtal Image Processng, Proc. SPIE 3808, pp. 406-414, 1999. [5]. M. Mloslavsk and T. S. Cho, Applcaton of LUM Flter wth Automatc Parameter Selecton to Edge Detecton, Applcatons of Dgtal Image Processng, Proc. SPIE 3460, pp. 865-871, 1998. [6]. H. Oktem, K. Egzaran, and V. Katkvnk, Adaptve De-nosng of Images by Locally Swtchng Wavelet Transforms, ICIP, 1999. [7]. F. Russo and G. Rampon, A Fuzzy Flter for Images Corrupted by Impulse ose, IEEE Sgnal Processng Letters, Vol. 3, o. 6, pp. 168-170, 1996. [8]. H. Kong and L. Guan, A eural etwork Adaptve Flter for the Removal of Impulse ose n Dgtal Images, eural etwork, Vol. 9, o. 3, pp. 373-378, 1996. [9]. T. Pavlds, Recognton of Prnted Text Under Realstc Condtons, Pattern Recognton Letters, Vol. 14, o. 4, pp. 317-226, 1993
[10]. T. Kanungo, R. M. Haralck, and I. Phllps, Global and Local Document Degradaton Models, Proc. ICDAR, pp. 730-734, 1993 [11]. Z. Jan, L. Wenyn, D. Dor, and L. Qng, A Lne Drawngs Degradaton Model for Performance Characterzaton, Proc. ICDAR, pp. 1020-1024, 2003. [12]. J. C. Mott-Smth, Medal Axs Transforms, Pcture Processng and Psychopctors, Academc Press, ew York, 1970. [13]. http://www.cvc.uab.es/grec2003/symreccontest/mages.htm, GREC2003 Symbol Recognton Contest.