Vous êtes sur la page 1sur 27

1 INTRODUCTION:

The goal of Optical Character Recognition (OCR) is to classify optical patterns (often contained in a digital image) corresponding to alphanumeric or other characters. The process of OCR involves several steps including segmentation, feature extraction, and classification. Each of these steps is a field unto itself, and is described briefly here in the context of a One example of OCR is sho!n belo! atlab implementation of OCR.

Therefore, Text capture is a process to convert analogue text based resources into digitally recognisable text resources. These digital text resources can be represented in many !ays such as searchable text in indexes to identify documents or page images, or as full text resources. "n essential first stage in any text capture process from analogue to digital !ill be to create a scanned image of the page side. This !ill provide the base for all other processes. The next stage may then be to use a technology #no!n as Optical Character Recognition to convert the text content into a machine readable format.

Optical Character Recognition (OCR) is a type of document image analysis !here a scanned digital image that contains either machine printed or hand!ritten script is input into an OCR soft!are engine and translating it into an editable machine readable digital text format (li#e "$C%% text). OCR !or#s by first pre&processing the digital page image into its smallest component parts !ith layout analysis to find text bloc#s, sentence'line bloc#s, !ord bloc#s and character bloc#s. Other features such as lines, graphics, photographs etc are recognised and discarded. The character bloc#s are then further bro#en do!n into components parts, pattern recogni(ed and compared to the OCR engines large dictionary of characters from various fonts and languages. Once a li#ely match is made then this is recorded and a set of characters in the !ord bloc# are recogni(ed until all li#ely characters have been found for the !ord bloc#. The !ord is then compared to the OCR engine)s large dictionary of complete !ords that exist for that language. These factors of characters and !ords recognised are the #ey to OCR accuracy * by combining them the OCR engine can deliver much higher levels of accuracy. odern OCR engines extend this accuracy through more sophisticated pre&processing of source digital images and better algorithms for fu((y matching, sounds&li#e matching and grammatical measurements to more accurately establish !ord accuracy.

1.1 Different uses for OCR


There are many uses for the output from an OCR engine and these are not limited to a full text representation online that exactly reproduces the original. +ecause OCR can, in many circumstances, deliver character recognition accuracy that is belo! !hat a good copy typist !ould achieve it is often assumed it has little validity as a process for many historical documents. ,o!ever, as long as the process is fitted to the information re-uirement then OCR can have a place even !hen the accuracy is relatively lo! (see "ccuracy belo! for more details). .otential uses include/ Indexing * the OCR text is output into a pure text file that is then imported to a search engine. The text is used as the basis for full text searching of the information resource. ,o!ever, the user never sees the OCR)d text * they are delivered a page image from the scanned document instead. This allo!s for the OCR accuracy to be -uite poor !hilst still delivering the document to the user and providing searching capability. ,o!ever, this mode of searching 0ust identifies the document not necessarily the !ord or page on !hich it appears * in other terms it 0ust indexes that those !ords appear in a specific item. "n example of this is Full text retrieval * in this mode the OCR text is created as above but further !or# is done in the delivery system to allo! for true full text retrieval. The search results are displayed !ith hit highlighting !ithin the page image displayed. This is a valuable addition to the indexing option from the perspective of the user. "n example of this is the 1orced igration Online 2igital 3ibrary4. Full text representation * in this option the OCR)d text is sho!n to the end user as a representation of the original document. %n this case the OCR must be very accurate indeed or the user !ill lose confidence in the information resource. "ll sorts of formatting issues in terms of the loo# and feel of the original are inherent !ithin this option and it is rarely used !ith mar#&up (see belo!) of some #ind. The #ey factor is the accuracy and this leads to most pro0ects having to chec# and correct OCR text to ensure the accuracy is suitable for publication !ith obvious time and cost implications. Full text representation with x l ar!"up & in this option the OCR output is presented to the end user !ith layout, structure or metadata added via the 5 3 mar#&up. %n the ma0ority of cases !here OCR)d text is to be delivered there !ill be at least a minimal amount of mar#&up done to represent structure or layout. Currently this process normally re-uires the highest amount of human intervention out of all the options listed here as OCR correction is very li#ely !ith additional mar#&up of the content in some!ay. any examples of digital text resources !ith 5 3 mar#&up may be found through the Text Encoding %nitiative !ebsite6. The pro0ects listed there also demonstrate the variety in levels of mar#&up that are 3

possible ma#ing it possible to vary activity to match the pro0ects intellectual re-uirements and economic constraints.

1.# $e% issues for whether to use OCR


There are several #ey issues to consider in deciding !hether to use OCR at all or choosing bet!een different possible appropriate uses for the text output. The main factors to consider are a combination of accuracy, efficiency and the value gained from the process. %f the accuracy is belo! 789 then considerations of the cost in terms of time and effort to proof read and correct the resource !ould have to be accounted for if a full text representation is to be made. 1or instance, see the EE+O production description for ho! the accuracy issue changed their potential approaches:. %f the OCR engine is not capable to delivering the re-uired accuracy then re#eying the text may become viable, but only if the intellectual value to be gained from having the re#eyed text matches the pro0ects goals and budgets. Other!ise, OCR for indexing and retrieval may be the most viable option.

1.3 &''ura'%
The ma0ority of OCR soft!are suppliers define accuracy in terms of a percentage figure based on the number of correct characters per volume of characters converted. This is very li#ely to be a misleading figure as it is normally based upon the OCR engine attempting to convert a perfect laser printed text of the modernity and -uality of, for instance, the printed version of this document. $o, if told that even the better OCR soft!are could get ; in ;<,<<< characters !rong and that it !ill then li#ely get more than one or t!o characters !rong in this document !ould this seem -uite so impressive= %t is more useful to #no! ho! accurate the OCR engine !ill be on pre&;7><)s printed texts of very varying -uality in terms of print and paper -uality. %n this context, it is highly unli#ely that !e !ill get 77.779 accuracy and !e could assume that even the very best -uality printed pre&;7><)s resources !ill give no more than 789 (and most !ould be considerably less than that). %n these scenarios the accuracy measure given by the soft!are suppliers is not very useful in deciding !hether OCR is appropriate to the original printed resource. Regarding a''ura'% as a output to easure ent of the a ount of li!el% a'tivit% re(uired to ena)le the text ore useful.

eet the defined re(uire ents would )e

%n this context !e might loo# at the number of !ords that are incorrect rather than number of characters. 1or example/ a page of ><< !ords !ith 4,><< characters. %f the OCR engine gives a result of 789 4

accuracy this e-uals >< characters incorrect. ,o!ever, loo#ed at in !ord terms this could convert to >< !ords incorrect (one character per !ord) and thus in !ord accuracy terms !ould e-ual 7<9 accuracy. %f 4> !ords are inaccurate (4 characters on average per !ord) then this gives 7>9 in !ord accuracy terms. %f ;< !ords !ere inaccurate (average of > characters per !ord) then the !ord accuracy is 789. %n terms of effort and usefulness the !ord accuracy matters more than the character accuracy * !e can see the possibility of > times the effort to correct to ;<<9 across the !ord accuracy range sho!n in this simple example. %t is essential to remember that correcting OCR or text output is relatively expensive in terms of time and effort re-uiring both correction and proof reading activities * so it best to see# !ays to avoid this additional activity if possible. The other consideration might be the usefulness of the text for indexing and retrieval purposes. %f it is possible to achieve 7<9 character accuracy and still get 7<9 !ord accuracy, then most search engines utilising fu((y logic !ould get in excess of 789 retrieval rate for straightfor!ard prose text. %n these cases the OCR accuracy may be of less interest than the potential retrieval rate for the resource (especially as the user !ill never see the OCR)d text to notice it isn)t perfect). %n most prose

circumstances significant !ords and names are repeated !hich improves even more the chances of retrieval and can enable high retrieval rates for OCR accuracies measuring lo!er than 7<9.

2 Classification Process
(Classification in general for any type of classifier) There are t!o steps in building a classifier/ training and testing. These steps can be bro#en do!n further into sub&steps. 5

2.1 Training
a. Pre-processing * .rocesses the data so it is in a suitable form for? b. Feature extraction * Reduce the amount of data by extracting relevant information@Asually results in a vector of scalar values. (Be also need toCOR "3%DE the features for distance measurementsE) c. Model Estimation * from the finite set of feature vectors, need to estimate a model (usually statistical) for each class of the training data

2.2 Testing
a. Pre-processing b. Feature extraction * (both same as above) c. Classification * Compare feature vectors to the various models and find the closest match. One can use a distance measure.

2.2.1 OCR * +re"pro'essing


These are the pre&processing steps often performed in OCR 6

2.2.1.1 ,inari-ation * Asually presented !ith a grayscale image, binari(ation is then simply a matter
of choosing a threshold value.

2.2.1.2 .orphologi'al Operators * Remove isolated spec#s and holes in characters, can use the
majority operator.

#.#.1./ 0eg entation * Chec# connectivity of shapes, label, and isolate. Can use
bwlabel and regionprops functions. 2ifficulties !ith characters that aren)t connected,

atlab F.G)s

e.g. the letter i, a semicolon, or a colon (H or /). $egmentation is by far the most important aspect of the pre&processing stage. %t allo!s the recogni(er to extract features from each individual character. %n the more complicated case of hand!ritten text, the segmentation problem becomes much more difficult as letters tend to be connected to each other.

#.#.# OCR * Feature extra'tion


Iiven a segmented (isolated) character, !hat are useful features for recognition= ;. oment based features Thin# of each character as a pdf. The 4&2 moments of the character are/

1rom the moments !e can compute features li#e/ ;. Total mass (number of pixels in a binari(ed character) 4. Centroid & Center of mass 6. Elliptical parameters i. Eccentricity (ratio of ma0or to minor axis) ii. Orientation (angle of ma0or axis) :. $#e!ness >. Jurtosis F. ,igher order moments 4. ,ough and Chain code transform 6. 1ourier transform and series 7

#.#./ OCR " .odel 1sti ation


Iiven labeled sets of features for many characters, !here the labels correspond to the particular classes that the characters belong to, !e !ish to estimate a statistical model for each character class. 1or example, suppose !e compute t!o features for each reali(ation of the characters < through 7. .lotting each character class as a function of the t!o features !e have/

Each character class tends to cluster together. This ma#es senseH a given number should loo# about the same for each reali(ation (provided !e use the si(e font type and si(e). Be might try to estimate a pdf (or pdf parameters such as mean and variance) for each character class. 1or example, in 1igure 6, !e can see that the G)s have a mean Orientation of 7< and ,.$#e!ness of <.<66.

#.#.2 OCR * Classifi'ation


"ccording to Tou and Ion(ale(, KThe principal function of a pattern recognition system is to yield decisions concerning the class membership of the patterns !ith !hich it is confronted.L %n the context of an OCR system, the recogni(er is confronted !ith a se-uence feature patterns from !hich it must determine the character classes. " rigorous treatment of pattern classification is beyond the scope of this paper. Be)ll simply note that if !e model the character classes by their estimated means, !e can use a distance measure for classification. The class to !hich a test character is assigned is that !ith the minimum distance.

3. .&T3&,
/.1 4hat Is .&T3&,5
"T3"+ is a high&performance language for technical computing. %t integrates computation, visuali(ation, and programming in an easy&to&use environment !here problems and solutions are expressed in familiar mathematical notation. Typical uses include/ 6 ath and computation 9

6"lgorithm development 6 odeling, simulation, and prototyping 62ata analysis, exploration, and visuali(ation 6$cientific and engineering graphics 6"pplication development, including graphical user interface building

"T3"+ is an interactive system !hose basic data element is an array that does not re-uire dimensioning. This allo!s you to solve many technical computing problems, especially those !ith matrix and vector formulations, in a fraction of the time it !ould ta#e to !rite a program in a scalar non& interactive language such as C or 1ORTR"C.

The name

"T3"+ stands for matrix laboratory.

"T3"+ !as originally !ritten to provide easy "T3"+ uses

access to matrix soft!are developed by the 3%C."CJ and E%$."CJ pro0ects. Today,

soft!are developed by the 3"."CJ and "R."CJ pro0ects, !hich together represent the state&of&the&art

in soft!are for matrix computation.

"T3"+ has evolved over a period of years !ith input from many "T3"+ is the tool of choice for high&

users. %n university environments, it is the standard instructional tool for introductory and advanced courses in mathematics, engineering, and science. %n industry, productivity research, development, and analysis.

3.2 Tool)oxes
"T3"+ features a family of application&specific solutions called toolboxes. Mery important to most users of "T3"+, toolboxes allo! you to learn and apply speciali(ed technology. Toolboxes are "T3"+ functions ( &files) that extend the "T3"+ environment to comprehensive collections of

solve particular classes of problems. "reas in !hich toolboxes are available include signal processing, control systems, neural net!or#s, fu((y logic, !avelets, simulation, and many others.

3.3 The .&T3&, 0%ste


10

The

"T3"+ system consists of five main parts/

3.3.1 Develop ent 1nviron ent:


This is the set of tools and facilities that help you use are graphical user interfaces. %t includes the "T3"+ functions and files. any of these tools

"T3"+ des#top and Command Bindo!, a command

history, and bro!sers for vie!ing help, the !or#space, files, and the search path.

3.3.2 The .&T3&, .athe ati'al Fun'tion 3i)rar%:


This is a vast collection of computational algorithms ranging from elementary functions li#e sum, sine, cosine, and complex arithmetic, to more sophisticated functions li#e matrix inverse, matrix eigen values, +essel functions, and fast 1ourier transforms.

3.3.3 The .&T3&, language:


This is a high&level matrix'array language !ith control flo! statements, functions, data structures, input'output, and ob0ect&oriented programming features. %t allo!s both Kprogramming in the smallL to rapidly create -uic# and dirty thro!&a!ay programs, and Kprogramming in the largeL to create complete large and complex application programs.

/./.2 7andle 8raphi's:


This is the "T3"+ graphics system. %t includes high&level commands for t!o&dimensional and three&

dimensional data visuali(ation, image processing, animation, and presentation graphics. %t also includes lo!&level commands that allo! you to fully customi(e the appearance of graphics as !ell as to build complete graphical user interfaces on your "T3"+ applications.

/./.9 The .&T3&, &ppli'ation +rogra

Interfa'e :&+I;:
"T3"+. %t include

This is a library that allo!s you to !rite C and 1ortran programs that interact !ith facilities for calling routines from engine, and for reading and !riting "T3"+ (dynamic lin#ing), calling "T&files.

"T3"+ as a computational

/.2 4hat Is 0i ulin!5


$imulin#, a companion program to "T3"+, is an interactive system for simulating nonlinear dynamic

systems. %t is a graphical mouse&driven program that allo!s you to model a system by dra!ing a bloc# diagram on the screen and manipulating it dynamically. %t can !or# !ith linear, nonlinear, continuous& 11

time, discrete&time, multirate, and hybrid systems. Blocksets are add&ons to $imulin# that provide additional libraries of bloc#s for speciali(ed applications li#e communications, signal processing, and po!er systems. eal-!ime "orks#op is a program that allo!s you to generate C code from your bloc# diagrams and to run it on a variety of real&time systems.

/.9 4hat Is 0tateflow5


$tateflo! is an interactive design tool for modeling and simulating complex reactive systems. Tightly integrated !ith $imulin# and "T3"+, $tateflo! provides $imulin# users !ith an elegant solution for designing embedded systems by giving them an efficient !ay to incorporate complex control and supervisory logic !ithin their $imulin# models. Bith $tateflo!, you can -uic#ly develop graphical models of event&driven systems using finite state machine theory, statechart formalisms, and flo! diagram notation. Together, $tateflo! and $imulin# serve as an executable specification and virtual prototype of your system design.

/.< +rogra

ing in .&T3&,:

atlab supports some basic programming structures that allo! looping and conditioning commands along !ith relational and logical operators. The syntax and use of some of these structures are very similar to those found in C, Basic, and Fortran. These ne! commands combined !ith ones !e have discussed earlier can create po!erful programs or ne! functions that can be added to atlab.

/.= Relational and 3ogi'al Operators


Relational operators allo! the comparison of scalars (or matrices, element by element). The result of relational operators is scalars (or matrices of the same si(e as the arguments) of either <N or ;Ns. %f the result of comparison is true, the ans!er is ;H other!ise, it is <. The follo!ing operators are available. > " less than >? " less than or e(ual @ " greater than @? " greater than or e(ual ?? " e(ual A? " not e(ual 12

Relations may be connected or -uantified by the logical operators B " and C " or A " not Bhen applied to scalars, a relation is actually the scalar ; or < depending on !hether the relation is true or false. 1or example @@ / @ 9 &ns ? D "lso try / > 9, / ?? 9, and / ?? /. Bhen the relational and logical operators applied to matrices of the same si(e, a relation is a matrix of <Ns and ;Ns giving the value of the relation bet!een corresponding entries.

1or example/ @@& ? rand:#;E , ? triu:&;E & ?? , &? D.F1D/ D.#<#9 D.=<## D.D2=9 ,? D.F1D/ D.#<#9 D D.D2=9 ans ? 11

13

D1

/.G 3oops and Conditional 0tru'tures


Three atlab commands are available for !riting loops, conditional loops, and conditional statements. atlab flo! control statements operate li#e

They are for, while and if"else commands. +asically, these those in most computer languages.

For: 1or example, for a given n, the statement x ? HIJ for i ? 1:nE x?HxEiK#IE end or x ? HIJ for i ? 1:n

x ? HxEiK#I end !ill produce a certain n&vector and the statement x ? H IJ for i ? n:"1:1E x?HxEiK#IE end !ill produce the same vector in reverse order. Try them. Cote that a matrix may be empty (such as x ? H I ).

4hile/ The general form of a !hile loop is 14

while relation state ents end The statements !ill be repeatedly executed as long as the relation remains true. 1or example, for a given number a, the follo!ing !ill compute and display the smallest nonnegative integer n such that #Kn@? a/ n ? DJ while #Kn > a n ? n L 1J end

If/ The general form of a simple if statement is if relation state ents end The statements !ill be executed only if the relation is true. illustrated by If n > D parit% ? DJ elseif re :nE#; ?? D parit% ? #J else parit% ? 1J end %n t!o&!ay branching the elseif portion !ould, of course, be omitted. 15 ultiple branching is also possible, as is

" relation bet!een matrices is interpreted by !hile and if to be true if each entry of the relation matrix is non(ero. ,ence, if you !ish to execute statement !hen matrices & and , are e-ual you could type if & ?? , state ent end but if you !ish to execute statement !hen & and , are not e-ual, you !ould type if an%:an%:& A? ,;; state ent end or, more simply, if & ?? , else state ent end

Cote that the seemingly obvious if & A? ,E state entE end Bill not give !hat is intended since statement !ould execute only if each of the corresponding entries of & and , differ. The functions any and all can be creatively used to reduce matrix relations to vectors or scalars. T!o anyNs are re-uired above since any is a vector operator.

/.F .atla) Co
Cl':

ands Re(uired:

Clear Command Bindo! 16

Clear: Remove items from !or#space, freeing up system memory Clear: Remove specified figure Title/ "dd title to current axes 3oad/ 3oad !or#space variables from dis# Inputdlg/ Create and open input dialog box Isa: 2etermine !hether input is ob0ect of given class

3ength: 3ength of vector 3inspa'e: Ienerate linearly spaced vectors The 3inspace function generates linearly spaced Mectors. %t is similar to the colon operator O/O, but gives direct control over the number of points 4thresh: $oft or hard thresholding 0u)plot: 17

Create axes in tiled positions Rand: Aniformly distributed pseudorandom numbers Thsele't: Threshold selection for de&noising 4noise: Coisy !avelet test data I read: % RE"2 Read image from graphics file. " P % RE"2(1%3EC" E,1 T) reads a grayscale or color image from the file specified by the string 1%3EC" E. %f the file is not in the current directory, or in a directory on the full pathname. "T3"+ path, specify the

I write: % BR%TE Brite image to graphics file. % BR%TE(",1%3EC" E,1 T) !rites the image " to the file specified by 1%3EC" E in the format specified by 1 T. " can be an &by&C (grayscale image) or &by&C&by&6 (color image) array. " cannot be an empty &by&C&by&: array containing

array. %f the format specified is T%11,

% BR%TE can also accept an

color data that uses the C QJ color space. % $,OB 2isplay image in ,andle Iraphics figure. % $,OB(%) displays the grayscale image %.

18

I show: % $,OB(%,R3OB ,%I,S) displays the grayscale image %, specifying the display range for % in R3OB ,%I,S. The value 3OB (and any value less than 3OB) displays as blac#, the value ,%I, (and any value greater than ,%I,) displays as !hite. Malues in bet!een are displayed as intermediate shades of gray, using the default number of gray levels. %f you use an empty matrix (RS) for R3OB ,%I,S, % $,OB uses Rmin(%(/)) max(%(/))SH that is, the minimum value in % is displayed as blac#, and the maximum value is displayed as !hite.

2.0OURC1 COD1
O'r. 999999999999999999999999999999999999999 9 OCR (Optical Character Recognition). 9999999999999999999999999999999999999999 !arning off clc, close all, clear all imagenPimread(N4.0pgN)H imsho!(imagen)H title(N%C.AT % "IE B%T, CO%$EN) if si(e(imagen,6)PP6 9RI+ image imagenPrgb4gray(imagen)H 19

end 9 Convert to +B threshold P graythresh(imagen)H imagen PTim4b!(imagen,threshold)H 9 Remove all ob0ect containing fe!er than 6< pixels imagen P b!areaopen(imagen,6<)H 9$torage matrix !ord from image !ordPR SH rePimagenH 9Opens text.txt as file for !rite fid P fopen(Nocr.txtN, N!tN)H 9 3oad templates load templates global templates 9 Compute the number of letters in template file numUletrasPsi(e(templates,4)H

!hile ; 91cn NlinesN separate lines in text Rfl reSPlines(re)H imgnPflH 9Ancomment line belo! to see lines one by one 9imsho!(fl)Hpause(<.>) 9&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 9 3abel and count connected components R3 CeS P b!label(imgn)H for nP;/Ce Rr,cS P find(3PPn)H 9 Extract letter n;Pimgn(min(r)/max(r),min(c)/max(c))H 9 Resi(e letter (same si(e of template) imgUrPimresi(e(n;,R:4 4:S)H 9Ancomment line belo! to see letters one by one 20

9imsho!(imgUr)Hpause(<.>) 9&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 9 Call fcn to convert image to text letterPreadUletter(imgUr,numUletras)H 9 3etter concatenation !ordPR!ord letterSH end 9fprintf(fid,N9sVnN,lo!er(!ord))H9Brite N!ordN in text file (lo!er) fprintf(fid,N9sVnN,!ord)H9Brite N!ordN in text file (upper) 9 Clear N!ordN variable !ordPR SH 9WBhen the sentences finish, brea#s the loop if isempty(re) 9$ee variable NreN in 1cn NlinesN brea# end end fclose(fid)H 9Open Ntext.txtN file !inopen(Nocr.txtN) clear all CreateMte plates. : 99999999999999999999999999999999999999999999 99CRE"TE TE .3"TE$ 99999999999999999999999999999999999999999999 93etters "Pimread(NlettersUnumbersV".bmpN)H+Pimread(NlettersUnumbersV+.bmpN)H CPimread(NlettersUnumbersVC.bmpN)H2Pimread(NlettersUnumbersV2.bmpN)H EPimread(NlettersUnumbersVE.bmpN)H1Pimread(NlettersUnumbersV1.bmpN)H IPimread(NlettersUnumbersVI.bmpN)H,Pimread(NlettersUnumbersV,.bmpN)H %Pimread(NlettersUnumbersV%.bmpN)HXPimread(NlettersUnumbersVX.bmpN)H JPimread(NlettersUnumbersVJ.bmpN)H3Pimread(NlettersUnumbersV3.bmpN)H 21

Pimread(NlettersUnumbersV .bmpN)HCPimread(NlettersUnumbersVC.bmpN)H OPimread(NlettersUnumbersVO.bmpN)H.Pimread(NlettersUnumbersV..bmpN)H YPimread(NlettersUnumbersVY.bmpN)HRPimread(NlettersUnumbersVR.bmpN)H $Pimread(NlettersUnumbersV$.bmpN)HTPimread(NlettersUnumbersVT.bmpN)H APimread(NlettersUnumbersVA.bmpN)HMPimread(NlettersUnumbersVM.bmpN)H BPimread(NlettersUnumbersVB.bmpN)H5Pimread(NlettersUnumbersV5.bmpN)H QPimread(NlettersUnumbersVQ.bmpN)HDPimread(NlettersUnumbersVD.bmpN)H 9Cumber onePimread(NlettersUnumbersV;.bmpN)H t!oPimread(NlettersUnumbersV4.bmpN)H threePimread(NlettersUnumbersV6.bmpN)HfourPimread(NlettersUnumbersV:.bmpN)H fivePimread(NlettersUnumbersV>.bmpN)H sixPimread(NlettersUnumbersVF.bmpN)H sevenPimread(NlettersUnumbersVG.bmpN)HeightPimread(NlettersUnumbersV8.bmpN)H ninePimread(NlettersUnumbersV7.bmpN)H (eroPimread(NlettersUnumbersV<.bmpN)H

letterPR" + C 2 E 1 I , % X J 3 numberPRone t!o three four five... six seven eight nine (eroSH characterPRletter numberSH

C O . Y R $ T A M B 5 Q DSH

templatesPmat4cell(character,:4,R4: 4: 4: 4: 4: 4: 4: ... 4: 4: 4: 4: 4: 4: 4: ... 4: 4: 4: 4: 4: 4: 4: ... 4: 4: 4: 4: 4: 4: 4: ... 4: 4: 4: 4: 4: 4: 4: 4:S)H save (NtemplatesN,NtemplatesN) clear all lines. function Rfl reSPlines(imUtexto) 9 2ivide text in lines 9 imUtexto&Zinput imageH fl&Zfirst lineH re&Zremain line 9 Example/ 9 imUtextoPimread(NTE$TU6.0pgN)H 9 Rfl reSPlines(imUtexto)H 22

9 subplot(6,;,;)Himsho!(imUtexto)Htitle(N%C.AT % "IEN) 9 subplot(6,;,4)Himsho!(fl)Htitle(N1%R$T 3%CEN) 9 subplot(6,;,6)Himsho!(re)Htitle(NRE "%C 3%CE$N) imUtextoPclip(imUtexto)H numUfilasPsi(e(imUtexto,;)H for sP;/numUfilas if sum(imUtexto(s,/))PP< nmPimUtexto(;/s&;, /)H 9 1irst line matrix rmPimUtexto(s/end, /)H9 Remain line matrix fl P clip(nm)H rePclip(rm)H 9W&W&WAncomment lines belo! to see the resultW&W&W&W& 9 9 brea# else flPimUtextoH9Only one line. rePR SH end end function imgUoutPclip(imgUin) Rf cSPfind(imgUin)H imgUoutPimgUin(min(f)/max(f),min(c)/max(c))H9Crops image raedMletter. function Rfl reSPlines(imUtexto) 9 2ivide text in lines 9 imUtexto&Zinput imageH fl&Zfirst lineH re&Zremain line 9 Example/ 9 imUtextoPimread(NTE$TU6.0pgN)H 9 Rfl reSPlines(imUtexto)H 9 subplot(6,;,;)Himsho!(imUtexto)Htitle(N%C.AT % "IEN) 9 subplot(6,;,4)Himsho!(fl)Htitle(N1%R$T 3%CEN) 23 subplot(4,;,;)Himsho!(fl)H subplot(4,;,4)Himsho!(re)H

9 subplot(6,;,6)Himsho!(re)Htitle(NRE "%C 3%CE$N) imUtextoPclip(imUtexto)H numUfilasPsi(e(imUtexto,;)H for sP;/numUfilas if sum(imUtexto(s,/))PP< nmPimUtexto(;/s&;, /)H 9 1irst line matrix rmPimUtexto(s/end, /)H9 Remain line matrix fl P clip(nm)H rePclip(rm)H 9W&W&WAncomment lines belo! to see the resultW&W&W&W& 9 9 brea# else flPimUtextoH9Only one line. rePR SH end end function imgUoutPclip(imgUin) Rf cSPfind(imgUin)H imgUoutPimgUin(min(f)/max(f),min(c)/max(c))H9Crops image subplot(4,;,;)Himsho!(fl)H subplot(4,;,4)Himsho!(re)H

24

< CONC3U0ION
Recognition of 3atin&script, type!ritten text is still not ;<<9 accurate even !here clear imaging is available. One study based on recognition of ;7th and early 4<th century ne!spaper pages concluded that character&by&character OCR accuracy for commercial OCR soft!are varied from G;9 to 789R4SH total accuracy can only be achieved by human revie!. Other areas@including recognition of hand printing, cursive hand!riting, and printed text in other scripts (especially those East "sian language characters !hich have many stro#es for a single character)@are still the sub0ect of active research. "ccuracy rates can be measured in several !ays, and ho! they are measured can greatly affect the reported accuracy rate. 1or example, if !ord context (basically a lexicon of !ords) is not used to correct soft!are finding non&existent !ords, a character error rate of ;9 (779 accuracy) may result in an error rate of >9 (7>9 accuracy) or !orse if the measurement is based on !hether each !hole !ord !as recogni(ed !ith no incorrect letters.

25

9 Referen'es
;. [ $ eading Mac#ine %peaks &ut 'oud$ , 1ebruary ;7:7, .opular $cience. 4. [ ,olley, Rose ("pr 4<<7). O,o! Iood Can %t Iet= "nalysing and %mproving OCR "ccuracy in 3arge $cale ,istoric Ce!spaper 2igitisation .rogramsO. 2&3ib aga(ine. http/''!!!.dlib.org'dlib'march<7'holley'<6holley.html. Retrieved > Xan 4<;;. 6. [ $uen, C.Q., et al (;78G&<>&47), Future C#allenges in (andwriting and Computer )pplications, 6rd %nternational $ymposium on ,and!riting and Computer "pplications, ;78G, http/''users.erols.com'r!services'pens'biblio88.html\$uen88 :. [ Tappert, Charles C., et al (;77<&<8), !#e %tate of t#e )rt in &n-line (andwriting ecognition, %EEE Transactions on .attern "nalysis and >. [ 3eCet&>, Convolutional Ceural Cet!or#s F. [ ilian, ar# (2ecember 4<, 4<;<). OCe! i.hone app translates foreign&language signsO. C**+ !ec#. http/''!!!.cnn.com'4<;<'TEC,'mobile';4'4<'!ord.lens.iphone.app'index.html. Retrieved 2ecember 4<, 4<;<. achine %ntelligence, Mol ;4 Co 8, "ugust ;77<, pp G8G&ff, http/''users.erols.com'r!services'pens'biblio7<.html\Tappert7<c, retrieved 4<<8&;<&<6 ontreal, ay 47,

26

27

Vous aimerez peut-être aussi