research article asm based synthesis of...

19
Research Article ASM Based Synthesis of Handwritten Arabic Text Pages Laslo Dinges, 1 Ayoub Al-Hamadi, 1 Moftah Elzobi, 1 Sherif El-etriby, 2,3 and Ahmed Ghoneim 4,5 1 Institute for Information Technology and Communications (IIKT), Otto-von-Guericke-University Magdeburg, 39016 Magdeburg, Germany 2 Umm Al-Qura University, Makkah 21421, Saudi Arabia 3 Faculty of Computers and Information, Menoufia University MUFIC, Menofia 32721, Egypt 4 Department of Soſtware Engineering, College of Computer Science and Information Sciences, King Saud University, Riyadh 11451, Saudi Arabia 5 Department of Computer Science, College of Science, Menoufia University, Menofia 32721, Egypt Correspondence should be addressed to Laslo Dinges; [email protected] Received 7 January 2015; Revised 28 April 2015; Accepted 29 April 2015 Academic Editor: Tongxing Li Copyright © 2015 Laslo Dinges et al. is is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Document analysis tasks, as text recognition, word spotting, or segmentation, are highly dependent on comprehensive and suitable databases for training and validation. However their generation is expensive in sense of labor and time. As a matter of fact, there is a lack of such databases, which complicates research and development. is is especially true for the case of Arabic handwriting recognition, that involves different preprocessing, segmentation, and recognition methods, which have individual demands on samples and ground truth. To bypass this problem, we present an efficient system that automatically turns Arabic Unicode text into synthetic images of handwritten documents and detailed ground truth. Active Shape Models (ASMs) based on 28046 online samples were used for character synthesis and statistical properties were extracted from the IESK-arDB database to simulate baselines and word slant or skew. In the synthesis step ASM based representations are composed to words and text pages, smoothed by B- Spline interpolation and rendered considering writing speed and pen characteristics. Finally, we use the synthetic data to validate a segmentation method. An experimental comparison with the IESK-arDB database encourages to train and test document analysis related methods on synthetic samples, whenever no sufficient natural ground truthed data is available. 1. Introduction A crucial step for every pattern recognition system is to train the classifier against a database and validate the system using the corresponding ground truth (GT). However, collecting handwriting samples is known as error prone, labor-, and time-expensive process [1]. Particularly costly are databases, which are suitable for training and validation of methods, that segment words into letters or analyse text pages as historical documents, since corresponding GT needs to include addi- tional information. For real handwriting databases this has to be done in a time consuming manual or semimanual way. is is one of the reasons, why data synthesis recently gained more and more interest [2]. e problem of the lack of satisfactory handwriting databases is very obvious in case of Arabic handwritings, where there mainly two well known, free available (offline) word databases (IFN/ENIT) [3], which exclusively contains Tunisian town names, and the IESK-arDB [4] that contains international town names and common terms as well, as 280 historical manuscript pages and 6000 segmented characters. We developed the IESK-arDB word database as a general database to train and validate segmentation based recogni- tion of Arabic words. erefore, the writers are from different Arabic countries; however, all of them writing in standard Nask. To match even the requirements of explicit segmenta- tion, we add detailed, manual GT for all word samples, which includes bounding boxes of Pieces of Arabic Words (PAWs) Hindawi Publishing Corporation e Scientific World Journal Volume 2015, Article ID 323575, 18 pages http://dx.doi.org/10.1155/2015/323575

Upload: others

Post on 17-Feb-2020

29 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

Research ArticleASM Based Synthesis of Handwritten Arabic Text Pages

Laslo Dinges1 Ayoub Al-Hamadi1 Moftah Elzobi1

Sherif El-etriby23 and Ahmed Ghoneim45

1 Institute for Information Technology and Communications (IIKT) Otto-von-Guericke-University Magdeburg39016 Magdeburg Germany2Umm Al-Qura University Makkah 21421 Saudi Arabia3Faculty of Computers and Information Menoufia University MUFIC Menofia 32721 Egypt4Department of Software Engineering College of Computer Science and Information Sciences King Saud UniversityRiyadh 11451 Saudi Arabia5Department of Computer Science College of Science Menoufia University Menofia 32721 Egypt

Correspondence should be addressed to Laslo Dinges laslodingesovgude

Received 7 January 2015 Revised 28 April 2015 Accepted 29 April 2015

Academic Editor Tongxing Li

Copyright copy 2015 Laslo Dinges et al This is an open access article distributed under the Creative Commons Attribution Licensewhich permits unrestricted use distribution and reproduction in any medium provided the original work is properly cited

Document analysis tasks as text recognition word spotting or segmentation are highly dependent on comprehensive and suitabledatabases for training and validation However their generation is expensive in sense of labor and time As a matter of fact thereis a lack of such databases which complicates research and development This is especially true for the case of Arabic handwritingrecognition that involves different preprocessing segmentation and recognition methods which have individual demands onsamples and ground truth To bypass this problem we present an efficient system that automatically turns Arabic Unicode text intosynthetic images of handwritten documents and detailed ground truth Active ShapeModels (ASMs) based on 28046 online sampleswere used for character synthesis and statistical properties were extracted from the IESK-arDB database to simulate baselinesand word slant or skew In the synthesis step ASM based representations are composed to words and text pages smoothed by B-Spline interpolation and rendered considering writing speed and pen characteristics Finally we use the synthetic data to validate asegmentation method An experimental comparison with the IESK-arDB database encourages to train and test document analysisrelated methods on synthetic samples whenever no sufficient natural ground truthed data is available

1 Introduction

A crucial step for every pattern recognition system is to trainthe classifier against a database and validate the system usingthe corresponding ground truth (GT) However collectinghandwriting samples is known as error prone labor- andtime-expensive process [1] Particularly costly are databaseswhich are suitable for training and validation ofmethods thatsegment words into letters or analyse text pages as historicaldocuments since corresponding GT needs to include addi-tional information For real handwriting databases this hasto be done in a time consuming manual or semimanual wayThis is one of the reasons why data synthesis recently gainedmore and more interest [2]

The problem of the lack of satisfactory handwritingdatabases is very obvious in case of Arabic handwritingswhere there mainly two well known free available (offline)word databases (IFNENIT) [3] which exclusively containsTunisian town names and the IESK-arDB [4] that containsinternational town names and common terms as well as 280historical manuscript pages and 6000 segmented charactersWe developed the IESK-arDB word database as a generaldatabase to train and validate segmentation based recogni-tion of Arabic wordsTherefore the writers are from differentArabic countries however all of them writing in standardNask To match even the requirements of explicit segmenta-tion we add detailed manual GT for all word samples whichincludes bounding boxes of Pieces of Arabic Words (PAWs)

Hindawi Publishing Corporatione Scientific World JournalVolume 2015 Article ID 323575 18 pageshttpdxdoiorg1011552015323575

2 The Scientific World Journal

Data acquisitionDocument synthesisValidationIn-output

i isolatede endm middleb beginn

Samples

Raw CharacterDB

ASMgeneration

Char form(i e m b) User input

Wordcompositioncomposition

ParagraphTrans-formations

Inter-polation

Rendering Synthesis

Realhandwriting

Seg-mentation mentation

Seg- Validation

Unicodesetting

Proof correlation

glyphs 119831

Figure 1 Simplified flowchart of the proposed synthesis system

and points where two letters are connected Neverthelessthe IESK-arDB word database contains only 300 differentwords (written by 20 writers) due to the time expensiveGT The manual proper generation of such detailed GT forcomplete Arabic text pages is indeed more complicated andhard to realize even for few samples To bypass this problem itwould be very helpful if databases necessary for the researchfield could be produced automatically One possible way toaccomplish this task is to generate synthetic handwritingsamples of single words and texts

We developed a system for this purpose which allowscreating synthetic databases from text files or Unicode thatis entered within the user interface (UI) Figure 1 givesan overview of the design of that system Ground truthare automatically generated They contain original UnicodeArabTeX transliteration and further data as the boundingbox of every letter Furthermore the trajectories are storedfor online applications The system is capable of generatingrealistic synthesis of words text lines and complete (singlecolumn) text pages

The rest of the paper is organized as follows In Section 3we give an overview of the related work Thereafter weoutline necessary data acquisition steps in Section 4 We alsodetail the mathematical background of Active Shape Models(ASMs) that we use to generate a large number of polygonalvariations of Arabic letters In Section 5 we describe ourproposed methods to synthesize words and text pages bycomposing and arranging ASM based glyphs Experimentalresults are discussed in Section 6 where we use synthesizeddatabases to validate a segmentationmethod Conclusion andfuture work are presented in the last section

2 Arabic Script

The Arabic script has some special characteristics so thatsynthesis or OCR approaches for Latin script will not succeed

withoutmajormodifications [6] Important aspects of Arabicscript are as follows

(1) Arabic is written from right to left

(2) There are 28 letters (Characters) in the Arabic alpha-bet whose shapes are sensitive to their form (isolatedbegin middle and end) see Table 1

(3) Six characters can only assume the isolated or endform which splits a word into two or more partscalled Piece of Arabic word (PAW) They consist ofthe main body (connected component) and relateddiacritics (dots) supplements like Hamza (

) In case

of handwriting the ascenders of the letters Kaf ( )Taa () or Dha ( ) can also be written as fragments

(4) Arabic is semicursive within a PAW letters are joinedto each other whether being handwritten or printed

(5) Very often PAWs overlap each other especially inhandwritings

(6) Sometimes one letter is written beneath its predeces-sor like Lam-Ya ( ) or Lam-Mim ( ) or it almostvanishes away when it is in middle form like Lam-Mim-Mim ( ) (unlike the middle letter of Kaf-Mim-Mim ( 13)) Hence in addition to the four basicforms there are also special forms which can be seenas exceptions Additional there are a few ligatureswhich are two following letters that build a completelynew character like LamAlif (

)

The Scientific World Journal 3

Table 1 Arabic alphabet Naskh style

i e m bAlif Ba Ta Tha Jim Ha Kha Dal Thal Ra $Zai $Sin amp (Shin amp (Sad ) + Dhad ) + Taa - Dha - Ayn 0 1 2 3Ghayn 0 1 2 3Fa 4 5 6 7Qaf 8 9 6 7Kaf Lam lt = gt Mim 13 ANun B C He D E F GWaw H IYa J K

(7) Some letters likeTha ( ) Ya (J ) or Jim ( ) have oneto three dots above under or within their ldquobodyrdquo

(8) Some letters like Ba ( ) Ta ( ) and Tha ( ) onlydiffer because of these dots

3 Related Work

There are several applications of text synthesis such as wordspotting CAPTCHAs character recognition improvementcalligraphy and others [2] Accordingly there are differentapproaches of synthesis In the literature research addressingthe issue of synthetic text generation can be classified intotwo main categories top-down and bottom-up approachesBoth can be either based on offline or online techniques

according to the available samples and applications Top-down approaches are typically based on neuromuscularmod-els that simulate the writing process itself [7 8] Thereforescript trajectories are seen as a result of character key points(built by the human brain when learning how to write)the writing speed character size and inertia which finallyleads to the curvature of handwritings These approaches arefocused more on the physical aspects of writing than theactual handwriting sample outcome One typical applicationis to investigate diseases as Parkinson or Alzheimer thatinfluence handwriting abilities [9]

Bottom-up approaches on the contrary model the shape(and possibly texture) of handwritings itself Hence bottom-up approaches are preferred in context of text recognitiontask like segmentation or handwriting recognition Bottom-up approaches can be further categorized into generation ofnew samples of the same level and concatenation to morecomplex outcomes such as words that are composed fromcharacters or glyphs [10]

A common generation technique is data perturbationwhich is performed by adding noise to online or offlinesamples Samples might be complete units as text lines orwords but single characters or glyphs (as syllables ligaturesor modified letters) are used mostly [11] In case of lettersor glyphs noise is often achieved by degradation of offlineor online samples or random displacement of trajectoriestransformations as shearing scaling or rotation are favoredfor perturbing words or text lines Another generation tech-nique is sample fusion that blends two or a couple of samplesto produce new hybrid ones [12 13] A better statisticalrelevance can be achieved using model based generation [1415] This initially requires the creation of deformable modelswhich represent a class by a flexible shape Deformablemodels are often based on statistical information that mustbe extracted from sufficient samples (usually on characterlevel) Then unlimited new representations of the samemodel class can be generated At the same time deformablemodels are capable of generating more realistic variancesthan data perturbation which closely depict the peculiar-ities of the letter class Examples for deformable modelsare Active Shape Models (ASMs) and novel Active ShapeStructural Models (ASSMs) which are used for generatingvariances of simple drawings and signatures [16] ASMsare also applied for the classification of Chinese letters[17]

Since documents in Latin based script might be hand-printed concatenation of such handwriting samples to unitsof higher levels can be done without connecting the samples[10] Proper simulation of cursive handwriting requires atleast partially connection though There are approaches thatconnect offline samples directly [18] and those who usepolynomial [19] spline [20 21] or probabilistic models [22]Due to the semi cursive style connecting ismandatory in caseof Arabic script

Systems using the described techniques to synthesizehandwritings have been built for different scripts and pur-poses Wang et al [23] proposed a learning based approachto synthesize cursive handwriting by combining shape and

4 The Scientific World Journal

physical models Thomas et al [24] have proposed syn-thetic handwriting method for generation of CAPTCHAsrsquo(completely automated public Turing test to tell computersand humans apart) text lines After segmentation samplesfor each letter are generated using shape models In thesynthesis process a delta log-normal function is used tocompose smooth and natural cursive handwriting Multipleapproaches specific to Latin script that are based on polyno-mial merging functions and Bezier curves have been docu-mented in [20] Miyao and Maruyama [25] have proposeda method to improve offline Japanese Hiragana characterclassification using virtual examples synthesized from anonline character database

In contrast to word synthesizing little research has beendone concerning text line paragraph or document synthesisIf synthesis of multiple text lines is considered at all itis typically modeled as horizontal baselines that may beinfluenced by noise [21] or each baseline line is definedby a rotation angle [10] Varga et al [26 27] presenteda method for handwritten English text line synthesizingtheir methodology starts by composing static image of thetext line by perturbing and chaining of character tem-plates Then text line is drawn using overlapping strokesand delta-lognormal velocity profiles as stated by delta-lognormal theory Chaudhuri and Kundu proposed a systemto synthesize handwritten Bangla script pages [28] Forpage layout simulation they compute Gaussian distributionsfrom natural text pages to model different features namelyleft margin angle line orientation interline gap and lineundulation

Due to the characteristics if Arabic script which werediscussed in Section 2 existing systems and methods cannot be directly used for Arabic Margner and Pechwitz[29] suggest an image based perturbation approach for thegeneration of synthetic printedArabicwordsThey add globalnoise of different degrees simulating degradation as artifactwhich are caused by repeated copying As for the problemof automatic synthesis of offline handwritten Arabic textto the best of our knowledge Elarian et al [3 30] are thefirst who published research work addressing this problemso far They propose a straightforward approach to composearbitrary Arabic words The approach starts by generating afinite set of letter images from two different writers manuallysegmented from IFNENIT database and then two kinds ofsimple features (width and direction feature) are extractedso they can be used later as a metrics in the concatenationstep Saabni and El-Sana proposed a system to synthesizePieces of Arabic Words (PAW) (without diacritics) [31]They use digital tablets to acquire online samples whichare randomly composed to PAWs Thereafter a subset of theproduced synthetic data is selected by clustering techniquesto get a compact database In [32] we proposed a systemto generate Arabic letter shapes by ASMs built from offlinesamples Subsequently we developed a system to renderimages of Arabic handwritten words concatenating ASMbased samples and using transformations on word level asoptional second generation step [33]

Table 2 Parameters and tresholds

Parameter Explanation Value

119903Number of samples used to computean ASM 50

119898Number of points of letter sampletrajectory x before approximation 119898 = 2668

119899Number of points of a approximatedsample x 25

120589 Controlling the space between words user defined120572119903 Word rotation plusmn45∘

120572119904 Word slant plusmn45∘

120603Controlling the sharpness of synthesiscontours 0ndash10

120596119875 Width of synthesized lines in points 1ndash10

Segmentation of Arabic words is quite challenging Itdepends on holistic word as well as the features of singlecharacters and detailed GT are required to perform a usefulvalidation Hence it is reasonable to test this method onsynthetic databases which contain such GT One of theearliest segmentation based approaches suggested for therecognition of Arabic handwritten text is the one proposedby [34] and no segmentation results are reported thoughXiu et al proposed probabilistic segmentation model forthis segmentation approach a tentative contour based oversegmentation is first performed on the text image as a resulta set of what they called graphemes is produced [35] Theapproach differentiates among three types of graphemesTheconfidence of each character is calculated according to theprobabilistic model respecting other factors for examplerecognition output geometric confidence and logical con-straintThe authors experimented the proposedmethodologyon five different test sets achieving 592 success rate

4 Data Acquisition and Generation

To synthesize Arabic handwritten words from glyphs asufficient amount of glyph samples has to be acquired firstIn our case trajectories of single letters and their connections(Kashidas) are used as glyphs The glyphs are acquired withonline techniques since relevant information can be extractedmore efficiently from trajectories than images Neverthelesswe are mainly interested in synthesizing offline data Hencewe decided to use online pens for data acquisition for theycan be applied as ordinary biros in contrast to digital tabletsFifty ormore samples per writer are taken from over hundredletter classes (28046 samples altogether) to built an onlinecharacter database To minimize manual effort and allowan easy extension this database is completely automaticallygenerated from raw data Raw data are trajectories X isin R119898times2

(see Table 2) for each stroke within a virtual DIN A4 pageThat page has a resolution of 1000 dpi and 58 rps (reportsper second) so there are constant timestamps 998779119905 = 119905

119894+1 minus

119905119894

= 00172 s between neighbored (1198941 1198942) isin

X Thegenerated database contains the trajectories and an image

The Scientific World Journal 5

119857

x

(a) 119899 = 10

119857

x

(b) 119899 = 25

Figure 2 The average x and 119903 samples x for the letter Sin in isolated form of writer 1 (a) The number of interpolation steps 119899 = 10 is notsufficient to represent complex characters as Sin () and details will be lost or distorted (b) With 119899 = 25 the approximated samples x arereliable enough to build proper ASMs for all character classes

representation for each Arabic letter class (see Table 1) aswell as the resulting Active Shape Models (ASMs) which aredescribed in the next section Digits and special charactersmight be added in future work

41 Computing Active Shape Models for Generation of ArabicCharacters Active Shape Models (ASMs) are statistical rep-resentations of the approximated shape of an object An ASMuses the distribution of some significant points to store themost important information of many shapes of a class in onesinglemodel Normally somewell-defined landmarks have tobe set manually for all samples and additional intermediatepoints between these landmarks are used if there are notenough landmarks to represent the shape However thedefinition of landmarks for over hundred classes for everywriter is barely realizable and would prevent to add datafrom further writers efficiently This is why we use two givenlandmarks the Start and the End point of each polygonand compute intermediate points by interpolating betweenthe given (

1198941 1198942) of X isin R119898times2 to get polygons X isin

R119899times2 By alternate storing of the 1199091198941 and 119909

1198942 coordinateseach polygon is represented as a single vector of size 2119899x = (11990911 11990912 11990921 11990922 1199091198991 1199091198992)

119879 that is required tobuild ASMs Given the point numbers119898 of the original and 119899of the desired approximated samples we interpolate in sucha way that the time steps 998779

119905= 998779

119905119898119899 between neighbored

interpolated points p119895 p

119895+1 | p119895

= (1199092119895 1199092119895+1) are stillconstant the Euclidean distance howevermay vary Given theoriginal points p isin

X we compute an interpolated point

p119895= (1minus120582

119886) p

1198951015840 +120582

119886p1198951015840+1

with 1198951015840

= lfloor119895998779119905rfloor 998779

119905=

998779119905

998779119905

120582119886= 119895998779

119905minus 119895

1015840

(1)

where 1198951015840 isin 1 119898 and 119895 isin 1 119899 This enables a more detailedmodeling of complex structures as the peaks of Sin () as onecan see in Figures 2 and 3 We set 119899 = 25 which is sufficientto represent even complex Arabic characters like Sin ( )as shown in Figure 2 (in order to speed up the syn-thesis process 119899 could be optimized for each individualclass)

We then scale all samples x keeping their aspect ratio Let119882 be the width and let119867 be the heights of an unscaled x andthen we scale x by 100119909100(119867 lowast 119882) and translate x so thatits center lies within the origin

For each class there are 119903 available vectors fromwhich theASM of the corresponding class is calculated (we set 119903 = 50for our experiments)

To build ASMs the expected value x and the covariancematrix S have to be calculated first

x =

sum119903

119894=1 x119894119903

S =

12119903 minus 1

119903

sum

119894=1(x

119894minus x) (x

119894minus x)119879

(2)

As a consequence of the covariance matrix calculation theEigenvalues 120582

119894and Eigenvectors e

119894can be determined and

then the ASM corresponding to character classes is calcu-lated Now any arbitrary number of vectors that representeach class can be calculated by linear combination

u = x +119903

sum

119895=1119888119895e119895 119888

119895isin [minus2radic120582

119895 2radic120582

119895] (3)

A limitation of 119888119895by plusmn2radic120582

119895assures that all the deviations

of u are within the doubled standard deviation 120590 This is acommon limit since most training samples lie within thisrange In few cases a limit ofmaximalplusmn3radic120582

119895is applied which

6 The Scientific World Journal

(a) u (b) u (B-Spline) (c) x

(d) x (B-Spline) (e) forall119888119895= 0 (f) forall|119888

119895| = 2radic120582

119895

Figure 3 Examples of glyphs (a) examples for ASM-glyph representations u (wheresum |119888119895| asymp sum 16radic120582

119895 see (3)) (b) a B-Spline interpolation

has been applied on the representations (c) (d) original letter samples x A B-Spline interpolation with 5 steps has been applied on (b) and(e) Examples of ASM-glyphs u that are composed to words are shown in (e) and (f) where the influence is minimal (e) and maximal (f)respectively for all eigenvalues

requires a clear increase of 119903 in order to keep u statisticallyreliable

Some examples of x and u are shown in Figure 3 Thecomputation of ASMs is quite costly especially if many sam-ples and interpolation points are used This is why we avoidrecalculations of ASMs at runtime since the synthesizingprocess requires a minimum of 100ASMs Hence all ASMs(including their corresponding online samples) are saved infiles to separate ASM generation from the synthesis module

42 ASMDistance Measure The distance 120575 of a sample x anda representation u of an ASM can be calculated as follows

120575 (x u) = 1119899

119899

sum

119894=1

radic(1199062119894minus1 minus 1199092119894minus1)2+ (1199062119894 minus 1199092119894)

2 (4)

Due to the performed scaling of x 120575(x u) can be interpretedas the approximated deviation in percent For all samples xwe compute the most similar representation ulowast by solving (3)numerically using c as unknown (initially forall119888

119894= 0) Some

examples of ulowast are visualized in Figure 4In contrast to ASMs from offline samples [32] most

online based ASMs are capable of representing their inputsamples well even without manually defined landmarkssince detailed slowly written structures (where landmarksare suspected) are represented by more intermediate pointsThis effect allows an efficient extension and maintenanceof the character database since time consuming manuallandmarking can be avoided

Nonetheless the average 120575 is writer dependent We mea-sured 120575 = 08 for writer 1 120575 = 146 for writer 2 and evenhigher values for the other writers whose handwriting styleis less tidy Furthermore 120575depends on the letter class A high 120575is mainly caused by some classes with diacritics as Zai ( ) thatneed improvement (see Figure 3(c)) The distance between

the letters main body and diacritics can vary clearly whichmay lead to inappropriate ulowast in case that x is unlike x Toreact against this effect more training samples could be usedor diacritics andmain bodies could be separated using ActiveShape Structural Models (ASSM) [16] However our ASMsare meant for synthesis approaches where the use of purenoise (perturbed data) is quite common and hencemoderateimprecision does not spoil the synthesis quality significantly

5 Synthesizing Arabic Handwritings

In the following subsections we describe all methods thatare applied to create synthetic Arabic handwritings fromUnicode using the ASM data from the last Section Oursystem uses these either to show a few specific syntheses forpreview purpose or to generate a complete database includingground truth

The methods which are used to synthesize and renderArabic handwritings are described in the following Sections

51 Composing Words The basic idea of Arabic handwritingsynthesis fromUnicode is to select glyphs with proper shapes(isolated initial end or middle form) and connect themsubsequently to build PAWs words and texts from whichimages or vector graphics are rendered

511 Calculation of the Letter Form Our system receives textas Unicode string that represents every letter as numberSince our samples are limited to the 28 regular letters andTamarbuta ( D ) we substitute special characters as Alif withHamza above (

) with their regular formAlif ( ) before starting

the synthesis Letter forms have a strong influence on theletter shape but they are not given by regular Unicode thusthey have to be determined first

The Scientific World Journal 7

119857

x119854lowast

(a) | 120575 = 096

119857

x119854lowast

(b) J | 120575 = 087

119857

x119854lowast

(c) | 120575 = 56

Figure 4 Examples of ASM based glyph ulowast that has the highest correlation (deviation 120575) with a randomly chosen samples x The averagesample polygon x is displayed to show how strong x differs from the expected shape Some of the ASM for characters with diacritics areproblematic as shown in (c)

Letters of the set Γ2 = (H ) can only assume isolated orend form All other letters such as Ayn() can assume begin-middle- and- as well as isolated- form Ayn (0 1 2 3)Therefore the form f0 of the first letter l0 of a word is

f0 =

i if l0 isin Γ2

b else(5)

Examples of the different letter forms within an Arabic wordare shown in Figure 5 Let f

minus1 be the form of lminus1 which is the

predecessor of letter l and l+1 = define that the successor

of l is a space tab or return token and then the position fof a letter l can be defined as follows

f =

i if fminus1 isin (i e) and (l isin Γ

2or l

+1 = )

b if fminus1 isin (i e) and (l notin Γ

2and l

+1 = )

m if fminus1 isin (bm) and (l notin Γ

2and l

+1 = )

e if fminus1 isin (bm) and (l isin Γ

2or l

+1 = )

(6)

Letters that have only two forms split an Arabic word intoPieces of ArabicWords (PAWs) which consist of one ormoreletters

i

i eb

e mb

Figure 5Outgoing from theUnicode sequence ( H J H JB)

the forms (isolated end middle and begin) of all letters aredetermined ( H H ) and composed to the wordII (New York)

512 Selection of Suitable Glyphs To ensure that the styles ofall neighbored glyphs are similar glyphs of different writerare not mixed within a synthesis We encouraged the writersto write letters only in this style that is dominant for theirwritings and avoid severe rotations The size of the glyphs isnormalized by the average character size we extracted fromthe IESK-arDB However we corrected the size manually incase of rare character classes A suitability measure for theglyph joint points has not been considered since steady jointsare achieved by B-Spline interpolation and rendering at theend of the synthesis process

513 Connecting Glyphs After all letter classes are definedby their names and forms corresponding ASMs are loaded

8 The Scientific World Journal

Input Current PAW A119888 precedent PAW A

119901 average letter width l

119908

Output Shifted current PAW A119888

If Bounding boxes of A119888and A

119901overlap then

while Trajectories of A119888and A

119901intersect do

Translate the 119909 coordinates of A119888by (14)l

119908

Algorithm 1 Solving intersections of neighbored PAWs

(a) Writer 1 (b) Writer 2 (c) Writer 3 (d) Writer 4

Figure 6 The word II (New York) synthesized by the average letter shapes 119909 of different writers

The ASMs are used to generate an unique polygonal rep-resentation u for each occurrence of a letter class in orderto avoid piecewise identical syntheses In order to composewords from these polygons each letter in end or middle formhas to be connected with its predecessor 3 rarr $ 3 I rarr I Let pf be the first point of and pl the last

point of its predecessor and then we can connect them by

translating by pl minus pf An example is shown in Figure 5The relation of a PAWrsquos 119910 coordinate and the baseline

depends on the letter classes the PAW is composed of Thuswe extracted the average 120583

119903and variance 120590

119903of the relative

distance between the baseline and the center of a letter frommanual created ground truth of our (real) word databaseIESK-arDB [4] We set the baseline to 0 and shift all 119910coordinates of each PAW by N(120583

119903 120590

119903) Finally the space

between the rightmost point of a PAW and the leftmostpoint of its predecessor has to be defined Therefore the userdepending parameter 120589 is used that may be negative in orderto simulate overlapping PAWs Given pl and pf the PAW canbe translated by the vector

tpaw = (

1199011198971minus 119901

1198911minus 120589

N (120583119903 120590

119903)

) (7)

In case of intersections between the polygons of overlappingPAWs 120589 is increased iteratively by 25 of the average letterwidth as described in Algorithm 1

Examples of words composed by the average letter shapesof different writers are shown in Figure 6 Examples fromASM based and original samples can be found in Table 3The maximal deviation 120590

119860means that the influence of an

eigenvector e119894is limited by plusmn2radic120582

119894 While letters look similar

using 120590 between 0 and 1 ASM representations u with 120590119860of

2 already provoke increased letter variation ASMs (trainedwith 119903 = 50 samples) are barely capable of representing adeviation of120590

119860= 3 though As amatter of fact there are noise

based deformations as shown in Table 3 (second last row)

This effect might be intended to create especially challengingsyntheses

52 Simulation of Global Variances ASMs already containvariations in slant width or connection size Neverthelessthese variations are limited by the used samples In order toincrease and control these variations affine transformationsare used (scaling translation shearing and rotation) whichallow optional manipulations of letter and PAW shapes Theuser interface (UI) of our synthesis system allows to set theaverage 120583 and variance 120590 of a Gaussian distribution for allaffine transformations Particularly global variations as theslant can be achieved this way The influences of these affinetransformations on the resulting word image is shown inFigure 7

A stretching is performed by scale each 119909 component ofeach letter point by the factor 119888 isin [05 2] The word slantcan be set by shearing the word with an angle of 120572

119904as the

skew of PAW can be manipulated by rotating to the angle120572119903 where 120572

119904 120572

119903isin [minus45∘ +45∘] We analyzed the skew and

slant of samples of the IESK-arDB database [4] with localminima regression and Hough transform We found that theskew correlates with a Gaussian distribution ofN(minus38∘ 71∘)(passed Chi square test with 120572 = 005) The slant can berepresented byN(minus46∘ 144∘)The size of the complete wordor single letters can be adjusted by an equal scaling with119888 isin [01 10] which can be used to control the resolution ofthe synthesized word images or to increase variation of lettersize As described in Section 513 variations of PAWpositionscan be realized by translations Even using the same glyphssynthetic words can assume large variations in shape whenusing affine transformations or cutting connection size asshown in Figure 7

When examining the glyph samples and synthesis wefound that compared to complete handwritings letter con-nections of the acquired samples are extended and evenexcessively (approximately twice as) long in case of writer 1Hence we allow to delete up to 25 of the letter points tosimulate stretched or missed connections which often occur

The Scientific World Journal 9

Table 3 Syntheses using ASMs and sample based glyphs of writer 1

120590119860sim |119888

119895|radic120582

119894Result

0

1

2

3

Samples

(a) Stretching (b) Slant (c) Size (d) Skew (e) Position (f) Connection

Figure 7 Affine transformations and connection shortening on synthetic words

in natural Arabic handwritings In Arabic handwritings somecharacters as Ya ( J ) are sometimes written beneath theirpredecessors As a result they resemble a single characterwhich impedes segmentation and recognition tasks Thiseffect can be simulated by a strong reduction of the Kashidaas shown in Figure 8 However this feature has been not yetentirely implemented since a list of all pairs of letters thattypically show this behaviour needs to be created first

53 Interpolation Since a polygonal letter representationdoes not look natural for vector graphics or images witha scaling factor gt 1 we use interpolation to improve theoutcome Let 119899(u) be the number of points of u and then weuse u as control points to interpolate a curve u By increasingthe interpolation steps 119899(u) can be approximated to theoriginal number of points of a sample X The average lengthof X is 119899( X) = 2668 and hence a tenfold increase 119899(u) =

25 rarr 119899(u) = 250 is generally sufficient to achieve smoothsyntheses To ensure that the above mentioned methodswork efficiently on the compressed representation u theinterpolation step is applied just before rendering or skippedin case of low-resolution synthesis

Our system supports two interpolation methods Piece-wise Cubic hermite-interpolation is 1198621-steady which meansthat only the first derivation of the used interpolation func-tion is steady Therefore hermite-interpolation leads to lesssmooth and accurate results a property that can be used tocreate noisy handwritings [32] (perturbed data technique)State-of-the-art B-Spline interpolation is commonly usedwithin CAD-applications since it is 1198622-steady and leads tosmooth natural curves which can be defined properly bytheir control points as shown in Figure 9 Although the B-Spline curve do not pass through all control points it fitsthe original curve sufficiently when 119899 = 25 control pointsare used Given the measure 120575 of (4) the average distancebetween u and the 119899 closest points of u can be computedUsing a cross-validation with 119896fold = 10 we get 120575(u u) =

045 with a variance of 0058

54 Rendering Handwriting Images The former sectionsdiscussed how to compose and interpolate polygonal rep-resentations of Arabic handwritings Now those have to betransformed into images and saved in common files formats(bmp png etc) which can easily be loaded by most text

10 The Scientific World Journal

(a) (b) (c)

Figure 8 Example for a synthesized letter pair using (a) full (b) half and (c) negative Kashida length

Control points uInterpolated points 119854

(a) B-Spline

Control points uInterpolated points 119854

(b) Cubic

Figure 9 Comparison of B-Spline and Cubic interpolation where 119899(u) = 25 and 119899(u) = 250

recognitions or document analysis systems Even preprocess-ing steps as thinning can influence the performance of thefollowing tasks Such preprocessing is sensitive to secondaryfeatures or flaws which are a result of the used writingmaterials hence the synthesized files should contain thosefeatures too Therefore we propose a rendering techniquethat reflects optical features caused by common pens asball pens or pencils [33] Subsequently a modification ofthis technique is described that allows rendering features ofhistorical handwritings

First of all pixels o have to be found that are closeto polygons u and belong to the foreground As shown inFigure 10(a) we first interpolate between two neighboredpoints p q of u (or u) and get 120588 lowast p minus q new points

o1015840 = ]p+ (1minus ]) q ] isin [0 1] (8)

where ] is uniform distributed and 120588 is a user definedparameter

Let n be the normal vector of line pq and then we shifteach o1015840 along n using a Gaussian distribution

o = o1015840 +N (120583 120590) n (9)

where 120590 and 120583 define the line width which is decreased up to20 in case that p lies between the PenUp or PenDown pointand the neighbored control point As a result the prototype ofa word image has been prepared that defines all pixels whichare influenced by pigments at all (shown in Figure 10(b))To allow sharp contours a limitation of |N(120583 120590)| lt 120603120590

is applied according to the simulated pen where 120603 is userdependent

