Angle Estmaton and Correcton of Hand Wrtten, Textual and Large areas of Non-Textual Document Images: A Novel Approach D.R.Ramesh Babu Pyush M Kumat Mahesh D Dhannawat PES Insttute of Technology Research Scholar Research Scholar Bangalore, Karnataka PICT, Pune PICT, Pune Inda Inda Inda Abstract- angle estmaton and correcton of a document page s an mportant task for document analyss and optcal character recognton (OCR) applcatons. Many approaches of skew detecton can process pure textual document mages successfully. But t s a challengng problem to process documents lke handwrtten, large areas of non-textual contents. In ths drecton, a novel approach for textual, large area of non-textual, handwrtten document skew detecton s presented n ths paper. Estmaton of skew angle s based on fndng centrod of each connected component (CC) and plottng the major axs of the ellpse of each connected component. The proposed technque was tested on varety of mages ncludng handwrtten and machne prnted documents. The testng results showed a successful rate more than 98% of the data set. Keywords: detecton, correcton, connected component, Major axs 1.0 Introducton Most of the tmes, document analyss systems requre pror skew detecton and correcton before the mages are forwarded for character recognton, layout analyss, document mage mosacng and many other applcatons. An effcent and accurate method for determnng document mage skew s therefore an essental need. A number of methods have prevously been proposed for dentfyng document mage skew angles. However, most of the approaches are desgned manly for machne prnted documents. They are usually able to deal wth small skew angles wthn ±15 0 falng to manage cases of documents that may exceed ths lmt. Moreover, some of them ental hgh computatonal cost, especally n the case where the Hough Transform s used. Also, certan approaches are font, column, graphcs or border dependent. There s very few skew detecton methods proposed to handle handwrtten documents. Some of them are desgned for specfc applcatons. Ths s manly because of the complexty of handwrtten documents ncludng varatons n wrtng styles szes of characters and touchng or connecton of characters, words and text lnes. A survey n ths regard was reported by Hull [1]. Many approaches of skew detecton can process pure textual document mages successfully. But t s a challengng problem to process documents wth large areas of non-textual contents. Some approaches have been proposed to address ths problem. Le et al. [] select a square regon domnated by text from the document mage and calculate the skew angle by ths area. Avanndra and Subhass Chaudhur [3] dvde the document nto blocks and use the medan of the cross-correlatons of all blocks to determne the skew angle. Xaoyan Zhu [4] proposed an approach based on classfcaton of textual and nontextual areas for skew correcton. The method dvdes the document mage nto blocks and uses Fourer Transform and Support Vector Machnes to determne whether each block s a textual one or not. The approach uses a classfer for classfyng textual and non-textual contents to determne skew detecton. The
approach entals hgh computatonal cost and the best classfer to classfy textual or non-textual regons. In ths paper, we propose a novel method for skew estmaton of complex document mages based on fndng orentaton of each word. The man advantage of the proposed method s the ablty to detect skew angle of document mxed wth non-text elements such as graphcs, bar-codes and forms. The paper s organzed as follows. In secton, skew detecton approach s presented and secton 3 gves analyss of algorthm on dfferent documents. Secton 4 gves evaluaton of proposed algorthm.e. percentage error and secton 5 concludes the work..0 detecton approach The approach s based on dentfcaton of connected components and fndng optmum skew angles of connected components. Intally, document mage (Fg 1) s preprocessed by extractng the edges usng Canny Edge Detector [5]. The extracted edges are dlated usng crcular structurng element for dentfcaton of connected components, whch s depcted n Fg..1 Estmaton of Angle The skew angle s estmated based on fndng centrod of each CC n the document and plottng ellpse on t. Orentaton of a CC s defned as an angle between reference-axs and prncpal axs (Major axs) around whch CC rotates wth mnmum nerta. The condton to be mantaned s that the nd moment of the regon s same as that of the ellpse. The centrod CEN (X, Y) of CCs s deduced as CEN ( X, Y ) = ( OrgX N, OrgY N )...(1) Where (OrgX, OrgY ) are co-ordnates values of pxels wthn respectve CCs and N represents total number of pxels present n each CC. 1 st order moments are calculated as follows ( X ) = ( OrgX X )...() ( Y ) = ( OrgY Y )...(3) Usng above mathematcal equatons, nd moments are order µ = xx µ = yy ( ( X ) N ) ( ( Y ) N )... (4)...(5) Fg.1 Document Image The moments µ = xy µ and xx x and y respectvely. The moment covarance between x and y. ( ( X Y ) N )... (6) µ are thus the varances of yy µ s the xy µ µ + = xx yy 4 µ + xy µ xy...(7) Fg. Connected components Image = µ µ + xx yy µ xy + 4 µ xy...(8)
Orentato n Angle ( ) ( 180 θ = ) tan 1 ( )...( 9) Fg.3 (a) Geometry of plottng ellpse of CC Π Algorthm: detecton Input: ed mage Output: corrected mage Method: Step 1. Usng canny edge detector, extract edges from gven nput mage, dlate t usng dsk as structurng element. Step. Orentaton of each CC s calculated usng equaton 9 by fndng major axs of ellpse drawn around each CC and store these angles n an array. Step 3. From the hstogram determne the orentaton of the Image by consderng the average of the longest spke. To get optmum skew angle calculate the average adjacent spke (whchever s larger) along wth the longest spke. Step 4. Rotate nput mage by the angle obtaned from above step to remove the skew. End of Algorthm. 3.0 EXPERIMENTAL RESULTS Fg.3 (b) Determnng the orentaton angle As shown n fg.3 (a), ellpse s plotted on CC and fg3 (b) gves orentaton angle θ. The proposed methodology s tested on dfferent types of documents namely Marath handwrtten, documents contanng mnmum textual and more non-textual nformaton, Kannada documents and other languages also. Ths automated skew detecton and correcton s carred out usng MATLAB 6.5.0.180913a Release 13.Algorthm s processed on.0 GHZ Pentum-IV processor wth 56 RAM sze. Result 1. Experment s performed on Kannada document wth manual rotaton The skew angle s estmated by takng hstogram of all the orentaton angles n the document and fndng the longest spke n t. Ths gves maxmum number of words orented n that range and average of these orentatons gves the skewed angle. For gettng more optmum results select ether left or rght spke of the longest spke and also consder ts average to get the domnant skewed angle. Fg 4(a) Kannada skewed document
Fg. 4(b) Bar graph whch determnes skewed angle Fg. 5(b) Bar graph whch determnes ed angle Fg. 4(c) corrected mage Fg. 5(c) corrected mage Result. Experment on manually rotated Marath handwrtten document Result 3. Experment on manually rotated large area of Non-textual document Fg.5(a) Marath handwrtten skewed document Fg.6(a) Large areas of Non-Textual skewed document
Fg. 6(b) Bar graph whch determnes skewed angle Fg. 7(b) Bar graph whch determnes ed angle Fg. 6(c) corrected Image Fg. 7(c) corrected Image Result 4. Experment on manually rotated Englsh document 4.0 EVALUATION OF PROPOSED ALGORITHM The effcency of the proposed algorthmc model s evaluated by testng the algorthm for dfferent data sets. Table 1 gves error calculaton for obtaned skewed angle as compared to orgnal skewng. It s observed that the proposed algorthm gves 1.5.0 % of error. Fg. 7(a) Englsh skewed Document
TABLE I: ERROR COST PARAMETER 6.0 REFERENCES Input mage Marath Handwrtten Document wth Text and mage Englsh Text document Kannada Text Document Orgn al (n deg.) Experme ntal (n deg.) Error (%) Total tme (sec) -5-4.915 1.7 4.797 35 35.3188 0.911 1.469 0 0.11 0.605 6.4-7 -6.87 1.88 4.567 [1] J. J. Hull, Document mage skew detecton: survey and notated bblography, Document Analyss Systems II, World Scentfc, 1998. [] D. S. Le, G. R. Thoma and H. Wechsler, Automatc page orentaton and skew angle detecton or bnary document mages, Pattern Recognton, vol. 7, pp.135-1344, 1994. [3] Avanndra and Subhass Chaudhur, Robust Detecton of n Document Images, IEEE Trans on Image Processng, Vol.6, pp. 344-349, 1997. [4] Xaoyan Zhu and Xaoxn Yn, A New Textual/Non- textual Classfer for Document Correcton, Proceedngs of the 16 th Internatonal Conference on Pattern Recognton (ICPR 0), 00 5. CONCLUSION In ths paper, a novel technque for calculatng and correctng the skew of textual/non- textual documents s presented. It s based on fndng the orentaton of the major axs of the ellpse boundng each word. The proposed scheme works on any language ncludng non textual data also. Proposed method s mplemented on 10 document mages wth 60% of textual documents and t s observed that average tme requred s around 4-6 sec. The results provded by ths approach are also satsfactory. The documents were tlted by a prespecfed angle rangng between 0 and ± 45 degree. From our experments t s observed that about 98% of the accuracy s obtaned. Future work encompasses the use of fuzzy logc for takng the decson regardng the orentaton angle. [5] Canny J. F., A computatonal approach to Edge detecton, IEEE Trans on Pattern Analyss and Machne Intellgence, Vol.8 (6), pp. 679-698, 1986. [6] S. Srhar and V.Govndaraju, Analyss of textual mages usng the hough transform, Machne Vson and Applcatons, :141 153, 1989. [7] A. H. W. Chn and A. Jennngs, detecton n handwrtten scrpts, Proc. IEEE on Speech and Image Technologes for Computng and Telecommuncatons, pages 319 3, 1997.