Background technology
The proposition of file scanning analytic system is that the user takes place in the process of file scanning because of not 90 ° of deflections of file and picture and 180 ° of inversions to causing of document placement direction to be scanned in order to discern and to correct, and improves the intellectuality and the robotization of scanning input process.Along with the electronic degree of daily life and working environment is increasingly high, people can face scans the back to deposit computing machine in a large amount of paper documents, and at this moment, the use value of this system will be highlighted.
Scanner is converted into electronic data with paper document and deposits computing machine in as a kind of computing machine external instrument equipment, and the user can be handled document on computers, and makes the more convenient and standard of preservation, transmission and management of file.The document placement direction is improper before scanning, and 90 ° of deflections or 180 ° of phenomenons such as inversion appear in the file and picture after usually can occurring scanning, and are as shown in Figure 1.When the number of documents of scanning more for a long time, whether inspection exists the image that direction puts upside down and corrects accordingly, as far as the user, becomes a loaded down with trivial details job.
Be used for scanned document deflection at present or be inverted the method for correcting mainly containing the OCR recognition technology, OCR is the abbreviation of English Optical Character Recognition, means optical character identification.Be mainly used in scanning document image is carried out analyzing and processing, obtain literal and layout information.This method is through translating into the computing machine ISN with character identifying method with the character code shape; Obtain the highest contrast ratio as discrimination through comparing with the comparison database Chinese words; Accomplish the identification of pictograph; Confirm document image information through analyzing correlation parameters such as discrimination simultaneously, whether have deflection or inversion, and then accomplish the rotation rectification of image like the document image.Wherein, the height of OCR discrimination has determined its performance.But the discrimination of OCR receives the influence of many factors, like scanning resolution, and the quality of picture, form, font and language etc.Scanning resolution is crossed and low can be reduced discrimination, but too highly not only can not improve discrimination, also can reduce treatment effeciency.And the whether clear and font of document own all can reduce the discrimination of OCR.And discrimination just will finally influence the judgement of information that whether file and picture is put upside down.
Sciagraphy is a kind of method of effectively image characteristics extraction.Usually, a width of cloth two dimensional image can be analyzed by the one dimension projection function of two quadratures.The characteristic of analysis image is convenient in the reduction of dimension, and has reduced calculated amount, so sciagraphy becomes a kind of important images analytical approach.Since in the document character code be distributed with that it is intrinsic, always according to from top to bottom, rule is from left to right arranged, so character code density presents the characteristics of upper left greater than lower right-most portion in the file and picture like character code in the document.When sciagraphy was applied to the Pixel Information of file and picture, the character code characteristic distributions can fully be reflected in drop shadow curve in the file and picture.Sciagraphy is different from the OCR technology, and it does not receive scanning resolution, picture format, font, even the influence of factor such as spoken and written languages.And the OCR recognition technology mainly is to utilize the method repeat to search comparison database to calculate each character code discrimination, and projection function only acts on the one-dimension information of image, the latter aspect operation efficiency far above the former.The present invention proposes a kind of analytical approach, can accurately judge and correct the direction of scanned document based on watershed segmentation and the extensive projection of quadrature.
Summary of the invention
The objective of the invention is to whether scanned document 90 ° of deflections or 180 ° of inversions are taken place judges and corrects according to judged result.
In order to achieve the above object, technical solution of the present invention provides a kind of analytical approach based on the extensive projection of quadrature, and it may further comprise the steps:
(1) effective coverage is definite in the file and picture: (Region of Interest, four margin zones in the file and picture are removed in ROI) location, obtain comprising the regional minimum rectangular area of character code in effective character code zone in the document.
(2) 90 ° of deflections of file and picture detect: through calculating the extensive drop shadow curve of file and picture variance, confirm whether 90 ° of deflections of image, and the document image is done handled.
(3) file and picture is inverted for 180 ° and is detected: through calculating the vertical gray integration projection average piecewise function through the file and picture after step (1) processing, confirm whether image 180 ° of inversions take place, and the document image is done handled.
The file scanning analysis process system of above-mentioned analytical approach based on the extensive projection of quadrature; Its (1) step; Obtain in the file and picture pixel wide L1 in top and left margin zone, L2 removes then that pixel wide is L1 about the file and picture; Left and right sides pixel wide is the zone of L2, obtains the smallest effective rectangular area ROI that comprises the character code zone in the document.
Above-mentioned analytical approach file scanning analysis process system based on the extensive projection of quadrature, its (2) step, the extensive projection function OGPF of the quadrature curve of calculating file and picture, wherein, the extensive projection function OGPF of quadrature comprises the extensive projection function OGPF of level
h(y) with vertical extensive projection function OGPF
v(x), they are respectively to each pixel information in the image, like the integral projection of gray scale, gradient, variance etc.Calculate OGPF more respectively
h(y) and OGPF
v(x) variance of function curve judges whether image 90 degree deflections take place.Its step is following:
1) the extensive projection function OGPF of calculated level
h(y) with vertical extensive projection function OGPF
v(x).OGPF
h(y) be meant each row pixel value of information summation in the image.OGPF
v(x) be meant each row pixel information summation in the image.If original image size is M * N, each point Pixel Information value be I (x, y), computing formula is following:
2) the extensive projection function OGPF of calculated level
h(y) curve variance GPFV
hWith vertical extensive projection function OGPF
v(x) curve variance GPFV
vWherein,
representes level and vertical extensive projection function curve average respectively, and calculation procedure is following:
3) judge whether file and picture deflects.Work as GPFV
h>=GPFV
vThe time, 90 ° of deflections do not take place in file and picture, work as GPFV
h<GPFV
vThe time, 90 ° of deflections take place in document.
4) image is corrected.According to judged result,, then former document image is carried out 90 ° rotation rectification, as the 1st correction result figure if 90 ° of deflections take place file and picture.If 90 ° of deflections do not take place, then with former document image as the 1st correction result figure.
Above-mentionedly judge that according to the extensive projection function curve of file and picture quadrature variance the foundation whether image 90 ° of deflections take place is: document is characterised in that; At first, there is the white space of certain area in four margins of document, secondly; The blank spaces that has fixing regularity between each row character code of document; Once more, because the character code quantity of every row is different with width, the character code that makes document can not occur aliging is listed as or regular character code row interval.The file and picture of 90 ° of deflections does not take place; The Wave crest and wave trough phenomenon of occurrence law property on the coordinate of each character code row and between-line spacing correspondence in the extensive projection function curve of level; And this waveform transformation is comparatively violent; Its vertical extensive projection function curve waveform does not then have this rule, and its waveform transformation is mild than the former.As shown in Figure 4.And towards the file and picture that 90 ° of deflections take place, its level is then just opposite with the former with vertical extensive projection function curve distribution.The acute variation of curve shows as the acute variation of each element value in the pairing one-dimensional vector of curve in discrete space, when respectively being worth acute variation in the one-dimensional vector, its variance also will increase.
The file scanning analysis process system of above-mentioned analytical approach based on the extensive projection of quadrature; In (3) step; Calculate the vertical gray integration projection average piecewise function of file and picture, the 1st correction result figure that this step institute analysis image is produced when being (2) EOS.Its step is following:
be the vertical gray integration projection of image average piecewise function; As x ∈ [1; M]; Y ∈ [1; N] time;
expression is positioned at file and picture upper left regions perpendicular gray integration projection average, and
representes to be positioned at file and picture lower right-most portion regions perpendicular gray integration projection average.Calculate as follows:
Wherein, the image size is M * N, M=2m or M=2m+1, N=2n or N=2n+1
During as
; Be that the vertical gray integration projection of file and picture upper left average is greater than file and picture lower right-most portion regions perpendicular gray integration projection average; Can judge that then 180 ° of inversions do not take place file and picture; Otherwise 180 ° of deflections take place in image.
According to judged result,, then the 1st correction result image is carried out 180 ° rotation rectification, as net result figure if 180 ° of inversions take place file and picture.If 180 ° of inversions do not take place, then with the 1st correction result image as net result figure.
Calculate before the vertical gray integration projection average piecewise function of file and picture, should earlier the 1st correction result figure be converted into gray level image or bianry image, and guarantee that the gray level image background pixel value is lower than the character code pixel value.
Above-mentioned judge that according to the vertical gray integration projection of file and picture average piecewise function the foundation whether image 180 ° of upsets take place is: document is characterised in that the custom that people write document is from top to bottom, from left to right.So character code distribution density upper left is higher than lower right-most portion in the document.Like this, when character code pixel point value is higher than the background pixel point value, towards the pairing row gray integration of its upper left of correct file and picture average greater than it in the pairing row gray integration of document lower right-most portion average.Rule can judge whether file and picture 180 ° of deflections take place according to this.
From the file scanning analyzing and processing process of described analytical approach based on the extensive projection of quadrature, the method has fully been used the characteristics of document self, promptly normally towards document, following characteristic is arranged: 1, the character code row horizontal alignment of document.2, there is the character code between-line spacing of rule in document.3, can be analyzed by left-to-right custom of writing document from top to bottom by people, the distribution density of character code presents upper left and is higher than lower right-most portion in the document.Through the level and vertical extensive projection function curve variance of contrast file and picture, judge whether file and picture 90 ° of deflections take place; Analyze the characteristics of vertical gray integration projection average piecewise function again, judge whether file and picture 180 ° of deflections take place.
Beneficial effect of the present invention:
Scanned document analysis and processing method of the present invention has good performance, for variations such as font, language, gray scales stronger adaptability is arranged all, can satisfy the needs of most scanning systems.The user can not improve the intellectuality and the robotization of scanning input process because of not 90 ° of deflections of file and picture and 180 ° of inversions to causing of document placement direction to be scanned in the process of file scanning.