541 Texture Biros or pencils cause an irregular pigmenta-tion intensity which is reflected by pixel intensities 119868(119909 119910)of scanned images A realistic physical model that simulatesthis behavior in a proper way is beyond the scope of thispaper a more simplified and generalized approach howeveris quite practical Inspired by the ability of Fourier transformbased image compression to represent the main nature ofa texture by a small subset of the underlying frequencieswe define a texture by 10 points (120582 120579 120601) in frequency spacein order to emulate irregularities caused by pen and paperThis way simplified but unique textures can be created atruntime However in contrast to image compression weare not interested in avoiding noise-prone high frequencies

The Scientific World Journal 11

n

p

qoi

(a) (b) (c) (d) (e) Synthetic image (f) Real image

(g) Example text line

Figure 10 Painting technique (a) scheme (b) word shape with 120588 = 6 120590 = 35 (Gaussian filter is disabled) (c-d) example results for paintingtechnique (c) test texture applied on (b) (d) 120588 = 30 120590 = 10 with ball pen texture and (e-f) comparison of natural and synthetic ball pentextures

Hence different high and low frequencies are combined tosimulate regional as well as locale effects (behavior of inkpaper texture) Each point represents a texture layer in imagespace with 1198681(119909 119910) isin [minus1 1] We created several textureclasses by defining different sets of Gaussian distributionsfor the angle 120579 wave length 120582 and phase shift 120601 of alllayers manually Afterwards pixel intensities 1198682(o) isin [0 256]are computed by accumulating most texture layers The leftlayers are used to achieve variations in their intensities bymultiplication Finally an image I with a small margin iscreated and all o are fitted to I subsequently

By creating word syntheses using polygonal glyphs andrendering techniques smooth letter connections can beachieved more efficiently compared to synthesis approachesthat use image based glyphs Furthermore in contrast tothe usage of natural textures the described technique is ableto generate unique nontiled textures for every synthesizedword as shown in Figures 10(c)ndash10(e) Depending on thetexture class a median or Gaussian filter is used before savingthe image

542 Simulation of Feather Like Writing Tools The previousmethod allows a proper simulation of text that is writtenby ball pens pencils or coal on white paper However toallow a more accurate simulation of writing instrumentsas fountains pens or feathers we extended our renderingtechnique This includes mainly the implementation of twofeatures the writing speed and the shape of the top of thewriting instrument further called Pen Shape

Pen Shape If the Pen Shape is modeled as line or ellipsoid theline width of the trajectory u depends not only on the widthof the Pen Shape 119908

119875 but also on its angle 120574

119875and the angle

of the trajectory tangent 120574u We initialize 120574119875= 45∘ changing

it continuously with a maximal deviation of plusmn15∘ This localedeviation is computed by adding two cosine functions wherethe wavelengths phases and amplitudes are redefined byGaussian distributions for each synthesis

According to the texture of a Pen Shape the contactwith the paper and consequently the caused pigmentationcan vary This is simulated by an one-dimensional function

119891(119909119875) | 0 le 119909

119875le 119908

119875that defines the pigmentation potential

for the long axis of the Pen Shape An emphasized exampleinspired by a fountain pen is shown in Figure 11(d)

Binary images can be rendered in a faster way by definingpolygons (here a triangle mesh) that is a result of extrudingan one-dimensional Pen Shape along u or u A visualizationof this can be found in Figure 11(c) and a resulting synthesisis shown in Figure 11(h) These polygons can then be drawnby standard routines If the angle of the Pen Shape and theline is identical or so close where the polygon width wouldbe smaller than one pixel a line have to be drawn instead toavoid letter fragmentation

Writing Speed Large lines or bows as the left part of Sin() are usually written faster thanmore complex structuresA high writing speed often causes a lack of pigmentationthat leads to brighter or dappled lines However there is noneed to reconstruct writing speed for the used online lettersamples already that contain such information From eachrepresentation u we can extract the relative local writingspeed for ASMs representations in points per second

V (119894) pts =1003817100381710038171003817(2119894minus1 2119894) minus (2119894+1 2119894+2)

1003817100381710038171003817pt

(119899 (u) 119899 (u)) Δ119905s

1 le 119894 le 119899 (u) (10)

In order to estimate the expected pigmentation intensitywe use the normalized writing speed V isin [0 1] where V = 0is the slowest and V = 1 is the fastest part of the trajectory ofa synthesis If c0 is the current color of a pixel in RGB colorspace and c

119901is the color of the pen pigment then the new

color is computed by

c = c119901120572119886+ c0120572119887 (1minus120572119886) c isin R

3 (11)

where 120572119886

= 08(1 minus V) + 02 defines opacity of c119901and

120572119887

= 1 defines the opacity of the background Althoughpigments that are used for handwritings are typically full orsemiopaque reduction of pigmentation caused by increasedwriting speed can lead to transparency This is simulated byreducing 120572

119886 as shown in Figure 11(e)

12 The Scientific World Journal

(a) u (b) u (B-Spline) (c) u (polygon mesh) (d) Pen shape (e) Speed (f)

(g) Example of a synthesized text line

(h) Example of a synthesized text line (fast method for binary images)

Figure 11 From the polygon u to a synthetic image that simulates a feather like writing instrument (c) Polygon mesh created from u that isused for fast rendering of binary images

To ensure a steady behavior we interpolate the speed ofconnected letters For the first 119899(u)4 points (2119894minus1 2119894)we setthe speed V of a letter in middle or end form to

V (119894) = V (119894) [1minus120582119894] + V

119887(119899 (u)) 120582

119894

120582119894= 4 119894

119899 (u) 119894 le

14119899 (u)

(12)

where V119887(119899(u)) is the speed at the end of the previous letter

The effect on the synthesis is shown in Figure 11(d)

Render on Degraded Background Finally we createFigure 11(f) by combining our texture rendering techniqueof Section 541 with the one based on Pen Shape and writingspeed using a nonuniform background Therefore weapplied a transparent texture on all pixels that does notbelong to the background texture This way small randomirregularity is simulated

In the shown examples a black color is used as mostdocuments are written with dark ink (like iron oxide or soot)Pigmentation intensity is implemented as transparencywhich allows simulating pigment accumulation at crossinglines or in case of a textured background However alsocolored opaque or semiopaque ink can be simulated Thismight be interesting in the context of historical documentssince important passages are often highlighted by using redink Another important feature of historical documents isdegradation of paper or parchment Currently we simplyuse images of natural paper or parchment as backgroundtextures which are scaled or tiled in case where they aresmaller than the synthesized document

55 Generation of Text Pages Recently not only characteror word recognition but also more complex document anal-ysis issues that address the interpretation or recognition of

complete documents become a focus of Arabic handwritingresearch Hence we investigate the possibilities of text pagesynthesis In this regard the accurate simulation of thelower baselines is crucial Many problems that occur whiledetecting lines words or connected components depend onthese baselines as for instance assigning diacritics (that arevery close to more than one text lines) to their correspondingPAW

Our approach of simulating baselines has three stepsFirst of all we set the coordinates (1199090 1199100) of the first letter foreach line Secondly the curvatures of the baselines have to becomputed Thirdly potential intersection of words have to besolved

Start PAWs Due to the style of Arabic handwritings alllines start at the rightmost 119909-coordinate 1199090 = 119909max Thevertical space between two neighbored lines can be definedas percentage of the average PAW heights to get 1199100 for eachbaseline

Baselines We implement the second step by declaring func-tions 119891(119909 1199100) that define the curvatures of the simulatedBaselines Ξ

119904(1199100 defines the initial heights of a line) We

normalize 1199100 isin [0 1] inside 119891(119909 1199100) so it becomes

independent of the page size How to compute proper 119891119894is

explained in Section 56Let l119903 define the lower right of a letters bounding box then

we first translate the letter l towards the baseline so that l119903touches it Subsequently the119910-position of lmust be correctedaccording to its class by translating it by t

119887 so that l119903 might

be above or below 119891(119897119903

119909 1199100) as shown in Figure 12Therefore

we extracted the normalized statistical relation N119887between

l119903 and the baseline from the IESK-arDB for all letter classes If119897ℎ is the heights and l119894 is the 119894th point of l we can compute t

119887=

(0 119897ℎN119887)119879 and l1015840119894 = l119894 + t

119887as shown in Figure 12 We perform

this for every first letter l119891of a PAW Apart from the position

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 2: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

2 The Scientific World Journal

Data acquisitionDocument synthesisValidationIn-output

i isolatede endm middleb beginn

Samples

Raw CharacterDB

ASMgeneration

Char form(i e m b) User input

Wordcompositioncomposition

ParagraphTrans-formations

Inter-polation

Rendering Synthesis

Realhandwriting

Seg-mentation mentation

Seg- Validation

Unicodesetting

Proof correlation

glyphs 119831

Figure 1 Simplified flowchart of the proposed synthesis system

and points where two letters are connected Neverthelessthe IESK-arDB word database contains only 300 differentwords (written by 20 writers) due to the time expensiveGT The manual proper generation of such detailed GT forcomplete Arabic text pages is indeed more complicated andhard to realize even for few samples To bypass this problem itwould be very helpful if databases necessary for the researchfield could be produced automatically One possible way toaccomplish this task is to generate synthetic handwritingsamples of single words and texts

We developed a system for this purpose which allowscreating synthetic databases from text files or Unicode thatis entered within the user interface (UI) Figure 1 givesan overview of the design of that system Ground truthare automatically generated They contain original UnicodeArabTeX transliteration and further data as the boundingbox of every letter Furthermore the trajectories are storedfor online applications The system is capable of generatingrealistic synthesis of words text lines and complete (singlecolumn) text pages

The rest of the paper is organized as follows In Section 3we give an overview of the related work Thereafter weoutline necessary data acquisition steps in Section 4 We alsodetail the mathematical background of Active Shape Models(ASMs) that we use to generate a large number of polygonalvariations of Arabic letters In Section 5 we describe ourproposed methods to synthesize words and text pages bycomposing and arranging ASM based glyphs Experimentalresults are discussed in Section 6 where we use synthesizeddatabases to validate a segmentationmethod Conclusion andfuture work are presented in the last section

2 Arabic Script

The Arabic script has some special characteristics so thatsynthesis or OCR approaches for Latin script will not succeed

withoutmajormodifications [6] Important aspects of Arabicscript are as follows

(1) Arabic is written from right to left

(2) There are 28 letters (Characters) in the Arabic alpha-bet whose shapes are sensitive to their form (isolatedbegin middle and end) see Table 1

(3) Six characters can only assume the isolated or endform which splits a word into two or more partscalled Piece of Arabic word (PAW) They consist ofthe main body (connected component) and relateddiacritics (dots) supplements like Hamza (

) In case

of handwriting the ascenders of the letters Kaf ( )Taa () or Dha ( ) can also be written as fragments

(4) Arabic is semicursive within a PAW letters are joinedto each other whether being handwritten or printed

(5) Very often PAWs overlap each other especially inhandwritings

(6) Sometimes one letter is written beneath its predeces-sor like Lam-Ya ( ) or Lam-Mim ( ) or it almostvanishes away when it is in middle form like Lam-Mim-Mim ( ) (unlike the middle letter of Kaf-Mim-Mim ( 13)) Hence in addition to the four basicforms there are also special forms which can be seenas exceptions Additional there are a few ligatureswhich are two following letters that build a completelynew character like LamAlif (

)

The Scientific World Journal 3

Table 1 Arabic alphabet Naskh style

i e m bAlif Ba Ta Tha Jim Ha Kha Dal Thal Ra $Zai $Sin amp (Shin amp (Sad ) + Dhad ) + Taa - Dha - Ayn 0 1 2 3Ghayn 0 1 2 3Fa 4 5 6 7Qaf 8 9 6 7Kaf Lam lt = gt Mim 13 ANun B C He D E F GWaw H IYa J K

(7) Some letters likeTha ( ) Ya (J ) or Jim ( ) have oneto three dots above under or within their ldquobodyrdquo

(8) Some letters like Ba ( ) Ta ( ) and Tha ( ) onlydiffer because of these dots

3 Related Work

There are several applications of text synthesis such as wordspotting CAPTCHAs character recognition improvementcalligraphy and others [2] Accordingly there are differentapproaches of synthesis In the literature research addressingthe issue of synthetic text generation can be classified intotwo main categories top-down and bottom-up approachesBoth can be either based on offline or online techniques

according to the available samples and applications Top-down approaches are typically based on neuromuscularmod-els that simulate the writing process itself [7 8] Thereforescript trajectories are seen as a result of character key points(built by the human brain when learning how to write)the writing speed character size and inertia which finallyleads to the curvature of handwritings These approaches arefocused more on the physical aspects of writing than theactual handwriting sample outcome One typical applicationis to investigate diseases as Parkinson or Alzheimer thatinfluence handwriting abilities [9]

Bottom-up approaches on the contrary model the shape(and possibly texture) of handwritings itself Hence bottom-up approaches are preferred in context of text recognitiontask like segmentation or handwriting recognition Bottom-up approaches can be further categorized into generation ofnew samples of the same level and concatenation to morecomplex outcomes such as words that are composed fromcharacters or glyphs [10]

A common generation technique is data perturbationwhich is performed by adding noise to online or offlinesamples Samples might be complete units as text lines orwords but single characters or glyphs (as syllables ligaturesor modified letters) are used mostly [11] In case of lettersor glyphs noise is often achieved by degradation of offlineor online samples or random displacement of trajectoriestransformations as shearing scaling or rotation are favoredfor perturbing words or text lines Another generation tech-nique is sample fusion that blends two or a couple of samplesto produce new hybrid ones [12 13] A better statisticalrelevance can be achieved using model based generation [1415] This initially requires the creation of deformable modelswhich represent a class by a flexible shape Deformablemodels are often based on statistical information that mustbe extracted from sufficient samples (usually on characterlevel) Then unlimited new representations of the samemodel class can be generated At the same time deformablemodels are capable of generating more realistic variancesthan data perturbation which closely depict the peculiar-ities of the letter class Examples for deformable modelsare Active Shape Models (ASMs) and novel Active ShapeStructural Models (ASSMs) which are used for generatingvariances of simple drawings and signatures [16] ASMsare also applied for the classification of Chinese letters[17]

Since documents in Latin based script might be hand-printed concatenation of such handwriting samples to unitsof higher levels can be done without connecting the samples[10] Proper simulation of cursive handwriting requires atleast partially connection though There are approaches thatconnect offline samples directly [18] and those who usepolynomial [19] spline [20 21] or probabilistic models [22]Due to the semi cursive style connecting ismandatory in caseof Arabic script

Systems using the described techniques to synthesizehandwritings have been built for different scripts and pur-poses Wang et al [23] proposed a learning based approachto synthesize cursive handwriting by combining shape and

4 The Scientific World Journal

physical models Thomas et al [24] have proposed syn-thetic handwriting method for generation of CAPTCHAsrsquo(completely automated public Turing test to tell computersand humans apart) text lines After segmentation samplesfor each letter are generated using shape models In thesynthesis process a delta log-normal function is used tocompose smooth and natural cursive handwriting Multipleapproaches specific to Latin script that are based on polyno-mial merging functions and Bezier curves have been docu-mented in [20] Miyao and Maruyama [25] have proposeda method to improve offline Japanese Hiragana characterclassification using virtual examples synthesized from anonline character database

In contrast to word synthesizing little research has beendone concerning text line paragraph or document synthesisIf synthesis of multiple text lines is considered at all itis typically modeled as horizontal baselines that may beinfluenced by noise [21] or each baseline line is definedby a rotation angle [10] Varga et al [26 27] presenteda method for handwritten English text line synthesizingtheir methodology starts by composing static image of thetext line by perturbing and chaining of character tem-plates Then text line is drawn using overlapping strokesand delta-lognormal velocity profiles as stated by delta-lognormal theory Chaudhuri and Kundu proposed a systemto synthesize handwritten Bangla script pages [28] Forpage layout simulation they compute Gaussian distributionsfrom natural text pages to model different features namelyleft margin angle line orientation interline gap and lineundulation

Due to the characteristics if Arabic script which werediscussed in Section 2 existing systems and methods cannot be directly used for Arabic Margner and Pechwitz[29] suggest an image based perturbation approach for thegeneration of synthetic printedArabicwordsThey add globalnoise of different degrees simulating degradation as artifactwhich are caused by repeated copying As for the problemof automatic synthesis of offline handwritten Arabic textto the best of our knowledge Elarian et al [3 30] are thefirst who published research work addressing this problemso far They propose a straightforward approach to composearbitrary Arabic words The approach starts by generating afinite set of letter images from two different writers manuallysegmented from IFNENIT database and then two kinds ofsimple features (width and direction feature) are extractedso they can be used later as a metrics in the concatenationstep Saabni and El-Sana proposed a system to synthesizePieces of Arabic Words (PAW) (without diacritics) [31]They use digital tablets to acquire online samples whichare randomly composed to PAWs Thereafter a subset of theproduced synthetic data is selected by clustering techniquesto get a compact database In [32] we proposed a systemto generate Arabic letter shapes by ASMs built from offlinesamples Subsequently we developed a system to renderimages of Arabic handwritten words concatenating ASMbased samples and using transformations on word level asoptional second generation step [33]

Table 2 Parameters and tresholds

Parameter Explanation Value

119903Number of samples used to computean ASM 50

119898Number of points of letter sampletrajectory x before approximation 119898 = 2668

119899Number of points of a approximatedsample x 25

120589 Controlling the space between words user defined120572119903 Word rotation plusmn45∘

120572119904 Word slant plusmn45∘

120603Controlling the sharpness of synthesiscontours 0ndash10

120596119875 Width of synthesized lines in points 1ndash10

Segmentation of Arabic words is quite challenging Itdepends on holistic word as well as the features of singlecharacters and detailed GT are required to perform a usefulvalidation Hence it is reasonable to test this method onsynthetic databases which contain such GT One of theearliest segmentation based approaches suggested for therecognition of Arabic handwritten text is the one proposedby [34] and no segmentation results are reported thoughXiu et al proposed probabilistic segmentation model forthis segmentation approach a tentative contour based oversegmentation is first performed on the text image as a resulta set of what they called graphemes is produced [35] Theapproach differentiates among three types of graphemesTheconfidence of each character is calculated according to theprobabilistic model respecting other factors for examplerecognition output geometric confidence and logical con-straintThe authors experimented the proposedmethodologyon five different test sets achieving 592 success rate

4 Data Acquisition and Generation

To synthesize Arabic handwritten words from glyphs asufficient amount of glyph samples has to be acquired firstIn our case trajectories of single letters and their connections(Kashidas) are used as glyphs The glyphs are acquired withonline techniques since relevant information can be extractedmore efficiently from trajectories than images Neverthelesswe are mainly interested in synthesizing offline data Hencewe decided to use online pens for data acquisition for theycan be applied as ordinary biros in contrast to digital tabletsFifty ormore samples per writer are taken from over hundredletter classes (28046 samples altogether) to built an onlinecharacter database To minimize manual effort and allowan easy extension this database is completely automaticallygenerated from raw data Raw data are trajectories X isin R119898times2

(see Table 2) for each stroke within a virtual DIN A4 pageThat page has a resolution of 1000 dpi and 58 rps (reportsper second) so there are constant timestamps 998779119905 = 119905

119894+1 minus

119905119894

= 00172 s between neighbored (1198941 1198942) isin

X Thegenerated database contains the trajectories and an image

The Scientific World Journal 5

119857

x

(a) 119899 = 10

119857

x

(b) 119899 = 25

Figure 2 The average x and 119903 samples x for the letter Sin in isolated form of writer 1 (a) The number of interpolation steps 119899 = 10 is notsufficient to represent complex characters as Sin () and details will be lost or distorted (b) With 119899 = 25 the approximated samples x arereliable enough to build proper ASMs for all character classes

representation for each Arabic letter class (see Table 1) aswell as the resulting Active Shape Models (ASMs) which aredescribed in the next section Digits and special charactersmight be added in future work

41 Computing Active Shape Models for Generation of ArabicCharacters Active Shape Models (ASMs) are statistical rep-resentations of the approximated shape of an object An ASMuses the distribution of some significant points to store themost important information of many shapes of a class in onesinglemodel Normally somewell-defined landmarks have tobe set manually for all samples and additional intermediatepoints between these landmarks are used if there are notenough landmarks to represent the shape However thedefinition of landmarks for over hundred classes for everywriter is barely realizable and would prevent to add datafrom further writers efficiently This is why we use two givenlandmarks the Start and the End point of each polygonand compute intermediate points by interpolating betweenthe given (

1198941 1198942) of X isin R119898times2 to get polygons X isin

R119899times2 By alternate storing of the 1199091198941 and 119909

1198942 coordinateseach polygon is represented as a single vector of size 2119899x = (11990911 11990912 11990921 11990922 1199091198991 1199091198992)

119879 that is required tobuild ASMs Given the point numbers119898 of the original and 119899of the desired approximated samples we interpolate in sucha way that the time steps 998779

119905= 998779

119905119898119899 between neighbored

interpolated points p119895 p

119895+1 | p119895

= (1199092119895 1199092119895+1) are stillconstant the Euclidean distance howevermay vary Given theoriginal points p isin

X we compute an interpolated point

p119895= (1minus120582

119886) p

1198951015840 +120582

119886p1198951015840+1

with 1198951015840

= lfloor119895998779119905rfloor 998779

119905=

998779119905

998779119905

120582119886= 119895998779

119905minus 119895

1015840

(1)

where 1198951015840 isin 1 119898 and 119895 isin 1 119899 This enables a more detailedmodeling of complex structures as the peaks of Sin () as onecan see in Figures 2 and 3 We set 119899 = 25 which is sufficientto represent even complex Arabic characters like Sin ( )as shown in Figure 2 (in order to speed up the syn-thesis process 119899 could be optimized for each individualclass)

We then scale all samples x keeping their aspect ratio Let119882 be the width and let119867 be the heights of an unscaled x andthen we scale x by 100119909100(119867 lowast 119882) and translate x so thatits center lies within the origin

For each class there are 119903 available vectors fromwhich theASM of the corresponding class is calculated (we set 119903 = 50for our experiments)

To build ASMs the expected value x and the covariancematrix S have to be calculated first

x =

sum119903

119894=1 x119894119903

S =

12119903 minus 1

119903

sum

119894=1(x

119894minus x) (x

119894minus x)119879

(2)

As a consequence of the covariance matrix calculation theEigenvalues 120582

119894and Eigenvectors e

119894can be determined and

then the ASM corresponding to character classes is calcu-lated Now any arbitrary number of vectors that representeach class can be calculated by linear combination

u = x +119903

sum

119895=1119888119895e119895 119888

119895isin [minus2radic120582

119895 2radic120582

119895] (3)

A limitation of 119888119895by plusmn2radic120582

119895assures that all the deviations

of u are within the doubled standard deviation 120590 This is acommon limit since most training samples lie within thisrange In few cases a limit ofmaximalplusmn3radic120582

119895is applied which

6 The Scientific World Journal

(a) u (b) u (B-Spline) (c) x

(d) x (B-Spline) (e) forall119888119895= 0 (f) forall|119888

119895| = 2radic120582

119895

Figure 3 Examples of glyphs (a) examples for ASM-glyph representations u (wheresum |119888119895| asymp sum 16radic120582

119895 see (3)) (b) a B-Spline interpolation

has been applied on the representations (c) (d) original letter samples x A B-Spline interpolation with 5 steps has been applied on (b) and(e) Examples of ASM-glyphs u that are composed to words are shown in (e) and (f) where the influence is minimal (e) and maximal (f)respectively for all eigenvalues

requires a clear increase of 119903 in order to keep u statisticallyreliable

Some examples of x and u are shown in Figure 3 Thecomputation of ASMs is quite costly especially if many sam-ples and interpolation points are used This is why we avoidrecalculations of ASMs at runtime since the synthesizingprocess requires a minimum of 100ASMs Hence all ASMs(including their corresponding online samples) are saved infiles to separate ASM generation from the synthesis module

42 ASMDistance Measure The distance 120575 of a sample x anda representation u of an ASM can be calculated as follows

120575 (x u) = 1119899

119899

sum

119894=1

radic(1199062119894minus1 minus 1199092119894minus1)2+ (1199062119894 minus 1199092119894)

2 (4)

Due to the performed scaling of x 120575(x u) can be interpretedas the approximated deviation in percent For all samples xwe compute the most similar representation ulowast by solving (3)numerically using c as unknown (initially forall119888

119894= 0) Some

examples of ulowast are visualized in Figure 4In contrast to ASMs from offline samples [32] most

online based ASMs are capable of representing their inputsamples well even without manually defined landmarkssince detailed slowly written structures (where landmarksare suspected) are represented by more intermediate pointsThis effect allows an efficient extension and maintenanceof the character database since time consuming manuallandmarking can be avoided

Nonetheless the average 120575 is writer dependent We mea-sured 120575 = 08 for writer 1 120575 = 146 for writer 2 and evenhigher values for the other writers whose handwriting styleis less tidy Furthermore 120575depends on the letter class A high 120575is mainly caused by some classes with diacritics as Zai ( ) thatneed improvement (see Figure 3(c)) The distance between

the letters main body and diacritics can vary clearly whichmay lead to inappropriate ulowast in case that x is unlike x Toreact against this effect more training samples could be usedor diacritics andmain bodies could be separated using ActiveShape Structural Models (ASSM) [16] However our ASMsare meant for synthesis approaches where the use of purenoise (perturbed data) is quite common and hencemoderateimprecision does not spoil the synthesis quality significantly

5 Synthesizing Arabic Handwritings

In the following subsections we describe all methods thatare applied to create synthetic Arabic handwritings fromUnicode using the ASM data from the last Section Oursystem uses these either to show a few specific syntheses forpreview purpose or to generate a complete database includingground truth

The methods which are used to synthesize and renderArabic handwritings are described in the following Sections

51 Composing Words The basic idea of Arabic handwritingsynthesis fromUnicode is to select glyphs with proper shapes(isolated initial end or middle form) and connect themsubsequently to build PAWs words and texts from whichimages or vector graphics are rendered

511 Calculation of the Letter Form Our system receives textas Unicode string that represents every letter as numberSince our samples are limited to the 28 regular letters andTamarbuta ( D ) we substitute special characters as Alif withHamza above (

) with their regular formAlif ( ) before starting

the synthesis Letter forms have a strong influence on theletter shape but they are not given by regular Unicode thusthey have to be determined first

The Scientific World Journal 7

119857

x119854lowast

(a) | 120575 = 096

119857

x119854lowast

(b) J | 120575 = 087

119857

x119854lowast

(c) | 120575 = 56

Figure 4 Examples of ASM based glyph ulowast that has the highest correlation (deviation 120575) with a randomly chosen samples x The averagesample polygon x is displayed to show how strong x differs from the expected shape Some of the ASM for characters with diacritics areproblematic as shown in (c)

Letters of the set Γ2 = (H ) can only assume isolated orend form All other letters such as Ayn() can assume begin-middle- and- as well as isolated- form Ayn (0 1 2 3)Therefore the form f0 of the first letter l0 of a word is

f0 =

i if l0 isin Γ2

b else(5)

Examples of the different letter forms within an Arabic wordare shown in Figure 5 Let f

minus1 be the form of lminus1 which is the

predecessor of letter l and l+1 = define that the successor

of l is a space tab or return token and then the position fof a letter l can be defined as follows

f =

i if fminus1 isin (i e) and (l isin Γ

2or l

+1 = )

b if fminus1 isin (i e) and (l notin Γ

2and l

+1 = )

m if fminus1 isin (bm) and (l notin Γ

2and l

+1 = )

e if fminus1 isin (bm) and (l isin Γ

2or l

+1 = )

(6)

Letters that have only two forms split an Arabic word intoPieces of ArabicWords (PAWs) which consist of one ormoreletters

i

i eb

e mb

Figure 5Outgoing from theUnicode sequence ( H J H JB)

the forms (isolated end middle and begin) of all letters aredetermined ( H H ) and composed to the wordII (New York)

512 Selection of Suitable Glyphs To ensure that the styles ofall neighbored glyphs are similar glyphs of different writerare not mixed within a synthesis We encouraged the writersto write letters only in this style that is dominant for theirwritings and avoid severe rotations The size of the glyphs isnormalized by the average character size we extracted fromthe IESK-arDB However we corrected the size manually incase of rare character classes A suitability measure for theglyph joint points has not been considered since steady jointsare achieved by B-Spline interpolation and rendering at theend of the synthesis process

513 Connecting Glyphs After all letter classes are definedby their names and forms corresponding ASMs are loaded

8 The Scientific World Journal

Input Current PAW A119888 precedent PAW A

119901 average letter width l

119908

Output Shifted current PAW A119888

If Bounding boxes of A119888and A

119901overlap then

while Trajectories of A119888and A

119901intersect do

Translate the 119909 coordinates of A119888by (14)l

119908

Algorithm 1 Solving intersections of neighbored PAWs

(a) Writer 1 (b) Writer 2 (c) Writer 3 (d) Writer 4

Figure 6 The word II (New York) synthesized by the average letter shapes 119909 of different writers

The ASMs are used to generate an unique polygonal rep-resentation u for each occurrence of a letter class in orderto avoid piecewise identical syntheses In order to composewords from these polygons each letter in end or middle formhas to be connected with its predecessor 3 rarr $ 3 I rarr I Let pf be the first point of and pl the last

point of its predecessor and then we can connect them by

translating by pl minus pf An example is shown in Figure 5The relation of a PAWrsquos 119910 coordinate and the baseline

depends on the letter classes the PAW is composed of Thuswe extracted the average 120583

119903and variance 120590

119903of the relative

distance between the baseline and the center of a letter frommanual created ground truth of our (real) word databaseIESK-arDB [4] We set the baseline to 0 and shift all 119910coordinates of each PAW by N(120583

119903 120590

119903) Finally the space

between the rightmost point of a PAW and the leftmostpoint of its predecessor has to be defined Therefore the userdepending parameter 120589 is used that may be negative in orderto simulate overlapping PAWs Given pl and pf the PAW canbe translated by the vector

tpaw = (

1199011198971minus 119901

1198911minus 120589

N (120583119903 120590

119903)

) (7)

In case of intersections between the polygons of overlappingPAWs 120589 is increased iteratively by 25 of the average letterwidth as described in Algorithm 1

Examples of words composed by the average letter shapesof different writers are shown in Figure 6 Examples fromASM based and original samples can be found in Table 3The maximal deviation 120590

119860means that the influence of an

eigenvector e119894is limited by plusmn2radic120582

119894 While letters look similar

using 120590 between 0 and 1 ASM representations u with 120590119860of

2 already provoke increased letter variation ASMs (trainedwith 119903 = 50 samples) are barely capable of representing adeviation of120590

119860= 3 though As amatter of fact there are noise

based deformations as shown in Table 3 (second last row)

This effect might be intended to create especially challengingsyntheses

52 Simulation of Global Variances ASMs already containvariations in slant width or connection size Neverthelessthese variations are limited by the used samples In order toincrease and control these variations affine transformationsare used (scaling translation shearing and rotation) whichallow optional manipulations of letter and PAW shapes Theuser interface (UI) of our synthesis system allows to set theaverage 120583 and variance 120590 of a Gaussian distribution for allaffine transformations Particularly global variations as theslant can be achieved this way The influences of these affinetransformations on the resulting word image is shown inFigure 7

A stretching is performed by scale each 119909 component ofeach letter point by the factor 119888 isin [05 2] The word slantcan be set by shearing the word with an angle of 120572

119904as the

skew of PAW can be manipulated by rotating to the angle120572119903 where 120572

119904 120572

119903isin [minus45∘ +45∘] We analyzed the skew and

slant of samples of the IESK-arDB database [4] with localminima regression and Hough transform We found that theskew correlates with a Gaussian distribution ofN(minus38∘ 71∘)(passed Chi square test with 120572 = 005) The slant can berepresented byN(minus46∘ 144∘)The size of the complete wordor single letters can be adjusted by an equal scaling with119888 isin [01 10] which can be used to control the resolution ofthe synthesized word images or to increase variation of lettersize As described in Section 513 variations of PAWpositionscan be realized by translations Even using the same glyphssynthetic words can assume large variations in shape whenusing affine transformations or cutting connection size asshown in Figure 7

When examining the glyph samples and synthesis wefound that compared to complete handwritings letter con-nections of the acquired samples are extended and evenexcessively (approximately twice as) long in case of writer 1Hence we allow to delete up to 25 of the letter points tosimulate stretched or missed connections which often occur

The Scientific World Journal 9

Table 3 Syntheses using ASMs and sample based glyphs of writer 1

120590119860sim |119888

119895|radic120582

119894Result

0

1

2

3

Samples

(a) Stretching (b) Slant (c) Size (d) Skew (e) Position (f) Connection

Figure 7 Affine transformations and connection shortening on synthetic words

in natural Arabic handwritings In Arabic handwritings somecharacters as Ya ( J ) are sometimes written beneath theirpredecessors As a result they resemble a single characterwhich impedes segmentation and recognition tasks Thiseffect can be simulated by a strong reduction of the Kashidaas shown in Figure 8 However this feature has been not yetentirely implemented since a list of all pairs of letters thattypically show this behaviour needs to be created first

53 Interpolation Since a polygonal letter representationdoes not look natural for vector graphics or images witha scaling factor gt 1 we use interpolation to improve theoutcome Let 119899(u) be the number of points of u and then weuse u as control points to interpolate a curve u By increasingthe interpolation steps 119899(u) can be approximated to theoriginal number of points of a sample X The average lengthof X is 119899( X) = 2668 and hence a tenfold increase 119899(u) =

25 rarr 119899(u) = 250 is generally sufficient to achieve smoothsyntheses To ensure that the above mentioned methodswork efficiently on the compressed representation u theinterpolation step is applied just before rendering or skippedin case of low-resolution synthesis

Our system supports two interpolation methods Piece-wise Cubic hermite-interpolation is 1198621-steady which meansthat only the first derivation of the used interpolation func-tion is steady Therefore hermite-interpolation leads to lesssmooth and accurate results a property that can be used tocreate noisy handwritings [32] (perturbed data technique)State-of-the-art B-Spline interpolation is commonly usedwithin CAD-applications since it is 1198622-steady and leads tosmooth natural curves which can be defined properly bytheir control points as shown in Figure 9 Although the B-Spline curve do not pass through all control points it fitsthe original curve sufficiently when 119899 = 25 control pointsare used Given the measure 120575 of (4) the average distancebetween u and the 119899 closest points of u can be computedUsing a cross-validation with 119896fold = 10 we get 120575(u u) =

045 with a variance of 0058

54 Rendering Handwriting Images The former sectionsdiscussed how to compose and interpolate polygonal rep-resentations of Arabic handwritings Now those have to betransformed into images and saved in common files formats(bmp png etc) which can easily be loaded by most text

10 The Scientific World Journal

(a) (b) (c)

Figure 8 Example for a synthesized letter pair using (a) full (b) half and (c) negative Kashida length

Control points uInterpolated points 119854

(a) B-Spline

Control points uInterpolated points 119854

(b) Cubic

