CN101770575B - Method and device for measuring image inclination angle of business card - Google Patents

Method and device for measuring image inclination angle of business card Download PDF

Info

Publication number
CN101770575B
CN101770575B CN2008102466299A CN200810246629A CN101770575B CN 101770575 B CN101770575 B CN 101770575B CN 2008102466299 A CN2008102466299 A CN 2008102466299A CN 200810246629 A CN200810246629 A CN 200810246629A CN 101770575 B CN101770575 B CN 101770575B
Authority
CN
China
Prior art keywords
image
inclination
projection
straight line
angle
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN2008102466299A
Other languages
Chinese (zh)
Other versions
CN101770575A (en
Inventor
李永彬
朱军民
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hanwang Technology Co Ltd
Original Assignee
Hanwang Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hanwang Technology Co Ltd filed Critical Hanwang Technology Co Ltd
Priority to CN2008102466299A priority Critical patent/CN101770575B/en
Publication of CN101770575A publication Critical patent/CN101770575A/en
Application granted granted Critical
Publication of CN101770575B publication Critical patent/CN101770575B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Analysis (AREA)

Abstract

The invention relates to a method and a device for measuring image inclination angle of a business card, which belong to the technical field of OCR. The method extracts the edge image of a business card image at first, searches the peripheral frame line of a business card in the edge image, judges if the image is inclined according to the inclination degree of the peripheral frame line, judges word editing direction thereof for the inclined picture, projects along the word editing direction and calculates the inclination angle of the image by projection characteristic. Judging the inclination of the image by collecting the peripheral frame line of the image, the invention can divide the images into an inclination type and an aclinal type quickly and process the two types respectively. The invention quickly judges the word editing direction by comparing the characteristics of projection histograms in the horizontal direction and the vertical direction. The determination of the word editing direction is greatly useful for calculating the inclination angle by projecting and analyzing the layout of the business card image.

Description

The measuring method of image inclination angle of business card and device
Technical field
The invention belongs to digital image processing techniques and OCR (optical character identification) technical field, particularly a kind of measuring method of image inclination angle of business card and device.
Background technology
In current commercial activity; Business card has been business partner, client's etc. an important information carrier; In the face of a large amount of business cards; Company and individual need that a kind of method is carried out automatically, information acquisition and processing exactly, and the general at present OCR (Optical Character Recognition) of employing system accomplishes this function.In business card OCR system; Possibly there is certain angle inclination (being generally less than 5 °) in the business card image of input; This inclination meeting produces harmful effect to printed page analysis, character cutting and the character recognition of business card, need carry out the angle of inclination and detect, and carries out image rectification according to angle then.
Existing slant detection method to file and picture all is based on bianry image basically, mainly can be divided into 4 types: based on the method for projection, based on the HOUGH conversion method, K-arest neighbors cluster method and based on the method for crossing dependency.
For business card image, be characterized in that literal line (row) is less, have only several row (row) or tens row (row) usually, the literal number is less, and the composing pattern is changeable.K-arest neighbors cluster method needs more literal connected domain just can calculate reliable result, is not suitable for business card image; Prerequisite based on the method for crossing dependency is that text has consistent typesetting format, also is not suitable for business card image; Method calculated amount based on the HOUGH conversion is bigger.So above-mentioned four types are used for the method that file image inclination detects, and relatively are fit to the tilt detection of business card image based on the method for projection.
Application number is that the patent of 200410080505.X discloses a kind of image processing method, through search straight line in image and according to the inclination situation computed image angle of inclination of straight line, in the process of Flame Image Process, need depend on the straight line in the image.Application number be 200710176208.9 patent to complicated file and picture, calculate the angle of inclination through the border segment of text filed and non-text filed extraction connected region as slant characteristic, need to exist in the image more connected region.These two kinds of methods are for business card image, and these two kinds of method applicabilities are relatively poor, and all are the angles of inclination of direct computed image, and do not judge automatically whether image need calculate the angle of inclination in advance.For the image that does not have inclination, the angle of inclination is zero, then need not carry out the angle of inclination and calculate.
Document " gray scale business card image quick slant detects and bearing calibration " (" Journal of Chinese Information Processing " 2004 01 phases; The 63-70 page or leaf) proposes a kind of four edges frame straight line and carry out the method that the angle of inclination is detected according to business card in the scanned business card image; This method is simply quick; But do not exist the situation of edge line then powerless for business card image, and the angle precision that only calculates according to edge line is not very high.
Utilize projecting method to calculate the angle of inclination of business card image, result of calculation is accurate, but calculates for the business card image that does not have inclination, is a kind of waste; Utilize business card frame straight line in the image to calculate the method at angle of inclination, fast simple, but for the situation of frame straight line disappearance, it is ineffective, receive the situation of noise pollution for the frame straight line, its result of calculation is not accurate enough.
Summary of the invention
The present invention proposes a kind of measuring method and device of image inclination angle of business card; This method is at first extracted the edge image of business card image, then on the edge of in the image search business card around the frame straight line, judge according to the inclined degree of frame straight line whether image exists inclination; For there being the picture of inclination; The editor of judging its literal to, and, utilize the angle of inclination of projection properties computed image along copy editor's direction projection; Can tilt and non-inclination by the automatic distinguishing business card image, can calculate accurate angle of inclination again.
The measuring method of image inclination angle of business card comprises the steps:
Step 1: the edge of the business card image of input and extraction input.The input business card image extracts gray-scale Image Edge as the substance of handling.
Step 2: the frame straight line around the search name picture.On the inherent four direction of extroversion, image is pressed ranks successively by the pixel search; If the alternate position spike of the coordinate of first black pixel that adjacent ranks record on the direction of search is not more than 2 pixels; Then these two black pixels are positioned on the same line segment, otherwise, newly-built line segment.If wherein the longest line segment length surpasses set threshold value, then this line segment place straight line is the frame straight line that this side up, otherwise this side up does not exist the frame straight line.
Step 3: judge according to the frame straight line that searches whether image tilts.If frame straight line number is more than or equal to 2, and demarcates to the frame straight line that tilts and count 0.7 times of frame straight line number that great-than search arrives, then this image inclination; Otherwise there is not inclination in image, and this method finishes.
Step 4: to the image that mark tilts, the editor of judging the image Chinese words to.Respectively image vertically with the horizontal projection histogram in, delimit straight line at interval with same projection value interval and projection value, respectively the number of projections sum of the set width that passes of calculated line; The direction that number of projections is bigger as the editor of literal to.
Step 5: the angle of inclination that utilizes the projecting method computed image.On copy editor's direction of image; Spend-5+5 the degree between; Respectively image is carried out projection at interval by angle same, calculate the quadratic sum of each projection histogram projection value of gained, the angle of inclination of image is the projection angle of the correspondence of the maximum projection histogram of projection quadratic sum value.
When pressing ranks by the pixel search in the said step 2, the hunting zone is located for
Figure GDA0000093707880000021
of edge to this image of this direction epigraph.
The span of the set threshold value of said step 2 is
Figure GDA0000093707880000022
of the corresponding width of entire image
The average coordinates value of the coordinate points of the similar number that the nose section plays not-go-end is got in the judgement of tilting in the said step 3 respectively, if calculate the gained angle of inclination greater than the inclination threshold value, then with the frame linear mark at this line segment place for tilting; Otherwise be labeled as non-inclination; Do not search the limit of frame straight line, directly this limit of mark is for tilting.
Set width range in the said step 4 is adjusted according to the capable height of character in the image; 1/3 be bound with smaller in level and the histogrammic maximal projection value of vertical projection with it between projection in zone.
When judging copy editor's direction in the said step 4, if the number of projections on the vertical and horizontal both direction equates that then copy editor's direction is the big direction of projection value quadratic sum of two projection histograms.
When in the said step 5 image being carried out projection; If copy editor's direction of image is a horizontal direction; Image is divided into a series of vertical bar images, and to each vertical bar image according to 0 ° of projection, with the whole projection histogram on synthetic this projecting direction of each projection histogram that obtains; If copy editor's direction of image is a vertical direction, then the image half-twist is carried out above-mentioned processing again.
During with image division, the width w of vertical bar image is in the said step 5:
Figure GDA0000093707880000031
Wherein, L is the width of image, and α is the angle of projection.
The measurement mechanism of image inclination angle of business card, form by following module:
Image input module, the edge of the business card image of input and extraction input.The input business card image extracts gray-scale Image Edge as the substance of handling.
Frame straight line around the frame search module, search name picture; On the inherent four direction of extroversion, image is pressed ranks successively by the pixel search; If the alternate position spike of the coordinate of first black pixel that adjacent ranks record on the direction of search is not more than 2 pixels; Then these two black pixels are positioned on the same line segment, otherwise, newly-built line segment.If wherein the longest line segment length surpasses set threshold value, then this line segment place straight line is the frame straight line that this side up, otherwise this side up does not exist the frame straight line.
The inclination determination module judges according to the frame straight line that searches whether image tilts.If frame straight line number is more than or equal to 2, and demarcates to the frame straight line that tilts and count 0.7 times of frame straight line number that great-than search arrives, then this image inclination; Otherwise there is not inclination in image, and this apparatus processes process finishes.
The words direction determination module, to the image that mark tilts, the editor of judging the image Chinese words to.Respectively image vertically with the horizontal projection histogram in, delimit straight line at interval with same projection value interval and projection value, respectively the number of projections sum of the set width that passes of calculated line; The direction that number of projections is bigger as the editor of literal to.
The angle calculation module is utilized the angle of inclination of projecting method computed image.On copy editor's direction of image; Spend-5+5 the degree between; Respectively image is carried out projection at interval by angle same, calculate the quadratic sum of each projection histogram projection value of gained, the angle of inclination of image is the projection angle of the correspondence of the maximum projection histogram of projection quadratic sum value.
The measuring method of image inclination angle of business card of the present invention and device, compared with prior art advantage is:
1, the mode of the present invention through the frame straight line of images acquired is to the image judgement of tilting; Can fast image be divided into inclination and not have two types; For nonangular image; No longer carry out the calculation procedure at angle of inclination,, utilize additive method to calculate accurate angle of inclination again for tilted image;
2, the present invention through the movement images level and the editor that vertically the histogrammic characteristic of projection judges fast literal on the both direction to, confirm that the printed page analysis that copy editor's direction is calculated angle of inclination and business card image for projection all has very big directive function;
3, the present invention calculates accurate image inclination angle to the imagery exploitation projecting method that is judged as inclination, and wherein the rotation of image " mistake is cut " analog image is adopted in the calculating of projection histogram, has quickened the computation process of projection histogram.
Description of drawings
Fig. 1 is the method flow diagram of the measuring method of image inclination angle of business card of the present invention;
Fig. 2 is the binary edge map of the business card specimen page of the embodiment of the measuring method of image inclination angle of business card of the present invention;
Fig. 3 a does not have the single hurdle of inclination template literal space of a whole page synoptic diagram for the level of the standard of the measuring method of image inclination angle of business card of the present invention;
Fig. 3 b is the vertical projection histogram of Fig. 3 a of the measuring method of image inclination angle of business card of the present invention;
Fig. 3 c is the horizontal projection histogram of Fig. 3 a of the measuring method of image inclination angle of business card of the present invention;
Fig. 4 a is the vertical projection histogram of the embodiment binary edge map of the measuring method of image inclination angle of business card of the present invention;
Fig. 4 b is the horizontal projection histogram of the embodiment binary edge map of the measuring method of image inclination angle of business card of the present invention;
Business card image was divided into the synoptic diagram of a series of vertical bar images when Fig. 5 a was 1 ° for the projecting direction of the measuring method of image inclination angle of business card of the present invention;
Fig. 5 b is the whole projection histogram of business card image when projecting direction is 1 ° of the measuring method of image inclination angle of business card of the present invention;
Fig. 6 is the histogram projection value quadratic sum curve of each projecting direction of embodiment of the measuring method of image inclination angle of business card of the present invention.
Embodiment
In order more to be expressly understood technology contents of the present invention, the following process of special act specifies.
The technical scheme that the present invention proposes is applicable to the gray level image of business card scan or shooting; Because ground unrest can influence the detection of frame straight line; So the background when picture scanning among the present invention or shooting is cleaner, does not have obvious texture, if image is colored; Can convert gray level image earlier into, adopt technical scheme of the present invention to handle again.
For the definition at angle of inclination is described, the literal line in the business card image (or text line) is abstracted into straight line, in the time of when this straight line level or vertically; The angle of inclination of business card image all is 0 (promptly not having inclination), and when this straight line is 0 position when rotating by the angle of inclination, the anglec of rotation is the angle of inclination of image; When regulation turned clockwise, the angle of inclination was for negative, when being rotated counterclockwise; The angle of inclination is for just; Because when big, the detection meeting of frame straight line is inaccurate at the angle of inclination, technical scheme of the present invention is applicable to the situation of angle of inclination between-5 ° to+5 °.Actual business card image is under people's intervention, to scan or take to obtain, and generally between-5 °~+ 5 °, technical scheme of the present invention satisfies general business card image demand at its angle of inclination.
The measuring method of image inclination angle of business card, as shown in Figure 1, comprise the steps:
Step 1: the edge of the business card image of input and extraction input.The input business card image, extracting gray-scale Image Edge is the substance of Digital Image Processing.Present embodiment adopts the Canny boundary operator to accomplish edge extracting, and its algorithm is not given unnecessary details.Edge image is a bianry image, and each pixel adopts a bit position storage, and the value of each pixel non-0 is 1 like this; In the present embodiment, prospect representes that with 1 background is represented with 0; If two kinds of colors of corresponding black and white, then prospect is represented with black, and background is represented with white.Obtain Fig. 2, for being the edge binary images of present embodiment.
Step 2: the four frame straight lines of searching for business card on the edge of in the bianry image.Business card is when scanning or taking into image, and the four edges of business card can form tangible edge with the crossing place of background, and these edges reflect in the bianry image on the edge of, are convenient the description, are called the frame straight line of business card.
Upper side frame straight line with business card is an example, and the search procedure of straight line is described.The upper side frame straight line of business card; Generally be positioned at last 1/3rd zones of whole business card image, so on each row of business card bianry image, in 1/3rd pixels, according to pixels search for first the black pixel (being called for short the upper end first black pixel) that runs into from top to bottom; If there is so black pixel; Then note the coordinate figure of this point, otherwise record is not searched element until all row and is finished.
After obtaining the upper end first black pixel of all row, can adopt least square fitting frame straight line, but its calculated amount is bigger, so this method adopts a kind of detection method simply fast:
In tilted image, a horizontal linear originally becomes a series of neighbouring line segments, so just can confirm the upper side frame straight line through detecting continuous line segment.From left to right the first black pixel to all row scans; If the upper end first black pixel in first black pixel of the upper end in the prostatitis and previous column is no more than 2 pixels at the range difference of vertical direction; Then judge current pixel point and last pixel on same line segment, otherwise, be that left end point newly plays a line segment with the current pixel point; Successively by the row search, up to the rightest row.Through said method, find a series of line segments, if wherein the longest surpass set threshold value, then this line segment place straight line is the upper side frame straight line, otherwise there is not the upper side frame straight line in image.
The span of said set threshold value is the four edges frame straight line in entire image height
Figure GDA0000093707880000051
present embodiment; Set threshold value is made as picture traverse
Figure GDA0000093707880000052
and then on image, according to pixels searches for the upper side frame straight line by row in
Figure GDA0000093707880000053
zone; After detecting the upper side frame straight line; In like manner, in following
Figure GDA0000093707880000061
zone of image, according to pixels search for the lower frame straight line by row; In zone, the left side of image , according to pixels search for the left frame straight line, in zone, the right side of image
Figure GDA0000093707880000063
, according to pixels search for the left frame straight line by row by row.
In the present embodiment; Picture traverse is 400, and picture altitude is 300, and the nose segment length that searches out in the upper side frame straight line is 362; The nose segment length that searches out in the lower frame straight line is 359; The nose segment length that searches out in the left frame straight line is 204, and the nose segment length that searches out in the left frame straight line is 202, so four edges frame straight line all exists.
Step 3: judge whether image tilts.Whether each the bar frame straight line that searches in elder generation's determining step two tilts, and judges according to frame straight inclined situation whether image tilts then.Limit for not searching the frame straight line is directly labeled as inclination.With maximum assurance all tilted images are not all calculated the angle of inclination for tilting there being clear and definite information to show under the nonangular situation of image with image tagged.For the limit that searches the frame straight line, if its angle of inclination greater than the inclination threshold value, then is labeled as inclination, the foundation of inclination threshold value for judging whether straight line tilts, greater than this inclination threshold value, image inclination then, on the contrary image does not tilt.Present embodiment medium dip threshold value is set to 0.5 °.
When calculating the angle of inclination, get the average coordinates value of coordinate points of similar number of the not-go-end of nose section respectively and calculate the gained angle of inclination.In the present embodiment; Calculate as follows at the angle of inclination of frame straight line: (last several pixels of several pixels and clearing end are possible inaccurate before the initiating terminal with clearing end the reciprocal the 10th average coordinates value to the 6th pixel of inverse to calculate the average coordinates value of the 6th to the 10th pixel of its nose section initiating terminal; Avoid these pixels in the calculating), utilize the angle of inclination of these two average coordinates value calculated line.Here just utilize the angle of inclination to judge whether image tilts,, all press positive-angle and calculate so that the angle of inclination is regardless of is positive and negative.
If frame straight line number that has searched and inclination frame straight line number wherein satisfy following two conditions:
(1) the frame straight line number that searches is more than or equal to 2;
(2) 0.7 times of the frame straight line number that arrives of inclination frame straight line number great-than search;
Judge that then image is inclination, otherwise there is not inclination in image, this method finishes.
In the present embodiment, be true origin with the upper left point of image, level is to the right an x axle positive dirction, is y axle positive dirction straight down.Two mean value coordinates at the nose section two ends in the upper side frame straight line are respectively (35,40), (382,63); The cotangent value of its corresponding tilt angle is (382-35)/(63-40) ≈ 15; 3.8 ° of arcctg15 ≈, promptly the angle of inclination of upper side frame straight line is greater than 0.5 °, and the upper side frame straight line tilts.
In like manner, can judge that lower frame straight line, left frame straight line, left frame straight line all tilt.Detect 4 in frame straight line in the present embodiment altogether, 4 >=2, and the frame straight line 4 >=4 * 0.7 that wherein tilts, two conditions of the judgement image inclination above satisfying are so judge this image inclination.
Step 4: the editor of judging pictograph to.In projection, need know that the along continuous straight runs projection still is projection vertically, so the editor that need know the image Chinese words in advance to, promptly process decision chart is that horizontal direction is arranged or vertical direction is arranged as Chinese words.
Shown in Fig. 3 a,, do vertical direction projection histogram (shown in Fig. 3 b) respectively, horizontal direction projection histogram (shown in Fig. 3 c) for this image that does not have inclination and character queueing discipline.In the horizontal projection histogram; Literal line forms a column projection; Row then is blank with interval between the row, and then can there be this characteristic in the vertical projection histogram, thus need only in projection histogram along certain fixedly projection value do a horizontal linear; Through calculating the number of the column projection of satisfying set width range that this straight line passes through, the editor that just can judge the image Chinese words to.In the projection histogram; The projection value representative image is what of the text pixel of this horizontal line (or vertically row); Along in the projection histogram of copy editor's direction, the projection of literal line is tangible column, does not then have projection value between the literal line; The column projection of satisfying set width range that horizontal linear at certain projection value place passes is more; And in the projection histogram of vertical copy editor's direction, not having tangible literal line and line space, the column projection of satisfying set width range that same horizontal linear passes is less.So, in the level and vertical projection histogram of image, the more direction of the column number of projections that satisfies set width range that the horizontal linear at certain projection value place passes be literal editor to.
Said method is fine for the text image effect that does not exist to tilt and single hurdle is arranged, but the business card image of and existence inclination changeable and inapplicable for typesetting format.
For business card image, because the influence of setting type or tilting, the fixedly projection value T in the said method is difficult for confirming, so the present invention gets a plurality of projection value T 1, T 2..., T nDelimit straight line, count the phase Calais through the column projection of width in set width range L that obtains each projection value place and judge copy editor's direction.Column projection in the projection histogram corresponding the line of text (row) in the business card; Setting the projection value interval is in order to make the straight line of on projection value, delimiting pass column projection as much as possible; If the interval lower limit of projection value is too little; Then owing to image inclination, all column projections possibly all connect together, and can't distinguish; If the upper limit in projection value interval is too big, then can only find the longest literal line (row).So the size in projection value interval is relevant with the length in pixels of business card image Chinese words row (row).After delimiting the projection value interval, more whole interval is cut apart, probably be divided into 8~10 five equilibrium minizones, the pixel wide of each minizone is exactly the projection value interval.
What a plurality of projection values were interval confirms that specifically method is following: the maximal projection value in each gentle vertical projection histogram of fetching water; Get one less in these two values then; With this smaller value 1/3 with of smaller value itself as the projection value interval lower limit and the upper limit, i.e. interval [the T of projection value 1, T n], and serve as at interval should the interval five equilibrium with 5 pixels, if five equilibrium just in time then outwards expands last minizone, form n projection value T 1, T 2..., T nSet width range L is relevant with the size of character in the image, in 300 * 400 image, chooses L and is [6,30].Projection value T in the corresponding vertical projection histogram of this image 1, T 2..., T nThe place delimit straight line, the column projection of the corresponding projection value of respectively horizontal intercepting, and calculate the number sum that is passed in the column projection in the set width range L.In like manner, calculate projection value T in the horizontal projection histogram 1, T 2..., T nLocate the number sum of the column projection in set width range L of horizontal intercepting.
The size of the column number of projections that satisfies set width range L of gained on comparison level direction and the vertical direction, copy editor's direction is the bigger direction of number.If two numerical value equate, the projection value quadratic sum of each pixel on the projecting direction in calculated level projection histogram and the vertical projection histogram then, copy editor's direction is the big direction of quadratic sum.
Fig. 4 a and Fig. 4 b are respectively the vertical projection histogram and the horizontal projection histogram of present embodiment, and wherein, each horizontal linear is corresponding each projection value T 1, T 2..., T nThe straight line that passes the column projection.In the present embodiment, the image size is 300 * 400, in level and the vertical projection histogram separately the smaller value of maximal projection value be 58, projection value T 1, T 2..., T nGet between 19~58, every get a value at a distance from 5, n=8 then, corresponding horizontal linear has 9, owing to 5 pixels of last minizone less than, to extending out, gets T n=59.The set width range L of column projection is taken as 6~30, and this value serves as with reference to getting with image Chinese words size.In vertical projection histogram and horizontal projection histogram; The column projection sum of the width of these 9 horizontal linear interceptings in the vertical projection histogram between 6~30 is 8; The column projection sum of the width of intercepting between 6~30 is 24 in the horizontal projection histogram; 24>8, so copy editor's direction of image is a horizontal direction in the present embodiment.
Step 5: computed image angle of inclination.In the step 4, the editor that has drawn the tilted image Chinese words to.Utilize the method at projection computed image angle of inclination following: image inclination angle is in-5 °~+ 5 ° scopes; Whenever get an angle value at a distance from a minute angle; Along these angle directions the business card binary edge map is carried out projection respectively then, obtain corresponding projection histogram; Calculate the mean square deviation of the projection value of each projection histogram.Mean square deviation is big more; Then the projection value fluctuation of each row (row) of image is big more; Be that each white space contrast of going (row) and going between (row) of image is obvious more; The corresponding projecting direction of the explanation angle of inclination of convergence and image more just, promptly the angle of the maximum projection histogram correspondence of the mean square deviation of projection value is exactly the angle of inclination of image.In actual computation, the average of the projection value of all directions projection histogram is equal basically, so replace mean square deviation with the quadratic sum of projection value, angle corresponding when the projection quadratic sum of projection histogram is maximum is the angle of inclination of image.
Because binary edge map is by the row storage, and the corresponding bit position of pixel, 8 bit form fundamental operation unit---the byte (byte) of a computing machine, so its horizontal projection of 0 ° can be calculated through the mode of tabling look-up by byte fast; To other projecting directions, can be through image being rotated according to projection angle, calculate the histogrammic mode of horizontal projection of rotation back image then and accomplish, but the calculated amount that is used to handle the image rotation is very big, increased the burden of hardware.
Horizontal linear in the digital picture appears with the form of adjacent up and down continuous line segment after rotating.Hence one can see that; Digital picture is rotated according to certain angle; Its result is equivalent to original image is divided into a series of vertical bar images, and the width of vertical bar image is by the width decision of projection angle and image, and these adjacent vertical bar images differ the height of a pixel successively at vertical direction.
This method adopts the mode of approximate simulation image rotation to accomplish this step and calculates; Be cut into a series of vertical bar images to the original image mistake according to projecting direction; Then to of the method projection of each vertical bar image according to 0 °; The projection histogram of the synthetic integral body of the projection histogram of each the vertical bar image that obtains, obtain the image projection histogram on this projecting direction again.
When selecting the vertical bar picture traverse, the width w of each vertical bar image is:
Figure GDA0000093707880000091
Wherein, L is the width of image, and α is the angle of projection, and the angle cotangent of trying to achieve is all used on the occasion of representing., and round the number of the vertical bar image that has promptly obtained dividing on the result carried out with the width L of image cotangent value divided by projection angle α.With the width L of image number, obtain the width w of the vertical bar image behind the five equilibrium divided by the vertical bar image.
In the present embodiment, range of tilt angles is between-5 °~+ 5 °, whenever gets an angle value at a distance from 0.25 °, then has 41 candidates' projecting direction.With 1 ° of projection angle is example, and ctg1 ≈ 57, the width of image are 400, and then vertically the width w of image is:
Figure GDA0000093707880000092
Shown in Fig. 5 a, be on 1 ° of projecting direction image is carried out the synoptic diagram that mistake is cut.Then, each vertical bar image is calculated projection histogram according to the method for 0 ° of projection; Differ a pixel according to adjacent vertical bar image in the vertical direction, with the synthetic complete projection histogram of these 8 projection histograms.Shown in Fig. 5 b, be with the synthetic final complete histogram of the wrong histogram of cutting image strip.The quadratic sum of this histogrammic projection value is 265850.
After the projection value quadratic sum of the projection histogram that calculates 41 projecting directions, these 41 data are done a mean filter, get the angle of inclination that the corresponding angle of maximal value is image then.In the present embodiment; Value behind 41 projection value quadratic sum mean filters is as shown in Figure 6, and wherein the quadratic sum value of " * " home position, place is maximum, corresponding to-3.5 °; So the corresponding angle of the maximal value of the projection value quadratic sum of projection histogram is-3.5 °, promptly the angle of inclination of image is-3.5 °.
This method is corresponding a kind of measurement mechanism of image inclination angle of business card, form by following module:
Image input module, the edge of the business card image of input and extraction input: the input business card image, extract gray-scale Image Edge as the substance of handling, with result transmission to the frame search module after the extraction.
The frame search module is pressed ranks by pixel search, the coordinate of first black pixel that record runs into to image successively on the export-oriented inherent four direction of image; If the difference of the black pixel of first of adjacent columns on the direction of search is not more than 2 pixels, then on these two same line segments of black pixel, otherwise, be the newly-built line segment of end points with this pixel; If wherein the longest line segment length surpasses set threshold value, then this line segment place straight line is the frame straight line that this side up, otherwise this side up does not have the frame straight line for image, at last the frame straight line outputed to the inclination determination module.
The inclination determination module; To the frame straight line that the searches judgement of tilting, if frame straight line number more than or equal to 2, and is demarcated the limit that tilts and counted 0.7 times of frame straight line number that great-than search arrives; Then this image inclination sends to the words direction determination module with the image that tilts; Otherwise this apparatus processes process finishes.
Copy editor's direction determining module; Image to the mark inclination; In the vertical and horizontal projection histogram of image, delimit straight line at interval, the column number of projections that satisfies set width range that calculated line is passed respectively respectively with same projection value interval and projection value; The direction that the column number of projections is bigger is calculated the angle of inclination as the editor of literal to sending to the angle calculation module.
The angle calculation module is carried out projection to image respectively at interval by angle same, calculates the quadratic sum of each projection histogram projection value of gained, and the angle of inclination of image is the projection angle of the correspondence of the maximum projection histogram of projection quadratic sum value.
In the present embodiment, the editor of pictograph to the image that is vertical direction, can be carried out 90 ° of rotations to it earlier for editor to being horizontal direction, and then adopts above-mentioned projecting method to calculate its angle of inclination.

Claims (8)

1. the measuring method of an image inclination angle of business card is characterized in that, comprises the steps:
Step 1: the edge of the business card image of input and extraction input; The input business card image extracts gray-scale Image Edge as the edge image of handling;
Step 2: the frame straight line around the search edge image; On the inherent four direction of extroversion, image is pressed ranks successively by the pixel search; If the alternate position spike of the coordinate of first black pixel that adjacent ranks record on the direction of search is not more than 2 pixels; Then these two black pixels are positioned on the same line segment, otherwise, newly-built line segment; If wherein the longest line segment length surpasses set threshold value, then this line segment place straight line is the frame straight line that this side up, otherwise this side up does not exist the frame straight line;
Step 3: judge according to the frame straight line that searches whether image tilts; If frame straight line number is more than or equal to 2, and demarcates to the frame straight line that tilts and count 0.7 times of frame straight line number that great-than search arrives, then this image inclination; Otherwise there is not inclination in image, and this method finishes;
Wherein, judge in the said step 3 when whether image tilts whether each the bar frame straight line that searches in the first determining step two tilts, and judges according to frame straight inclined situation whether image tilts then; Limit for not searching the frame straight line is directly labeled as inclination; With maximum assurance all tilted images are not all calculated the angle of inclination for tilting there being clear and definite information to show under the nonangular situation of image with image tagged; For the limit that searches the frame straight line, if its angle of inclination greater than the inclination threshold value, then is labeled as inclination, the foundation of said inclination threshold value for judging whether straight line tilts;
Step 4: to the image that mark tilts, the editor of judging the image Chinese words to; Respectively image vertically with the horizontal projection histogram in, delimit straight line at interval with same projection value interval and projection value, respectively the number of projections sum of the set width that passes of calculated line; The direction that number of projections is bigger as the editor of literal to;
Step 5: the angle of inclination that utilizes the projecting method computed image; On copy editor's direction of image; Spend-5+5 the degree between; Respectively image is carried out projection at interval by angle same, calculate the quadratic sum of each projection histogram projection value of gained, the angle of inclination of image is the projection angle of the correspondence of the maximum projection histogram of projection quadratic sum value;
Wherein, When in the said step 5 image being carried out projection,, image is divided into a series of vertical bar images if copy editor's direction of image is a horizontal direction; And to each vertical bar image according to 0 ° of projection, with the whole projection histogram on synthetic this projecting direction of each projection histogram that obtains; If copy editor's direction of image is a vertical direction, then the image half-twist is carried out above-mentioned processing again, thereby obtain projection histogram.
2. according to the measuring method of the said a kind of image inclination angle of business card of claim 1; It is characterized in that: when pressing ranks by the pixel search in the said step 2, the hunting zone is located for
Figure FDA0000106035190000011
of edge to this image of this direction epigraph.
3. according to the measuring method of the said a kind of image inclination angle of business card of claim 1, it is characterized in that: the span of the set threshold value of said step 2 is
Figure FDA0000106035190000021
of the corresponding width of entire image
4. according to the measuring method of the said a kind of image inclination angle of business card of claim 1; It is characterized in that: the judgement of tilting in the said step 3; Get the average coordinates value of the coordinate points of the similar number that the nose section plays not-go-end respectively; If calculate the gained angle of inclination greater than the inclination threshold value, then the frame linear mark with this line segment place is inclination; Otherwise be labeled as non-inclination; Do not search the limit of frame straight line, directly this limit of mark is for tilting.
5. according to the measuring method of the said a kind of image inclination angle of business card of claim 1, it is characterized in that: the set width range in the said step 4 is adjusted according to the capable height of character in the image; 1/3 be bound with smaller in level and the histogrammic maximal projection value of vertical projection with it between projection in zone.
6. according to the measuring method of the said a kind of image inclination angle of business card of claim 1; It is characterized in that: when judging copy editor's direction in the said step 4; If the number of projections on the vertical and horizontal both direction equates that then copy editor's direction is the big direction of projection value quadratic sum of two projection histograms.
7. according to the measuring method of the said a kind of image inclination angle of business card of claim 1, it is characterized in that: during with image division, the width w of vertical bar image is in the said step 5:
Figure FDA0000106035190000022
Wherein, L is the width of image, and α is the angle of projection.
8. the measurement mechanism of an image inclination angle of business card is characterized in that, is made up of following module:
Image input module, the edge of the business card image of input and extraction input; The input business card image extracts gray-scale Image Edge as the edge image of handling;
The frame search module, the frame straight line around the search edge image; On the inherent four direction of extroversion, image is pressed ranks successively by the pixel search; If the alternate position spike of the coordinate of first black pixel that adjacent ranks record on the direction of search is not more than 2 pixels; Then these two black pixels are positioned on the same line segment, otherwise, newly-built line segment; If wherein the longest line segment length surpasses set threshold value, then this line segment place straight line is the frame straight line that this side up, otherwise this side up does not exist the frame straight line;
The inclination determination module judges according to the frame straight line that searches whether image tilts; If frame straight line number is more than or equal to 2, and demarcates to the frame straight line that tilts and count 0.7 times of frame straight line number that great-than search arrives, then this image inclination; Otherwise there is not inclination in image, and this apparatus processes process finishes;
Wherein, judge when whether image tilts in the said inclination determination module, judge that whether each the bar frame straight line that searches in the frame search module tilts, and judges according to frame straight inclined situation whether image tilts then earlier; Limit for not searching the frame straight line is directly labeled as inclination; With maximum assurance all tilted images are not all calculated the angle of inclination for tilting there being clear and definite information to show under the nonangular situation of image with image tagged; For the limit that searches the frame straight line, if its angle of inclination greater than the inclination threshold value, then is labeled as inclination, the foundation of said inclination threshold value for judging whether straight line tilts;
The words direction determination module, to the image that mark tilts, the editor of judging the image Chinese words to; Respectively image vertically with the horizontal projection histogram in, delimit straight line at interval with same projection value interval and projection value, respectively the number of projections sum of the set width that passes of calculated line; The direction that number of projections is bigger as the editor of literal to;
The angle calculation module is utilized the angle of inclination of projecting method computed image; On copy editor's direction of image; Spend-5+5 the degree between; Respectively image is carried out projection at interval by angle same, calculate the quadratic sum of each projection histogram projection value of gained, the angle of inclination of image is the projection angle of the correspondence of the maximum projection histogram of projection quadratic sum value;
Wherein, When in the said angle calculation module image being carried out projection; If copy editor's direction of image is a horizontal direction; Image is divided into a series of vertical bar images, and to each vertical bar image according to 0 ° of projection, with the whole projection histogram on synthetic this projecting direction of each projection histogram that obtains; If copy editor's direction of image is a vertical direction, then the image half-twist is carried out above-mentioned processing again, thereby obtain projection histogram.
CN2008102466299A 2008-12-31 2008-12-31 Method and device for measuring image inclination angle of business card Expired - Fee Related CN101770575B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008102466299A CN101770575B (en) 2008-12-31 2008-12-31 Method and device for measuring image inclination angle of business card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008102466299A CN101770575B (en) 2008-12-31 2008-12-31 Method and device for measuring image inclination angle of business card

Publications (2)

Publication Number Publication Date
CN101770575A CN101770575A (en) 2010-07-07
CN101770575B true CN101770575B (en) 2012-06-06

Family

ID=42503427

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008102466299A Expired - Fee Related CN101770575B (en) 2008-12-31 2008-12-31 Method and device for measuring image inclination angle of business card

Country Status (1)

Country Link
CN (1) CN101770575B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110622172A (en) * 2018-04-18 2019-12-27 北京嘀嘀无限科技发展有限公司 Image processing method and system

Families Citing this family (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102831422B (en) * 2012-06-15 2014-08-13 杭州九聚科技有限公司 Method for cutting and correcting dislocation of paper note image
CN102831421B (en) * 2012-08-29 2015-09-23 华东师范大学 A kind of document above-below direction detection method based on punctuation mark
CN103398698B (en) * 2013-07-31 2015-11-18 深圳市金立通信设备有限公司 A kind of level measurement method, device and mobile terminal
CN103400400B (en) * 2013-08-07 2017-03-01 南京巨鲨显示科技有限公司 A kind of method for correcting image based on region
CN103488983B (en) * 2013-09-13 2016-10-26 复旦大学 The business card OCR data correcting method in a kind of knowledge based storehouse and system
CN105184294B (en) * 2015-09-22 2018-12-04 成都数联铭品科技有限公司 It is a kind of based on pixel tracking inclination text judge recognition methods
CN105678296B (en) * 2015-12-30 2019-12-06 小米科技有限责任公司 Method and device for determining character inclination angle
CN105894526A (en) * 2016-04-29 2016-08-24 广东小天才科技有限公司 Picture correction method and device
CN106250831A (en) * 2016-07-22 2016-12-21 北京小米移动软件有限公司 Image detecting method, device and the device for image detection
CN106295638B (en) * 2016-07-29 2019-10-15 北京小米移动软件有限公司 Certificate image sloped correcting method and device
CN106295632A (en) * 2016-08-03 2017-01-04 广东小天才科技有限公司 Method and device for adjusting content of search questions
CN106951897A (en) * 2017-03-11 2017-07-14 深圳市极客思索科技有限公司 A kind of inclined degree determination methods of medical document photograph
CN107092909B (en) * 2017-03-21 2019-06-14 杭州朔天科技有限公司 Angle detection algorithm based on triangle correspondence theorem
CN107680046A (en) * 2017-07-25 2018-02-09 平安科技(深圳)有限公司 Image rectification method, device, storage medium and computer equipment
CN108052936B (en) * 2017-11-03 2021-06-29 中国科学院计算技术研究所 Automatic inclination correction method and system for Braille image
CN107798355B (en) * 2017-11-17 2021-12-07 山西同方知网数字出版技术有限公司 Automatic analysis and judgment method based on document image format
CN108810307B (en) * 2018-06-15 2020-09-04 深圳市成者云科技有限公司 Frame page number scanning system
CN109829460A (en) * 2019-04-02 2019-05-31 安徽省安瑞机电科技有限公司 A kind of License Plate Character Segmentation recognition methods and its system applied to parking management system
CN110460827B (en) * 2019-07-30 2022-07-15 歌尔光学科技有限公司 Method and device for determining working state of galvanometer and computer storage medium
CN110569847B (en) * 2019-09-20 2023-08-22 上海交通大学苏州人工智能研究院 Character inclination angle determining method, character inclination correcting method and computer
CN111415337B (en) * 2020-03-13 2024-04-19 中冶长天国际工程有限责任公司 Trolley grate inclination angle detection method and system of sintering machine
CN112446351B (en) * 2020-12-09 2022-08-09 杭州米数科技有限公司 Intelligent identification method for medical bills

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110622172A (en) * 2018-04-18 2019-12-27 北京嘀嘀无限科技发展有限公司 Image processing method and system

Also Published As

Publication number Publication date
CN101770575A (en) 2010-07-07

Similar Documents

Publication Publication Date Title
CN101770575B (en) Method and device for measuring image inclination angle of business card
CN111814722B (en) Method and device for identifying table in image, electronic equipment and storage medium
CN103258198B (en) Character extracting method in a kind of form document image
CN103034848B (en) A kind of recognition methods of form types
Garz et al. Binarization-free text line segmentation for historical documents based on interest point clustering
US9396404B2 (en) Robust industrial optical character recognition
CN111091124B (en) Spine character recognition method
Zahour et al. Text line segmentation of historical arabic documents
CN103258201A (en) Form line extraction method integrating global information and local information
CN109325401A (en) The method and system for being labeled, identifying to title field are positioned based on edge
CN110598566A (en) Image processing method, device, terminal and computer readable storage medium
CN103310211A (en) Filling mark recognition method based on image processing
CN112329641B (en) Form identification method, device, equipment and readable storage medium
JPH09311905A (en) Line detecting method and character recognition device
CN117315668A (en) Text intelligent recognition system based on OCR
Amin et al. Page segmentation and classification utilizing bottom-up approach
CN111612045A (en) Universal method for acquiring target detection data set
CN116363655A (en) Financial bill identification method and system
CN102693424B (en) Document skew correction method based on Harr-like features
Kapoor et al. Skew angle detectionof a cursive handwritten Devanagari script character image.
CN102682308B (en) Imaging processing method and device
CN115063817A (en) Form identification method and system based on morphological detection and storage medium
Biswas et al. Text extraction from scanned land map images
Höhn Detecting arbitrarily oriented text labels in early maps
Liu et al. Layout analysis of historical Tibetan documents

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20120606

CF01 Termination of patent right due to non-payment of annual fee