Background technology
OCR may be defined as the method that text image data is transformed into a kind of character code form (as: ASC II sign indicating number) that can read by word-processing application.In original text image data, text character by independent pixel with other types of image data, as: the mode that picture or lines are identical is formed.After being transformed into the character code form, original text character image is just no longer available.Therefore, OCR handles the image want the single character that art is of high quality, so that image is transformed into specific character code.It is the point of some connections or an independently set of pixel that many OCR handle a character definition.If the text image quality is low, consequently single character fogs or stains in the adjacent character, and then OCR handles and character can not be separated into their independent codes, and text can not make an explanation with word-processing application.
Text image may be because a variety of causes and quality is low.Usually comprise the character that constitutes by erroneous pixel by the text image that duplicating machine, facsimile recorder, printer and digital camera produced.The pixel of mistake is more such pixels, it is the part that they should or form a character prospect, and therefore, for example: should be endowed a kind of low shading value such as black, rather than in image as a setting a part and be endowed a kind of high shading value (intensity) as white, perhaps vice versa.These mistakes may be, for example by high ground unrest, and low spatial resolution, or the illumination that changes causes.If the pixel of a plurality of mistakes flocks together, the stain that image may tool or smudgy then, these stains or smudgyly may extend across some characters or even several rows.
Therefore, invented the OCR technology so that improve the ability of from the low-quality image that contains erroneous pixel, distinguishing character and word.It is the fundamental purpose of this class technology that each single character and they next-door neighbour's vertical and neighbours level are separated.The neighbours that character is vertical with them separate the upright position (also being commonly referred to as text deposits) of discerning line of text, usually are that finish horizontal outshot by analysis image and the upright position that is identified in the space horizontal line that exists between each row of text.This is often undertaken by the histogram analysis of each pixel column.In histogram analysis, the sum of foreground pixel in each pixel column and the similar sum of adjacent lines are compared.Then the line between each line of text is defined as by the low ebb of low histogram counting representative and discerns.Low ebb is clipped between the assorted histogram counting in peak of representative coboundary of adjacent line of text and lower limb.
The background row pixel of above-mentioned horizontal cross-section (profile) technology between line of text can both be worked being interrupted by foreground pixel well.When the serious skew of text or when text image, stain or during the smudgy background row that enters between the line of text, this problem is taken place.
Under the situation of skew mistake, line of text on the page or upwards or downward-sloping.The coboundary that has the horizontal outshot of the text at serious positive twist oblique angle can analyze the lower limb of a line of text and be close to the line of text under it.Thereby final histogram is generally of no use to the identification line of text.The solution relevant with above-mentioned serious skew problem comprises line of text branch or some files in the prior art, analyzes the horizontal cross-section of each file then.As shown in Figure 1, to be reassembled into their original full copies capable for each line of text of each file.It is overlapping by determining which row level to reconfigure process, will differentiate from the character row of first file and character row from its adjacent columns.By connect to need ground from, for example: first file on the page left side advances to the last file on the page right side, and each original character row is reconfigured.
As shown in Figure 1, after the capable position of identification character, the line of text can join under the rectangle situation on all four limits.Use the prior art fragmentation technique that is applied on inner each pixel of each rectangle then,, discern single text character and finish the OCR processing comprising vertical general picture technology.
Carry out OCR work on the file of serious skew although above-mentioned process with the line of text recombination discerned in a plurality of files is well suited for having, seriously be stained with between each line of text or ambiguous file on can not work well.Thisly be stained with or smudgyly usually cause a page regional area to have continuous foreground pixel to go to another line from a line of text.That works stops the line of text of discerning in the specific file.Equally, the OCR technology of prior art can cause identification than the capable high or short mirage line of text of actual word.The final text output that these mirage line of text may make OCR handle is unintelligible.
Local contamination or smudgy general especially in the text image of clapping with digital camera.For least cost farthest, digital camera usually is made with low resolution, and the illumination that is also changed easily with the formed image of this camera and the influence of high ground unrest.Yet this class camera often is used to take file, as: the texts and pictures in the business card resemble.Then can be with effective OCR technology with in information typing PDA(Personal Digital Assistant) or the portable computer in the file.
Therefore, need a kind of improved OCR technology, so that can be used to the line of text in the discriminating digit image, the distortion under the situation of serious local fuzzy region of described line of text.
DETAILED DESCRIPTION OF THE PREFERRED
Referring to accompanying drawing, wherein identical reference number is at the identical or corresponding element of expression, and Fig. 2 is the process flow diagram of a kind of summary of first embodiment of the invention.The present invention analyzes the binary picture 200 (step S10) of the file 205 that obtains with a kind of image acquiring device 210 (as: digital camera).At first image 200 is divided into a plurality of files 215 (step S12) according to OCR processing of the present invention.Analyze the pixel in each file 215 then, so that estimate the position on horizontal line of text border 220 and the sum (step S14) of each row 215 Chinese one's own profession.Follow needs according to a particular system, give included text line number in the fixed number file 215 with one, perhaps have file 215 numbers of a given text line number, perhaps they the two, compare with at least one threshold value, so that determine a seed file 225 (step S16).Then, the coboundary of each line of text and lower boundary stride across all files in the horizontal-extending seed file 225, so that determine to observe district 230 (step S18).At last, be the position (step S20) that all pixels of image 200 are calculated horizontal subdivision line 235 between the adjacent observation district 230 basically by analyzing once more.
Use method of the present invention, can some files 205 as: report, mail and business card effectively are transformed into a kind of digital character code format, as ASCII character.The scale-of-two of file 205 or bit image can obtain with various types of image acquiring devices 205.These devices can comprise for example flatbed scanner and hand-held digital camera.As mentioned above, the problem relevant with resolution, illumination or ground unrest may make the binary picture of acquisition have local smudgy part 300, as shown in Figure 3A and 3B.Smudgy part 300 can not be represented the text of source document 205 exactly.
As shown in Figure 3A, smudgy sometimes part 300 may be so serious, to such an extent as to form formation text character in the adjacent lines is extended and stretched into to the low shading value pixel of text/character between each line of text low shading value pixel in the delegation.In this case, the position and the size of the one's own profession of art methods identification binary picture Chinese as above-mentioned horizontal cross-section method, may cause two row 310 and 315 are identified as to have the single row more much higher than actual text row.
In other cases, shown in Fig. 3 B, local smudgy part 300 can produce between two row and not touch any text character.This can cause the unreal row of " text " 320 of horizontal cross-section method identification of prior art, and described " text " 320 is in the source document 205 and do not exist.
As shown in Figure 2, the present invention has overcome and the smudgy relevant problem in part by at first a binary picture being divided into a plurality of files 215.Each file can have fixed width or variable-width, and this depends on specific application requirements.For example, being designed to read the camera of making product nameplate or scanner can be installed in the fixed position on the assembly line.Local lighting or other environmental baseline may cause local smudgy, and this part fogs unclear general just on binary picture one side of making product nameplate.Then, the OCR that uses the inventive method can be handled and calibrate, so that scale-of-two label image is being divided into than the file of thin space and is divided into the file of broad spacing on another image-side on the image-side that comprises smudgy part 300.Discuss as following, that works locatees the position of actual text row on making product nameplate more accurately.
After having confirmed each file 215, analyze the pixel in each file 215, so that estimate the position on horizontal line of text border 220, and the sum of each file 215 Chinese one's own profession.Total line number of text is the estimative figure of each row 215 Chinese one's own profession sum.Can estimate the sum of line of text with various technology comprising the horizontal cross-section method.The horizontal cross-section method can be represented the one-row pixels sum addition file 215 inside of prospect text character, for example: in all pixel addition that can represent between the specific shading value threshold value of black.Then, estimate total line number in the position of each line of text in each file 215 and each file 215 with pixel number of lines histogram.
Then, according to the needs of a particular system, will be in giving fixed number file 215 included text line number, or file number with given text line number, perhaps they the two, compare with at least one threshold value, so that determine a seed file 225.Seed file 225 is the file 215 of the source document 205 Chinese one's own professions shown in can the most accurate reproduction binary picture 200.Then, can explain that other may contain the position of the file Chinese one's own profession of local smudgy part at all with the seed file.
Can determine which file 215 the most suitable seed files 225 that are confirmed to be with various technology.For example, a kind of relatively method of line of text sum is the number of lines histogram that adopts as shown in Figure 4.The sum of file 215 of estimating to contain the certain number line of text is given along Y-axis.The line of text sum of estimating is given along X-axis.Then, discarded file sum or line of text sum are set up at least one threshold value, described discarded file sum or line of text sum may be because smudgy part or other error or the caused mistake of distortion.
For example, can set up a low threshold value 410 and discern file 215, described file 215 may contain and identical ambiguity error shown in Fig. 3 A.For example, if only estimate a file 215 comprise have only two styles of writing this, then this file 215 may contain and causes the ambiguous error that the multirow actual text combines in the source document 205.As shown in Figure 4, only containing two styles of writing file originally should discard from further analysis.
Equally, can set up a upper threshold value 420 and discern file 215, described file 215 may contain and identical ambiguity error shown in Fig. 3 B.For example, if estimate to have only a file 215 to comprise 8 styles of writing originally, then this file may contain the unreal row that causes increase " text " in source document 205.As shown in Figure 4, containing 8 styles of writing file originally should discard from further analysis.
In addition, can be with single file threshold value 430, so that discard the file 215 that comprises unusual text line number.For example, file threshold value 430 shown in Figure 4 will discard include only two styles of writing this file 215 and include only this file 215 of 8 styles of writing.
Whether with lower threshold value 410, upper threshold value 420, file threshold value 430, or all three kinds of threshold values all are used for according to particular system of the present invention, can determine according to the needs of this particular system, as those skilled in the art institute is conspicuous.For example, some special system may produce the seldom aforesaid mirage line of text of recognition, and does not perhaps need a kind of upper threshold value that is used to discard wrong file row sum.In addition, can also can determine with manual methods with the definite automatically certain threshold level of an OCR system by an OCR user.
Referring to Fig. 4, in one embodiment of the invention, analyze all the other text line numbers then again, and the text line number that supposition is included in the maximum number file 215 is a text line number actual in the whole binary picture 200 along X-axis.The example of Fig. 4 shows that 5 files 215 are identified as and comprise 4 line of text.Then, one of them of selected these files 215 is used for finishing actual line number and the position determined in the binary image 200 Chinese one's own professions of source document 205 as seed file 225.
Alternatively, according to the requirement of a particular system, can be identified as the file 215 that contains maximum or minimum text line number to seed file 225.For example, referring to Fig. 4, analysis of threshold discard comprise 2 row or 8 row files 215 after, can select comprise maximum text line number (shown in Fig. 4 example 7) remaining file one of them as seed file 225.Be suitable for most specific OCR system be used for determine that the technology of seed file 225 may depend on as mentioned above in the prevailing ambiguity error type of a specific OCR system.
Fig. 5 A-5E further shows the method that is used for determining the physical location of all line of text in the whole binary picture 200 according to of the present invention.Fig. 5 A represents according to one group of estimated line of text size and position of file 215 initial analysis as mentioned above.
Fig. 5 B shows with first file as seed file 225.Then, the coboundary and the lower boundary horizontal-extending of each line of text in the seed file 225 striden across all files 215, so that form and the corresponding observation of binary picture 200 Chinese one's own professions district 230.Then, come finishing to observe district 230 by the estimation of between each line of text, setting up horizontal more accurately line of text border 220.Fig. 5 C-5E shows the method on the horizontal line of text of finishing border.At first, shown in Fig. 5 C, calculate each and observe the horizontal cross-section that give prominence in district 230.Again as mentioned above, determine to stride across the sum of all pixels that may there be text character in an entire row of pixels, for example: at all foreground pixels 505 that are lower than a specific shading value threshold value that may have black.All foreground pixels 510 that surpass a specific shading value threshold value are ignored.
Then, each is observed district 230, determine to have the peak pixel row 515 of maximum outstanding section sum in that district.To every pair of adjacent observation district 230, analyze all pixel columns between each peak pixel row then, so that it is capable 520 to discern a minimum pixel, described minimum pixel capable 520 limits the separator bar 235 of a terminal level between each line of text.Minimum pixel capable 520 is at the pixel column that contains between two peak pixel row of minimum foreground pixel several 505.
After the horizontal subdivision line 235 that limits with minimum pixel column 520 between all line of text, adopt well-known standard OCR technology in this technology to come single character or word in the recognition line of text.These standard techniques comprise for example vertical section method and fragmentation technique and relevant function method.
Therefore, the present invention is the effective ways that are used for recognition or deposit each line of text of binary picture as the part that OCR handles.The use that digital camera technology increases day by day in handheld camera and other install as mobile phone and personal digital assistant causes more file to be digitized imaging by these devices.As described herein, these digital pictures 200 usually have very poor quality, and reason is because lower equipment and/or other environmental factor of use cost, as: file illumination very little or too much.The image 200 of these distortions usually suffers local ambiguous influence, thereby makes the part of some line of text in the image seem unintelligible concerning prior art OCR.Special advantage of the present invention is and can comes best identified can most accurately reappear the line of text seed file 225 of source document 205 Chinese one's own professions with various technology.Then, other may contain the position of local ambiguous file 215 Chinese one's own professions can to explain all with seed file 225.Therefore, method of the present invention is a kind of new OCR technology, and being used for binary picture 200 Chinese one's own professions by precision identification and location distortion, to overcome this part smudgy.Should be appreciated that above-mentioned explanation only is exemplary, rather than restrictive.Although the present invention is fully described with regard to preferred embodiment and with reference to accompanying drawing, should be noted that concerning this area the technician, obviously be easy to carry out multiple change and modification.These changes and modification are construed as and are included in as defined by the appended claims within the scope of the invention.