Figure 9 Comparison of B-Spline and Cubic interpolation where 119899(u) = 25 and 119899(u) = 250

recognitions or document analysis systems Even preprocess-ing steps as thinning can influence the performance of thefollowing tasks Such preprocessing is sensitive to secondaryfeatures or flaws which are a result of the used writingmaterials hence the synthesized files should contain thosefeatures too Therefore we propose a rendering techniquethat reflects optical features caused by common pens asball pens or pencils [33] Subsequently a modification ofthis technique is described that allows rendering features ofhistorical handwritings

First of all pixels o have to be found that are closeto polygons u and belong to the foreground As shown inFigure 10(a) we first interpolate between two neighboredpoints p q of u (or u) and get 120588 lowast p minus q new points

o1015840 = ]p+ (1minus ]) q ] isin [0 1] (8)

where ] is uniform distributed and 120588 is a user definedparameter

Let n be the normal vector of line pq and then we shifteach o1015840 along n using a Gaussian distribution

o = o1015840 +N (120583 120590) n (9)

where 120590 and 120583 define the line width which is decreased up to20 in case that p lies between the PenUp or PenDown pointand the neighbored control point As a result the prototype ofa word image has been prepared that defines all pixels whichare influenced by pigments at all (shown in Figure 10(b))To allow sharp contours a limitation of |N(120583 120590)| lt 120603120590

is applied according to the simulated pen where 120603 is userdependent

541 Texture Biros or pencils cause an irregular pigmenta-tion intensity which is reflected by pixel intensities 119868(119909 119910)of scanned images A realistic physical model that simulatesthis behavior in a proper way is beyond the scope of thispaper a more simplified and generalized approach howeveris quite practical Inspired by the ability of Fourier transformbased image compression to represent the main nature ofa texture by a small subset of the underlying frequencieswe define a texture by 10 points (120582 120579 120601) in frequency spacein order to emulate irregularities caused by pen and paperThis way simplified but unique textures can be created atruntime However in contrast to image compression weare not interested in avoiding noise-prone high frequencies

The Scientific World Journal 11

n

p

qoi

(a) (b) (c) (d) (e) Synthetic image (f) Real image

(g) Example text line

Figure 10 Painting technique (a) scheme (b) word shape with 120588 = 6 120590 = 35 (Gaussian filter is disabled) (c-d) example results for paintingtechnique (c) test texture applied on (b) (d) 120588 = 30 120590 = 10 with ball pen texture and (e-f) comparison of natural and synthetic ball pentextures

Hence different high and low frequencies are combined tosimulate regional as well as locale effects (behavior of inkpaper texture) Each point represents a texture layer in imagespace with 1198681(119909 119910) isin [minus1 1] We created several textureclasses by defining different sets of Gaussian distributionsfor the angle 120579 wave length 120582 and phase shift 120601 of alllayers manually Afterwards pixel intensities 1198682(o) isin [0 256]are computed by accumulating most texture layers The leftlayers are used to achieve variations in their intensities bymultiplication Finally an image I with a small margin iscreated and all o are fitted to I subsequently

By creating word syntheses using polygonal glyphs andrendering techniques smooth letter connections can beachieved more efficiently compared to synthesis approachesthat use image based glyphs Furthermore in contrast tothe usage of natural textures the described technique is ableto generate unique nontiled textures for every synthesizedword as shown in Figures 10(c)ndash10(e) Depending on thetexture class a median or Gaussian filter is used before savingthe image

542 Simulation of Feather Like Writing Tools The previousmethod allows a proper simulation of text that is writtenby ball pens pencils or coal on white paper However toallow a more accurate simulation of writing instrumentsas fountains pens or feathers we extended our renderingtechnique This includes mainly the implementation of twofeatures the writing speed and the shape of the top of thewriting instrument further called Pen Shape

Pen Shape If the Pen Shape is modeled as line or ellipsoid theline width of the trajectory u depends not only on the widthof the Pen Shape 119908

119875 but also on its angle 120574

119875and the angle

of the trajectory tangent 120574u We initialize 120574119875= 45∘ changing

it continuously with a maximal deviation of plusmn15∘ This localedeviation is computed by adding two cosine functions wherethe wavelengths phases and amplitudes are redefined byGaussian distributions for each synthesis

According to the texture of a Pen Shape the contactwith the paper and consequently the caused pigmentationcan vary This is simulated by an one-dimensional function

119891(119909119875) | 0 le 119909

119875le 119908

119875that defines the pigmentation potential

for the long axis of the Pen Shape An emphasized exampleinspired by a fountain pen is shown in Figure 11(d)

Binary images can be rendered in a faster way by definingpolygons (here a triangle mesh) that is a result of extrudingan one-dimensional Pen Shape along u or u A visualizationof this can be found in Figure 11(c) and a resulting synthesisis shown in Figure 11(h) These polygons can then be drawnby standard routines If the angle of the Pen Shape and theline is identical or so close where the polygon width wouldbe smaller than one pixel a line have to be drawn instead toavoid letter fragmentation

Writing Speed Large lines or bows as the left part of Sin() are usually written faster thanmore complex structuresA high writing speed often causes a lack of pigmentationthat leads to brighter or dappled lines However there is noneed to reconstruct writing speed for the used online lettersamples already that contain such information From eachrepresentation u we can extract the relative local writingspeed for ASMs representations in points per second

V (119894) pts =1003817100381710038171003817(2119894minus1 2119894) minus (2119894+1 2119894+2)

1003817100381710038171003817pt

(119899 (u) 119899 (u)) Δ119905s

1 le 119894 le 119899 (u) (10)

In order to estimate the expected pigmentation intensitywe use the normalized writing speed V isin [0 1] where V = 0is the slowest and V = 1 is the fastest part of the trajectory ofa synthesis If c0 is the current color of a pixel in RGB colorspace and c

119901is the color of the pen pigment then the new

color is computed by

c = c119901120572119886+ c0120572119887 (1minus120572119886) c isin R

3 (11)

where 120572119886

= 08(1 minus V) + 02 defines opacity of c119901and

120572119887

= 1 defines the opacity of the background Althoughpigments that are used for handwritings are typically full orsemiopaque reduction of pigmentation caused by increasedwriting speed can lead to transparency This is simulated byreducing 120572

119886 as shown in Figure 11(e)

12 The Scientific World Journal

(a) u (b) u (B-Spline) (c) u (polygon mesh) (d) Pen shape (e) Speed (f)

(g) Example of a synthesized text line

(h) Example of a synthesized text line (fast method for binary images)

Figure 11 From the polygon u to a synthetic image that simulates a feather like writing instrument (c) Polygon mesh created from u that isused for fast rendering of binary images

To ensure a steady behavior we interpolate the speed ofconnected letters For the first 119899(u)4 points (2119894minus1 2119894)we setthe speed V of a letter in middle or end form to

V (119894) = V (119894) [1minus120582119894] + V

119887(119899 (u)) 120582

119894

120582119894= 4 119894

119899 (u) 119894 le

14119899 (u)

(12)

where V119887(119899(u)) is the speed at the end of the previous letter

The effect on the synthesis is shown in Figure 11(d)

Render on Degraded Background Finally we createFigure 11(f) by combining our texture rendering techniqueof Section 541 with the one based on Pen Shape and writingspeed using a nonuniform background Therefore weapplied a transparent texture on all pixels that does notbelong to the background texture This way small randomirregularity is simulated

In the shown examples a black color is used as mostdocuments are written with dark ink (like iron oxide or soot)Pigmentation intensity is implemented as transparencywhich allows simulating pigment accumulation at crossinglines or in case of a textured background However alsocolored opaque or semiopaque ink can be simulated Thismight be interesting in the context of historical documentssince important passages are often highlighted by using redink Another important feature of historical documents isdegradation of paper or parchment Currently we simplyuse images of natural paper or parchment as backgroundtextures which are scaled or tiled in case where they aresmaller than the synthesized document

55 Generation of Text Pages Recently not only characteror word recognition but also more complex document anal-ysis issues that address the interpretation or recognition of

complete documents become a focus of Arabic handwritingresearch Hence we investigate the possibilities of text pagesynthesis In this regard the accurate simulation of thelower baselines is crucial Many problems that occur whiledetecting lines words or connected components depend onthese baselines as for instance assigning diacritics (that arevery close to more than one text lines) to their correspondingPAW

Our approach of simulating baselines has three stepsFirst of all we set the coordinates (1199090 1199100) of the first letter foreach line Secondly the curvatures of the baselines have to becomputed Thirdly potential intersection of words have to besolved

Start PAWs Due to the style of Arabic handwritings alllines start at the rightmost 119909-coordinate 1199090 = 119909max Thevertical space between two neighbored lines can be definedas percentage of the average PAW heights to get 1199100 for eachbaseline

Baselines We implement the second step by declaring func-tions 119891(119909 1199100) that define the curvatures of the simulatedBaselines Ξ

119904(1199100 defines the initial heights of a line) We

normalize 1199100 isin [0 1] inside 119891(119909 1199100) so it becomes

independent of the page size How to compute proper 119891119894is

explained in Section 56Let l119903 define the lower right of a letters bounding box then

we first translate the letter l towards the baseline so that l119903touches it Subsequently the119910-position of lmust be correctedaccording to its class by translating it by t

119887 so that l119903 might

be above or below 119891(119897119903

119909 1199100) as shown in Figure 12Therefore

we extracted the normalized statistical relation N119887between

l119903 and the baseline from the IESK-arDB for all letter classes If119897ℎ is the heights and l119894 is the 119894th point of l we can compute t

119887=

(0 119897ℎN119887)119879 and l1015840119894 = l119894 + t

119887as shown in Figure 12 We perform

this for every first letter l119891of a PAW Apart from the position

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 3: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

The Scientific World Journal 3

Table 1 Arabic alphabet Naskh style

i e m bAlif Ba Ta Tha Jim Ha Kha Dal Thal Ra $Zai $Sin amp (Shin amp (Sad ) + Dhad ) + Taa - Dha - Ayn 0 1 2 3Ghayn 0 1 2 3Fa 4 5 6 7Qaf 8 9 6 7Kaf Lam lt = gt Mim 13 ANun B C He D E F GWaw H IYa J K

(7) Some letters likeTha ( ) Ya (J ) or Jim ( ) have oneto three dots above under or within their ldquobodyrdquo

(8) Some letters like Ba ( ) Ta ( ) and Tha ( ) onlydiffer because of these dots

3 Related Work

There are several applications of text synthesis such as wordspotting CAPTCHAs character recognition improvementcalligraphy and others [2] Accordingly there are differentapproaches of synthesis In the literature research addressingthe issue of synthetic text generation can be classified intotwo main categories top-down and bottom-up approachesBoth can be either based on offline or online techniques

according to the available samples and applications Top-down approaches are typically based on neuromuscularmod-els that simulate the writing process itself [7 8] Thereforescript trajectories are seen as a result of character key points(built by the human brain when learning how to write)the writing speed character size and inertia which finallyleads to the curvature of handwritings These approaches arefocused more on the physical aspects of writing than theactual handwriting sample outcome One typical applicationis to investigate diseases as Parkinson or Alzheimer thatinfluence handwriting abilities [9]

Bottom-up approaches on the contrary model the shape(and possibly texture) of handwritings itself Hence bottom-up approaches are preferred in context of text recognitiontask like segmentation or handwriting recognition Bottom-up approaches can be further categorized into generation ofnew samples of the same level and concatenation to morecomplex outcomes such as words that are composed fromcharacters or glyphs [10]

A common generation technique is data perturbationwhich is performed by adding noise to online or offlinesamples Samples might be complete units as text lines orwords but single characters or glyphs (as syllables ligaturesor modified letters) are used mostly [11] In case of lettersor glyphs noise is often achieved by degradation of offlineor online samples or random displacement of trajectoriestransformations as shearing scaling or rotation are favoredfor perturbing words or text lines Another generation tech-nique is sample fusion that blends two or a couple of samplesto produce new hybrid ones [12 13] A better statisticalrelevance can be achieved using model based generation [1415] This initially requires the creation of deformable modelswhich represent a class by a flexible shape Deformablemodels are often based on statistical information that mustbe extracted from sufficient samples (usually on characterlevel) Then unlimited new representations of the samemodel class can be generated At the same time deformablemodels are capable of generating more realistic variancesthan data perturbation which closely depict the peculiar-ities of the letter class Examples for deformable modelsare Active Shape Models (ASMs) and novel Active ShapeStructural Models (ASSMs) which are used for generatingvariances of simple drawings and signatures [16] ASMsare also applied for the classification of Chinese letters[17]

Since documents in Latin based script might be hand-printed concatenation of such handwriting samples to unitsof higher levels can be done without connecting the samples[10] Proper simulation of cursive handwriting requires atleast partially connection though There are approaches thatconnect offline samples directly [18] and those who usepolynomial [19] spline [20 21] or probabilistic models [22]Due to the semi cursive style connecting ismandatory in caseof Arabic script

Systems using the described techniques to synthesizehandwritings have been built for different scripts and pur-poses Wang et al [23] proposed a learning based approachto synthesize cursive handwriting by combining shape and

4 The Scientific World Journal

physical models Thomas et al [24] have proposed syn-thetic handwriting method for generation of CAPTCHAsrsquo(completely automated public Turing test to tell computersand humans apart) text lines After segmentation samplesfor each letter are generated using shape models In thesynthesis process a delta log-normal function is used tocompose smooth and natural cursive handwriting Multipleapproaches specific to Latin script that are based on polyno-mial merging functions and Bezier curves have been docu-mented in [20] Miyao and Maruyama [25] have proposeda method to improve offline Japanese Hiragana characterclassification using virtual examples synthesized from anonline character database

In contrast to word synthesizing little research has beendone concerning text line paragraph or document synthesisIf synthesis of multiple text lines is considered at all itis typically modeled as horizontal baselines that may beinfluenced by noise [21] or each baseline line is definedby a rotation angle [10] Varga et al [26 27] presenteda method for handwritten English text line synthesizingtheir methodology starts by composing static image of thetext line by perturbing and chaining of character tem-plates Then text line is drawn using overlapping strokesand delta-lognormal velocity profiles as stated by delta-lognormal theory Chaudhuri and Kundu proposed a systemto synthesize handwritten Bangla script pages [28] Forpage layout simulation they compute Gaussian distributionsfrom natural text pages to model different features namelyleft margin angle line orientation interline gap and lineundulation

Due to the characteristics if Arabic script which werediscussed in Section 2 existing systems and methods cannot be directly used for Arabic Margner and Pechwitz[29] suggest an image based perturbation approach for thegeneration of synthetic printedArabicwordsThey add globalnoise of different degrees simulating degradation as artifactwhich are caused by repeated copying As for the problemof automatic synthesis of offline handwritten Arabic textto the best of our knowledge Elarian et al [3 30] are thefirst who published research work addressing this problemso far They propose a straightforward approach to composearbitrary Arabic words The approach starts by generating afinite set of letter images from two different writers manuallysegmented from IFNENIT database and then two kinds ofsimple features (width and direction feature) are extractedso they can be used later as a metrics in the concatenationstep Saabni and El-Sana proposed a system to synthesizePieces of Arabic Words (PAW) (without diacritics) [31]They use digital tablets to acquire online samples whichare randomly composed to PAWs Thereafter a subset of theproduced synthetic data is selected by clustering techniquesto get a compact database In [32] we proposed a systemto generate Arabic letter shapes by ASMs built from offlinesamples Subsequently we developed a system to renderimages of Arabic handwritten words concatenating ASMbased samples and using transformations on word level asoptional second generation step [33]

Table 2 Parameters and tresholds

Parameter Explanation Value

119903Number of samples used to computean ASM 50

119898Number of points of letter sampletrajectory x before approximation 119898 = 2668

119899Number of points of a approximatedsample x 25

120589 Controlling the space between words user defined120572119903 Word rotation plusmn45∘

120572119904 Word slant plusmn45∘

120603Controlling the sharpness of synthesiscontours 0ndash10

120596119875 Width of synthesized lines in points 1ndash10

Segmentation of Arabic words is quite challenging Itdepends on holistic word as well as the features of singlecharacters and detailed GT are required to perform a usefulvalidation Hence it is reasonable to test this method onsynthetic databases which contain such GT One of theearliest segmentation based approaches suggested for therecognition of Arabic handwritten text is the one proposedby [34] and no segmentation results are reported thoughXiu et al proposed probabilistic segmentation model forthis segmentation approach a tentative contour based oversegmentation is first performed on the text image as a resulta set of what they called graphemes is produced [35] Theapproach differentiates among three types of graphemesTheconfidence of each character is calculated according to theprobabilistic model respecting other factors for examplerecognition output geometric confidence and logical con-straintThe authors experimented the proposedmethodologyon five different test sets achieving 592 success rate

4 Data Acquisition and Generation

To synthesize Arabic handwritten words from glyphs asufficient amount of glyph samples has to be acquired firstIn our case trajectories of single letters and their connections(Kashidas) are used as glyphs The glyphs are acquired withonline techniques since relevant information can be extractedmore efficiently from trajectories than images Neverthelesswe are mainly interested in synthesizing offline data Hencewe decided to use online pens for data acquisition for theycan be applied as ordinary biros in contrast to digital tabletsFifty ormore samples per writer are taken from over hundredletter classes (28046 samples altogether) to built an onlinecharacter database To minimize manual effort and allowan easy extension this database is completely automaticallygenerated from raw data Raw data are trajectories X isin R119898times2

(see Table 2) for each stroke within a virtual DIN A4 pageThat page has a resolution of 1000 dpi and 58 rps (reportsper second) so there are constant timestamps 998779119905 = 119905

119894+1 minus

119905119894

= 00172 s between neighbored (1198941 1198942) isin

X Thegenerated database contains the trajectories and an image

The Scientific World Journal 5

119857

x

(a) 119899 = 10

119857

x

(b) 119899 = 25

Figure 2 The average x and 119903 samples x for the letter Sin in isolated form of writer 1 (a) The number of interpolation steps 119899 = 10 is notsufficient to represent complex characters as Sin () and details will be lost or distorted (b) With 119899 = 25 the approximated samples x arereliable enough to build proper ASMs for all character classes

representation for each Arabic letter class (see Table 1) aswell as the resulting Active Shape Models (ASMs) which aredescribed in the next section Digits and special charactersmight be added in future work

41 Computing Active Shape Models for Generation of ArabicCharacters Active Shape Models (ASMs) are statistical rep-resentations of the approximated shape of an object An ASMuses the distribution of some significant points to store themost important information of many shapes of a class in onesinglemodel Normally somewell-defined landmarks have tobe set manually for all samples and additional intermediatepoints between these landmarks are used if there are notenough landmarks to represent the shape However thedefinition of landmarks for over hundred classes for everywriter is barely realizable and would prevent to add datafrom further writers efficiently This is why we use two givenlandmarks the Start and the End point of each polygonand compute intermediate points by interpolating betweenthe given (

1198941 1198942) of X isin R119898times2 to get polygons X isin

R119899times2 By alternate storing of the 1199091198941 and 119909

1198942 coordinateseach polygon is represented as a single vector of size 2119899x = (11990911 11990912 11990921 11990922 1199091198991 1199091198992)

119879 that is required tobuild ASMs Given the point numbers119898 of the original and 119899of the desired approximated samples we interpolate in sucha way that the time steps 998779

119905= 998779

119905119898119899 between neighbored

interpolated points p119895 p

119895+1 | p119895

= (1199092119895 1199092119895+1) are stillconstant the Euclidean distance howevermay vary Given theoriginal points p isin

X we compute an interpolated point

p119895= (1minus120582

119886) p

1198951015840 +120582

119886p1198951015840+1

with 1198951015840

= lfloor119895998779119905rfloor 998779

119905=

998779119905

998779119905

120582119886= 119895998779

119905minus 119895

1015840

(1)

where 1198951015840 isin 1 119898 and 119895 isin 1 119899 This enables a more detailedmodeling of complex structures as the peaks of Sin () as onecan see in Figures 2 and 3 We set 119899 = 25 which is sufficientto represent even complex Arabic characters like Sin ( )as shown in Figure 2 (in order to speed up the syn-thesis process 119899 could be optimized for each individualclass)

We then scale all samples x keeping their aspect ratio Let119882 be the width and let119867 be the heights of an unscaled x andthen we scale x by 100119909100(119867 lowast 119882) and translate x so thatits center lies within the origin

For each class there are 119903 available vectors fromwhich theASM of the corresponding class is calculated (we set 119903 = 50for our experiments)

To build ASMs the expected value x and the covariancematrix S have to be calculated first

x =

sum119903

119894=1 x119894119903

S =

12119903 minus 1

119903

sum

119894=1(x

119894minus x) (x

119894minus x)119879

(2)

As a consequence of the covariance matrix calculation theEigenvalues 120582

119894and Eigenvectors e

119894can be determined and

then the ASM corresponding to character classes is calcu-lated Now any arbitrary number of vectors that representeach class can be calculated by linear combination

u = x +119903

sum

119895=1119888119895e119895 119888

119895isin [minus2radic120582

119895 2radic120582

119895] (3)

A limitation of 119888119895by plusmn2radic120582

119895assures that all the deviations

of u are within the doubled standard deviation 120590 This is acommon limit since most training samples lie within thisrange In few cases a limit ofmaximalplusmn3radic120582

119895is applied which

6 The Scientific World Journal

(a) u (b) u (B-Spline) (c) x

(d) x (B-Spline) (e) forall119888119895= 0 (f) forall|119888

119895| = 2radic120582

119895

Figure 3 Examples of glyphs (a) examples for ASM-glyph representations u (wheresum |119888119895| asymp sum 16radic120582

119895 see (3)) (b) a B-Spline interpolation

has been applied on the representations (c) (d) original letter samples x A B-Spline interpolation with 5 steps has been applied on (b) and(e) Examples of ASM-glyphs u that are composed to words are shown in (e) and (f) where the influence is minimal (e) and maximal (f)respectively for all eigenvalues

requires a clear increase of 119903 in order to keep u statisticallyreliable

Some examples of x and u are shown in Figure 3 Thecomputation of ASMs is quite costly especially if many sam-ples and interpolation points are used This is why we avoidrecalculations of ASMs at runtime since the synthesizingprocess requires a minimum of 100ASMs Hence all ASMs(including their corresponding online samples) are saved infiles to separate ASM generation from the synthesis module

42 ASMDistance Measure The distance 120575 of a sample x anda representation u of an ASM can be calculated as follows

120575 (x u) = 1119899

119899

sum

119894=1

radic(1199062119894minus1 minus 1199092119894minus1)2+ (1199062119894 minus 1199092119894)

2 (4)

Due to the performed scaling of x 120575(x u) can be interpretedas the approximated deviation in percent For all samples xwe compute the most similar representation ulowast by solving (3)numerically using c as unknown (initially forall119888

119894= 0) Some

examples of ulowast are visualized in Figure 4In contrast to ASMs from offline samples [32] most

online based ASMs are capable of representing their inputsamples well even without manually defined landmarkssince detailed slowly written structures (where landmarksare suspected) are represented by more intermediate pointsThis effect allows an efficient extension and maintenanceof the character database since time consuming manuallandmarking can be avoided

Nonetheless the average 120575 is writer dependent We mea-sured 120575 = 08 for writer 1 120575 = 146 for writer 2 and evenhigher values for the other writers whose handwriting styleis less tidy Furthermore 120575depends on the letter class A high 120575is mainly caused by some classes with diacritics as Zai ( ) thatneed improvement (see Figure 3(c)) The distance between

the letters main body and diacritics can vary clearly whichmay lead to inappropriate ulowast in case that x is unlike x Toreact against this effect more training samples could be usedor diacritics andmain bodies could be separated using ActiveShape Structural Models (ASSM) [16] However our ASMsare meant for synthesis approaches where the use of purenoise (perturbed data) is quite common and hencemoderateimprecision does not spoil the synthesis quality significantly

5 Synthesizing Arabic Handwritings

In the following subsections we describe all methods thatare applied to create synthetic Arabic handwritings fromUnicode using the ASM data from the last Section Oursystem uses these either to show a few specific syntheses forpreview purpose or to generate a complete database includingground truth

The methods which are used to synthesize and renderArabic handwritings are described in the following Sections

51 Composing Words The basic idea of Arabic handwritingsynthesis fromUnicode is to select glyphs with proper shapes(isolated initial end or middle form) and connect themsubsequently to build PAWs words and texts from whichimages or vector graphics are rendered

511 Calculation of the Letter Form Our system receives textas Unicode string that represents every letter as numberSince our samples are limited to the 28 regular letters andTamarbuta ( D ) we substitute special characters as Alif withHamza above (

) with their regular formAlif ( ) before starting

the synthesis Letter forms have a strong influence on theletter shape but they are not given by regular Unicode thusthey have to be determined first

The Scientific World Journal 7

119857

x119854lowast

(a) | 120575 = 096

119857

x119854lowast

(b) J | 120575 = 087

119857

x119854lowast

(c) | 120575 = 56

Figure 4 Examples of ASM based glyph ulowast that has the highest correlation (deviation 120575) with a randomly chosen samples x The averagesample polygon x is displayed to show how strong x differs from the expected shape Some of the ASM for characters with diacritics areproblematic as shown in (c)

Letters of the set Γ2 = (H ) can only assume isolated orend form All other letters such as Ayn() can assume begin-middle- and- as well as isolated- form Ayn (0 1 2 3)Therefore the form f0 of the first letter l0 of a word is

f0 =

i if l0 isin Γ2

b else(5)

Examples of the different letter forms within an Arabic wordare shown in Figure 5 Let f

minus1 be the form of lminus1 which is the

predecessor of letter l and l+1 = define that the successor

of l is a space tab or return token and then the position fof a letter l can be defined as follows

f =

i if fminus1 isin (i e) and (l isin Γ

2or l

+1 = )

b if fminus1 isin (i e) and (l notin Γ

2and l

+1 = )

m if fminus1 isin (bm) and (l notin Γ

2and l

+1 = )

e if fminus1 isin (bm) and (l isin Γ

2or l

+1 = )

(6)

Letters that have only two forms split an Arabic word intoPieces of ArabicWords (PAWs) which consist of one ormoreletters

i

i eb

e mb

Figure 5Outgoing from theUnicode sequence ( H J H JB)

the forms (isolated end middle and begin) of all letters aredetermined ( H H ) and composed to the wordII (New York)

512 Selection of Suitable Glyphs To ensure that the styles ofall neighbored glyphs are similar glyphs of different writerare not mixed within a synthesis We encouraged the writersto write letters only in this style that is dominant for theirwritings and avoid severe rotations The size of the glyphs isnormalized by the average character size we extracted fromthe IESK-arDB However we corrected the size manually incase of rare character classes A suitability measure for theglyph joint points has not been considered since steady jointsare achieved by B-Spline interpolation and rendering at theend of the synthesis process

513 Connecting Glyphs After all letter classes are definedby their names and forms corresponding ASMs are loaded

8 The Scientific World Journal

Input Current PAW A119888 precedent PAW A

119901 average letter width l

119908

Output Shifted current PAW A119888

If Bounding boxes of A119888and A

119901overlap then

while Trajectories of A119888and A

119901intersect do

Translate the 119909 coordinates of A119888by (14)l

119908

Algorithm 1 Solving intersections of neighbored PAWs

(a) Writer 1 (b) Writer 2 (c) Writer 3 (d) Writer 4

Figure 6 The word II (New York) synthesized by the average letter shapes 119909 of different writers

The ASMs are used to generate an unique polygonal rep-resentation u for each occurrence of a letter class in orderto avoid piecewise identical syntheses In order to composewords from these polygons each letter in end or middle formhas to be connected with its predecessor 3 rarr $ 3 I rarr I Let pf be the first point of and pl the last

point of its predecessor and then we can connect them by

translating by pl minus pf An example is shown in Figure 5The relation of a PAWrsquos 119910 coordinate and the baseline

depends on the letter classes the PAW is composed of Thuswe extracted the average 120583

119903and variance 120590

119903of the relative

distance between the baseline and the center of a letter frommanual created ground truth of our (real) word databaseIESK-arDB [4] We set the baseline to 0 and shift all 119910coordinates of each PAW by N(120583

119903 120590

119903) Finally the space

between the rightmost point of a PAW and the leftmostpoint of its predecessor has to be defined Therefore the userdepending parameter 120589 is used that may be negative in orderto simulate overlapping PAWs Given pl and pf the PAW canbe translated by the vector

tpaw = (

1199011198971minus 119901

1198911minus 120589

N (120583119903 120590

119903)

) (7)

In case of intersections between the polygons of overlappingPAWs 120589 is increased iteratively by 25 of the average letterwidth as described in Algorithm 1

Examples of words composed by the average letter shapesof different writers are shown in Figure 6 Examples fromASM based and original samples can be found in Table 3The maximal deviation 120590

119860means that the influence of an

eigenvector e119894is limited by plusmn2radic120582

119894 While letters look similar

using 120590 between 0 and 1 ASM representations u with 120590119860of

2 already provoke increased letter variation ASMs (trainedwith 119903 = 50 samples) are barely capable of representing adeviation of120590

119860= 3 though As amatter of fact there are noise

based deformations as shown in Table 3 (second last row)

This effect might be intended to create especially challengingsyntheses

52 Simulation of Global Variances ASMs already containvariations in slant width or connection size Neverthelessthese variations are limited by the used samples In order toincrease and control these variations affine transformationsare used (scaling translation shearing and rotation) whichallow optional manipulations of letter and PAW shapes Theuser interface (UI) of our synthesis system allows to set theaverage 120583 and variance 120590 of a Gaussian distribution for allaffine transformations Particularly global variations as theslant can be achieved this way The influences of these affinetransformations on the resulting word image is shown inFigure 7

A stretching is performed by scale each 119909 component ofeach letter point by the factor 119888 isin [05 2] The word slantcan be set by shearing the word with an angle of 120572

119904as the

skew of PAW can be manipulated by rotating to the angle120572119903 where 120572

119904 120572

119903isin [minus45∘ +45∘] We analyzed the skew and

slant of samples of the IESK-arDB database [4] with localminima regression and Hough transform We found that theskew correlates with a Gaussian distribution ofN(minus38∘ 71∘)(passed Chi square test with 120572 = 005) The slant can berepresented byN(minus46∘ 144∘)The size of the complete wordor single letters can be adjusted by an equal scaling with119888 isin [01 10] which can be used to control the resolution ofthe synthesized word images or to increase variation of lettersize As described in Section 513 variations of PAWpositionscan be realized by translations Even using the same glyphssynthetic words can assume large variations in shape whenusing affine transformations or cutting connection size asshown in Figure 7

When examining the glyph samples and synthesis wefound that compared to complete handwritings letter con-nections of the acquired samples are extended and evenexcessively (approximately twice as) long in case of writer 1Hence we allow to delete up to 25 of the letter points tosimulate stretched or missed connections which often occur

The Scientific World Journal 9

Table 3 Syntheses using ASMs and sample based glyphs of writer 1

120590119860sim |119888

119895|radic120582

119894Result

0

1

2

3

Samples

(a) Stretching (b) Slant (c) Size (d) Skew (e) Position (f) Connection

Figure 7 Affine transformations and connection shortening on synthetic words

in natural Arabic handwritings In Arabic handwritings somecharacters as Ya ( J ) are sometimes written beneath theirpredecessors As a result they resemble a single characterwhich impedes segmentation and recognition tasks Thiseffect can be simulated by a strong reduction of the Kashidaas shown in Figure 8 However this feature has been not yetentirely implemented since a list of all pairs of letters thattypically show this behaviour needs to be created first

53 Interpolation Since a polygonal letter representationdoes not look natural for vector graphics or images witha scaling factor gt 1 we use interpolation to improve theoutcome Let 119899(u) be the number of points of u and then weuse u as control points to interpolate a curve u By increasingthe interpolation steps 119899(u) can be approximated to theoriginal number of points of a sample X The average lengthof X is 119899( X) = 2668 and hence a tenfold increase 119899(u) =

25 rarr 119899(u) = 250 is generally sufficient to achieve smoothsyntheses To ensure that the above mentioned methodswork efficiently on the compressed representation u theinterpolation step is applied just before rendering or skippedin case of low-resolution synthesis

Our system supports two interpolation methods Piece-wise Cubic hermite-interpolation is 1198621-steady which meansthat only the first derivation of the used interpolation func-tion is steady Therefore hermite-interpolation leads to lesssmooth and accurate results a property that can be used tocreate noisy handwritings [32] (perturbed data technique)State-of-the-art B-Spline interpolation is commonly usedwithin CAD-applications since it is 1198622-steady and leads tosmooth natural curves which can be defined properly bytheir control points as shown in Figure 9 Although the B-Spline curve do not pass through all control points it fitsthe original curve sufficiently when 119899 = 25 control pointsare used Given the measure 120575 of (4) the average distancebetween u and the 119899 closest points of u can be computedUsing a cross-validation with 119896fold = 10 we get 120575(u u) =

045 with a variance of 0058

54 Rendering Handwriting Images The former sectionsdiscussed how to compose and interpolate polygonal rep-resentations of Arabic handwritings Now those have to betransformed into images and saved in common files formats(bmp png etc) which can easily be loaded by most text

10 The Scientific World Journal

(a) (b) (c)

Figure 8 Example for a synthesized letter pair using (a) full (b) half and (c) negative Kashida length

Control points uInterpolated points 119854

(a) B-Spline

Control points uInterpolated points 119854

(b) Cubic

Figure 9 Comparison of B-Spline and Cubic interpolation where 119899(u) = 25 and 119899(u) = 250

recognitions or document analysis systems Even preprocess-ing steps as thinning can influence the performance of thefollowing tasks Such preprocessing is sensitive to secondaryfeatures or flaws which are a result of the used writingmaterials hence the synthesized files should contain thosefeatures too Therefore we propose a rendering techniquethat reflects optical features caused by common pens asball pens or pencils [33] Subsequently a modification ofthis technique is described that allows rendering features ofhistorical handwritings

First of all pixels o have to be found that are closeto polygons u and belong to the foreground As shown inFigure 10(a) we first interpolate between two neighboredpoints p q of u (or u) and get 120588 lowast p minus q new points

o1015840 = ]p+ (1minus ]) q ] isin [0 1] (8)

where ] is uniform distributed and 120588 is a user definedparameter

Let n be the normal vector of line pq and then we shifteach o1015840 along n using a Gaussian distribution

o = o1015840 +N (120583 120590) n (9)

where 120590 and 120583 define the line width which is decreased up to20 in case that p lies between the PenUp or PenDown pointand the neighbored control point As a result the prototype ofa word image has been prepared that defines all pixels whichare influenced by pigments at all (shown in Figure 10(b))To allow sharp contours a limitation of |N(120583 120590)| lt 120603120590

is applied according to the simulated pen where 120603 is userdependent

541 Texture Biros or pencils cause an irregular pigmenta-tion intensity which is reflected by pixel intensities 119868(119909 119910)of scanned images A realistic physical model that simulatesthis behavior in a proper way is beyond the scope of thispaper a more simplified and generalized approach howeveris quite practical Inspired by the ability of Fourier transformbased image compression to represent the main nature ofa texture by a small subset of the underlying frequencieswe define a texture by 10 points (120582 120579 120601) in frequency spacein order to emulate irregularities caused by pen and paperThis way simplified but unique textures can be created atruntime However in contrast to image compression weare not interested in avoiding noise-prone high frequencies

The Scientific World Journal 11

n

p

qoi

(a) (b) (c) (d) (e) Synthetic image (f) Real image

(g) Example text line

Figure 10 Painting technique (a) scheme (b) word shape with 120588 = 6 120590 = 35 (Gaussian filter is disabled) (c-d) example results for paintingtechnique (c) test texture applied on (b) (d) 120588 = 30 120590 = 10 with ball pen texture and (e-f) comparison of natural and synthetic ball pentextures

Hence different high and low frequencies are combined tosimulate regional as well as locale effects (behavior of inkpaper texture) Each point represents a texture layer in imagespace with 1198681(119909 119910) isin [minus1 1] We created several textureclasses by defining different sets of Gaussian distributionsfor the angle 120579 wave length 120582 and phase shift 120601 of alllayers manually Afterwards pixel intensities 1198682(o) isin [0 256]are computed by accumulating most texture layers The leftlayers are used to achieve variations in their intensities bymultiplication Finally an image I with a small margin iscreated and all o are fitted to I subsequently

By creating word syntheses using polygonal glyphs andrendering techniques smooth letter connections can beachieved more efficiently compared to synthesis approachesthat use image based glyphs Furthermore in contrast tothe usage of natural textures the described technique is ableto generate unique nontiled textures for every synthesizedword as shown in Figures 10(c)ndash10(e) Depending on thetexture class a median or Gaussian filter is used before savingthe image

542 Simulation of Feather Like Writing Tools The previousmethod allows a proper simulation of text that is writtenby ball pens pencils or coal on white paper However toallow a more accurate simulation of writing instrumentsas fountains pens or feathers we extended our renderingtechnique This includes mainly the implementation of twofeatures the writing speed and the shape of the top of thewriting instrument further called Pen Shape

Pen Shape If the Pen Shape is modeled as line or ellipsoid theline width of the trajectory u depends not only on the widthof the Pen Shape 119908

119875 but also on its angle 120574

119875and the angle

of the trajectory tangent 120574u We initialize 120574119875= 45∘ changing

it continuously with a maximal deviation of plusmn15∘ This localedeviation is computed by adding two cosine functions wherethe wavelengths phases and amplitudes are redefined byGaussian distributions for each synthesis

According to the texture of a Pen Shape the contactwith the paper and consequently the caused pigmentationcan vary This is simulated by an one-dimensional function

119891(119909119875) | 0 le 119909

119875le 119908

119875that defines the pigmentation potential

for the long axis of the Pen Shape An emphasized exampleinspired by a fountain pen is shown in Figure 11(d)

Binary images can be rendered in a faster way by definingpolygons (here a triangle mesh) that is a result of extrudingan one-dimensional Pen Shape along u or u A visualizationof this can be found in Figure 11(c) and a resulting synthesisis shown in Figure 11(h) These polygons can then be drawnby standard routines If the angle of the Pen Shape and theline is identical or so close where the polygon width wouldbe smaller than one pixel a line have to be drawn instead toavoid letter fragmentation

Writing Speed Large lines or bows as the left part of Sin() are usually written faster thanmore complex structuresA high writing speed often causes a lack of pigmentationthat leads to brighter or dappled lines However there is noneed to reconstruct writing speed for the used online lettersamples already that contain such information From eachrepresentation u we can extract the relative local writingspeed for ASMs representations in points per second

V (119894) pts =1003817100381710038171003817(2119894minus1 2119894) minus (2119894+1 2119894+2)

1003817100381710038171003817pt

(119899 (u) 119899 (u)) Δ119905s

1 le 119894 le 119899 (u) (10)

In order to estimate the expected pigmentation intensitywe use the normalized writing speed V isin [0 1] where V = 0is the slowest and V = 1 is the fastest part of the trajectory ofa synthesis If c0 is the current color of a pixel in RGB colorspace and c

119901is the color of the pen pigment then the new

color is computed by

c = c119901120572119886+ c0120572119887 (1minus120572119886) c isin R

3 (11)

where 120572119886

= 08(1 minus V) + 02 defines opacity of c119901and

120572119887

= 1 defines the opacity of the background Althoughpigments that are used for handwritings are typically full orsemiopaque reduction of pigmentation caused by increasedwriting speed can lead to transparency This is simulated byreducing 120572

119886 as shown in Figure 11(e)

12 The Scientific World Journal

(a) u (b) u (B-Spline) (c) u (polygon mesh) (d) Pen shape (e) Speed (f)

(g) Example of a synthesized text line

(h) Example of a synthesized text line (fast method for binary images)

Figure 11 From the polygon u to a synthetic image that simulates a feather like writing instrument (c) Polygon mesh created from u that isused for fast rendering of binary images

To ensure a steady behavior we interpolate the speed ofconnected letters For the first 119899(u)4 points (2119894minus1 2119894)we setthe speed V of a letter in middle or end form to

V (119894) = V (119894) [1minus120582119894] + V

119887(119899 (u)) 120582

119894

120582119894= 4 119894

119899 (u) 119894 le

14119899 (u)

(12)

where V119887(119899(u)) is the speed at the end of the previous letter

The effect on the synthesis is shown in Figure 11(d)

Render on Degraded Background Finally we createFigure 11(f) by combining our texture rendering techniqueof Section 541 with the one based on Pen Shape and writingspeed using a nonuniform background Therefore weapplied a transparent texture on all pixels that does notbelong to the background texture This way small randomirregularity is simulated

In the shown examples a black color is used as mostdocuments are written with dark ink (like iron oxide or soot)Pigmentation intensity is implemented as transparencywhich allows simulating pigment accumulation at crossinglines or in case of a textured background However alsocolored opaque or semiopaque ink can be simulated Thismight be interesting in the context of historical documentssince important passages are often highlighted by using redink Another important feature of historical documents isdegradation of paper or parchment Currently we simplyuse images of natural paper or parchment as backgroundtextures which are scaled or tiled in case where they aresmaller than the synthesized document

55 Generation of Text Pages Recently not only characteror word recognition but also more complex document anal-ysis issues that address the interpretation or recognition of

complete documents become a focus of Arabic handwritingresearch Hence we investigate the possibilities of text pagesynthesis In this regard the accurate simulation of thelower baselines is crucial Many problems that occur whiledetecting lines words or connected components depend onthese baselines as for instance assigning diacritics (that arevery close to more than one text lines) to their correspondingPAW

Our approach of simulating baselines has three stepsFirst of all we set the coordinates (1199090 1199100) of the first letter foreach line Secondly the curvatures of the baselines have to becomputed Thirdly potential intersection of words have to besolved

Start PAWs Due to the style of Arabic handwritings alllines start at the rightmost 119909-coordinate 1199090 = 119909max Thevertical space between two neighbored lines can be definedas percentage of the average PAW heights to get 1199100 for eachbaseline

Baselines We implement the second step by declaring func-tions 119891(119909 1199100) that define the curvatures of the simulatedBaselines Ξ

119904(1199100 defines the initial heights of a line) We

normalize 1199100 isin [0 1] inside 119891(119909 1199100) so it becomes

independent of the page size How to compute proper 119891119894is

explained in Section 56Let l119903 define the lower right of a letters bounding box then

we first translate the letter l towards the baseline so that l119903touches it Subsequently the119910-position of lmust be correctedaccording to its class by translating it by t

119887 so that l119903 might

be above or below 119891(119897119903

119909 1199100) as shown in Figure 12Therefore

we extracted the normalized statistical relation N119887between

l119903 and the baseline from the IESK-arDB for all letter classes If119897ℎ is the heights and l119894 is the 119894th point of l we can compute t

119887=

(0 119897ℎN119887)119879 and l1015840119894 = l119894 + t

119887as shown in Figure 12 We perform

this for every first letter l119891of a PAW Apart from the position

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 4: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

4 The Scientific World Journal

physical models Thomas et al [24] have proposed syn-thetic handwriting method for generation of CAPTCHAsrsquo(completely automated public Turing test to tell computersand humans apart) text lines After segmentation samplesfor each letter are generated using shape models In thesynthesis process a delta log-normal function is used tocompose smooth and natural cursive handwriting Multipleapproaches specific to Latin script that are based on polyno-mial merging functions and Bezier curves have been docu-mented in [20] Miyao and Maruyama [25] have proposeda method to improve offline Japanese Hiragana characterclassification using virtual examples synthesized from anonline character database

In contrast to word synthesizing little research has beendone concerning text line paragraph or document synthesisIf synthesis of multiple text lines is considered at all itis typically modeled as horizontal baselines that may beinfluenced by noise [21] or each baseline line is definedby a rotation angle [10] Varga et al [26 27] presenteda method for handwritten English text line synthesizingtheir methodology starts by composing static image of thetext line by perturbing and chaining of character tem-plates Then text line is drawn using overlapping strokesand delta-lognormal velocity profiles as stated by delta-lognormal theory Chaudhuri and Kundu proposed a systemto synthesize handwritten Bangla script pages [28] Forpage layout simulation they compute Gaussian distributionsfrom natural text pages to model different features namelyleft margin angle line orientation interline gap and lineundulation

Due to the characteristics if Arabic script which werediscussed in Section 2 existing systems and methods cannot be directly used for Arabic Margner and Pechwitz[29] suggest an image based perturbation approach for thegeneration of synthetic printedArabicwordsThey add globalnoise of different degrees simulating degradation as artifactwhich are caused by repeated copying As for the problemof automatic synthesis of offline handwritten Arabic textto the best of our knowledge Elarian et al [3 30] are thefirst who published research work addressing this problemso far They propose a straightforward approach to composearbitrary Arabic words The approach starts by generating afinite set of letter images from two different writers manuallysegmented from IFNENIT database and then two kinds ofsimple features (width and direction feature) are extractedso they can be used later as a metrics in the concatenationstep Saabni and El-Sana proposed a system to synthesizePieces of Arabic Words (PAW) (without diacritics) [31]They use digital tablets to acquire online samples whichare randomly composed to PAWs Thereafter a subset of theproduced synthetic data is selected by clustering techniquesto get a compact database In [32] we proposed a systemto generate Arabic letter shapes by ASMs built from offlinesamples Subsequently we developed a system to renderimages of Arabic handwritten words concatenating ASMbased samples and using transformations on word level asoptional second generation step [33]

Table 2 Parameters and tresholds

Parameter Explanation Value

119903Number of samples used to computean ASM 50

119898Number of points of letter sampletrajectory x before approximation 119898 = 2668

119899Number of points of a approximatedsample x 25

120589 Controlling the space between words user defined120572119903 Word rotation plusmn45∘

120572119904 Word slant plusmn45∘

120603Controlling the sharpness of synthesiscontours 0ndash10

120596119875 Width of synthesized lines in points 1ndash10

Segmentation of Arabic words is quite challenging Itdepends on holistic word as well as the features of singlecharacters and detailed GT are required to perform a usefulvalidation Hence it is reasonable to test this method onsynthetic databases which contain such GT One of theearliest segmentation based approaches suggested for therecognition of Arabic handwritten text is the one proposedby [34] and no segmentation results are reported thoughXiu et al proposed probabilistic segmentation model forthis segmentation approach a tentative contour based oversegmentation is first performed on the text image as a resulta set of what they called graphemes is produced [35] Theapproach differentiates among three types of graphemesTheconfidence of each character is calculated according to theprobabilistic model respecting other factors for examplerecognition output geometric confidence and logical con-straintThe authors experimented the proposedmethodologyon five different test sets achieving 592 success rate

4 Data Acquisition and Generation

To synthesize Arabic handwritten words from glyphs asufficient amount of glyph samples has to be acquired firstIn our case trajectories of single letters and their connections(Kashidas) are used as glyphs The glyphs are acquired withonline techniques since relevant information can be extractedmore efficiently from trajectories than images Neverthelesswe are mainly interested in synthesizing offline data Hencewe decided to use online pens for data acquisition for theycan be applied as ordinary biros in contrast to digital tabletsFifty ormore samples per writer are taken from over hundredletter classes (28046 samples altogether) to built an onlinecharacter database To minimize manual effort and allowan easy extension this database is completely automaticallygenerated from raw data Raw data are trajectories X isin R119898times2

(see Table 2) for each stroke within a virtual DIN A4 pageThat page has a resolution of 1000 dpi and 58 rps (reportsper second) so there are constant timestamps 998779119905 = 119905

119894+1 minus

119905119894

= 00172 s between neighbored (1198941 1198942) isin

X Thegenerated database contains the trajectories and an image

The Scientific World Journal 5

119857

x

(a) 119899 = 10

119857

x

(b) 119899 = 25

Figure 2 The average x and 119903 samples x for the letter Sin in isolated form of writer 1 (a) The number of interpolation steps 119899 = 10 is notsufficient to represent complex characters as Sin () and details will be lost or distorted (b) With 119899 = 25 the approximated samples x arereliable enough to build proper ASMs for all character classes

representation for each Arabic letter class (see Table 1) aswell as the resulting Active Shape Models (ASMs) which aredescribed in the next section Digits and special charactersmight be added in future work

41 Computing Active Shape Models for Generation of ArabicCharacters Active Shape Models (ASMs) are statistical rep-resentations of the approximated shape of an object An ASMuses the distribution of some significant points to store themost important information of many shapes of a class in onesinglemodel Normally somewell-defined landmarks have tobe set manually for all samples and additional intermediatepoints between these landmarks are used if there are notenough landmarks to represent the shape However thedefinition of landmarks for over hundred classes for everywriter is barely realizable and would prevent to add datafrom further writers efficiently This is why we use two givenlandmarks the Start and the End point of each polygonand compute intermediate points by interpolating betweenthe given (

1198941 1198942) of X isin R119898times2 to get polygons X isin

R119899times2 By alternate storing of the 1199091198941 and 119909

1198942 coordinateseach polygon is represented as a single vector of size 2119899x = (11990911 11990912 11990921 11990922 1199091198991 1199091198992)

119879 that is required tobuild ASMs Given the point numbers119898 of the original and 119899of the desired approximated samples we interpolate in sucha way that the time steps 998779

119905= 998779

119905119898119899 between neighbored

interpolated points p119895 p

119895+1 | p119895

= (1199092119895 1199092119895+1) are stillconstant the Euclidean distance howevermay vary Given theoriginal points p isin

X we compute an interpolated point

p119895= (1minus120582

119886) p

1198951015840 +120582

119886p1198951015840+1

with 1198951015840

= lfloor119895998779119905rfloor 998779

119905=

998779119905

998779119905

120582119886= 119895998779

119905minus 119895

1015840

(1)

where 1198951015840 isin 1 119898 and 119895 isin 1 119899 This enables a more detailedmodeling of complex structures as the peaks of Sin () as onecan see in Figures 2 and 3 We set 119899 = 25 which is sufficientto represent even complex Arabic characters like Sin ( )as shown in Figure 2 (in order to speed up the syn-thesis process 119899 could be optimized for each individualclass)

We then scale all samples x keeping their aspect ratio Let119882 be the width and let119867 be the heights of an unscaled x andthen we scale x by 100119909100(119867 lowast 119882) and translate x so thatits center lies within the origin

For each class there are 119903 available vectors fromwhich theASM of the corresponding class is calculated (we set 119903 = 50for our experiments)

To build ASMs the expected value x and the covariancematrix S have to be calculated first

x =

sum119903

119894=1 x119894119903

S =

12119903 minus 1

119903

sum

119894=1(x

119894minus x) (x

119894minus x)119879

(2)

As a consequence of the covariance matrix calculation theEigenvalues 120582

119894and Eigenvectors e

119894can be determined and

then the ASM corresponding to character classes is calcu-lated Now any arbitrary number of vectors that representeach class can be calculated by linear combination

u = x +119903

sum

119895=1119888119895e119895 119888

119895isin [minus2radic120582

119895 2radic120582

119895] (3)

A limitation of 119888119895by plusmn2radic120582

119895assures that all the deviations

of u are within the doubled standard deviation 120590 This is acommon limit since most training samples lie within thisrange In few cases a limit ofmaximalplusmn3radic120582

119895is applied which

6 The Scientific World Journal

(a) u (b) u (B-Spline) (c) x

(d) x (B-Spline) (e) forall119888119895= 0 (f) forall|119888

119895| = 2radic120582

119895

Figure 3 Examples of glyphs (a) examples for ASM-glyph representations u (wheresum |119888119895| asymp sum 16radic120582

119895 see (3)) (b) a B-Spline interpolation

has been applied on the representations (c) (d) original letter samples x A B-Spline interpolation with 5 steps has been applied on (b) and(e) Examples of ASM-glyphs u that are composed to words are shown in (e) and (f) where the influence is minimal (e) and maximal (f)respectively for all eigenvalues

requires a clear increase of 119903 in order to keep u statisticallyreliable

Some examples of x and u are shown in Figure 3 Thecomputation of ASMs is quite costly especially if many sam-ples and interpolation points are used This is why we avoidrecalculations of ASMs at runtime since the synthesizingprocess requires a minimum of 100ASMs Hence all ASMs(including their corresponding online samples) are saved infiles to separate ASM generation from the synthesis module

42 ASMDistance Measure The distance 120575 of a sample x anda representation u of an ASM can be calculated as follows

120575 (x u) = 1119899

119899

sum

119894=1

radic(1199062119894minus1 minus 1199092119894minus1)2+ (1199062119894 minus 1199092119894)

2 (4)

Due to the performed scaling of x 120575(x u) can be interpretedas the approximated deviation in percent For all samples xwe compute the most similar representation ulowast by solving (3)numerically using c as unknown (initially forall119888

119894= 0) Some

examples of ulowast are visualized in Figure 4In contrast to ASMs from offline samples [32] most

online based ASMs are capable of representing their inputsamples well even without manually defined landmarkssince detailed slowly written structures (where landmarksare suspected) are represented by more intermediate pointsThis effect allows an efficient extension and maintenanceof the character database since time consuming manuallandmarking can be avoided

Nonetheless the average 120575 is writer dependent We mea-sured 120575 = 08 for writer 1 120575 = 146 for writer 2 and evenhigher values for the other writers whose handwriting styleis less tidy Furthermore 120575depends on the letter class A high 120575is mainly caused by some classes with diacritics as Zai ( ) thatneed improvement (see Figure 3(c)) The distance between

the letters main body and diacritics can vary clearly whichmay lead to inappropriate ulowast in case that x is unlike x Toreact against this effect more training samples could be usedor diacritics andmain bodies could be separated using ActiveShape Structural Models (ASSM) [16] However our ASMsare meant for synthesis approaches where the use of purenoise (perturbed data) is quite common and hencemoderateimprecision does not spoil the synthesis quality significantly

5 Synthesizing Arabic Handwritings

In the following subsections we describe all methods thatare applied to create synthetic Arabic handwritings fromUnicode using the ASM data from the last Section Oursystem uses these either to show a few specific syntheses forpreview purpose or to generate a complete database includingground truth

The methods which are used to synthesize and renderArabic handwritings are described in the following Sections

51 Composing Words The basic idea of Arabic handwritingsynthesis fromUnicode is to select glyphs with proper shapes(isolated initial end or middle form) and connect themsubsequently to build PAWs words and texts from whichimages or vector graphics are rendered

511 Calculation of the Letter Form Our system receives textas Unicode string that represents every letter as numberSince our samples are limited to the 28 regular letters andTamarbuta ( D ) we substitute special characters as Alif withHamza above (

) with their regular formAlif ( ) before starting

the synthesis Letter forms have a strong influence on theletter shape but they are not given by regular Unicode thusthey have to be determined first

The Scientific World Journal 7

119857

x119854lowast

(a) | 120575 = 096

119857

x119854lowast

(b) J | 120575 = 087

119857

x119854lowast

(c) | 120575 = 56

Figure 4 Examples of ASM based glyph ulowast that has the highest correlation (deviation 120575) with a randomly chosen samples x The averagesample polygon x is displayed to show how strong x differs from the expected shape Some of the ASM for characters with diacritics areproblematic as shown in (c)

Letters of the set Γ2 = (H ) can only assume isolated orend form All other letters such as Ayn() can assume begin-middle- and- as well as isolated- form Ayn (0 1 2 3)Therefore the form f0 of the first letter l0 of a word is

f0 =

i if l0 isin Γ2

b else(5)

Examples of the different letter forms within an Arabic wordare shown in Figure 5 Let f

minus1 be the form of lminus1 which is the

predecessor of letter l and l+1 = define that the successor

of l is a space tab or return token and then the position fof a letter l can be defined as follows

f =

i if fminus1 isin (i e) and (l isin Γ

2or l

+1 = )

b if fminus1 isin (i e) and (l notin Γ

2and l

+1 = )

m if fminus1 isin (bm) and (l notin Γ

2and l

+1 = )

e if fminus1 isin (bm) and (l isin Γ

2or l

+1 = )

(6)

Letters that have only two forms split an Arabic word intoPieces of ArabicWords (PAWs) which consist of one ormoreletters

i

i eb

e mb

Figure 5Outgoing from theUnicode sequence ( H J H JB)

the forms (isolated end middle and begin) of all letters aredetermined ( H H ) and composed to the wordII (New York)

512 Selection of Suitable Glyphs To ensure that the styles ofall neighbored glyphs are similar glyphs of different writerare not mixed within a synthesis We encouraged the writersto write letters only in this style that is dominant for theirwritings and avoid severe rotations The size of the glyphs isnormalized by the average character size we extracted fromthe IESK-arDB However we corrected the size manually incase of rare character classes A suitability measure for theglyph joint points has not been considered since steady jointsare achieved by B-Spline interpolation and rendering at theend of the synthesis process

513 Connecting Glyphs After all letter classes are definedby their names and forms corresponding ASMs are loaded

8 The Scientific World Journal

Input Current PAW A119888 precedent PAW A

119901 average letter width l

119908

Output Shifted current PAW A119888

If Bounding boxes of A119888and A

119901overlap then

while Trajectories of A119888and A

119901intersect do

Translate the 119909 coordinates of A119888by (14)l

119908

Algorithm 1 Solving intersections of neighbored PAWs

(a) Writer 1 (b) Writer 2 (c) Writer 3 (d) Writer 4

Figure 6 The word II (New York) synthesized by the average letter shapes 119909 of different writers

The ASMs are used to generate an unique polygonal rep-resentation u for each occurrence of a letter class in orderto avoid piecewise identical syntheses In order to composewords from these polygons each letter in end or middle formhas to be connected with its predecessor 3 rarr $ 3 I rarr I Let pf be the first point of and pl the last

point of its predecessor and then we can connect them by

translating by pl minus pf An example is shown in Figure 5The relation of a PAWrsquos 119910 coordinate and the baseline

depends on the letter classes the PAW is composed of Thuswe extracted the average 120583

119903and variance 120590

119903of the relative

distance between the baseline and the center of a letter frommanual created ground truth of our (real) word databaseIESK-arDB [4] We set the baseline to 0 and shift all 119910coordinates of each PAW by N(120583

119903 120590

119903) Finally the space

between the rightmost point of a PAW and the leftmostpoint of its predecessor has to be defined Therefore the userdepending parameter 120589 is used that may be negative in orderto simulate overlapping PAWs Given pl and pf the PAW canbe translated by the vector

tpaw = (

1199011198971minus 119901

1198911minus 120589

N (120583119903 120590

119903)

) (7)

In case of intersections between the polygons of overlappingPAWs 120589 is increased iteratively by 25 of the average letterwidth as described in Algorithm 1

Examples of words composed by the average letter shapesof different writers are shown in Figure 6 Examples fromASM based and original samples can be found in Table 3The maximal deviation 120590

119860means that the influence of an

eigenvector e119894is limited by plusmn2radic120582

119894 While letters look similar

using 120590 between 0 and 1 ASM representations u with 120590119860of

2 already provoke increased letter variation ASMs (trainedwith 119903 = 50 samples) are barely capable of representing adeviation of120590

119860= 3 though As amatter of fact there are noise

based deformations as shown in Table 3 (second last row)

This effect might be intended to create especially challengingsyntheses

52 Simulation of Global Variances ASMs already containvariations in slant width or connection size Neverthelessthese variations are limited by the used samples In order toincrease and control these variations affine transformationsare used (scaling translation shearing and rotation) whichallow optional manipulations of letter and PAW shapes Theuser interface (UI) of our synthesis system allows to set theaverage 120583 and variance 120590 of a Gaussian distribution for allaffine transformations Particularly global variations as theslant can be achieved this way The influences of these affinetransformations on the resulting word image is shown inFigure 7

A stretching is performed by scale each 119909 component ofeach letter point by the factor 119888 isin [05 2] The word slantcan be set by shearing the word with an angle of 120572

119904as the

skew of PAW can be manipulated by rotating to the angle120572119903 where 120572

119904 120572

119903isin [minus45∘ +45∘] We analyzed the skew and

slant of samples of the IESK-arDB database [4] with localminima regression and Hough transform We found that theskew correlates with a Gaussian distribution ofN(minus38∘ 71∘)(passed Chi square test with 120572 = 005) The slant can berepresented byN(minus46∘ 144∘)The size of the complete wordor single letters can be adjusted by an equal scaling with119888 isin [01 10] which can be used to control the resolution ofthe synthesized word images or to increase variation of lettersize As described in Section 513 variations of PAWpositionscan be realized by translations Even using the same glyphssynthetic words can assume large variations in shape whenusing affine transformations or cutting connection size asshown in Figure 7

When examining the glyph samples and synthesis wefound that compared to complete handwritings letter con-nections of the acquired samples are extended and evenexcessively (approximately twice as) long in case of writer 1Hence we allow to delete up to 25 of the letter points tosimulate stretched or missed connections which often occur

The Scientific World Journal 9

Table 3 Syntheses using ASMs and sample based glyphs of writer 1

120590119860sim |119888

119895|radic120582

119894Result

0

1

2

3

Samples

(a) Stretching (b) Slant (c) Size (d) Skew (e) Position (f) Connection

Figure 7 Affine transformations and connection shortening on synthetic words

in natural Arabic handwritings In Arabic handwritings somecharacters as Ya ( J ) are sometimes written beneath theirpredecessors As a result they resemble a single characterwhich impedes segmentation and recognition tasks Thiseffect can be simulated by a strong reduction of the Kashidaas shown in Figure 8 However this feature has been not yetentirely implemented since a list of all pairs of letters thattypically show this behaviour needs to be created first

53 Interpolation Since a polygonal letter representationdoes not look natural for vector graphics or images witha scaling factor gt 1 we use interpolation to improve theoutcome Let 119899(u) be the number of points of u and then weuse u as control points to interpolate a curve u By increasingthe interpolation steps 119899(u) can be approximated to theoriginal number of points of a sample X The average lengthof X is 119899( X) = 2668 and hence a tenfold increase 119899(u) =

25 rarr 119899(u) = 250 is generally sufficient to achieve smoothsyntheses To ensure that the above mentioned methodswork efficiently on the compressed representation u theinterpolation step is applied just before rendering or skippedin case of low-resolution synthesis

Our system supports two interpolation methods Piece-wise Cubic hermite-interpolation is 1198621-steady which meansthat only the first derivation of the used interpolation func-tion is steady Therefore hermite-interpolation leads to lesssmooth and accurate results a property that can be used tocreate noisy handwritings [32] (perturbed data technique)State-of-the-art B-Spline interpolation is commonly usedwithin CAD-applications since it is 1198622-steady and leads tosmooth natural curves which can be defined properly bytheir control points as shown in Figure 9 Although the B-Spline curve do not pass through all control points it fitsthe original curve sufficiently when 119899 = 25 control pointsare used Given the measure 120575 of (4) the average distancebetween u and the 119899 closest points of u can be computedUsing a cross-validation with 119896fold = 10 we get 120575(u u) =

045 with a variance of 0058

54 Rendering Handwriting Images The former sectionsdiscussed how to compose and interpolate polygonal rep-resentations of Arabic handwritings Now those have to betransformed into images and saved in common files formats(bmp png etc) which can easily be loaded by most text

10 The Scientific World Journal

(a) (b) (c)

Figure 8 Example for a synthesized letter pair using (a) full (b) half and (c) negative Kashida length

Control points uInterpolated points 119854

(a) B-Spline

Control points uInterpolated points 119854

(b) Cubic

Figure 9 Comparison of B-Spline and Cubic interpolation where 119899(u) = 25 and 119899(u) = 250

recognitions or document analysis systems Even preprocess-ing steps as thinning can influence the performance of thefollowing tasks Such preprocessing is sensitive to secondaryfeatures or flaws which are a result of the used writingmaterials hence the synthesized files should contain thosefeatures too Therefore we propose a rendering techniquethat reflects optical features caused by common pens asball pens or pencils [33] Subsequently a modification ofthis technique is described that allows rendering features ofhistorical handwritings

First of all pixels o have to be found that are closeto polygons u and belong to the foreground As shown inFigure 10(a) we first interpolate between two neighboredpoints p q of u (or u) and get 120588 lowast p minus q new points

o1015840 = ]p+ (1minus ]) q ] isin [0 1] (8)

where ] is uniform distributed and 120588 is a user definedparameter

Let n be the normal vector of line pq and then we shifteach o1015840 along n using a Gaussian distribution

o = o1015840 +N (120583 120590) n (9)

where 120590 and 120583 define the line width which is decreased up to20 in case that p lies between the PenUp or PenDown pointand the neighbored control point As a result the prototype ofa word image has been prepared that defines all pixels whichare influenced by pigments at all (shown in Figure 10(b))To allow sharp contours a limitation of |N(120583 120590)| lt 120603120590

is applied according to the simulated pen where 120603 is userdependent

541 Texture Biros or pencils cause an irregular pigmenta-tion intensity which is reflected by pixel intensities 119868(119909 119910)of scanned images A realistic physical model that simulatesthis behavior in a proper way is beyond the scope of thispaper a more simplified and generalized approach howeveris quite practical Inspired by the ability of Fourier transformbased image compression to represent the main nature ofa texture by a small subset of the underlying frequencieswe define a texture by 10 points (120582 120579 120601) in frequency spacein order to emulate irregularities caused by pen and paperThis way simplified but unique textures can be created atruntime However in contrast to image compression weare not interested in avoiding noise-prone high frequencies

The Scientific World Journal 11

n

p

qoi

(a) (b) (c) (d) (e) Synthetic image (f) Real image

(g) Example text line

Figure 10 Painting technique (a) scheme (b) word shape with 120588 = 6 120590 = 35 (Gaussian filter is disabled) (c-d) example results for paintingtechnique (c) test texture applied on (b) (d) 120588 = 30 120590 = 10 with ball pen texture and (e-f) comparison of natural and synthetic ball pentextures

Hence different high and low frequencies are combined tosimulate regional as well as locale effects (behavior of inkpaper texture) Each point represents a texture layer in imagespace with 1198681(119909 119910) isin [minus1 1] We created several textureclasses by defining different sets of Gaussian distributionsfor the angle 120579 wave length 120582 and phase shift 120601 of alllayers manually Afterwards pixel intensities 1198682(o) isin [0 256]are computed by accumulating most texture layers The leftlayers are used to achieve variations in their intensities bymultiplication Finally an image I with a small margin iscreated and all o are fitted to I subsequently

By creating word syntheses using polygonal glyphs andrendering techniques smooth letter connections can beachieved more efficiently compared to synthesis approachesthat use image based glyphs Furthermore in contrast tothe usage of natural textures the described technique is ableto generate unique nontiled textures for every synthesizedword as shown in Figures 10(c)ndash10(e) Depending on thetexture class a median or Gaussian filter is used before savingthe image

542 Simulation of Feather Like Writing Tools The previousmethod allows a proper simulation of text that is writtenby ball pens pencils or coal on white paper However toallow a more accurate simulation of writing instrumentsas fountains pens or feathers we extended our renderingtechnique This includes mainly the implementation of twofeatures the writing speed and the shape of the top of thewriting instrument further called Pen Shape

Pen Shape If the Pen Shape is modeled as line or ellipsoid theline width of the trajectory u depends not only on the widthof the Pen Shape 119908

119875 but also on its angle 120574

119875and the angle

of the trajectory tangent 120574u We initialize 120574119875= 45∘ changing

it continuously with a maximal deviation of plusmn15∘ This localedeviation is computed by adding two cosine functions wherethe wavelengths phases and amplitudes are redefined byGaussian distributions for each synthesis

According to the texture of a Pen Shape the contactwith the paper and consequently the caused pigmentationcan vary This is simulated by an one-dimensional function

119891(119909119875) | 0 le 119909

119875le 119908

119875that defines the pigmentation potential

for the long axis of the Pen Shape An emphasized exampleinspired by a fountain pen is shown in Figure 11(d)

Binary images can be rendered in a faster way by definingpolygons (here a triangle mesh) that is a result of extrudingan one-dimensional Pen Shape along u or u A visualizationof this can be found in Figure 11(c) and a resulting synthesisis shown in Figure 11(h) These polygons can then be drawnby standard routines If the angle of the Pen Shape and theline is identical or so close where the polygon width wouldbe smaller than one pixel a line have to be drawn instead toavoid letter fragmentation

Writing Speed Large lines or bows as the left part of Sin() are usually written faster thanmore complex structuresA high writing speed often causes a lack of pigmentationthat leads to brighter or dappled lines However there is noneed to reconstruct writing speed for the used online lettersamples already that contain such information From eachrepresentation u we can extract the relative local writingspeed for ASMs representations in points per second

V (119894) pts =1003817100381710038171003817(2119894minus1 2119894) minus (2119894+1 2119894+2)

1003817100381710038171003817pt

(119899 (u) 119899 (u)) Δ119905s

1 le 119894 le 119899 (u) (10)

In order to estimate the expected pigmentation intensitywe use the normalized writing speed V isin [0 1] where V = 0is the slowest and V = 1 is the fastest part of the trajectory ofa synthesis If c0 is the current color of a pixel in RGB colorspace and c

119901is the color of the pen pigment then the new

color is computed by

c = c119901120572119886+ c0120572119887 (1minus120572119886) c isin R

3 (11)

where 120572119886

= 08(1 minus V) + 02 defines opacity of c119901and

120572119887

= 1 defines the opacity of the background Althoughpigments that are used for handwritings are typically full orsemiopaque reduction of pigmentation caused by increasedwriting speed can lead to transparency This is simulated byreducing 120572

119886 as shown in Figure 11(e)

12 The Scientific World Journal

(a) u (b) u (B-Spline) (c) u (polygon mesh) (d) Pen shape (e) Speed (f)

(g) Example of a synthesized text line

(h) Example of a synthesized text line (fast method for binary images)

Figure 11 From the polygon u to a synthetic image that simulates a feather like writing instrument (c) Polygon mesh created from u that isused for fast rendering of binary images

To ensure a steady behavior we interpolate the speed ofconnected letters For the first 119899(u)4 points (2119894minus1 2119894)we setthe speed V of a letter in middle or end form to

V (119894) = V (119894) [1minus120582119894] + V

119887(119899 (u)) 120582

119894

120582119894= 4 119894

119899 (u) 119894 le

14119899 (u)

(12)

where V119887(119899(u)) is the speed at the end of the previous letter

The effect on the synthesis is shown in Figure 11(d)

Render on Degraded Background Finally we createFigure 11(f) by combining our texture rendering techniqueof Section 541 with the one based on Pen Shape and writingspeed using a nonuniform background Therefore weapplied a transparent texture on all pixels that does notbelong to the background texture This way small randomirregularity is simulated

In the shown examples a black color is used as mostdocuments are written with dark ink (like iron oxide or soot)Pigmentation intensity is implemented as transparencywhich allows simulating pigment accumulation at crossinglines or in case of a textured background However alsocolored opaque or semiopaque ink can be simulated Thismight be interesting in the context of historical documentssince important passages are often highlighted by using redink Another important feature of historical documents isdegradation of paper or parchment Currently we simplyuse images of natural paper or parchment as backgroundtextures which are scaled or tiled in case where they aresmaller than the synthesized document

55 Generation of Text Pages Recently not only characteror word recognition but also more complex document anal-ysis issues that address the interpretation or recognition of

complete documents become a focus of Arabic handwritingresearch Hence we investigate the possibilities of text pagesynthesis In this regard the accurate simulation of thelower baselines is crucial Many problems that occur whiledetecting lines words or connected components depend onthese baselines as for instance assigning diacritics (that arevery close to more than one text lines) to their correspondingPAW

Our approach of simulating baselines has three stepsFirst of all we set the coordinates (1199090 1199100) of the first letter foreach line Secondly the curvatures of the baselines have to becomputed Thirdly potential intersection of words have to besolved

Start PAWs Due to the style of Arabic handwritings alllines start at the rightmost 119909-coordinate 1199090 = 119909max Thevertical space between two neighbored lines can be definedas percentage of the average PAW heights to get 1199100 for eachbaseline

Baselines We implement the second step by declaring func-tions 119891(119909 1199100) that define the curvatures of the simulatedBaselines Ξ

119904(1199100 defines the initial heights of a line) We

normalize 1199100 isin [0 1] inside 119891(119909 1199100) so it becomes

independent of the page size How to compute proper 119891119894is

explained in Section 56Let l119903 define the lower right of a letters bounding box then

we first translate the letter l towards the baseline so that l119903touches it Subsequently the119910-position of lmust be correctedaccording to its class by translating it by t

119887 so that l119903 might

be above or below 119891(119897119903

119909 1199100) as shown in Figure 12Therefore

we extracted the normalized statistical relation N119887between

l119903 and the baseline from the IESK-arDB for all letter classes If119897ℎ is the heights and l119894 is the 119894th point of l we can compute t

119887=

(0 119897ℎN119887)119879 and l1015840119894 = l119894 + t

119887as shown in Figure 12 We perform

this for every first letter l119891of a PAW Apart from the position

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 5: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

The Scientific World Journal 5

119857

x

(a) 119899 = 10

119857

x

(b) 119899 = 25

Figure 2 The average x and 119903 samples x for the letter Sin in isolated form of writer 1 (a) The number of interpolation steps 119899 = 10 is notsufficient to represent complex characters as Sin () and details will be lost or distorted (b) With 119899 = 25 the approximated samples x arereliable enough to build proper ASMs for all character classes

representation for each Arabic letter class (see Table 1) aswell as the resulting Active Shape Models (ASMs) which aredescribed in the next section Digits and special charactersmight be added in future work

41 Computing Active Shape Models for Generation of ArabicCharacters Active Shape Models (ASMs) are statistical rep-resentations of the approximated shape of an object An ASMuses the distribution of some significant points to store themost important information of many shapes of a class in onesinglemodel Normally somewell-defined landmarks have tobe set manually for all samples and additional intermediatepoints between these landmarks are used if there are notenough landmarks to represent the shape However thedefinition of landmarks for over hundred classes for everywriter is barely realizable and would prevent to add datafrom further writers efficiently This is why we use two givenlandmarks the Start and the End point of each polygonand compute intermediate points by interpolating betweenthe given (

1198941 1198942) of X isin R119898times2 to get polygons X isin

R119899times2 By alternate storing of the 1199091198941 and 119909

1198942 coordinateseach polygon is represented as a single vector of size 2119899x = (11990911 11990912 11990921 11990922 1199091198991 1199091198992)

119879 that is required tobuild ASMs Given the point numbers119898 of the original and 119899of the desired approximated samples we interpolate in sucha way that the time steps 998779

119905= 998779

119905119898119899 between neighbored

interpolated points p119895 p

119895+1 | p119895

= (1199092119895 1199092119895+1) are stillconstant the Euclidean distance howevermay vary Given theoriginal points p isin

X we compute an interpolated point

p119895= (1minus120582

119886) p

1198951015840 +120582

119886p1198951015840+1

with 1198951015840

= lfloor119895998779119905rfloor 998779

119905=

998779119905

998779119905

120582119886= 119895998779

119905minus 119895

1015840

(1)

where 1198951015840 isin 1 119898 and 119895 isin 1 119899 This enables a more detailedmodeling of complex structures as the peaks of Sin () as onecan see in Figures 2 and 3 We set 119899 = 25 which is sufficientto represent even complex Arabic characters like Sin ( )as shown in Figure 2 (in order to speed up the syn-thesis process 119899 could be optimized for each individualclass)

We then scale all samples x keeping their aspect ratio Let119882 be the width and let119867 be the heights of an unscaled x andthen we scale x by 100119909100(119867 lowast 119882) and translate x so thatits center lies within the origin

For each class there are 119903 available vectors fromwhich theASM of the corresponding class is calculated (we set 119903 = 50for our experiments)

To build ASMs the expected value x and the covariancematrix S have to be calculated first

x =

sum119903

119894=1 x119894119903

S =

12119903 minus 1

119903

sum

119894=1(x

119894minus x) (x

119894minus x)119879

(2)

As a consequence of the covariance matrix calculation theEigenvalues 120582

119894and Eigenvectors e

119894can be determined and

then the ASM corresponding to character classes is calcu-lated Now any arbitrary number of vectors that representeach class can be calculated by linear combination

u = x +119903

sum

119895=1119888119895e119895 119888

119895isin [minus2radic120582

119895 2radic120582

119895] (3)

A limitation of 119888119895by plusmn2radic120582

119895assures that all the deviations

of u are within the doubled standard deviation 120590 This is acommon limit since most training samples lie within thisrange In few cases a limit ofmaximalplusmn3radic120582

119895is applied which

6 The Scientific World Journal

(a) u (b) u (B-Spline) (c) x

(d) x (B-Spline) (e) forall119888119895= 0 (f) forall|119888

119895| = 2radic120582

119895

Figure 3 Examples of glyphs (a) examples for ASM-glyph representations u (wheresum |119888119895| asymp sum 16radic120582

119895 see (3)) (b) a B-Spline interpolation

has been applied on the representations (c) (d) original letter samples x A B-Spline interpolation with 5 steps has been applied on (b) and(e) Examples of ASM-glyphs u that are composed to words are shown in (e) and (f) where the influence is minimal (e) and maximal (f)respectively for all eigenvalues

requires a clear increase of 119903 in order to keep u statisticallyreliable

Some examples of x and u are shown in Figure 3 Thecomputation of ASMs is quite costly especially if many sam-ples and interpolation points are used This is why we avoidrecalculations of ASMs at runtime since the synthesizingprocess requires a minimum of 100ASMs Hence all ASMs(including their corresponding online samples) are saved infiles to separate ASM generation from the synthesis module

42 ASMDistance Measure The distance 120575 of a sample x anda representation u of an ASM can be calculated as follows

120575 (x u) = 1119899

119899

sum

119894=1

radic(1199062119894minus1 minus 1199092119894minus1)2+ (1199062119894 minus 1199092119894)

2 (4)

Due to the performed scaling of x 120575(x u) can be interpretedas the approximated deviation in percent For all samples xwe compute the most similar representation ulowast by solving (3)numerically using c as unknown (initially forall119888

119894= 0) Some

examples of ulowast are visualized in Figure 4In contrast to ASMs from offline samples [32] most

online based ASMs are capable of representing their inputsamples well even without manually defined landmarkssince detailed slowly written structures (where landmarksare suspected) are represented by more intermediate pointsThis effect allows an efficient extension and maintenanceof the character database since time consuming manuallandmarking can be avoided

Nonetheless the average 120575 is writer dependent We mea-sured 120575 = 08 for writer 1 120575 = 146 for writer 2 and evenhigher values for the other writers whose handwriting styleis less tidy Furthermore 120575depends on the letter class A high 120575is mainly caused by some classes with diacritics as Zai ( ) thatneed improvement (see Figure 3(c)) The distance between

the letters main body and diacritics can vary clearly whichmay lead to inappropriate ulowast in case that x is unlike x Toreact against this effect more training samples could be usedor diacritics andmain bodies could be separated using ActiveShape Structural Models (ASSM) [16] However our ASMsare meant for synthesis approaches where the use of purenoise (perturbed data) is quite common and hencemoderateimprecision does not spoil the synthesis quality significantly

5 Synthesizing Arabic Handwritings

In the following subsections we describe all methods thatare applied to create synthetic Arabic handwritings fromUnicode using the ASM data from the last Section Oursystem uses these either to show a few specific syntheses forpreview purpose or to generate a complete database includingground truth

The methods which are used to synthesize and renderArabic handwritings are described in the following Sections

51 Composing Words The basic idea of Arabic handwritingsynthesis fromUnicode is to select glyphs with proper shapes(isolated initial end or middle form) and connect themsubsequently to build PAWs words and texts from whichimages or vector graphics are rendered

511 Calculation of the Letter Form Our system receives textas Unicode string that represents every letter as numberSince our samples are limited to the 28 regular letters andTamarbuta ( D ) we substitute special characters as Alif withHamza above (

) with their regular formAlif ( ) before starting

the synthesis Letter forms have a strong influence on theletter shape but they are not given by regular Unicode thusthey have to be determined first

The Scientific World Journal 7

119857

x119854lowast

(a) | 120575 = 096

119857

x119854lowast

(b) J | 120575 = 087

119857

x119854lowast

(c) | 120575 = 56

Figure 4 Examples of ASM based glyph ulowast that has the highest correlation (deviation 120575) with a randomly chosen samples x The averagesample polygon x is displayed to show how strong x differs from the expected shape Some of the ASM for characters with diacritics areproblematic as shown in (c)

Letters of the set Γ2 = (H ) can only assume isolated orend form All other letters such as Ayn() can assume begin-middle- and- as well as isolated- form Ayn (0 1 2 3)Therefore the form f0 of the first letter l0 of a word is

f0 =

i if l0 isin Γ2

b else(5)

Examples of the different letter forms within an Arabic wordare shown in Figure 5 Let f

minus1 be the form of lminus1 which is the

predecessor of letter l and l+1 = define that the successor

of l is a space tab or return token and then the position fof a letter l can be defined as follows

f =

i if fminus1 isin (i e) and (l isin Γ

2or l

+1 = )

b if fminus1 isin (i e) and (l notin Γ

2and l

+1 = )

m if fminus1 isin (bm) and (l notin Γ

2and l

+1 = )

e if fminus1 isin (bm) and (l isin Γ

2or l

+1 = )

(6)

Letters that have only two forms split an Arabic word intoPieces of ArabicWords (PAWs) which consist of one ormoreletters

i

i eb

e mb

Figure 5Outgoing from theUnicode sequence ( H J H JB)

the forms (isolated end middle and begin) of all letters aredetermined ( H H ) and composed to the wordII (New York)

512 Selection of Suitable Glyphs To ensure that the styles ofall neighbored glyphs are similar glyphs of different writerare not mixed within a synthesis We encouraged the writersto write letters only in this style that is dominant for theirwritings and avoid severe rotations The size of the glyphs isnormalized by the average character size we extracted fromthe IESK-arDB However we corrected the size manually incase of rare character classes A suitability measure for theglyph joint points has not been considered since steady jointsare achieved by B-Spline interpolation and rendering at theend of the synthesis process

513 Connecting Glyphs After all letter classes are definedby their names and forms corresponding ASMs are loaded

8 The Scientific World Journal

Input Current PAW A119888 precedent PAW A

119901 average letter width l

119908

Output Shifted current PAW A119888

If Bounding boxes of A119888and A

119901overlap then

while Trajectories of A119888and A

119901intersect do

Translate the 119909 coordinates of A119888by (14)l

119908

Algorithm 1 Solving intersections of neighbored PAWs

(a) Writer 1 (b) Writer 2 (c) Writer 3 (d) Writer 4

Figure 6 The word II (New York) synthesized by the average letter shapes 119909 of different writers

The ASMs are used to generate an unique polygonal rep-resentation u for each occurrence of a letter class in orderto avoid piecewise identical syntheses In order to composewords from these polygons each letter in end or middle formhas to be connected with its predecessor 3 rarr $ 3 I rarr I Let pf be the first point of and pl the last

point of its predecessor and then we can connect them by

translating by pl minus pf An example is shown in Figure 5The relation of a PAWrsquos 119910 coordinate and the baseline

depends on the letter classes the PAW is composed of Thuswe extracted the average 120583

119903and variance 120590

119903of the relative

distance between the baseline and the center of a letter frommanual created ground truth of our (real) word databaseIESK-arDB [4] We set the baseline to 0 and shift all 119910coordinates of each PAW by N(120583

119903 120590

119903) Finally the space

between the rightmost point of a PAW and the leftmostpoint of its predecessor has to be defined Therefore the userdepending parameter 120589 is used that may be negative in orderto simulate overlapping PAWs Given pl and pf the PAW canbe translated by the vector

tpaw = (

1199011198971minus 119901

1198911minus 120589

N (120583119903 120590

119903)

) (7)

In case of intersections between the polygons of overlappingPAWs 120589 is increased iteratively by 25 of the average letterwidth as described in Algorithm 1

Examples of words composed by the average letter shapesof different writers are shown in Figure 6 Examples fromASM based and original samples can be found in Table 3The maximal deviation 120590

119860means that the influence of an

eigenvector e119894is limited by plusmn2radic120582

119894 While letters look similar

using 120590 between 0 and 1 ASM representations u with 120590119860of

2 already provoke increased letter variation ASMs (trainedwith 119903 = 50 samples) are barely capable of representing adeviation of120590

119860= 3 though As amatter of fact there are noise

based deformations as shown in Table 3 (second last row)

This effect might be intended to create especially challengingsyntheses

52 Simulation of Global Variances ASMs already containvariations in slant width or connection size Neverthelessthese variations are limited by the used samples In order toincrease and control these variations affine transformationsare used (scaling translation shearing and rotation) whichallow optional manipulations of letter and PAW shapes Theuser interface (UI) of our synthesis system allows to set theaverage 120583 and variance 120590 of a Gaussian distribution for allaffine transformations Particularly global variations as theslant can be achieved this way The influences of these affinetransformations on the resulting word image is shown inFigure 7

A stretching is performed by scale each 119909 component ofeach letter point by the factor 119888 isin [05 2] The word slantcan be set by shearing the word with an angle of 120572

119904as the

skew of PAW can be manipulated by rotating to the angle120572119903 where 120572

119904 120572

119903isin [minus45∘ +45∘] We analyzed the skew and

slant of samples of the IESK-arDB database [4] with localminima regression and Hough transform We found that theskew correlates with a Gaussian distribution ofN(minus38∘ 71∘)(passed Chi square test with 120572 = 005) The slant can berepresented byN(minus46∘ 144∘)The size of the complete wordor single letters can be adjusted by an equal scaling with119888 isin [01 10] which can be used to control the resolution ofthe synthesized word images or to increase variation of lettersize As described in Section 513 variations of PAWpositionscan be realized by translations Even using the same glyphssynthetic words can assume large variations in shape whenusing affine transformations or cutting connection size asshown in Figure 7

When examining the glyph samples and synthesis wefound that compared to complete handwritings letter con-nections of the acquired samples are extended and evenexcessively (approximately twice as) long in case of writer 1Hence we allow to delete up to 25 of the letter points tosimulate stretched or missed connections which often occur

The Scientific World Journal 9

Table 3 Syntheses using ASMs and sample based glyphs of writer 1

120590119860sim |119888

119895|radic120582

119894Result

0

1

2

3

Samples

(a) Stretching (b) Slant (c) Size (d) Skew (e) Position (f) Connection

Figure 7 Affine transformations and connection shortening on synthetic words

in natural Arabic handwritings In Arabic handwritings somecharacters as Ya ( J ) are sometimes written beneath theirpredecessors As a result they resemble a single characterwhich impedes segmentation and recognition tasks Thiseffect can be simulated by a strong reduction of the Kashidaas shown in Figure 8 However this feature has been not yetentirely implemented since a list of all pairs of letters thattypically show this behaviour needs to be created first

53 Interpolation Since a polygonal letter representationdoes not look natural for vector graphics or images witha scaling factor gt 1 we use interpolation to improve theoutcome Let 119899(u) be the number of points of u and then weuse u as control points to interpolate a curve u By increasingthe interpolation steps 119899(u) can be approximated to theoriginal number of points of a sample X The average lengthof X is 119899( X) = 2668 and hence a tenfold increase 119899(u) =

25 rarr 119899(u) = 250 is generally sufficient to achieve smoothsyntheses To ensure that the above mentioned methodswork efficiently on the compressed representation u theinterpolation step is applied just before rendering or skippedin case of low-resolution synthesis

Our system supports two interpolation methods Piece-wise Cubic hermite-interpolation is 1198621-steady which meansthat only the first derivation of the used interpolation func-tion is steady Therefore hermite-interpolation leads to lesssmooth and accurate results a property that can be used tocreate noisy handwritings [32] (perturbed data technique)State-of-the-art B-Spline interpolation is commonly usedwithin CAD-applications since it is 1198622-steady and leads tosmooth natural curves which can be defined properly bytheir control points as shown in Figure 9 Although the B-Spline curve do not pass through all control points it fitsthe original curve sufficiently when 119899 = 25 control pointsare used Given the measure 120575 of (4) the average distancebetween u and the 119899 closest points of u can be computedUsing a cross-validation with 119896fold = 10 we get 120575(u u) =

045 with a variance of 0058

54 Rendering Handwriting Images The former sectionsdiscussed how to compose and interpolate polygonal rep-resentations of Arabic handwritings Now those have to betransformed into images and saved in common files formats(bmp png etc) which can easily be loaded by most text

10 The Scientific World Journal

(a) (b) (c)

Figure 8 Example for a synthesized letter pair using (a) full (b) half and (c) negative Kashida length

Control points uInterpolated points 119854

(a) B-Spline

Control points uInterpolated points 119854

(b) Cubic

Figure 9 Comparison of B-Spline and Cubic interpolation where 119899(u) = 25 and 119899(u) = 250

recognitions or document analysis systems Even preprocess-ing steps as thinning can influence the performance of thefollowing tasks Such preprocessing is sensitive to secondaryfeatures or flaws which are a result of the used writingmaterials hence the synthesized files should contain thosefeatures too Therefore we propose a rendering techniquethat reflects optical features caused by common pens asball pens or pencils [33] Subsequently a modification ofthis technique is described that allows rendering features ofhistorical handwritings

First of all pixels o have to be found that are closeto polygons u and belong to the foreground As shown inFigure 10(a) we first interpolate between two neighboredpoints p q of u (or u) and get 120588 lowast p minus q new points

o1015840 = ]p+ (1minus ]) q ] isin [0 1] (8)

where ] is uniform distributed and 120588 is a user definedparameter

Let n be the normal vector of line pq and then we shifteach o1015840 along n using a Gaussian distribution

o = o1015840 +N (120583 120590) n (9)

where 120590 and 120583 define the line width which is decreased up to20 in case that p lies between the PenUp or PenDown pointand the neighbored control point As a result the prototype ofa word image has been prepared that defines all pixels whichare influenced by pigments at all (shown in Figure 10(b))To allow sharp contours a limitation of |N(120583 120590)| lt 120603120590

is applied according to the simulated pen where 120603 is userdependent

541 Texture Biros or pencils cause an irregular pigmenta-tion intensity which is reflected by pixel intensities 119868(119909 119910)of scanned images A realistic physical model that simulatesthis behavior in a proper way is beyond the scope of thispaper a more simplified and generalized approach howeveris quite practical Inspired by the ability of Fourier transformbased image compression to represent the main nature ofa texture by a small subset of the underlying frequencieswe define a texture by 10 points (120582 120579 120601) in frequency spacein order to emulate irregularities caused by pen and paperThis way simplified but unique textures can be created atruntime However in contrast to image compression weare not interested in avoiding noise-prone high frequencies

The Scientific World Journal 11

n

p

qoi

(a) (b) (c) (d) (e) Synthetic image (f) Real image

(g) Example text line

Figure 10 Painting technique (a) scheme (b) word shape with 120588 = 6 120590 = 35 (Gaussian filter is disabled) (c-d) example results for paintingtechnique (c) test texture applied on (b) (d) 120588 = 30 120590 = 10 with ball pen texture and (e-f) comparison of natural and synthetic ball pentextures

Hence different high and low frequencies are combined tosimulate regional as well as locale effects (behavior of inkpaper texture) Each point represents a texture layer in imagespace with 1198681(119909 119910) isin [minus1 1] We created several textureclasses by defining different sets of Gaussian distributionsfor the angle 120579 wave length 120582 and phase shift 120601 of alllayers manually Afterwards pixel intensities 1198682(o) isin [0 256]are computed by accumulating most texture layers The leftlayers are used to achieve variations in their intensities bymultiplication Finally an image I with a small margin iscreated and all o are fitted to I subsequently

By creating word syntheses using polygonal glyphs andrendering techniques smooth letter connections can beachieved more efficiently compared to synthesis approachesthat use image based glyphs Furthermore in contrast tothe usage of natural textures the described technique is ableto generate unique nontiled textures for every synthesizedword as shown in Figures 10(c)ndash10(e) Depending on thetexture class a median or Gaussian filter is used before savingthe image

542 Simulation of Feather Like Writing Tools The previousmethod allows a proper simulation of text that is writtenby ball pens pencils or coal on white paper However toallow a more accurate simulation of writing instrumentsas fountains pens or feathers we extended our renderingtechnique This includes mainly the implementation of twofeatures the writing speed and the shape of the top of thewriting instrument further called Pen Shape

Pen Shape If the Pen Shape is modeled as line or ellipsoid theline width of the trajectory u depends not only on the widthof the Pen Shape 119908

119875 but also on its angle 120574

119875and the angle

of the trajectory tangent 120574u We initialize 120574119875= 45∘ changing

it continuously with a maximal deviation of plusmn15∘ This localedeviation is computed by adding two cosine functions wherethe wavelengths phases and amplitudes are redefined byGaussian distributions for each synthesis

According to the texture of a Pen Shape the contactwith the paper and consequently the caused pigmentationcan vary This is simulated by an one-dimensional function

119891(119909119875) | 0 le 119909

119875le 119908

119875that defines the pigmentation potential

for the long axis of the Pen Shape An emphasized exampleinspired by a fountain pen is shown in Figure 11(d)

Binary images can be rendered in a faster way by definingpolygons (here a triangle mesh) that is a result of extrudingan one-dimensional Pen Shape along u or u A visualizationof this can be found in Figure 11(c) and a resulting synthesisis shown in Figure 11(h) These polygons can then be drawnby standard routines If the angle of the Pen Shape and theline is identical or so close where the polygon width wouldbe smaller than one pixel a line have to be drawn instead toavoid letter fragmentation

Writing Speed Large lines or bows as the left part of Sin() are usually written faster thanmore complex structuresA high writing speed often causes a lack of pigmentationthat leads to brighter or dappled lines However there is noneed to reconstruct writing speed for the used online lettersamples already that contain such information From eachrepresentation u we can extract the relative local writingspeed for ASMs representations in points per second

V (119894) pts =1003817100381710038171003817(2119894minus1 2119894) minus (2119894+1 2119894+2)

1003817100381710038171003817pt

(119899 (u) 119899 (u)) Δ119905s

1 le 119894 le 119899 (u) (10)

In order to estimate the expected pigmentation intensitywe use the normalized writing speed V isin [0 1] where V = 0is the slowest and V = 1 is the fastest part of the trajectory ofa synthesis If c0 is the current color of a pixel in RGB colorspace and c

119901is the color of the pen pigment then the new

color is computed by

c = c119901120572119886+ c0120572119887 (1minus120572119886) c isin R

3 (11)

where 120572119886

= 08(1 minus V) + 02 defines opacity of c119901and

120572119887

= 1 defines the opacity of the background Althoughpigments that are used for handwritings are typically full orsemiopaque reduction of pigmentation caused by increasedwriting speed can lead to transparency This is simulated byreducing 120572

119886 as shown in Figure 11(e)

12 The Scientific World Journal

(a) u (b) u (B-Spline) (c) u (polygon mesh) (d) Pen shape (e) Speed (f)

(g) Example of a synthesized text line

(h) Example of a synthesized text line (fast method for binary images)

Figure 11 From the polygon u to a synthetic image that simulates a feather like writing instrument (c) Polygon mesh created from u that isused for fast rendering of binary images

To ensure a steady behavior we interpolate the speed ofconnected letters For the first 119899(u)4 points (2119894minus1 2119894)we setthe speed V of a letter in middle or end form to

V (119894) = V (119894) [1minus120582119894] + V

119887(119899 (u)) 120582

119894

120582119894= 4 119894

119899 (u) 119894 le

14119899 (u)

(12)

where V119887(119899(u)) is the speed at the end of the previous letter

The effect on the synthesis is shown in Figure 11(d)

Render on Degraded Background Finally we createFigure 11(f) by combining our texture rendering techniqueof Section 541 with the one based on Pen Shape and writingspeed using a nonuniform background Therefore weapplied a transparent texture on all pixels that does notbelong to the background texture This way small randomirregularity is simulated

In the shown examples a black color is used as mostdocuments are written with dark ink (like iron oxide or soot)Pigmentation intensity is implemented as transparencywhich allows simulating pigment accumulation at crossinglines or in case of a textured background However alsocolored opaque or semiopaque ink can be simulated Thismight be interesting in the context of historical documentssince important passages are often highlighted by using redink Another important feature of historical documents isdegradation of paper or parchment Currently we simplyuse images of natural paper or parchment as backgroundtextures which are scaled or tiled in case where they aresmaller than the synthesized document

55 Generation of Text Pages Recently not only characteror word recognition but also more complex document anal-ysis issues that address the interpretation or recognition of

complete documents become a focus of Arabic handwritingresearch Hence we investigate the possibilities of text pagesynthesis In this regard the accurate simulation of thelower baselines is crucial Many problems that occur whiledetecting lines words or connected components depend onthese baselines as for instance assigning diacritics (that arevery close to more than one text lines) to their correspondingPAW

Our approach of simulating baselines has three stepsFirst of all we set the coordinates (1199090 1199100) of the first letter foreach line Secondly the curvatures of the baselines have to becomputed Thirdly potential intersection of words have to besolved

Start PAWs Due to the style of Arabic handwritings alllines start at the rightmost 119909-coordinate 1199090 = 119909max Thevertical space between two neighbored lines can be definedas percentage of the average PAW heights to get 1199100 for eachbaseline

Baselines We implement the second step by declaring func-tions 119891(119909 1199100) that define the curvatures of the simulatedBaselines Ξ

119904(1199100 defines the initial heights of a line) We

normalize 1199100 isin [0 1] inside 119891(119909 1199100) so it becomes

independent of the page size How to compute proper 119891119894is

explained in Section 56Let l119903 define the lower right of a letters bounding box then

we first translate the letter l towards the baseline so that l119903touches it Subsequently the119910-position of lmust be correctedaccording to its class by translating it by t

119887 so that l119903 might

be above or below 119891(119897119903

119909 1199100) as shown in Figure 12Therefore

we extracted the normalized statistical relation N119887between

l119903 and the baseline from the IESK-arDB for all letter classes If119897ℎ is the heights and l119894 is the 119894th point of l we can compute t

119887=

(0 119897ℎN119887)119879 and l1015840119894 = l119894 + t

119887as shown in Figure 12 We perform

this for every first letter l119891of a PAW Apart from the position

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 6: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

6 The Scientific World Journal

(a) u (b) u (B-Spline) (c) x

(d) x (B-Spline) (e) forall119888119895= 0 (f) forall|119888

119895| = 2radic120582

119895

Figure 3 Examples of glyphs (a) examples for ASM-glyph representations u (wheresum |119888119895| asymp sum 16radic120582

119895 see (3)) (b) a B-Spline interpolation

has been applied on the representations (c) (d) original letter samples x A B-Spline interpolation with 5 steps has been applied on (b) and(e) Examples of ASM-glyphs u that are composed to words are shown in (e) and (f) where the influence is minimal (e) and maximal (f)respectively for all eigenvalues

requires a clear increase of 119903 in order to keep u statisticallyreliable

Some examples of x and u are shown in Figure 3 Thecomputation of ASMs is quite costly especially if many sam-ples and interpolation points are used This is why we avoidrecalculations of ASMs at runtime since the synthesizingprocess requires a minimum of 100ASMs Hence all ASMs(including their corresponding online samples) are saved infiles to separate ASM generation from the synthesis module

42 ASMDistance Measure The distance 120575 of a sample x anda representation u of an ASM can be calculated as follows

120575 (x u) = 1119899

119899

sum

119894=1

radic(1199062119894minus1 minus 1199092119894minus1)2+ (1199062119894 minus 1199092119894)

2 (4)

Due to the performed scaling of x 120575(x u) can be interpretedas the approximated deviation in percent For all samples xwe compute the most similar representation ulowast by solving (3)numerically using c as unknown (initially forall119888

119894= 0) Some

examples of ulowast are visualized in Figure 4In contrast to ASMs from offline samples [32] most

online based ASMs are capable of representing their inputsamples well even without manually defined landmarkssince detailed slowly written structures (where landmarksare suspected) are represented by more intermediate pointsThis effect allows an efficient extension and maintenanceof the character database since time consuming manuallandmarking can be avoided

Nonetheless the average 120575 is writer dependent We mea-sured 120575 = 08 for writer 1 120575 = 146 for writer 2 and evenhigher values for the other writers whose handwriting styleis less tidy Furthermore 120575depends on the letter class A high 120575is mainly caused by some classes with diacritics as Zai ( ) thatneed improvement (see Figure 3(c)) The distance between

the letters main body and diacritics can vary clearly whichmay lead to inappropriate ulowast in case that x is unlike x Toreact against this effect more training samples could be usedor diacritics andmain bodies could be separated using ActiveShape Structural Models (ASSM) [16] However our ASMsare meant for synthesis approaches where the use of purenoise (perturbed data) is quite common and hencemoderateimprecision does not spoil the synthesis quality significantly

5 Synthesizing Arabic Handwritings

In the following subsections we describe all methods thatare applied to create synthetic Arabic handwritings fromUnicode using the ASM data from the last Section Oursystem uses these either to show a few specific syntheses forpreview purpose or to generate a complete database includingground truth

The methods which are used to synthesize and renderArabic handwritings are described in the following Sections

51 Composing Words The basic idea of Arabic handwritingsynthesis fromUnicode is to select glyphs with proper shapes(isolated initial end or middle form) and connect themsubsequently to build PAWs words and texts from whichimages or vector graphics are rendered

511 Calculation of the Letter Form Our system receives textas Unicode string that represents every letter as numberSince our samples are limited to the 28 regular letters andTamarbuta ( D ) we substitute special characters as Alif withHamza above (

) with their regular formAlif ( ) before starting

the synthesis Letter forms have a strong influence on theletter shape but they are not given by regular Unicode thusthey have to be determined first

The Scientific World Journal 7

119857

x119854lowast

(a) | 120575 = 096

119857

x119854lowast

(b) J | 120575 = 087

119857

x119854lowast

(c) | 120575 = 56

Figure 4 Examples of ASM based glyph ulowast that has the highest correlation (deviation 120575) with a randomly chosen samples x The averagesample polygon x is displayed to show how strong x differs from the expected shape Some of the ASM for characters with diacritics areproblematic as shown in (c)

Letters of the set Γ2 = (H ) can only assume isolated orend form All other letters such as Ayn() can assume begin-middle- and- as well as isolated- form Ayn (0 1 2 3)Therefore the form f0 of the first letter l0 of a word is

f0 =

i if l0 isin Γ2

b else(5)

Examples of the different letter forms within an Arabic wordare shown in Figure 5 Let f

minus1 be the form of lminus1 which is the

predecessor of letter l and l+1 = define that the successor

of l is a space tab or return token and then the position fof a letter l can be defined as follows

f =

i if fminus1 isin (i e) and (l isin Γ

2or l

+1 = )

b if fminus1 isin (i e) and (l notin Γ

2and l

+1 = )

m if fminus1 isin (bm) and (l notin Γ

2and l

+1 = )

e if fminus1 isin (bm) and (l isin Γ

2or l

+1 = )

(6)

Letters that have only two forms split an Arabic word intoPieces of ArabicWords (PAWs) which consist of one ormoreletters

i

i eb

e mb

Figure 5Outgoing from theUnicode sequence ( H J H JB)

the forms (isolated end middle and begin) of all letters aredetermined ( H H ) and composed to the wordII (New York)

512 Selection of Suitable Glyphs To ensure that the styles ofall neighbored glyphs are similar glyphs of different writerare not mixed within a synthesis We encouraged the writersto write letters only in this style that is dominant for theirwritings and avoid severe rotations The size of the glyphs isnormalized by the average character size we extracted fromthe IESK-arDB However we corrected the size manually incase of rare character classes A suitability measure for theglyph joint points has not been considered since steady jointsare achieved by B-Spline interpolation and rendering at theend of the synthesis process

513 Connecting Glyphs After all letter classes are definedby their names and forms corresponding ASMs are loaded

8 The Scientific World Journal

Input Current PAW A119888 precedent PAW A

119901 average letter width l

119908

Output Shifted current PAW A119888

If Bounding boxes of A119888and A

119901overlap then

while Trajectories of A119888and A

119901intersect do

Translate the 119909 coordinates of A119888by (14)l

119908

Algorithm 1 Solving intersections of neighbored PAWs

(a) Writer 1 (b) Writer 2 (c) Writer 3 (d) Writer 4

Figure 6 The word II (New York) synthesized by the average letter shapes 119909 of different writers

The ASMs are used to generate an unique polygonal rep-resentation u for each occurrence of a letter class in orderto avoid piecewise identical syntheses In order to composewords from these polygons each letter in end or middle formhas to be connected with its predecessor 3 rarr $ 3 I rarr I Let pf be the first point of and pl the last

point of its predecessor and then we can connect them by

translating by pl minus pf An example is shown in Figure 5The relation of a PAWrsquos 119910 coordinate and the baseline

depends on the letter classes the PAW is composed of Thuswe extracted the average 120583

119903and variance 120590

119903of the relative

distance between the baseline and the center of a letter frommanual created ground truth of our (real) word databaseIESK-arDB [4] We set the baseline to 0 and shift all 119910coordinates of each PAW by N(120583

119903 120590

119903) Finally the space

between the rightmost point of a PAW and the leftmostpoint of its predecessor has to be defined Therefore the userdepending parameter 120589 is used that may be negative in orderto simulate overlapping PAWs Given pl and pf the PAW canbe translated by the vector

tpaw = (

1199011198971minus 119901

1198911minus 120589

N (120583119903 120590

119903)

) (7)

In case of intersections between the polygons of overlappingPAWs 120589 is increased iteratively by 25 of the average letterwidth as described in Algorithm 1

Examples of words composed by the average letter shapesof different writers are shown in Figure 6 Examples fromASM based and original samples can be found in Table 3The maximal deviation 120590

119860means that the influence of an

eigenvector e119894is limited by plusmn2radic120582

119894 While letters look similar

using 120590 between 0 and 1 ASM representations u with 120590119860of

2 already provoke increased letter variation ASMs (trainedwith 119903 = 50 samples) are barely capable of representing adeviation of120590

119860= 3 though As amatter of fact there are noise

based deformations as shown in Table 3 (second last row)

This effect might be intended to create especially challengingsyntheses

52 Simulation of Global Variances ASMs already containvariations in slant width or connection size Neverthelessthese variations are limited by the used samples In order toincrease and control these variations affine transformationsare used (scaling translation shearing and rotation) whichallow optional manipulations of letter and PAW shapes Theuser interface (UI) of our synthesis system allows to set theaverage 120583 and variance 120590 of a Gaussian distribution for allaffine transformations Particularly global variations as theslant can be achieved this way The influences of these affinetransformations on the resulting word image is shown inFigure 7

A stretching is performed by scale each 119909 component ofeach letter point by the factor 119888 isin [05 2] The word slantcan be set by shearing the word with an angle of 120572

119904as the

skew of PAW can be manipulated by rotating to the angle120572119903 where 120572

119904 120572

119903isin [minus45∘ +45∘] We analyzed the skew and

slant of samples of the IESK-arDB database [4] with localminima regression and Hough transform We found that theskew correlates with a Gaussian distribution ofN(minus38∘ 71∘)(passed Chi square test with 120572 = 005) The slant can berepresented byN(minus46∘ 144∘)The size of the complete wordor single letters can be adjusted by an equal scaling with119888 isin [01 10] which can be used to control the resolution ofthe synthesized word images or to increase variation of lettersize As described in Section 513 variations of PAWpositionscan be realized by translations Even using the same glyphssynthetic words can assume large variations in shape whenusing affine transformations or cutting connection size asshown in Figure 7

When examining the glyph samples and synthesis wefound that compared to complete handwritings letter con-nections of the acquired samples are extended and evenexcessively (approximately twice as) long in case of writer 1Hence we allow to delete up to 25 of the letter points tosimulate stretched or missed connections which often occur

The Scientific World Journal 9

Table 3 Syntheses using ASMs and sample based glyphs of writer 1

120590119860sim |119888

119895|radic120582

119894Result

0

1

2

3

Samples

(a) Stretching (b) Slant (c) Size (d) Skew (e) Position (f) Connection

Figure 7 Affine transformations and connection shortening on synthetic words

in natural Arabic handwritings In Arabic handwritings somecharacters as Ya ( J ) are sometimes written beneath theirpredecessors As a result they resemble a single characterwhich impedes segmentation and recognition tasks Thiseffect can be simulated by a strong reduction of the Kashidaas shown in Figure 8 However this feature has been not yetentirely implemented since a list of all pairs of letters thattypically show this behaviour needs to be created first

53 Interpolation Since a polygonal letter representationdoes not look natural for vector graphics or images witha scaling factor gt 1 we use interpolation to improve theoutcome Let 119899(u) be the number of points of u and then weuse u as control points to interpolate a curve u By increasingthe interpolation steps 119899(u) can be approximated to theoriginal number of points of a sample X The average lengthof X is 119899( X) = 2668 and hence a tenfold increase 119899(u) =

25 rarr 119899(u) = 250 is generally sufficient to achieve smoothsyntheses To ensure that the above mentioned methodswork efficiently on the compressed representation u theinterpolation step is applied just before rendering or skippedin case of low-resolution synthesis

Our system supports two interpolation methods Piece-wise Cubic hermite-interpolation is 1198621-steady which meansthat only the first derivation of the used interpolation func-tion is steady Therefore hermite-interpolation leads to lesssmooth and accurate results a property that can be used tocreate noisy handwritings [32] (perturbed data technique)State-of-the-art B-Spline interpolation is commonly usedwithin CAD-applications since it is 1198622-steady and leads tosmooth natural curves which can be defined properly bytheir control points as shown in Figure 9 Although the B-Spline curve do not pass through all control points it fitsthe original curve sufficiently when 119899 = 25 control pointsare used Given the measure 120575 of (4) the average distancebetween u and the 119899 closest points of u can be computedUsing a cross-validation with 119896fold = 10 we get 120575(u u) =

045 with a variance of 0058

54 Rendering Handwriting Images The former sectionsdiscussed how to compose and interpolate polygonal rep-resentations of Arabic handwritings Now those have to betransformed into images and saved in common files formats(bmp png etc) which can easily be loaded by most text

10 The Scientific World Journal

(a) (b) (c)

Figure 8 Example for a synthesized letter pair using (a) full (b) half and (c) negative Kashida length

Control points uInterpolated points 119854

(a) B-Spline

Control points uInterpolated points 119854

(b) Cubic

Figure 9 Comparison of B-Spline and Cubic interpolation where 119899(u) = 25 and 119899(u) = 250

recognitions or document analysis systems Even preprocess-ing steps as thinning can influence the performance of thefollowing tasks Such preprocessing is sensitive to secondaryfeatures or flaws which are a result of the used writingmaterials hence the synthesized files should contain thosefeatures too Therefore we propose a rendering techniquethat reflects optical features caused by common pens asball pens or pencils [33] Subsequently a modification ofthis technique is described that allows rendering features ofhistorical handwritings

First of all pixels o have to be found that are closeto polygons u and belong to the foreground As shown inFigure 10(a) we first interpolate between two neighboredpoints p q of u (or u) and get 120588 lowast p minus q new points

o1015840 = ]p+ (1minus ]) q ] isin [0 1] (8)

where ] is uniform distributed and 120588 is a user definedparameter

Let n be the normal vector of line pq and then we shifteach o1015840 along n using a Gaussian distribution

o = o1015840 +N (120583 120590) n (9)

where 120590 and 120583 define the line width which is decreased up to20 in case that p lies between the PenUp or PenDown pointand the neighbored control point As a result the prototype ofa word image has been prepared that defines all pixels whichare influenced by pigments at all (shown in Figure 10(b))To allow sharp contours a limitation of |N(120583 120590)| lt 120603120590

is applied according to the simulated pen where 120603 is userdependent

541 Texture Biros or pencils cause an irregular pigmenta-tion intensity which is reflected by pixel intensities 119868(119909 119910)of scanned images A realistic physical model that simulatesthis behavior in a proper way is beyond the scope of thispaper a more simplified and generalized approach howeveris quite practical Inspired by the ability of Fourier transformbased image compression to represent the main nature ofa texture by a small subset of the underlying frequencieswe define a texture by 10 points (120582 120579 120601) in frequency spacein order to emulate irregularities caused by pen and paperThis way simplified but unique textures can be created atruntime However in contrast to image compression weare not interested in avoiding noise-prone high frequencies

The Scientific World Journal 11

n

p

qoi

(a) (b) (c) (d) (e) Synthetic image (f) Real image

(g) Example text line

Figure 10 Painting technique (a) scheme (b) word shape with 120588 = 6 120590 = 35 (Gaussian filter is disabled) (c-d) example results for paintingtechnique (c) test texture applied on (b) (d) 120588 = 30 120590 = 10 with ball pen texture and (e-f) comparison of natural and synthetic ball pentextures

Hence different high and low frequencies are combined tosimulate regional as well as locale effects (behavior of inkpaper texture) Each point represents a texture layer in imagespace with 1198681(119909 119910) isin [minus1 1] We created several textureclasses by defining different sets of Gaussian distributionsfor the angle 120579 wave length 120582 and phase shift 120601 of alllayers manually Afterwards pixel intensities 1198682(o) isin [0 256]are computed by accumulating most texture layers The leftlayers are used to achieve variations in their intensities bymultiplication Finally an image I with a small margin iscreated and all o are fitted to I subsequently

By creating word syntheses using polygonal glyphs andrendering techniques smooth letter connections can beachieved more efficiently compared to synthesis approachesthat use image based glyphs Furthermore in contrast tothe usage of natural textures the described technique is ableto generate unique nontiled textures for every synthesizedword as shown in Figures 10(c)ndash10(e) Depending on thetexture class a median or Gaussian filter is used before savingthe image

542 Simulation of Feather Like Writing Tools The previousmethod allows a proper simulation of text that is writtenby ball pens pencils or coal on white paper However toallow a more accurate simulation of writing instrumentsas fountains pens or feathers we extended our renderingtechnique This includes mainly the implementation of twofeatures the writing speed and the shape of the top of thewriting instrument further called Pen Shape

Pen Shape If the Pen Shape is modeled as line or ellipsoid theline width of the trajectory u depends not only on the widthof the Pen Shape 119908

119875 but also on its angle 120574

119875and the angle

of the trajectory tangent 120574u We initialize 120574119875= 45∘ changing

it continuously with a maximal deviation of plusmn15∘ This localedeviation is computed by adding two cosine functions wherethe wavelengths phases and amplitudes are redefined byGaussian distributions for each synthesis

According to the texture of a Pen Shape the contactwith the paper and consequently the caused pigmentationcan vary This is simulated by an one-dimensional function

119891(119909119875) | 0 le 119909

119875le 119908

119875that defines the pigmentation potential

for the long axis of the Pen Shape An emphasized exampleinspired by a fountain pen is shown in Figure 11(d)

Binary images can be rendered in a faster way by definingpolygons (here a triangle mesh) that is a result of extrudingan one-dimensional Pen Shape along u or u A visualizationof this can be found in Figure 11(c) and a resulting synthesisis shown in Figure 11(h) These polygons can then be drawnby standard routines If the angle of the Pen Shape and theline is identical or so close where the polygon width wouldbe smaller than one pixel a line have to be drawn instead toavoid letter fragmentation

Writing Speed Large lines or bows as the left part of Sin() are usually written faster thanmore complex structuresA high writing speed often causes a lack of pigmentationthat leads to brighter or dappled lines However there is noneed to reconstruct writing speed for the used online lettersamples already that contain such information From eachrepresentation u we can extract the relative local writingspeed for ASMs representations in points per second

V (119894) pts =1003817100381710038171003817(2119894minus1 2119894) minus (2119894+1 2119894+2)

1003817100381710038171003817pt

(119899 (u) 119899 (u)) Δ119905s

1 le 119894 le 119899 (u) (10)

In order to estimate the expected pigmentation intensitywe use the normalized writing speed V isin [0 1] where V = 0is the slowest and V = 1 is the fastest part of the trajectory ofa synthesis If c0 is the current color of a pixel in RGB colorspace and c

119901is the color of the pen pigment then the new

color is computed by

c = c119901120572119886+ c0120572119887 (1minus120572119886) c isin R

3 (11)

where 120572119886

= 08(1 minus V) + 02 defines opacity of c119901and

120572119887

= 1 defines the opacity of the background Althoughpigments that are used for handwritings are typically full orsemiopaque reduction of pigmentation caused by increasedwriting speed can lead to transparency This is simulated byreducing 120572

119886 as shown in Figure 11(e)

12 The Scientific World Journal

(a) u (b) u (B-Spline) (c) u (polygon mesh) (d) Pen shape (e) Speed (f)

(g) Example of a synthesized text line

(h) Example of a synthesized text line (fast method for binary images)

Figure 11 From the polygon u to a synthetic image that simulates a feather like writing instrument (c) Polygon mesh created from u that isused for fast rendering of binary images

To ensure a steady behavior we interpolate the speed ofconnected letters For the first 119899(u)4 points (2119894minus1 2119894)we setthe speed V of a letter in middle or end form to

V (119894) = V (119894) [1minus120582119894] + V

119887(119899 (u)) 120582

119894

120582119894= 4 119894

119899 (u) 119894 le

14119899 (u)

(12)

where V119887(119899(u)) is the speed at the end of the previous letter

The effect on the synthesis is shown in Figure 11(d)

Render on Degraded Background Finally we createFigure 11(f) by combining our texture rendering techniqueof Section 541 with the one based on Pen Shape and writingspeed using a nonuniform background Therefore weapplied a transparent texture on all pixels that does notbelong to the background texture This way small randomirregularity is simulated

In the shown examples a black color is used as mostdocuments are written with dark ink (like iron oxide or soot)Pigmentation intensity is implemented as transparencywhich allows simulating pigment accumulation at crossinglines or in case of a textured background However alsocolored opaque or semiopaque ink can be simulated Thismight be interesting in the context of historical documentssince important passages are often highlighted by using redink Another important feature of historical documents isdegradation of paper or parchment Currently we simplyuse images of natural paper or parchment as backgroundtextures which are scaled or tiled in case where they aresmaller than the synthesized document

55 Generation of Text Pages Recently not only characteror word recognition but also more complex document anal-ysis issues that address the interpretation or recognition of

complete documents become a focus of Arabic handwritingresearch Hence we investigate the possibilities of text pagesynthesis In this regard the accurate simulation of thelower baselines is crucial Many problems that occur whiledetecting lines words or connected components depend onthese baselines as for instance assigning diacritics (that arevery close to more than one text lines) to their correspondingPAW

Our approach of simulating baselines has three stepsFirst of all we set the coordinates (1199090 1199100) of the first letter foreach line Secondly the curvatures of the baselines have to becomputed Thirdly potential intersection of words have to besolved

Start PAWs Due to the style of Arabic handwritings alllines start at the rightmost 119909-coordinate 1199090 = 119909max Thevertical space between two neighbored lines can be definedas percentage of the average PAW heights to get 1199100 for eachbaseline

Baselines We implement the second step by declaring func-tions 119891(119909 1199100) that define the curvatures of the simulatedBaselines Ξ

119904(1199100 defines the initial heights of a line) We

normalize 1199100 isin [0 1] inside 119891(119909 1199100) so it becomes

independent of the page size How to compute proper 119891119894is

explained in Section 56Let l119903 define the lower right of a letters bounding box then

we first translate the letter l towards the baseline so that l119903touches it Subsequently the119910-position of lmust be correctedaccording to its class by translating it by t

119887 so that l119903 might

be above or below 119891(119897119903

119909 1199100) as shown in Figure 12Therefore

we extracted the normalized statistical relation N119887between

l119903 and the baseline from the IESK-arDB for all letter classes If119897ℎ is the heights and l119894 is the 119894th point of l we can compute t

119887=

(0 119897ℎN119887)119879 and l1015840119894 = l119894 + t

119887as shown in Figure 12 We perform

this for every first letter l119891of a PAW Apart from the position

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 7: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

The Scientific World Journal 7

119857

x119854lowast

(a) | 120575 = 096

119857

x119854lowast

(b) J | 120575 = 087

119857

x119854lowast

(c) | 120575 = 56

Figure 4 Examples of ASM based glyph ulowast that has the highest correlation (deviation 120575) with a randomly chosen samples x The averagesample polygon x is displayed to show how strong x differs from the expected shape Some of the ASM for characters with diacritics areproblematic as shown in (c)

Letters of the set Γ2 = (H ) can only assume isolated orend form All other letters such as Ayn() can assume begin-middle- and- as well as isolated- form Ayn (0 1 2 3)Therefore the form f0 of the first letter l0 of a word is

f0 =

i if l0 isin Γ2

b else(5)

Examples of the different letter forms within an Arabic wordare shown in Figure 5 Let f

minus1 be the form of lminus1 which is the

predecessor of letter l and l+1 = define that the successor

of l is a space tab or return token and then the position fof a letter l can be defined as follows

f =

i if fminus1 isin (i e) and (l isin Γ

2or l

+1 = )

b if fminus1 isin (i e) and (l notin Γ

2and l

+1 = )

m if fminus1 isin (bm) and (l notin Γ

2and l

+1 = )

e if fminus1 isin (bm) and (l isin Γ

2or l

+1 = )

(6)

Letters that have only two forms split an Arabic word intoPieces of ArabicWords (PAWs) which consist of one ormoreletters

i

i eb

e mb

Figure 5Outgoing from theUnicode sequence ( H J H JB)

the forms (isolated end middle and begin) of all letters aredetermined ( H H ) and composed to the wordII (New York)

512 Selection of Suitable Glyphs To ensure that the styles ofall neighbored glyphs are similar glyphs of different writerare not mixed within a synthesis We encouraged the writersto write letters only in this style that is dominant for theirwritings and avoid severe rotations The size of the glyphs isnormalized by the average character size we extracted fromthe IESK-arDB However we corrected the size manually incase of rare character classes A suitability measure for theglyph joint points has not been considered since steady jointsare achieved by B-Spline interpolation and rendering at theend of the synthesis process

513 Connecting Glyphs After all letter classes are definedby their names and forms corresponding ASMs are loaded

8 The Scientific World Journal

Input Current PAW A119888 precedent PAW A

119901 average letter width l

119908

Output Shifted current PAW A119888

If Bounding boxes of A119888and A

119901overlap then

while Trajectories of A119888and A

119901intersect do

Translate the 119909 coordinates of A119888by (14)l

119908

Algorithm 1 Solving intersections of neighbored PAWs

(a) Writer 1 (b) Writer 2 (c) Writer 3 (d) Writer 4

Figure 6 The word II (New York) synthesized by the average letter shapes 119909 of different writers

The ASMs are used to generate an unique polygonal rep-resentation u for each occurrence of a letter class in orderto avoid piecewise identical syntheses In order to composewords from these polygons each letter in end or middle formhas to be connected with its predecessor 3 rarr $ 3 I rarr I Let pf be the first point of and pl the last

point of its predecessor and then we can connect them by

translating by pl minus pf An example is shown in Figure 5The relation of a PAWrsquos 119910 coordinate and the baseline

depends on the letter classes the PAW is composed of Thuswe extracted the average 120583

119903and variance 120590

119903of the relative

distance between the baseline and the center of a letter frommanual created ground truth of our (real) word databaseIESK-arDB [4] We set the baseline to 0 and shift all 119910coordinates of each PAW by N(120583

119903 120590

119903) Finally the space

between the rightmost point of a PAW and the leftmostpoint of its predecessor has to be defined Therefore the userdepending parameter 120589 is used that may be negative in orderto simulate overlapping PAWs Given pl and pf the PAW canbe translated by the vector

tpaw = (

1199011198971minus 119901

1198911minus 120589

N (120583119903 120590

119903)

) (7)

In case of intersections between the polygons of overlappingPAWs 120589 is increased iteratively by 25 of the average letterwidth as described in Algorithm 1

Examples of words composed by the average letter shapesof different writers are shown in Figure 6 Examples fromASM based and original samples can be found in Table 3The maximal deviation 120590

119860means that the influence of an

eigenvector e119894is limited by plusmn2radic120582

119894 While letters look similar

using 120590 between 0 and 1 ASM representations u with 120590119860of

2 already provoke increased letter variation ASMs (trainedwith 119903 = 50 samples) are barely capable of representing adeviation of120590

119860= 3 though As amatter of fact there are noise

based deformations as shown in Table 3 (second last row)

This effect might be intended to create especially challengingsyntheses

52 Simulation of Global Variances ASMs already containvariations in slant width or connection size Neverthelessthese variations are limited by the used samples In order toincrease and control these variations affine transformationsare used (scaling translation shearing and rotation) whichallow optional manipulations of letter and PAW shapes Theuser interface (UI) of our synthesis system allows to set theaverage 120583 and variance 120590 of a Gaussian distribution for allaffine transformations Particularly global variations as theslant can be achieved this way The influences of these affinetransformations on the resulting word image is shown inFigure 7

A stretching is performed by scale each 119909 component ofeach letter point by the factor 119888 isin [05 2] The word slantcan be set by shearing the word with an angle of 120572

119904as the

skew of PAW can be manipulated by rotating to the angle120572119903 where 120572

119904 120572

119903isin [minus45∘ +45∘] We analyzed the skew and

slant of samples of the IESK-arDB database [4] with localminima regression and Hough transform We found that theskew correlates with a Gaussian distribution ofN(minus38∘ 71∘)(passed Chi square test with 120572 = 005) The slant can berepresented byN(minus46∘ 144∘)The size of the complete wordor single letters can be adjusted by an equal scaling with119888 isin [01 10] which can be used to control the resolution ofthe synthesized word images or to increase variation of lettersize As described in Section 513 variations of PAWpositionscan be realized by translations Even using the same glyphssynthetic words can assume large variations in shape whenusing affine transformations or cutting connection size asshown in Figure 7

When examining the glyph samples and synthesis wefound that compared to complete handwritings letter con-nections of the acquired samples are extended and evenexcessively (approximately twice as) long in case of writer 1Hence we allow to delete up to 25 of the letter points tosimulate stretched or missed connections which often occur

The Scientific World Journal 9

Table 3 Syntheses using ASMs and sample based glyphs of writer 1

120590119860sim |119888

119895|radic120582

119894Result

0

1

2

3

Samples

(a) Stretching (b) Slant (c) Size (d) Skew (e) Position (f) Connection

Figure 7 Affine transformations and connection shortening on synthetic words

in natural Arabic handwritings In Arabic handwritings somecharacters as Ya ( J ) are sometimes written beneath theirpredecessors As a result they resemble a single characterwhich impedes segmentation and recognition tasks Thiseffect can be simulated by a strong reduction of the Kashidaas shown in Figure 8 However this feature has been not yetentirely implemented since a list of all pairs of letters thattypically show this behaviour needs to be created first

53 Interpolation Since a polygonal letter representationdoes not look natural for vector graphics or images witha scaling factor gt 1 we use interpolation to improve theoutcome Let 119899(u) be the number of points of u and then weuse u as control points to interpolate a curve u By increasingthe interpolation steps 119899(u) can be approximated to theoriginal number of points of a sample X The average lengthof X is 119899( X) = 2668 and hence a tenfold increase 119899(u) =

25 rarr 119899(u) = 250 is generally sufficient to achieve smoothsyntheses To ensure that the above mentioned methodswork efficiently on the compressed representation u theinterpolation step is applied just before rendering or skippedin case of low-resolution synthesis

Our system supports two interpolation methods Piece-wise Cubic hermite-interpolation is 1198621-steady which meansthat only the first derivation of the used interpolation func-tion is steady Therefore hermite-interpolation leads to lesssmooth and accurate results a property that can be used tocreate noisy handwritings [32] (perturbed data technique)State-of-the-art B-Spline interpolation is commonly usedwithin CAD-applications since it is 1198622-steady and leads tosmooth natural curves which can be defined properly bytheir control points as shown in Figure 9 Although the B-Spline curve do not pass through all control points it fitsthe original curve sufficiently when 119899 = 25 control pointsare used Given the measure 120575 of (4) the average distancebetween u and the 119899 closest points of u can be computedUsing a cross-validation with 119896fold = 10 we get 120575(u u) =

045 with a variance of 0058

54 Rendering Handwriting Images The former sectionsdiscussed how to compose and interpolate polygonal rep-resentations of Arabic handwritings Now those have to betransformed into images and saved in common files formats(bmp png etc) which can easily be loaded by most text

10 The Scientific World Journal

(a) (b) (c)

Figure 8 Example for a synthesized letter pair using (a) full (b) half and (c) negative Kashida length

Control points uInterpolated points 119854

(a) B-Spline

Control points uInterpolated points 119854

(b) Cubic

Figure 9 Comparison of B-Spline and Cubic interpolation where 119899(u) = 25 and 119899(u) = 250

recognitions or document analysis systems Even preprocess-ing steps as thinning can influence the performance of thefollowing tasks Such preprocessing is sensitive to secondaryfeatures or flaws which are a result of the used writingmaterials hence the synthesized files should contain thosefeatures too Therefore we propose a rendering techniquethat reflects optical features caused by common pens asball pens or pencils [33] Subsequently a modification ofthis technique is described that allows rendering features ofhistorical handwritings

First of all pixels o have to be found that are closeto polygons u and belong to the foreground As shown inFigure 10(a) we first interpolate between two neighboredpoints p q of u (or u) and get 120588 lowast p minus q new points

o1015840 = ]p+ (1minus ]) q ] isin [0 1] (8)

where ] is uniform distributed and 120588 is a user definedparameter

Let n be the normal vector of line pq and then we shifteach o1015840 along n using a Gaussian distribution

o = o1015840 +N (120583 120590) n (9)

where 120590 and 120583 define the line width which is decreased up to20 in case that p lies between the PenUp or PenDown pointand the neighbored control point As a result the prototype ofa word image has been prepared that defines all pixels whichare influenced by pigments at all (shown in Figure 10(b))To allow sharp contours a limitation of |N(120583 120590)| lt 120603120590

is applied according to the simulated pen where 120603 is userdependent

541 Texture Biros or pencils cause an irregular pigmenta-tion intensity which is reflected by pixel intensities 119868(119909 119910)of scanned images A realistic physical model that simulatesthis behavior in a proper way is beyond the scope of thispaper a more simplified and generalized approach howeveris quite practical Inspired by the ability of Fourier transformbased image compression to represent the main nature ofa texture by a small subset of the underlying frequencieswe define a texture by 10 points (120582 120579 120601) in frequency spacein order to emulate irregularities caused by pen and paperThis way simplified but unique textures can be created atruntime However in contrast to image compression weare not interested in avoiding noise-prone high frequencies

The Scientific World Journal 11

n

p

qoi

(a) (b) (c) (d) (e) Synthetic image (f) Real image

(g) Example text line

Figure 10 Painting technique (a) scheme (b) word shape with 120588 = 6 120590 = 35 (Gaussian filter is disabled) (c-d) example results for paintingtechnique (c) test texture applied on (b) (d) 120588 = 30 120590 = 10 with ball pen texture and (e-f) comparison of natural and synthetic ball pentextures

Hence different high and low frequencies are combined tosimulate regional as well as locale effects (behavior of inkpaper texture) Each point represents a texture layer in imagespace with 1198681(119909 119910) isin [minus1 1] We created several textureclasses by defining different sets of Gaussian distributionsfor the angle 120579 wave length 120582 and phase shift 120601 of alllayers manually Afterwards pixel intensities 1198682(o) isin [0 256]are computed by accumulating most texture layers The leftlayers are used to achieve variations in their intensities bymultiplication Finally an image I with a small margin iscreated and all o are fitted to I subsequently

By creating word syntheses using polygonal glyphs andrendering techniques smooth letter connections can beachieved more efficiently compared to synthesis approachesthat use image based glyphs Furthermore in contrast tothe usage of natural textures the described technique is ableto generate unique nontiled textures for every synthesizedword as shown in Figures 10(c)ndash10(e) Depending on thetexture class a median or Gaussian filter is used before savingthe image

542 Simulation of Feather Like Writing Tools The previousmethod allows a proper simulation of text that is writtenby ball pens pencils or coal on white paper However toallow a more accurate simulation of writing instrumentsas fountains pens or feathers we extended our renderingtechnique This includes mainly the implementation of twofeatures the writing speed and the shape of the top of thewriting instrument further called Pen Shape

Pen Shape If the Pen Shape is modeled as line or ellipsoid theline width of the trajectory u depends not only on the widthof the Pen Shape 119908

119875 but also on its angle 120574

119875and the angle

of the trajectory tangent 120574u We initialize 120574119875= 45∘ changing

it continuously with a maximal deviation of plusmn15∘ This localedeviation is computed by adding two cosine functions wherethe wavelengths phases and amplitudes are redefined byGaussian distributions for each synthesis

According to the texture of a Pen Shape the contactwith the paper and consequently the caused pigmentationcan vary This is simulated by an one-dimensional function

119891(119909119875) | 0 le 119909

119875le 119908

119875that defines the pigmentation potential

for the long axis of the Pen Shape An emphasized exampleinspired by a fountain pen is shown in Figure 11(d)

Binary images can be rendered in a faster way by definingpolygons (here a triangle mesh) that is a result of extrudingan one-dimensional Pen Shape along u or u A visualizationof this can be found in Figure 11(c) and a resulting synthesisis shown in Figure 11(h) These polygons can then be drawnby standard routines If the angle of the Pen Shape and theline is identical or so close where the polygon width wouldbe smaller than one pixel a line have to be drawn instead toavoid letter fragmentation

Writing Speed Large lines or bows as the left part of Sin() are usually written faster thanmore complex structuresA high writing speed often causes a lack of pigmentationthat leads to brighter or dappled lines However there is noneed to reconstruct writing speed for the used online lettersamples already that contain such information From eachrepresentation u we can extract the relative local writingspeed for ASMs representations in points per second

V (119894) pts =1003817100381710038171003817(2119894minus1 2119894) minus (2119894+1 2119894+2)

1003817100381710038171003817pt

(119899 (u) 119899 (u)) Δ119905s

1 le 119894 le 119899 (u) (10)

In order to estimate the expected pigmentation intensitywe use the normalized writing speed V isin [0 1] where V = 0is the slowest and V = 1 is the fastest part of the trajectory ofa synthesis If c0 is the current color of a pixel in RGB colorspace and c

119901is the color of the pen pigment then the new

color is computed by

c = c119901120572119886+ c0120572119887 (1minus120572119886) c isin R

3 (11)

where 120572119886

= 08(1 minus V) + 02 defines opacity of c119901and

120572119887

= 1 defines the opacity of the background Althoughpigments that are used for handwritings are typically full orsemiopaque reduction of pigmentation caused by increasedwriting speed can lead to transparency This is simulated byreducing 120572

119886 as shown in Figure 11(e)

12 The Scientific World Journal

(a) u (b) u (B-Spline) (c) u (polygon mesh) (d) Pen shape (e) Speed (f)

(g) Example of a synthesized text line

(h) Example of a synthesized text line (fast method for binary images)

Figure 11 From the polygon u to a synthetic image that simulates a feather like writing instrument (c) Polygon mesh created from u that isused for fast rendering of binary images

To ensure a steady behavior we interpolate the speed ofconnected letters For the first 119899(u)4 points (2119894minus1 2119894)we setthe speed V of a letter in middle or end form to

V (119894) = V (119894) [1minus120582119894] + V

119887(119899 (u)) 120582

119894

120582119894= 4 119894

119899 (u) 119894 le

14119899 (u)

(12)

where V119887(119899(u)) is the speed at the end of the previous letter

The effect on the synthesis is shown in Figure 11(d)

Render on Degraded Background Finally we createFigure 11(f) by combining our texture rendering techniqueof Section 541 with the one based on Pen Shape and writingspeed using a nonuniform background Therefore weapplied a transparent texture on all pixels that does notbelong to the background texture This way small randomirregularity is simulated

In the shown examples a black color is used as mostdocuments are written with dark ink (like iron oxide or soot)Pigmentation intensity is implemented as transparencywhich allows simulating pigment accumulation at crossinglines or in case of a textured background However alsocolored opaque or semiopaque ink can be simulated Thismight be interesting in the context of historical documentssince important passages are often highlighted by using redink Another important feature of historical documents isdegradation of paper or parchment Currently we simplyuse images of natural paper or parchment as backgroundtextures which are scaled or tiled in case where they aresmaller than the synthesized document

55 Generation of Text Pages Recently not only characteror word recognition but also more complex document anal-ysis issues that address the interpretation or recognition of

complete documents become a focus of Arabic handwritingresearch Hence we investigate the possibilities of text pagesynthesis In this regard the accurate simulation of thelower baselines is crucial Many problems that occur whiledetecting lines words or connected components depend onthese baselines as for instance assigning diacritics (that arevery close to more than one text lines) to their correspondingPAW

Our approach of simulating baselines has three stepsFirst of all we set the coordinates (1199090 1199100) of the first letter foreach line Secondly the curvatures of the baselines have to becomputed Thirdly potential intersection of words have to besolved

Start PAWs Due to the style of Arabic handwritings alllines start at the rightmost 119909-coordinate 1199090 = 119909max Thevertical space between two neighbored lines can be definedas percentage of the average PAW heights to get 1199100 for eachbaseline

Baselines We implement the second step by declaring func-tions 119891(119909 1199100) that define the curvatures of the simulatedBaselines Ξ

119904(1199100 defines the initial heights of a line) We

normalize 1199100 isin [0 1] inside 119891(119909 1199100) so it becomes

independent of the page size How to compute proper 119891119894is

explained in Section 56Let l119903 define the lower right of a letters bounding box then

we first translate the letter l towards the baseline so that l119903touches it Subsequently the119910-position of lmust be correctedaccording to its class by translating it by t

119887 so that l119903 might

be above or below 119891(119897119903

119909 1199100) as shown in Figure 12Therefore

we extracted the normalized statistical relation N119887between

l119903 and the baseline from the IESK-arDB for all letter classes If119897ℎ is the heights and l119894 is the 119894th point of l we can compute t

119887=

(0 119897ℎN119887)119879 and l1015840119894 = l119894 + t

119887as shown in Figure 12 We perform

this for every first letter l119891of a PAW Apart from the position

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 8: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

8 The Scientific World Journal

Input Current PAW A119888 precedent PAW A

119901 average letter width l

119908

Output Shifted current PAW A119888

If Bounding boxes of A119888and A

119901overlap then

while Trajectories of A119888and A

119901intersect do

Translate the 119909 coordinates of A119888by (14)l

119908

Algorithm 1 Solving intersections of neighbored PAWs

(a) Writer 1 (b) Writer 2 (c) Writer 3 (d) Writer 4

Figure 6 The word II (New York) synthesized by the average letter shapes 119909 of different writers

The ASMs are used to generate an unique polygonal rep-resentation u for each occurrence of a letter class in orderto avoid piecewise identical syntheses In order to composewords from these polygons each letter in end or middle formhas to be connected with its predecessor 3 rarr $ 3 I rarr I Let pf be the first point of and pl the last

point of its predecessor and then we can connect them by

translating by pl minus pf An example is shown in Figure 5The relation of a PAWrsquos 119910 coordinate and the baseline

depends on the letter classes the PAW is composed of Thuswe extracted the average 120583

119903and variance 120590

119903of the relative

distance between the baseline and the center of a letter frommanual created ground truth of our (real) word databaseIESK-arDB [4] We set the baseline to 0 and shift all 119910coordinates of each PAW by N(120583

119903 120590

119903) Finally the space

between the rightmost point of a PAW and the leftmostpoint of its predecessor has to be defined Therefore the userdepending parameter 120589 is used that may be negative in orderto simulate overlapping PAWs Given pl and pf the PAW canbe translated by the vector

tpaw = (

1199011198971minus 119901

1198911minus 120589

N (120583119903 120590

119903)

) (7)

In case of intersections between the polygons of overlappingPAWs 120589 is increased iteratively by 25 of the average letterwidth as described in Algorithm 1

Examples of words composed by the average letter shapesof different writers are shown in Figure 6 Examples fromASM based and original samples can be found in Table 3The maximal deviation 120590

119860means that the influence of an

eigenvector e119894is limited by plusmn2radic120582

119894 While letters look similar

using 120590 between 0 and 1 ASM representations u with 120590119860of

2 already provoke increased letter variation ASMs (trainedwith 119903 = 50 samples) are barely capable of representing adeviation of120590

119860= 3 though As amatter of fact there are noise

based deformations as shown in Table 3 (second last row)

This effect might be intended to create especially challengingsyntheses

52 Simulation of Global Variances ASMs already containvariations in slant width or connection size Neverthelessthese variations are limited by the used samples In order toincrease and control these variations affine transformationsare used (scaling translation shearing and rotation) whichallow optional manipulations of letter and PAW shapes Theuser interface (UI) of our synthesis system allows to set theaverage 120583 and variance 120590 of a Gaussian distribution for allaffine transformations Particularly global variations as theslant can be achieved this way The influences of these affinetransformations on the resulting word image is shown inFigure 7

A stretching is performed by scale each 119909 component ofeach letter point by the factor 119888 isin [05 2] The word slantcan be set by shearing the word with an angle of 120572

119904as the

skew of PAW can be manipulated by rotating to the angle120572119903 where 120572

119904 120572

119903isin [minus45∘ +45∘] We analyzed the skew and

slant of samples of the IESK-arDB database [4] with localminima regression and Hough transform We found that theskew correlates with a Gaussian distribution ofN(minus38∘ 71∘)(passed Chi square test with 120572 = 005) The slant can berepresented byN(minus46∘ 144∘)The size of the complete wordor single letters can be adjusted by an equal scaling with119888 isin [01 10] which can be used to control the resolution ofthe synthesized word images or to increase variation of lettersize As described in Section 513 variations of PAWpositionscan be realized by translations Even using the same glyphssynthetic words can assume large variations in shape whenusing affine transformations or cutting connection size asshown in Figure 7

When examining the glyph samples and synthesis wefound that compared to complete handwritings letter con-nections of the acquired samples are extended and evenexcessively (approximately twice as) long in case of writer 1Hence we allow to delete up to 25 of the letter points tosimulate stretched or missed connections which often occur

The Scientific World Journal 9

Table 3 Syntheses using ASMs and sample based glyphs of writer 1

120590119860sim |119888

119895|radic120582

119894Result

0

1

2

3

Samples

(a) Stretching (b) Slant (c) Size (d) Skew (e) Position (f) Connection

Figure 7 Affine transformations and connection shortening on synthetic words

in natural Arabic handwritings In Arabic handwritings somecharacters as Ya ( J ) are sometimes written beneath theirpredecessors As a result they resemble a single characterwhich impedes segmentation and recognition tasks Thiseffect can be simulated by a strong reduction of the Kashidaas shown in Figure 8 However this feature has been not yetentirely implemented since a list of all pairs of letters thattypically show this behaviour needs to be created first

53 Interpolation Since a polygonal letter representationdoes not look natural for vector graphics or images witha scaling factor gt 1 we use interpolation to improve theoutcome Let 119899(u) be the number of points of u and then weuse u as control points to interpolate a curve u By increasingthe interpolation steps 119899(u) can be approximated to theoriginal number of points of a sample X The average lengthof X is 119899( X) = 2668 and hence a tenfold increase 119899(u) =

25 rarr 119899(u) = 250 is generally sufficient to achieve smoothsyntheses To ensure that the above mentioned methodswork efficiently on the compressed representation u theinterpolation step is applied just before rendering or skippedin case of low-resolution synthesis

Our system supports two interpolation methods Piece-wise Cubic hermite-interpolation is 1198621-steady which meansthat only the first derivation of the used interpolation func-tion is steady Therefore hermite-interpolation leads to lesssmooth and accurate results a property that can be used tocreate noisy handwritings [32] (perturbed data technique)State-of-the-art B-Spline interpolation is commonly usedwithin CAD-applications since it is 1198622-steady and leads tosmooth natural curves which can be defined properly bytheir control points as shown in Figure 9 Although the B-Spline curve do not pass through all control points it fitsthe original curve sufficiently when 119899 = 25 control pointsare used Given the measure 120575 of (4) the average distancebetween u and the 119899 closest points of u can be computedUsing a cross-validation with 119896fold = 10 we get 120575(u u) =

045 with a variance of 0058

54 Rendering Handwriting Images The former sectionsdiscussed how to compose and interpolate polygonal rep-resentations of Arabic handwritings Now those have to betransformed into images and saved in common files formats(bmp png etc) which can easily be loaded by most text

10 The Scientific World Journal

(a) (b) (c)

Figure 8 Example for a synthesized letter pair using (a) full (b) half and (c) negative Kashida length

Control points uInterpolated points 119854

(a) B-Spline

Control points uInterpolated points 119854

(b) Cubic

Figure 9 Comparison of B-Spline and Cubic interpolation where 119899(u) = 25 and 119899(u) = 250

recognitions or document analysis systems Even preprocess-ing steps as thinning can influence the performance of thefollowing tasks Such preprocessing is sensitive to secondaryfeatures or flaws which are a result of the used writingmaterials hence the synthesized files should contain thosefeatures too Therefore we propose a rendering techniquethat reflects optical features caused by common pens asball pens or pencils [33] Subsequently a modification ofthis technique is described that allows rendering features ofhistorical handwritings

First of all pixels o have to be found that are closeto polygons u and belong to the foreground As shown inFigure 10(a) we first interpolate between two neighboredpoints p q of u (or u) and get 120588 lowast p minus q new points

o1015840 = ]p+ (1minus ]) q ] isin [0 1] (8)

where ] is uniform distributed and 120588 is a user definedparameter

Let n be the normal vector of line pq and then we shifteach o1015840 along n using a Gaussian distribution

o = o1015840 +N (120583 120590) n (9)

where 120590 and 120583 define the line width which is decreased up to20 in case that p lies between the PenUp or PenDown pointand the neighbored control point As a result the prototype ofa word image has been prepared that defines all pixels whichare influenced by pigments at all (shown in Figure 10(b))To allow sharp contours a limitation of |N(120583 120590)| lt 120603120590

is applied according to the simulated pen where 120603 is userdependent

541 Texture Biros or pencils cause an irregular pigmenta-tion intensity which is reflected by pixel intensities 119868(119909 119910)of scanned images A realistic physical model that simulatesthis behavior in a proper way is beyond the scope of thispaper a more simplified and generalized approach howeveris quite practical Inspired by the ability of Fourier transformbased image compression to represent the main nature ofa texture by a small subset of the underlying frequencieswe define a texture by 10 points (120582 120579 120601) in frequency spacein order to emulate irregularities caused by pen and paperThis way simplified but unique textures can be created atruntime However in contrast to image compression weare not interested in avoiding noise-prone high frequencies

The Scientific World Journal 11

n

p

qoi

(a) (b) (c) (d) (e) Synthetic image (f) Real image

(g) Example text line

Figure 10 Painting technique (a) scheme (b) word shape with 120588 = 6 120590 = 35 (Gaussian filter is disabled) (c-d) example results for paintingtechnique (c) test texture applied on (b) (d) 120588 = 30 120590 = 10 with ball pen texture and (e-f) comparison of natural and synthetic ball pentextures

Hence different high and low frequencies are combined tosimulate regional as well as locale effects (behavior of inkpaper texture) Each point represents a texture layer in imagespace with 1198681(119909 119910) isin [minus1 1] We created several textureclasses by defining different sets of Gaussian distributionsfor the angle 120579 wave length 120582 and phase shift 120601 of alllayers manually Afterwards pixel intensities 1198682(o) isin [0 256]are computed by accumulating most texture layers The leftlayers are used to achieve variations in their intensities bymultiplication Finally an image I with a small margin iscreated and all o are fitted to I subsequently

By creating word syntheses using polygonal glyphs andrendering techniques smooth letter connections can beachieved more efficiently compared to synthesis approachesthat use image based glyphs Furthermore in contrast tothe usage of natural textures the described technique is ableto generate unique nontiled textures for every synthesizedword as shown in Figures 10(c)ndash10(e) Depending on thetexture class a median or Gaussian filter is used before savingthe image

542 Simulation of Feather Like Writing Tools The previousmethod allows a proper simulation of text that is writtenby ball pens pencils or coal on white paper However toallow a more accurate simulation of writing instrumentsas fountains pens or feathers we extended our renderingtechnique This includes mainly the implementation of twofeatures the writing speed and the shape of the top of thewriting instrument further called Pen Shape

Pen Shape If the Pen Shape is modeled as line or ellipsoid theline width of the trajectory u depends not only on the widthof the Pen Shape 119908

119875 but also on its angle 120574

119875and the angle

of the trajectory tangent 120574u We initialize 120574119875= 45∘ changing

it continuously with a maximal deviation of plusmn15∘ This localedeviation is computed by adding two cosine functions wherethe wavelengths phases and amplitudes are redefined byGaussian distributions for each synthesis

According to the texture of a Pen Shape the contactwith the paper and consequently the caused pigmentationcan vary This is simulated by an one-dimensional function

119891(119909119875) | 0 le 119909

119875le 119908

119875that defines the pigmentation potential

for the long axis of the Pen Shape An emphasized exampleinspired by a fountain pen is shown in Figure 11(d)

Binary images can be rendered in a faster way by definingpolygons (here a triangle mesh) that is a result of extrudingan one-dimensional Pen Shape along u or u A visualizationof this can be found in Figure 11(c) and a resulting synthesisis shown in Figure 11(h) These polygons can then be drawnby standard routines If the angle of the Pen Shape and theline is identical or so close where the polygon width wouldbe smaller than one pixel a line have to be drawn instead toavoid letter fragmentation

Writing Speed Large lines or bows as the left part of Sin() are usually written faster thanmore complex structuresA high writing speed often causes a lack of pigmentationthat leads to brighter or dappled lines However there is noneed to reconstruct writing speed for the used online lettersamples already that contain such information From eachrepresentation u we can extract the relative local writingspeed for ASMs representations in points per second

V (119894) pts =1003817100381710038171003817(2119894minus1 2119894) minus (2119894+1 2119894+2)

1003817100381710038171003817pt

(119899 (u) 119899 (u)) Δ119905s

1 le 119894 le 119899 (u) (10)

In order to estimate the expected pigmentation intensitywe use the normalized writing speed V isin [0 1] where V = 0is the slowest and V = 1 is the fastest part of the trajectory ofa synthesis If c0 is the current color of a pixel in RGB colorspace and c

119901is the color of the pen pigment then the new

color is computed by

c = c119901120572119886+ c0120572119887 (1minus120572119886) c isin R

3 (11)

where 120572119886

= 08(1 minus V) + 02 defines opacity of c119901and

120572119887

= 1 defines the opacity of the background Althoughpigments that are used for handwritings are typically full orsemiopaque reduction of pigmentation caused by increasedwriting speed can lead to transparency This is simulated byreducing 120572

119886 as shown in Figure 11(e)

12 The Scientific World Journal

(a) u (b) u (B-Spline) (c) u (polygon mesh) (d) Pen shape (e) Speed (f)

(g) Example of a synthesized text line

(h) Example of a synthesized text line (fast method for binary images)

Figure 11 From the polygon u to a synthetic image that simulates a feather like writing instrument (c) Polygon mesh created from u that isused for fast rendering of binary images

To ensure a steady behavior we interpolate the speed ofconnected letters For the first 119899(u)4 points (2119894minus1 2119894)we setthe speed V of a letter in middle or end form to

V (119894) = V (119894) [1minus120582119894] + V

119887(119899 (u)) 120582

119894

120582119894= 4 119894

119899 (u) 119894 le

14119899 (u)

(12)

where V119887(119899(u)) is the speed at the end of the previous letter

The effect on the synthesis is shown in Figure 11(d)

Render on Degraded Background Finally we createFigure 11(f) by combining our texture rendering techniqueof Section 541 with the one based on Pen Shape and writingspeed using a nonuniform background Therefore weapplied a transparent texture on all pixels that does notbelong to the background texture This way small randomirregularity is simulated

In the shown examples a black color is used as mostdocuments are written with dark ink (like iron oxide or soot)Pigmentation intensity is implemented as transparencywhich allows simulating pigment accumulation at crossinglines or in case of a textured background However alsocolored opaque or semiopaque ink can be simulated Thismight be interesting in the context of historical documentssince important passages are often highlighted by using redink Another important feature of historical documents isdegradation of paper or parchment Currently we simplyuse images of natural paper or parchment as backgroundtextures which are scaled or tiled in case where they aresmaller than the synthesized document

55 Generation of Text Pages Recently not only characteror word recognition but also more complex document anal-ysis issues that address the interpretation or recognition of

complete documents become a focus of Arabic handwritingresearch Hence we investigate the possibilities of text pagesynthesis In this regard the accurate simulation of thelower baselines is crucial Many problems that occur whiledetecting lines words or connected components depend onthese baselines as for instance assigning diacritics (that arevery close to more than one text lines) to their correspondingPAW

Our approach of simulating baselines has three stepsFirst of all we set the coordinates (1199090 1199100) of the first letter foreach line Secondly the curvatures of the baselines have to becomputed Thirdly potential intersection of words have to besolved

Start PAWs Due to the style of Arabic handwritings alllines start at the rightmost 119909-coordinate 1199090 = 119909max Thevertical space between two neighbored lines can be definedas percentage of the average PAW heights to get 1199100 for eachbaseline

Baselines We implement the second step by declaring func-tions 119891(119909 1199100) that define the curvatures of the simulatedBaselines Ξ

119904(1199100 defines the initial heights of a line) We

normalize 1199100 isin [0 1] inside 119891(119909 1199100) so it becomes

independent of the page size How to compute proper 119891119894is

explained in Section 56Let l119903 define the lower right of a letters bounding box then

we first translate the letter l towards the baseline so that l119903touches it Subsequently the119910-position of lmust be correctedaccording to its class by translating it by t

119887 so that l119903 might

be above or below 119891(119897119903

119909 1199100) as shown in Figure 12Therefore

we extracted the normalized statistical relation N119887between

l119903 and the baseline from the IESK-arDB for all letter classes If119897ℎ is the heights and l119894 is the 119894th point of l we can compute t

119887=

(0 119897ℎN119887)119879 and l1015840119894 = l119894 + t

119887as shown in Figure 12 We perform

this for every first letter l119891of a PAW Apart from the position

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 9: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

The Scientific World Journal 9

Table 3 Syntheses using ASMs and sample based glyphs of writer 1

120590119860sim |119888

119895|radic120582

119894Result

0

1

2

3

Samples

(a) Stretching (b) Slant (c) Size (d) Skew (e) Position (f) Connection

Figure 7 Affine transformations and connection shortening on synthetic words

in natural Arabic handwritings In Arabic handwritings somecharacters as Ya ( J ) are sometimes written beneath theirpredecessors As a result they resemble a single characterwhich impedes segmentation and recognition tasks Thiseffect can be simulated by a strong reduction of the Kashidaas shown in Figure 8 However this feature has been not yetentirely implemented since a list of all pairs of letters thattypically show this behaviour needs to be created first

53 Interpolation Since a polygonal letter representationdoes not look natural for vector graphics or images witha scaling factor gt 1 we use interpolation to improve theoutcome Let 119899(u) be the number of points of u and then weuse u as control points to interpolate a curve u By increasingthe interpolation steps 119899(u) can be approximated to theoriginal number of points of a sample X The average lengthof X is 119899( X) = 2668 and hence a tenfold increase 119899(u) =

25 rarr 119899(u) = 250 is generally sufficient to achieve smoothsyntheses To ensure that the above mentioned methodswork efficiently on the compressed representation u theinterpolation step is applied just before rendering or skippedin case of low-resolution synthesis

Our system supports two interpolation methods Piece-wise Cubic hermite-interpolation is 1198621-steady which meansthat only the first derivation of the used interpolation func-tion is steady Therefore hermite-interpolation leads to lesssmooth and accurate results a property that can be used tocreate noisy handwritings [32] (perturbed data technique)State-of-the-art B-Spline interpolation is commonly usedwithin CAD-applications since it is 1198622-steady and leads tosmooth natural curves which can be defined properly bytheir control points as shown in Figure 9 Although the B-Spline curve do not pass through all control points it fitsthe original curve sufficiently when 119899 = 25 control pointsare used Given the measure 120575 of (4) the average distancebetween u and the 119899 closest points of u can be computedUsing a cross-validation with 119896fold = 10 we get 120575(u u) =

045 with a variance of 0058

54 Rendering Handwriting Images The former sectionsdiscussed how to compose and interpolate polygonal rep-resentations of Arabic handwritings Now those have to betransformed into images and saved in common files formats(bmp png etc) which can easily be loaded by most text

10 The Scientific World Journal

(a) (b) (c)

Figure 8 Example for a synthesized letter pair using (a) full (b) half and (c) negative Kashida length

Control points uInterpolated points 119854

(a) B-Spline

Control points uInterpolated points 119854

(b) Cubic

Figure 9 Comparison of B-Spline and Cubic interpolation where 119899(u) = 25 and 119899(u) = 250

recognitions or document analysis systems Even preprocess-ing steps as thinning can influence the performance of thefollowing tasks Such preprocessing is sensitive to secondaryfeatures or flaws which are a result of the used writingmaterials hence the synthesized files should contain thosefeatures too Therefore we propose a rendering techniquethat reflects optical features caused by common pens asball pens or pencils [33] Subsequently a modification ofthis technique is described that allows rendering features ofhistorical handwritings

First of all pixels o have to be found that are closeto polygons u and belong to the foreground As shown inFigure 10(a) we first interpolate between two neighboredpoints p q of u (or u) and get 120588 lowast p minus q new points

o1015840 = ]p+ (1minus ]) q ] isin [0 1] (8)

where ] is uniform distributed and 120588 is a user definedparameter

Let n be the normal vector of line pq and then we shifteach o1015840 along n using a Gaussian distribution

o = o1015840 +N (120583 120590) n (9)

where 120590 and 120583 define the line width which is decreased up to20 in case that p lies between the PenUp or PenDown pointand the neighbored control point As a result the prototype ofa word image has been prepared that defines all pixels whichare influenced by pigments at all (shown in Figure 10(b))To allow sharp contours a limitation of |N(120583 120590)| lt 120603120590

is applied according to the simulated pen where 120603 is userdependent

541 Texture Biros or pencils cause an irregular pigmenta-tion intensity which is reflected by pixel intensities 119868(119909 119910)of scanned images A realistic physical model that simulatesthis behavior in a proper way is beyond the scope of thispaper a more simplified and generalized approach howeveris quite practical Inspired by the ability of Fourier transformbased image compression to represent the main nature ofa texture by a small subset of the underlying frequencieswe define a texture by 10 points (120582 120579 120601) in frequency spacein order to emulate irregularities caused by pen and paperThis way simplified but unique textures can be created atruntime However in contrast to image compression weare not interested in avoiding noise-prone high frequencies

The Scientific World Journal 11

n

p

qoi

(a) (b) (c) (d) (e) Synthetic image (f) Real image

(g) Example text line

Figure 10 Painting technique (a) scheme (b) word shape with 120588 = 6 120590 = 35 (Gaussian filter is disabled) (c-d) example results for paintingtechnique (c) test texture applied on (b) (d) 120588 = 30 120590 = 10 with ball pen texture and (e-f) comparison of natural and synthetic ball pentextures

Hence different high and low frequencies are combined tosimulate regional as well as locale effects (behavior of inkpaper texture) Each point represents a texture layer in imagespace with 1198681(119909 119910) isin [minus1 1] We created several textureclasses by defining different sets of Gaussian distributionsfor the angle 120579 wave length 120582 and phase shift 120601 of alllayers manually Afterwards pixel intensities 1198682(o) isin [0 256]are computed by accumulating most texture layers The leftlayers are used to achieve variations in their intensities bymultiplication Finally an image I with a small margin iscreated and all o are fitted to I subsequently

By creating word syntheses using polygonal glyphs andrendering techniques smooth letter connections can beachieved more efficiently compared to synthesis approachesthat use image based glyphs Furthermore in contrast tothe usage of natural textures the described technique is ableto generate unique nontiled textures for every synthesizedword as shown in Figures 10(c)ndash10(e) Depending on thetexture class a median or Gaussian filter is used before savingthe image

542 Simulation of Feather Like Writing Tools The previousmethod allows a proper simulation of text that is writtenby ball pens pencils or coal on white paper However toallow a more accurate simulation of writing instrumentsas fountains pens or feathers we extended our renderingtechnique This includes mainly the implementation of twofeatures the writing speed and the shape of the top of thewriting instrument further called Pen Shape

Pen Shape If the Pen Shape is modeled as line or ellipsoid theline width of the trajectory u depends not only on the widthof the Pen Shape 119908

119875 but also on its angle 120574

119875and the angle

of the trajectory tangent 120574u We initialize 120574119875= 45∘ changing

it continuously with a maximal deviation of plusmn15∘ This localedeviation is computed by adding two cosine functions wherethe wavelengths phases and amplitudes are redefined byGaussian distributions for each synthesis

According to the texture of a Pen Shape the contactwith the paper and consequently the caused pigmentationcan vary This is simulated by an one-dimensional function

119891(119909119875) | 0 le 119909

119875le 119908

119875that defines the pigmentation potential

for the long axis of the Pen Shape An emphasized exampleinspired by a fountain pen is shown in Figure 11(d)

Binary images can be rendered in a faster way by definingpolygons (here a triangle mesh) that is a result of extrudingan one-dimensional Pen Shape along u or u A visualizationof this can be found in Figure 11(c) and a resulting synthesisis shown in Figure 11(h) These polygons can then be drawnby standard routines If the angle of the Pen Shape and theline is identical or so close where the polygon width wouldbe smaller than one pixel a line have to be drawn instead toavoid letter fragmentation

Writing Speed Large lines or bows as the left part of Sin() are usually written faster thanmore complex structuresA high writing speed often causes a lack of pigmentationthat leads to brighter or dappled lines However there is noneed to reconstruct writing speed for the used online lettersamples already that contain such information From eachrepresentation u we can extract the relative local writingspeed for ASMs representations in points per second

V (119894) pts =1003817100381710038171003817(2119894minus1 2119894) minus (2119894+1 2119894+2)

1003817100381710038171003817pt

(119899 (u) 119899 (u)) Δ119905s

1 le 119894 le 119899 (u) (10)

In order to estimate the expected pigmentation intensitywe use the normalized writing speed V isin [0 1] where V = 0is the slowest and V = 1 is the fastest part of the trajectory ofa synthesis If c0 is the current color of a pixel in RGB colorspace and c

119901is the color of the pen pigment then the new

color is computed by

c = c119901120572119886+ c0120572119887 (1minus120572119886) c isin R

3 (11)

where 120572119886

= 08(1 minus V) + 02 defines opacity of c119901and

120572119887

= 1 defines the opacity of the background Althoughpigments that are used for handwritings are typically full orsemiopaque reduction of pigmentation caused by increasedwriting speed can lead to transparency This is simulated byreducing 120572

119886 as shown in Figure 11(e)

12 The Scientific World Journal

(a) u (b) u (B-Spline) (c) u (polygon mesh) (d) Pen shape (e) Speed (f)

(g) Example of a synthesized text line

(h) Example of a synthesized text line (fast method for binary images)

Figure 11 From the polygon u to a synthetic image that simulates a feather like writing instrument (c) Polygon mesh created from u that isused for fast rendering of binary images

To ensure a steady behavior we interpolate the speed ofconnected letters For the first 119899(u)4 points (2119894minus1 2119894)we setthe speed V of a letter in middle or end form to

V (119894) = V (119894) [1minus120582119894] + V

119887(119899 (u)) 120582

119894

120582119894= 4 119894

119899 (u) 119894 le

14119899 (u)

(12)

where V119887(119899(u)) is the speed at the end of the previous letter

The effect on the synthesis is shown in Figure 11(d)

Render on Degraded Background Finally we createFigure 11(f) by combining our texture rendering techniqueof Section 541 with the one based on Pen Shape and writingspeed using a nonuniform background Therefore weapplied a transparent texture on all pixels that does notbelong to the background texture This way small randomirregularity is simulated

In the shown examples a black color is used as mostdocuments are written with dark ink (like iron oxide or soot)Pigmentation intensity is implemented as transparencywhich allows simulating pigment accumulation at crossinglines or in case of a textured background However alsocolored opaque or semiopaque ink can be simulated Thismight be interesting in the context of historical documentssince important passages are often highlighted by using redink Another important feature of historical documents isdegradation of paper or parchment Currently we simplyuse images of natural paper or parchment as backgroundtextures which are scaled or tiled in case where they aresmaller than the synthesized document

55 Generation of Text Pages Recently not only characteror word recognition but also more complex document anal-ysis issues that address the interpretation or recognition of

complete documents become a focus of Arabic handwritingresearch Hence we investigate the possibilities of text pagesynthesis In this regard the accurate simulation of thelower baselines is crucial Many problems that occur whiledetecting lines words or connected components depend onthese baselines as for instance assigning diacritics (that arevery close to more than one text lines) to their correspondingPAW

Our approach of simulating baselines has three stepsFirst of all we set the coordinates (1199090 1199100) of the first letter foreach line Secondly the curvatures of the baselines have to becomputed Thirdly potential intersection of words have to besolved

Start PAWs Due to the style of Arabic handwritings alllines start at the rightmost 119909-coordinate 1199090 = 119909max Thevertical space between two neighbored lines can be definedas percentage of the average PAW heights to get 1199100 for eachbaseline

Baselines We implement the second step by declaring func-tions 119891(119909 1199100) that define the curvatures of the simulatedBaselines Ξ

119904(1199100 defines the initial heights of a line) We

normalize 1199100 isin [0 1] inside 119891(119909 1199100) so it becomes

independent of the page size How to compute proper 119891119894is

explained in Section 56Let l119903 define the lower right of a letters bounding box then

we first translate the letter l towards the baseline so that l119903touches it Subsequently the119910-position of lmust be correctedaccording to its class by translating it by t

119887 so that l119903 might

be above or below 119891(119897119903

119909 1199100) as shown in Figure 12Therefore

we extracted the normalized statistical relation N119887between

l119903 and the baseline from the IESK-arDB for all letter classes If119897ℎ is the heights and l119894 is the 119894th point of l we can compute t

119887=

(0 119897ℎN119887)119879 and l1015840119894 = l119894 + t

119887as shown in Figure 12 We perform

this for every first letter l119891of a PAW Apart from the position

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 10: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

10 The Scientific World Journal

(a) (b) (c)

Figure 8 Example for a synthesized letter pair using (a) full (b) half and (c) negative Kashida length

Control points uInterpolated points 119854

(a) B-Spline

Control points uInterpolated points 119854

(b) Cubic

Figure 9 Comparison of B-Spline and Cubic interpolation where 119899(u) = 25 and 119899(u) = 250

recognitions or document analysis systems Even preprocess-ing steps as thinning can influence the performance of thefollowing tasks Such preprocessing is sensitive to secondaryfeatures or flaws which are a result of the used writingmaterials hence the synthesized files should contain thosefeatures too Therefore we propose a rendering techniquethat reflects optical features caused by common pens asball pens or pencils [33] Subsequently a modification ofthis technique is described that allows rendering features ofhistorical handwritings

First of all pixels o have to be found that are closeto polygons u and belong to the foreground As shown inFigure 10(a) we first interpolate between two neighboredpoints p q of u (or u) and get 120588 lowast p minus q new points

o1015840 = ]p+ (1minus ]) q ] isin [0 1] (8)

where ] is uniform distributed and 120588 is a user definedparameter

Let n be the normal vector of line pq and then we shifteach o1015840 along n using a Gaussian distribution

o = o1015840 +N (120583 120590) n (9)

where 120590 and 120583 define the line width which is decreased up to20 in case that p lies between the PenUp or PenDown pointand the neighbored control point As a result the prototype ofa word image has been prepared that defines all pixels whichare influenced by pigments at all (shown in Figure 10(b))To allow sharp contours a limitation of |N(120583 120590)| lt 120603120590

is applied according to the simulated pen where 120603 is userdependent

541 Texture Biros or pencils cause an irregular pigmenta-tion intensity which is reflected by pixel intensities 119868(119909 119910)of scanned images A realistic physical model that simulatesthis behavior in a proper way is beyond the scope of thispaper a more simplified and generalized approach howeveris quite practical Inspired by the ability of Fourier transformbased image compression to represent the main nature ofa texture by a small subset of the underlying frequencieswe define a texture by 10 points (120582 120579 120601) in frequency spacein order to emulate irregularities caused by pen and paperThis way simplified but unique textures can be created atruntime However in contrast to image compression weare not interested in avoiding noise-prone high frequencies

The Scientific World Journal 11

n

p

qoi

(a) (b) (c) (d) (e) Synthetic image (f) Real image

(g) Example text line

Figure 10 Painting technique (a) scheme (b) word shape with 120588 = 6 120590 = 35 (Gaussian filter is disabled) (c-d) example results for paintingtechnique (c) test texture applied on (b) (d) 120588 = 30 120590 = 10 with ball pen texture and (e-f) comparison of natural and synthetic ball pentextures

Hence different high and low frequencies are combined tosimulate regional as well as locale effects (behavior of inkpaper texture) Each point represents a texture layer in imagespace with 1198681(119909 119910) isin [minus1 1] We created several textureclasses by defining different sets of Gaussian distributionsfor the angle 120579 wave length 120582 and phase shift 120601 of alllayers manually Afterwards pixel intensities 1198682(o) isin [0 256]are computed by accumulating most texture layers The leftlayers are used to achieve variations in their intensities bymultiplication Finally an image I with a small margin iscreated and all o are fitted to I subsequently

By creating word syntheses using polygonal glyphs andrendering techniques smooth letter connections can beachieved more efficiently compared to synthesis approachesthat use image based glyphs Furthermore in contrast tothe usage of natural textures the described technique is ableto generate unique nontiled textures for every synthesizedword as shown in Figures 10(c)ndash10(e) Depending on thetexture class a median or Gaussian filter is used before savingthe image

542 Simulation of Feather Like Writing Tools The previousmethod allows a proper simulation of text that is writtenby ball pens pencils or coal on white paper However toallow a more accurate simulation of writing instrumentsas fountains pens or feathers we extended our renderingtechnique This includes mainly the implementation of twofeatures the writing speed and the shape of the top of thewriting instrument further called Pen Shape

Pen Shape If the Pen Shape is modeled as line or ellipsoid theline width of the trajectory u depends not only on the widthof the Pen Shape 119908

119875 but also on its angle 120574

119875and the angle

of the trajectory tangent 120574u We initialize 120574119875= 45∘ changing

it continuously with a maximal deviation of plusmn15∘ This localedeviation is computed by adding two cosine functions wherethe wavelengths phases and amplitudes are redefined byGaussian distributions for each synthesis

According to the texture of a Pen Shape the contactwith the paper and consequently the caused pigmentationcan vary This is simulated by an one-dimensional function

119891(119909119875) | 0 le 119909

119875le 119908

119875that defines the pigmentation potential

for the long axis of the Pen Shape An emphasized exampleinspired by a fountain pen is shown in Figure 11(d)

Binary images can be rendered in a faster way by definingpolygons (here a triangle mesh) that is a result of extrudingan one-dimensional Pen Shape along u or u A visualizationof this can be found in Figure 11(c) and a resulting synthesisis shown in Figure 11(h) These polygons can then be drawnby standard routines If the angle of the Pen Shape and theline is identical or so close where the polygon width wouldbe smaller than one pixel a line have to be drawn instead toavoid letter fragmentation

Writing Speed Large lines or bows as the left part of Sin() are usually written faster thanmore complex structuresA high writing speed often causes a lack of pigmentationthat leads to brighter or dappled lines However there is noneed to reconstruct writing speed for the used online lettersamples already that contain such information From eachrepresentation u we can extract the relative local writingspeed for ASMs representations in points per second

V (119894) pts =1003817100381710038171003817(2119894minus1 2119894) minus (2119894+1 2119894+2)

1003817100381710038171003817pt

(119899 (u) 119899 (u)) Δ119905s

1 le 119894 le 119899 (u) (10)

In order to estimate the expected pigmentation intensitywe use the normalized writing speed V isin [0 1] where V = 0is the slowest and V = 1 is the fastest part of the trajectory ofa synthesis If c0 is the current color of a pixel in RGB colorspace and c

119901is the color of the pen pigment then the new

color is computed by

c = c119901120572119886+ c0120572119887 (1minus120572119886) c isin R

3 (11)

where 120572119886

= 08(1 minus V) + 02 defines opacity of c119901and

120572119887

= 1 defines the opacity of the background Althoughpigments that are used for handwritings are typically full orsemiopaque reduction of pigmentation caused by increasedwriting speed can lead to transparency This is simulated byreducing 120572

119886 as shown in Figure 11(e)

12 The Scientific World Journal

(a) u (b) u (B-Spline) (c) u (polygon mesh) (d) Pen shape (e) Speed (f)

(g) Example of a synthesized text line

(h) Example of a synthesized text line (fast method for binary images)

Figure 11 From the polygon u to a synthetic image that simulates a feather like writing instrument (c) Polygon mesh created from u that isused for fast rendering of binary images

To ensure a steady behavior we interpolate the speed ofconnected letters For the first 119899(u)4 points (2119894minus1 2119894)we setthe speed V of a letter in middle or end form to

V (119894) = V (119894) [1minus120582119894] + V

119887(119899 (u)) 120582

119894

120582119894= 4 119894

119899 (u) 119894 le

14119899 (u)

(12)

where V119887(119899(u)) is the speed at the end of the previous letter

The effect on the synthesis is shown in Figure 11(d)

Render on Degraded Background Finally we createFigure 11(f) by combining our texture rendering techniqueof Section 541 with the one based on Pen Shape and writingspeed using a nonuniform background Therefore weapplied a transparent texture on all pixels that does notbelong to the background texture This way small randomirregularity is simulated

In the shown examples a black color is used as mostdocuments are written with dark ink (like iron oxide or soot)Pigmentation intensity is implemented as transparencywhich allows simulating pigment accumulation at crossinglines or in case of a textured background However alsocolored opaque or semiopaque ink can be simulated Thismight be interesting in the context of historical documentssince important passages are often highlighted by using redink Another important feature of historical documents isdegradation of paper or parchment Currently we simplyuse images of natural paper or parchment as backgroundtextures which are scaled or tiled in case where they aresmaller than the synthesized document

55 Generation of Text Pages Recently not only characteror word recognition but also more complex document anal-ysis issues that address the interpretation or recognition of

complete documents become a focus of Arabic handwritingresearch Hence we investigate the possibilities of text pagesynthesis In this regard the accurate simulation of thelower baselines is crucial Many problems that occur whiledetecting lines words or connected components depend onthese baselines as for instance assigning diacritics (that arevery close to more than one text lines) to their correspondingPAW

Our approach of simulating baselines has three stepsFirst of all we set the coordinates (1199090 1199100) of the first letter foreach line Secondly the curvatures of the baselines have to becomputed Thirdly potential intersection of words have to besolved

Start PAWs Due to the style of Arabic handwritings alllines start at the rightmost 119909-coordinate 1199090 = 119909max Thevertical space between two neighbored lines can be definedas percentage of the average PAW heights to get 1199100 for eachbaseline

Baselines We implement the second step by declaring func-tions 119891(119909 1199100) that define the curvatures of the simulatedBaselines Ξ

119904(1199100 defines the initial heights of a line) We

normalize 1199100 isin [0 1] inside 119891(119909 1199100) so it becomes

independent of the page size How to compute proper 119891119894is

explained in Section 56Let l119903 define the lower right of a letters bounding box then

we first translate the letter l towards the baseline so that l119903touches it Subsequently the119910-position of lmust be correctedaccording to its class by translating it by t

119887 so that l119903 might

be above or below 119891(119897119903

119909 1199100) as shown in Figure 12Therefore

we extracted the normalized statistical relation N119887between

l119903 and the baseline from the IESK-arDB for all letter classes If119897ℎ is the heights and l119894 is the 119894th point of l we can compute t

119887=

(0 119897ℎN119887)119879 and l1015840119894 = l119894 + t

119887as shown in Figure 12 We perform

this for every first letter l119891of a PAW Apart from the position

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 11: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

The Scientific World Journal 11

n

p

qoi

(a) (b) (c) (d) (e) Synthetic image (f) Real image

(g) Example text line

Figure 10 Painting technique (a) scheme (b) word shape with 120588 = 6 120590 = 35 (Gaussian filter is disabled) (c-d) example results for paintingtechnique (c) test texture applied on (b) (d) 120588 = 30 120590 = 10 with ball pen texture and (e-f) comparison of natural and synthetic ball pentextures

Hence different high and low frequencies are combined tosimulate regional as well as locale effects (behavior of inkpaper texture) Each point represents a texture layer in imagespace with 1198681(119909 119910) isin [minus1 1] We created several textureclasses by defining different sets of Gaussian distributionsfor the angle 120579 wave length 120582 and phase shift 120601 of alllayers manually Afterwards pixel intensities 1198682(o) isin [0 256]are computed by accumulating most texture layers The leftlayers are used to achieve variations in their intensities bymultiplication Finally an image I with a small margin iscreated and all o are fitted to I subsequently

By creating word syntheses using polygonal glyphs andrendering techniques smooth letter connections can beachieved more efficiently compared to synthesis approachesthat use image based glyphs Furthermore in contrast tothe usage of natural textures the described technique is ableto generate unique nontiled textures for every synthesizedword as shown in Figures 10(c)ndash10(e) Depending on thetexture class a median or Gaussian filter is used before savingthe image

542 Simulation of Feather Like Writing Tools The previousmethod allows a proper simulation of text that is writtenby ball pens pencils or coal on white paper However toallow a more accurate simulation of writing instrumentsas fountains pens or feathers we extended our renderingtechnique This includes mainly the implementation of twofeatures the writing speed and the shape of the top of thewriting instrument further called Pen Shape

Pen Shape If the Pen Shape is modeled as line or ellipsoid theline width of the trajectory u depends not only on the widthof the Pen Shape 119908

119875 but also on its angle 120574

119875and the angle

of the trajectory tangent 120574u We initialize 120574119875= 45∘ changing

it continuously with a maximal deviation of plusmn15∘ This localedeviation is computed by adding two cosine functions wherethe wavelengths phases and amplitudes are redefined byGaussian distributions for each synthesis

According to the texture of a Pen Shape the contactwith the paper and consequently the caused pigmentationcan vary This is simulated by an one-dimensional function

119891(119909119875) | 0 le 119909

119875le 119908

119875that defines the pigmentation potential

for the long axis of the Pen Shape An emphasized exampleinspired by a fountain pen is shown in Figure 11(d)

Binary images can be rendered in a faster way by definingpolygons (here a triangle mesh) that is a result of extrudingan one-dimensional Pen Shape along u or u A visualizationof this can be found in Figure 11(c) and a resulting synthesisis shown in Figure 11(h) These polygons can then be drawnby standard routines If the angle of the Pen Shape and theline is identical or so close where the polygon width wouldbe smaller than one pixel a line have to be drawn instead toavoid letter fragmentation

Writing Speed Large lines or bows as the left part of Sin() are usually written faster thanmore complex structuresA high writing speed often causes a lack of pigmentationthat leads to brighter or dappled lines However there is noneed to reconstruct writing speed for the used online lettersamples already that contain such information From eachrepresentation u we can extract the relative local writingspeed for ASMs representations in points per second

V (119894) pts =1003817100381710038171003817(2119894minus1 2119894) minus (2119894+1 2119894+2)

1003817100381710038171003817pt

(119899 (u) 119899 (u)) Δ119905s

1 le 119894 le 119899 (u) (10)

In order to estimate the expected pigmentation intensitywe use the normalized writing speed V isin [0 1] where V = 0is the slowest and V = 1 is the fastest part of the trajectory ofa synthesis If c0 is the current color of a pixel in RGB colorspace and c

119901is the color of the pen pigment then the new

color is computed by

c = c119901120572119886+ c0120572119887 (1minus120572119886) c isin R

3 (11)

where 120572119886

= 08(1 minus V) + 02 defines opacity of c119901and

120572119887

= 1 defines the opacity of the background Althoughpigments that are used for handwritings are typically full orsemiopaque reduction of pigmentation caused by increasedwriting speed can lead to transparency This is simulated byreducing 120572

119886 as shown in Figure 11(e)

12 The Scientific World Journal

(a) u (b) u (B-Spline) (c) u (polygon mesh) (d) Pen shape (e) Speed (f)

(g) Example of a synthesized text line

(h) Example of a synthesized text line (fast method for binary images)

Figure 11 From the polygon u to a synthetic image that simulates a feather like writing instrument (c) Polygon mesh created from u that isused for fast rendering of binary images

To ensure a steady behavior we interpolate the speed ofconnected letters For the first 119899(u)4 points (2119894minus1 2119894)we setthe speed V of a letter in middle or end form to

V (119894) = V (119894) [1minus120582119894] + V

119887(119899 (u)) 120582

119894

120582119894= 4 119894

119899 (u) 119894 le

14119899 (u)

(12)

where V119887(119899(u)) is the speed at the end of the previous letter

The effect on the synthesis is shown in Figure 11(d)

Render on Degraded Background Finally we createFigure 11(f) by combining our texture rendering techniqueof Section 541 with the one based on Pen Shape and writingspeed using a nonuniform background Therefore weapplied a transparent texture on all pixels that does notbelong to the background texture This way small randomirregularity is simulated

In the shown examples a black color is used as mostdocuments are written with dark ink (like iron oxide or soot)Pigmentation intensity is implemented as transparencywhich allows simulating pigment accumulation at crossinglines or in case of a textured background However alsocolored opaque or semiopaque ink can be simulated Thismight be interesting in the context of historical documentssince important passages are often highlighted by using redink Another important feature of historical documents isdegradation of paper or parchment Currently we simplyuse images of natural paper or parchment as backgroundtextures which are scaled or tiled in case where they aresmaller than the synthesized document

55 Generation of Text Pages Recently not only characteror word recognition but also more complex document anal-ysis issues that address the interpretation or recognition of

complete documents become a focus of Arabic handwritingresearch Hence we investigate the possibilities of text pagesynthesis In this regard the accurate simulation of thelower baselines is crucial Many problems that occur whiledetecting lines words or connected components depend onthese baselines as for instance assigning diacritics (that arevery close to more than one text lines) to their correspondingPAW

Our approach of simulating baselines has three stepsFirst of all we set the coordinates (1199090 1199100) of the first letter foreach line Secondly the curvatures of the baselines have to becomputed Thirdly potential intersection of words have to besolved

Start PAWs Due to the style of Arabic handwritings alllines start at the rightmost 119909-coordinate 1199090 = 119909max Thevertical space between two neighbored lines can be definedas percentage of the average PAW heights to get 1199100 for eachbaseline

Baselines We implement the second step by declaring func-tions 119891(119909 1199100) that define the curvatures of the simulatedBaselines Ξ

119904(1199100 defines the initial heights of a line) We

normalize 1199100 isin [0 1] inside 119891(119909 1199100) so it becomes

independent of the page size How to compute proper 119891119894is

explained in Section 56Let l119903 define the lower right of a letters bounding box then

we first translate the letter l towards the baseline so that l119903touches it Subsequently the119910-position of lmust be correctedaccording to its class by translating it by t

119887 so that l119903 might

be above or below 119891(119897119903

119909 1199100) as shown in Figure 12Therefore

we extracted the normalized statistical relation N119887between

l119903 and the baseline from the IESK-arDB for all letter classes If119897ℎ is the heights and l119894 is the 119894th point of l we can compute t

119887=

(0 119897ℎN119887)119879 and l1015840119894 = l119894 + t

119887as shown in Figure 12 We perform

this for every first letter l119891of a PAW Apart from the position

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 12: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

12 The Scientific World Journal

(a) u (b) u (B-Spline) (c) u (polygon mesh) (d) Pen shape (e) Speed (f)

(g) Example of a synthesized text line

(h) Example of a synthesized text line (fast method for binary images)

Figure 11 From the polygon u to a synthetic image that simulates a feather like writing instrument (c) Polygon mesh created from u that isused for fast rendering of binary images

To ensure a steady behavior we interpolate the speed ofconnected letters For the first 119899(u)4 points (2119894minus1 2119894)we setthe speed V of a letter in middle or end form to

V (119894) = V (119894) [1minus120582119894] + V

119887(119899 (u)) 120582

119894

120582119894= 4 119894

119899 (u) 119894 le

14119899 (u)

(12)

where V119887(119899(u)) is the speed at the end of the previous letter

The effect on the synthesis is shown in Figure 11(d)

Render on Degraded Background Finally we createFigure 11(f) by combining our texture rendering techniqueof Section 541 with the one based on Pen Shape and writingspeed using a nonuniform background Therefore weapplied a transparent texture on all pixels that does notbelong to the background texture This way small randomirregularity is simulated

In the shown examples a black color is used as mostdocuments are written with dark ink (like iron oxide or soot)Pigmentation intensity is implemented as transparencywhich allows simulating pigment accumulation at crossinglines or in case of a textured background However alsocolored opaque or semiopaque ink can be simulated Thismight be interesting in the context of historical documentssince important passages are often highlighted by using redink Another important feature of historical documents isdegradation of paper or parchment Currently we simplyuse images of natural paper or parchment as backgroundtextures which are scaled or tiled in case where they aresmaller than the synthesized document

55 Generation of Text Pages Recently not only characteror word recognition but also more complex document anal-ysis issues that address the interpretation or recognition of

complete documents become a focus of Arabic handwritingresearch Hence we investigate the possibilities of text pagesynthesis In this regard the accurate simulation of thelower baselines is crucial Many problems that occur whiledetecting lines words or connected components depend onthese baselines as for instance assigning diacritics (that arevery close to more than one text lines) to their correspondingPAW

Our approach of simulating baselines has three stepsFirst of all we set the coordinates (1199090 1199100) of the first letter foreach line Secondly the curvatures of the baselines have to becomputed Thirdly potential intersection of words have to besolved

Start PAWs Due to the style of Arabic handwritings alllines start at the rightmost 119909-coordinate 1199090 = 119909max Thevertical space between two neighbored lines can be definedas percentage of the average PAW heights to get 1199100 for eachbaseline

Baselines We implement the second step by declaring func-tions 119891(119909 1199100) that define the curvatures of the simulatedBaselines Ξ

119904(1199100 defines the initial heights of a line) We

normalize 1199100 isin [0 1] inside 119891(119909 1199100) so it becomes

independent of the page size How to compute proper 119891119894is

explained in Section 56Let l119903 define the lower right of a letters bounding box then

we first translate the letter l towards the baseline so that l119903touches it Subsequently the119910-position of lmust be correctedaccording to its class by translating it by t

119887 so that l119903 might

be above or below 119891(119897119903

119909 1199100) as shown in Figure 12Therefore

we extracted the normalized statistical relation N119887between

l119903 and the baseline from the IESK-arDB for all letter classes If119897ℎ is the heights and l119894 is the 119894th point of l we can compute t

119887=

(0 119897ℎN119887)119879 and l1015840119894 = l119894 + t

119887as shown in Figure 12 We perform

this for every first letter l119891of a PAW Apart from the position

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 13: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

The Scientific World Journal 13

( l998400lxl998400ry)

f(x y0)119845998400l

rarr119834

rarr119835

119845r

119845998400r

lh119977b

120601

Figure 12 Arranging a letter along the baseline

also the PAW skew depends on the baseline We simulate thisby rotating all points l1015840119894 of a letter around their pen down pointl10158401 Let l119897 be the lower left of the bounding box of the currentletter l and then the rotation angle is

120601 = cosminus1⟨a b⟩

|a| 10038161003816100381610038161003816

b10038161003816100381610038161003816

a = l1015840119903 minus l1015840119897 b = l1015840119903 minus (

1198971015840119897

119909

1198971015840119903

119910

) (13)

Before we rotate a letter l1015840 = l1015840119891it has to be connected with

its predecessor l1015840119901translating it by t

119895= (l1015840119890

119901minus l10158401) This way

the handwriting synthesis fits to the baseline without causingaliasing effects

Solving Intersections In the last step we detect and solveintersections between lines Therefore all PAWB of the lineabove have to be detected whose bounding boxes overlapwith the current PAW A or whose distances are less than 120598For allB we then calculate weather there is any intersectionsbetween line segments sA = l1015840119894

Al1015840119894+1A

isin A and sB =

l1015840119894Bl1015840119894+1

Bisin B If so A is translated by (0 120595)119879 This has to

be done also for the predecessor of A by using the transla-tion (120595 0)119879 Similar to Algorithm 1 (where intersections oftwo neighbored PAWs of the same line are handled) thesesteps have to be repeated until no intersection is detectedanymore

Two lines which are not parallel have an intersectionpoint z To proof weather two line segments intersect z oftheir corresponding lines must be calculated first A pair ofline segments sA and sB intersects if and only if z lies onboth line segments as shown in Figure 13(a) However theremight be an intersection of lines in the rendered image evenif sA and sB do not intersect To avoid this the distance 120576of the two line segments has to be higher than 120576min where120576min has to be at least one pt larger than 2 times the PenShape widths 119908

119875 Let w be the point of the opposite line

segment of l120576isin l1015840119894A l

1015840119894+1A l1015840119894B l

1015840119894+1B that is closest to l

120576 and

then we get 120576 = l120576minus w In case that z lies only on one line

segment sBA we know that l120576isin l1015840119894AB l

1015840119894+1AB as shown in

Figure 13(b) Otherwise l120576minuswmust be calculated for all four

pointsOutcomes of the described techniques of text page gen-

eration are shown in Figure 14 How to determine a properbaseline function 119891(119909 1199100) will be discussed in the nextsection

56 Optimization of Baseline Functions A set of baselines Ξare 119899 sequences of bounding boxes of all PAW within a pageordered from the first to the last PAW of a line To validateand optimize synthetic baselines Ξ

119904 which are a result of

119891(119909 1199100) we calculate the correlation 120588 = corr(Ξ119903 Ξ

119904)

where Ξ119903

contains 11295 PAW extracted from naturalhandwritings

To get the global correlation 120588119892 we train a Gaussian

Mixture Model (GMM) on Ξ119903 Therefore features 119909 as the

average 120583 and sigma 120590 of the normalized space betweentext lines 120583 and 120590 of the angle 120601 between a text line and thehorizontal or 120583 and 120590 of the change of 120601 depending on 1199100are used Subsequently we use the GMM to calculate thelog likelihood logL(120579 | x) where Ξ

119904with x belongs to the

class of natural baselines 120579 Now the global correlation can becomputed by 120588

119892= 119899

minus1sum119899 logL(120579 | x)To detect lines that have odd curvatures we also compare

each synthetic line with all natural ones Therefore we repre-sent each line byL which is a series of the geometrical centersc of the PAW-bounding boxes To ease the comparisonall natural L

119903and synthetic L

119904lines are normalized and

translated so that their first (rightmost) c lies within theorigin For all 119898

Ξcenters c isin L

119904we search neighbored

c119886 c119887 isin L119903that fulfill c119886

119909gt c

119909gt c119887

119909 Now 120588

119897= corr(L

119904L

119903)

can be calculated

120588119897= log(1minus(

sum119898Ξ1003817100381710038171003817c minus c119903

1003817100381710038171003817

119898Ξ

))

c119903

=

c119886119909minus c

119909

c119887119909minus c119886

119909

c119886

+

c119909minus c119887

119909

c119887119909minus c119886

119909

c119887

(14)

Using the average 120588119897of the five best matches 120588

119897we get 120588 =

120588119897+ 120588

119892 where 120588 indicated how proper 119891(119909 1199100) simulates

the shapes of natural baselines The functions 119891119894have to be

defined manually within the UI however an automaticallyoptimization can be initialized subsequently We definedmultiple 119891

119894 reflecting different peculiarities that could be

observed studying historical and other Arabic handwritingsThe function that defines a set of ground truth (nonhistorical)text pages of the IESK-arDB and that was used to generate thesyntheses in Figure 14 is 1198911(119909 1199100)

minus 211990211199091199100 +1199100 [07 sin (25119909minus 12) + 1199022 sdot sin (10119909)

+ 1199023 sdot sin (8119909+ 2)] (15)

The parameters 119902119894are redefined byGaussian distributions

N119894(120583

119894 120590

119894) for each page synthesis To find the optimal 119902

119894

we use genetic programming where 120583119894 120590

119894are the genetic

representation and 120588 is the fitness of an individual For 1198911 weget the parameterization

1199021 lArr997904 N (015 084)

1199022 lArr997904 N (067 051)

1199023 lArr997904 N (035 017)

(16)

Depending on the defined formula and features of the usedΞ119903 more or less challenging page syntheses can be achieved

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 14: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

14 The Scientific World Journal

119859

119845998400iB

119845998400i+1A

119845998400i+1B

119845998400iA

(a)

120576min

120576

119859

119856

119845998400i+1A119845998400iA

119845998400i+1B

119845998400iB

(b)

120576min

120576

119856

119859 119845998400iA

119845998400iB

119845998400i+1A

119845998400i+1B

(c)

Figure 13 Detecting intersections of two line segments where the grid has the size 1 pt to suggest the synthesized image 120576 is 2 pt (a) Thelines segments intersect (b)The line segments are close and sB points to sB but there is no need to moveA since their shortest distance 120576 ishigher than 120576min (c) The intersection point z is outside both line segments but 120576 is smaller than 120576min so an intersection of the correspondinglines of the synthesized image is expected

6 Results and Discussions

We found that our system is able to synthesize multiplerealistic samples for all words that do not include specialcharacters like Hamza over Nabira or ligatures like LamAlifor digits (which can be included when extending the letterdatabase) In the following we propose a method to declaresuitable functions for Baseline definitions and validate theapplicability of our synthesis outcomes

61 Synthesis Evaluation Since the data synthesis module isbuilt to ease the development and validation of methods thatare related to document analysis it is not only of interestwhether syntheses look realistic or not In fact it is crucialhow image processing methods behave when being fed withsynthetic instead of natural data This is investigated in thissection where a method that segments handwritten Arabicwords into letters is validated on such data We chose wordsegmentation as example due to its sensitivity to character

shapes as well as global features like overlapping PAWs orvarying Kashida length

Segmentation of Arabic Words The segmentation methodwhich is used for the following experiments is described in[4] It is based on topological features and a set of rules thatreduces all candidates to a final set of points which dividetwo neighbored letters In contrast to other approachescandidates are not minima that indicate the middle of aKashida but typically the following branch point

Comparison of Real and Synthetic Validation DatabasesThe synthetic samples which are created by the proposedapproach are meant as training or testing data for differentdocument analysis methods To investigate whether thesesyntheses can be used instead or additional to naturalsamples we created synthetic samples (png files + groundtruth) of all words of the IESK-arDB database [4] thatwe call IESK-arDB-Syn in the following We validate thedescribed segmentation method on both databases using

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 15: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

The Scientific World Journal 15

(a) Real (b) Synthesis (PDF) (c) Synthesis (PNG)

(d) (e) (f)

Figure 14 Examples for syntheses of complete text pages (a) one of the natural handwritings that have been used to compute function 119891(b) synthesis using optimized 1198911 (given by (15)) rendered as PDF (c) another synthesis using 1198911 rendered as png image More examplesinclusive ground truth will be added at httpwwwiesk-ardbovgude soon Text synthesis from a BBC newsletter (d) BBC article about avirus outbreak in Saudi Arabia [5] (e-f) two syntheses of the given paragraph of (d)

Table 4 Validation of the segmentation method

Database IESK-arDB IESK-arDB-SynNumber of word samples 2540 9000Measure 120583 120590 120583 120590

Error per word 167 013 174 0024Error per letter 035 0026 034 00045Over segmentation (per word) 079 0097 086 00066Under segmentation (per word) 087 0071 088 0019Perfect segmentation (per word) 017 00019 013 00067

cross validation As shown in Table 4 the detected errorrates are comparable This proves at least that the proposedsynthesis method is capable of reflecting those features ofnatural Arabic words which are critical for segmentations

Furthermore the proposed synthesis approach enablesinvestigating the robustness of the segmentation methodagainst the influence of particular features Therefore webuilt modifications of IESK-arDB-Syn for experiments A andB using the UI to ensure that only the investigated featurediffers for samples of the same writer The results of theseexperiments are shown in Figure 15

Experiment A ASM Eigenvector Intensity The intensities 119888119894of

the used eigenvectors define the similarity of a computed let-ter shape u and x where maximal intensities (119888

119894) often causes

unexpected deformed shapes which are hard to classifyThe experiment confirms that eigenvector intensities are also

proportional to segmentation error frequencyHowever evenstrongly deformed letter shapes reduce the segmentationresults onlymoderately since their influence onKashidas andkey features as branch points is less than their influence onthe signature of the letter curvature which seems more vitalregarding character recognition

Experiment B Writer As one can see in Figure 15(b)the segmentation method is quite sensitive to the writerdependent style Best performance is achieved on writer 1since letters are written in a proper style and have longKashidas

Experiment C Skew Although skew correction is a commonpreprocessing step this experiments show that the usedsegmentation method is robust against a skew of plusmn20∘

Experiment D Kashida Length Kashidas are the connectionsof two letters which have a high variation in case ofArabic handwritings The experiment shows that a validsegmentation is especially difficult in case of very smallKashidas since most structures that indicate a potentialdividing point are hidden or vanished in such cases Inextreme cases neighbored letters can be written one abovethe other This effect could be observed in both naturaland synthetic handwritings and makes segmentation verychallenging In contrast to slant and skew variation Kashidarelated problems cannot be solved by a simple preprocessingtechnique

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 16: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

16 The Scientific World Journal

0 1 2

0

1

2

Inte

nsity

120590A

(a) ASM

1 32 4

0

1

2

Writer ID

Inte

nsity

(b) Writer

0 20

0

1

2

Inte

nsity

Skew Θ

minus20

(c) Skew of handwriting

0 20 40 60 80 100

0

1

2

3

Kashida cutting ()

Inte

nsity

(d) Kashida

Inte

nsity

ErrorwordErrorletter

Under segPerfect seg in 100

0 20 40

0

1

2

3

Slant Θminus40 minus20

Over seg

(e) Slant of handwriting

Figure 15 Experiments show the influence of different features on the average error of the word segmentation method

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 17: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

The Scientific World Journal 17

Experiment E Slant The used segmentation method doesonly segment at rows with exactly one foreground pixelHence extreme slants can cause segmentation errors if theslant causes strongly overlapping ascenders The experimentshows that a slant of about 20∘ even slightly improves thesegmentation results which might be caused by the frequentappearance of Alif ( ) in end-form that can be detected morereliable if it has a positive slantThis effect is weakened whenreducing theKashidas length though Finally the experimentshows that slant correction is not a mandatory but nonethe-less useful preprocessing step for the proposed segmentationmethod especially for handwritings with strong negativeslant

7 Conclusion

We have presented an efficient approach to generate pseudohandwritten Arabic words and text pages including dia-critic marks (dots) from Unicode Online sample andActive Shape Model based glyphs from multiple writersas well as affine transformations allow to generate variousimages for a given Unicode string to cover the variabil-ity of human handwritings Data of new writers can beadded easily and efficiently since the definition of man-ual landmarks is not necessary Features as the slant canbe controlled manually if desired Interpolation methodsand a rendering technique are used to meet the proper-ties of offline handwritings We investigated the practicalapplicability of the synthesis by validating a segmentationalgorithm on natural and synthetic data getting comparableresults

In our future work we are going to extend the used alpha-bet acquire letter samples from more writers and reducethe amount of synthesized words by clustering techniquesas affinity propagation This will help to synthesize compactbut representative databases and use them to train and testmethods for handwriting recognition and document analysisapproaches

Conflict of Interests

The authors declare that they have no competing interests

Acknowledgment

The authors would like to extend their sincere appreciation tothe Deanship of Scientific Research at King Saud Universityfor its funding of this International Research Group (IRG14-28)

References

[1] V Margner and H El Abed ldquoDatabases and competitionsstrategies to improve Arabic recognition systemsrdquo inArabic andChinese Handwriting Recognition SACH 2006 Summit CollegePark MD USA September 27-28 2006 Selected Papers vol4768 of Lecture Notes in Computer Science pp 82ndash103 SpringerBerlin Germany 2008

[2] Y Elarian RAbdel-Aal I AhmadMT Parvez andA ZidourildquoHandwriting synthesis classifications and techniquesrdquo Inter-national Journal on Document Analysis and Recognition vol 17no 4 pp 455ndash469 2014

[3] Y Elarian H A Al-Muhsateb and L M Ghouti ldquoArabichandwriting synthesisrdquo in Proceedings of the 1st InternationalWorkshop on Frontiers in Arabic Handwriting Recognition 2011httphdlhandlenet200327562

[4] M Elzobi A Al-Hamadi Z Al Aghbari and L Dings ldquoIESK-ArDB a database for handwritten Arabic and an optimizedtopological segmentation approachrdquo International Journal onDocument Analysis and Recognition vol 16 no 3 pp 295ndash3082013

[5] httpwwwbbccoukarabicscienceandtech[6] L M Lorigo and V Govindaraju ldquoOffline arabic handwriting

recognition a surveyrdquo IEEE Transactions on Pattern Analysisand Machine Intelligence vol 28 no 5 pp 712ndash724 2006

[7] J M Hollerbach ldquoAn oscillation theory of handwritingrdquo Biolog-ical Cybernetics vol 39 no 2 pp 139ndash156 1981

[8] G Gangadhar D Joseph and V S Chakravarthy ldquoAn oscilla-tory neuromotor model of handwriting generationrdquo Interna-tional Journal on Document Analysis and Recognition vol 10no 2 pp 69ndash84 2007

[9] R Plamondon W Guerfali and Scribens (Laboratory) TheGeneration of Handwriting with Delta-Lognormal SynergiesRapport Technique Laboratoire Scribens Departement deGenie Electrique Ecole Polytechnique de Montreal 1996httpbooksgoogledebooksid=6Vn9MwEACAAJ

[10] I Guyon ldquoHandwriting synthesis from handwritten glyphsrdquo inProceedings of the 5th International Workshop on Frontiers ofHandwriting Recognition pp 309ndash312 1996

[11] T Varga and H Bunke ldquoPerturbation models for generatingsynthetic training data in handwriting recognitionrdquo inMachineLearning in Document Analysis and Recognition S Marinaiand H Fujisawa Eds vol 90 pp 333ndash360 Springer BerlinGermany 2008

[12] Y Zheng and D S Doermann ldquoHandwriting matching and itsapplication to handwriting synthesisrdquo in Proceedings of the 8thInternational Conference on Document Analysis and Recognition(ICDAR rsquo05) pp 861ndash865 IEEE Computer Society SeoulRepublic of Korea September 2005

[13] P Viswanath N Murty and S Bhatnagar ldquoOverlap patternsynthesis with an efficient nearest neighbor classifierrdquo PatternRecognition vol 38 no 8 pp 1187ndash1195 2005

[14] H I Choi S-J Cho and J H Kim ldquoGeneration of handwrittencharacters with bayesian network based on-line handwritingrecognizersrdquo in Proceedings of the 7th International Conferenceon Document Analysis and Recognition pp 995ndash999 IEEEEdinburgh UK August 2003

[15] J Dolinsky andH Takagi ldquoSynthesizing handwritten charactersusing naturalness learningrdquo in Proceedings of the IEEE Interna-tional Conference on Computational Cybernetics (ICCC 07) pp101ndash106 Gammarth Tunisia October 2007

[16] S Al-Zubi ldquoActive shape structural modelrdquo Tech Rep 2004[17] D Shi S R Gunn and R I Damper ldquoHandwritten Chinese

radical recognition using nonlinear active shape modelsrdquo IEEETransactions on Pattern Analysis and Machine Intelligence vol25 no 2 pp 277ndash280 2003

[18] M Helmers and H Bunke ldquoGeneration and use of synthetictraining data in cursive handwriting recognitionrdquo in PatternRecognition and Image Analysis Proceedings of the 1st Iberian

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 18: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

18 The Scientific World Journal

Conference IbPRIA 2003 Puerto de Andratx Mallorca SpainJUne 4ndash6 2003 F J Perales A J C Campilho N P de la Blancaand A Sanfeliu Eds vol 2652 of Lecture Notes in ComputerScience pp 336ndash345 Springer Berlin Germany 2003

[19] C V Jawahar A Balasubramanian M Meshesha and A MNamboodiri ldquoRetrieval of online handwriting by synthesis andmatchingrdquo Pattern Recognition vol 42 no 7 pp 1445ndash14572009

[20] P Rao ldquoShape vectors an efficient parametric representationfor the synthesis and recognition of hand script charactersrdquoSadhana vol 18 no 1 pp 1ndash15 1993

[21] Y Xu H Shum J Wang and C Wu ldquoLearning-based systemand process for synthesizing cursive handwritingrdquo US Patent7227993 2007 httpwwwgooglecoinpatentsUS7227993

[22] Z Lin and L Wan ldquoStyle-preserving English handwritingsynthesisrdquo Pattern Recognition vol 40 no 7 pp 2097ndash21092007

[23] J Wang C Wu Y-Q Xu and H-Y Shum ldquoCombining shapeand physical models for online cursive handwriting synthesisrdquoInternational Journal on Document Analysis and Recognitionvol 7 no 4 pp 219ndash227 2005

[24] A O Thomas A Rusu and V Govindaraju ldquoSynthetic hand-written CAPTCHAsrdquo Pattern Recognition vol 42 no 12 pp3365ndash3373 2009

[25] H Miyao and M Maruyama ldquoVirtual example synthesis basedon PCA for off-line handwritten character recognitionrdquo inDocument Analysis Systems VII vol 3872 pp 96ndash105 SpringerBerlin Germany 2006

[26] T Varga and H Bunke ldquoGeneration of synthetic trainingdata for an HMM-based handwriting recognition systemrdquo inProceedings of the 7th International Conference on DocumentAnalysis and Recognition vol 1 pp 618ndash622 Edinburgh UKAugust 2003

[27] T Varga D Kilchhofer and H Bunke ldquoTemplate-based syn-thetic handwriting generation for the training of recognitionsystemsrdquo in Proceedings of the 12th Conference of the Interna-tional Graphonomics Society pp 206ndash211 2005

[28] B B Chaudhuri and A Kundu ldquoSynthesis of individual hand-writing in bangla scriptrdquo in Proceedings of the ICFHR 2008httpwwwcenparmiconcordiacaICFHR2008Proceedingspaperscr1079pdf

[29] V Margner and M Pechwitz ldquoSynthetic data for Arabic OCRsystem developmentrdquo in Proceedings of the 6th InternationalConference on Document Analysis and Recognition pp 1159ndash1163 Seattle Wash USA

[30] Y Elarian I Ahmad S Awaida W G Al-Khatib and AZidouri ldquoAn Arabic handwriting synthesis systemrdquo PatternRecognition vol 48 no 3 pp 849ndash861 2015

[31] R M Saabni and J A El-Sana ldquoComprehensive syntheticArabic database for onoff-line script recognition researchrdquoInternational Journal on Document Analysis and Recognitionvol 16 no 3 pp 285ndash294 2013

[32] L Dinges M Elzobi A Al-Hamadi and Z Al-AghbarildquoSynthizing handwritten arabic text using active shape modelsrdquoin Image Processing and Communications Challenges 3 vol 102of Advances in Intelligent and Soft Computing pp 401ndash408Springer Berlin Germany 2011

[33] L Dinges A Al-Hamadi and M Elzobi ldquoAn approach forarabic handwriting synthesis based on active shape modelsrdquo inProceedings of the 12th International Conference on DocumentAnalysis and Recognition (ICDAR rsquo13) pp 1260ndash1264 August2013

[34] H Almuallim and S Yamaguchi ldquoA method of recognitionof arabic cursive handwritingrdquo IEEE Transactions on PatternAnalysis andMachine Intelligence vol 9 no 5 pp 715ndash722 1987

[35] P Xiu L Peng X Ding and H Wang ldquoOffline handwrittenarabic character segmentation with probabilistic modelrdquo inDocument Analysis Systems VII vol 3872 of Lecture Notes inComputer Science No project 60472002 pp 402ndash412 SpringerBerlin Germany 2006

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Page 19: Research Article ASM Based Synthesis of …downloads.hindawi.com/journals/tswj/2015/323575.pdfResearch Article ASM Based Synthesis of Handwritten Arabic Text Pages LasloDinges, 1 AyoubAl-Hamadi,

Submit your manuscripts athttpwwwhindawicom

Computer Games Technology

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Distributed Sensor Networks

International Journal of

Advances in

FuzzySystems

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014

International Journal of

ReconfigurableComputing

Hindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Applied Computational Intelligence and Soft Computing

thinspAdvancesthinspinthinsp

Artificial Intelligence

HindawithinspPublishingthinspCorporationhttpwwwhindawicom Volumethinsp2014

Advances inSoftware EngineeringHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Electrical and Computer Engineering

Journal of

Journal of

Computer Networks and Communications

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporation

httpwwwhindawicom Volume 2014

Advances in

Multimedia

International Journal of

Biomedical Imaging

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

ArtificialNeural Systems

Advances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

RoboticsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Computational Intelligence and Neuroscience

Industrial EngineeringJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Modelling amp Simulation in EngineeringHindawi Publishing Corporation httpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Human-ComputerInteraction

Advances in

Computer EngineeringAdvances in

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014