CN109977910A - Bill method for rapidly positioning and its system based on colored line segment - Google Patents
Bill method for rapidly positioning and its system based on colored line segment Download PDFInfo
- Publication number
- CN109977910A CN109977910A CN201910273966.5A CN201910273966A CN109977910A CN 109977910 A CN109977910 A CN 109977910A CN 201910273966 A CN201910273966 A CN 201910273966A CN 109977910 A CN109977910 A CN 109977910A
- Authority
- CN
- China
- Prior art keywords
- line segment
- bill
- line
- gradient
- group
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformation in the plane of the image
- G06T3/40—Scaling the whole image or part thereof
- G06T3/4023—Decimation- or insertion-based scaling, e.g. pixel or line decimation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/25—Determination of region of interest [ROI] or a volume of interest [VOI]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/40—Document-oriented image-based pattern recognition
- G06V30/41—Analysis of document content
- G06V30/412—Layout analysis of documents structured with printed lines or input boxes, e.g. business forms or tables
Abstract
The present invention relates to bill frame method for rapidly positioning and its system based on colored Line segment detection, comprising: input bill images, bi-directional scaling image, colored Line segment detection merge line segment, and maximum quadrangle, output vertex are set up in line segment screening.It the invention has the advantages that: that can identify colored bill, is not influenced by gray scale conversion, accurate quickly positioning bill vertex cuts out effective document field.
Description
Technical field
The present invention relates to bill method for rapidly positioning and its system based on colored line segment, belong to field of image recognition.
Background technique
By image processing techniques means, converts the text of bill, number to the data of electronic edition, pass through computer journey
Sequence fast implements the acquisition of data information.In traditional financial process, there are a large amount of bills to need manual typing, uses image
Identification technology greatly improves the efficiency and accuracy of data acquisition.With the development of image procossing and OCR character recognition technologies,
Financial process electronization dramatically reduces Financial Billing and renders an account the working strength of reimbursement.
It is identified in automatic bill, in the scenes such as business card recognition, the image taken pictures using mobile terminal is not accurate ticket
According to, or even also as shooting angle is different, obtained pattern distortion.In order to facilitate identifying and handling, need automatic method will
Bill, which is cut out, to be come, while correcting fault image, carries out subsequent processing.The Line Segment Detection Algorithm of the prior art is in bill detection
There are several deficiencies: 1, being not suitable with color image, color image carries out Line segment detection after needing to change into grayscale image;2, ticket contents
In itself there are a large amount of lines, lines and background color gradient are high, and step-length is short, and bill edge is usually that gradient is low, and step-length is long,
It is not easy to detect;3, detection speed is slow.
Summary of the invention
In order to solve the above technical problem, the present invention provides the bill frame method for rapidly positioning based on colored Line segment detection
And its system, the progress of colored bill can quickly be positioned.
Technical solution of the present invention one:
Bill frame method for rapidly positioning based on colored Line segment detection, includes the following steps:
S1: the image that a frame includes bill is obtained.
S2: diminution processing is carried out by the image that linear interpolation method includes bill to a frame in proportion, is reduced
Image, the ratio value lv=300/min (w, h) that linear interpolation method uses, wherein w, h are respectively that a frame includes bill
The width of image and length, the wide and high of the downscaled images is respectively w2=w × lv, h2=h × lv.
S3: by colored LSD Line Segment Detection Algorithm, identify that line segment all in the downscaled images, the line segment indicate
For L={ x1, y1, x2, y2 }, wherein (x1, y1) and (x2, y2) is two endpoints of line segment L, and all line segments are formed line
Duan Jihe L_set;Wherein, the colour LSD Line Segment Detection Algorithm is down-sampled and contract by carrying out a Gauss to bill images
Small image carries out gradient detection to the RGB triple channel of image, determines that maximum gradient value is passed through as benchmark gradient in three
Region increases operation and rectangle estimates operation, exports the line segment detected.
S4: being sorted from large to small all line segments in line segment aggregate L_set by length, and by line segment merge algorithm into
Line section merges, and merges the line segment on a wherein approximate straight line.
S5: being grouped line segment of the S4 step after line segment merges, according to line segment both ends extreme coordinates difference, by line
Section is divided into 4 groups, respectively corresponds four edge direction up and down of quadrangle.
S6: being filtered processing to 4 groups of line segments respectively, remove unqualified line segment, including deviateing and too short line segment.
S7: by the method for exhaustion from 4 groups of line segments Jing Guo filtration treatment, according to the number order in grouping successively from each group
A line segment is taken respectively, so that each line segment of each group was combined with each other once, and calculates adjacent two lines section in every kind of combination
The sum of the distance between adjacent endpoint, when sum of the distance minimum, export this four line segments.
S8: four line segment group quadrangularlies that S7 step is exported calculate the intersection point of adjacent two lines section straight line, obtain four
A intersection point exports 4 vertex of this 4 intersection points as bill.
In S3 step, the step of colored LSD Line Segment Detection Algorithm are as follows:
To image progress, Gauss is down-sampled, downscaled images resolution ratio.
Gradient calculating is carried out respectively to each pixel for the image for reducing resolution ratio, wherein R, G, B triple channel of pixel
It is calculated respectively using the gradient that gradient algorithm carries out corresponding channel, takes the maximum value in three gradients as the gradient of current pixel
Value.
Each pixel is screened according to the gradient value of output, removal is wherein less than the pixel of Grads threshold, wherein institute
Stating Grads threshold is
Region is carried out according to its gradient value respectively to the pixel after screening and increases operation, is merged and current pixel gradient direction
Identical pixel obtains corresponding planning region.
Rectangle approximate calculation is carried out to all planning regions, obtains corresponding straightway.
Export the extreme coordinates of all straightways.
In S4 step, line segment merges algorithm are as follows:
First to vertex C, D of vertex A, B and L (j) of line segment L (i), line segment AC, AD, BC, BD and horizontal folder are judged
, whether less than 10, it is if 4, four angle ∠ 1, ∠ 2, ∠ 3, ∠ angles less than 1 degree, judge two nearest vertex distances of distance
Then judgement is successfully entered in next step, otherwise judgement failure;
To vertex C, D of vertex A, B and L (j) of line segment L (i), takes and do new line segment apart from longest two vertex, add
Enter into set, deletes original two lines section.
In S5 step, group technology is to work as dx>dy and y1<y0 and y2<y0, then line segment L is classified as group 1;Work as dx > dy and
Line segment L is then classified as group 2 by y1 > y0 and y2 > y0;As dx < dy and x1 < x0 and x2 < x0, then line segment L is classified as group 3;As dx < dy
And x1 > x0 and x2 > x0, then line segment L is classified as group 4;Otherwise, line segment is rejected;Wherein, dx=| x2-x1 |, dy=| y2-y1 |, x0
=w2/ 2, y0=h2/2。
In S6 step, filtration treatment method is, to any two lines section L1, L2 in current group, when ∠ (L1, L2) is less than
3 degree, and dst1 < dst2, then it deletes and deviates line segment L1;When ∠ (L1, L2) is less than 3 degree, and dst1 > dst2, then delete piece deviation
Line segment L2, wherein the angle of ∠ (L1, L2) expression L1 and L2, straight line where dst1, dst2 respectively indicate L1, L2 and point (x0,
Y0) distance;
The too short line segment that length in all current groups is less than len/3 is deleted, wherein len is current group middle line segment length longest
Value.
Technical solution of the present invention two:
Bill frame quick positioning system based on colored Line segment detection, including memory and processor, the memory
It is stored with instruction, described instruction is suitable for being loaded by processor and executing following steps:
Obtain the image that a frame includes bill.
Diminution processing is carried out by the image that linear interpolation method includes bill to a frame in proportion, obtains diminution figure
Picture, the ratio value lv=300/min (w, h) that linear interpolation method uses, wherein w, h are respectively the figure that a frame includes bill
The width of picture and length, the wide and high of the downscaled images is respectively w2=w × lv, h2=h × lv.
By colored LSD Line Segment Detection Algorithm, identify that line segment all in the downscaled images, the line segment are expressed as L
={ x1, y1, x2, y2 }, wherein (x1, y1) and (x2, y2) is two endpoints of line segment L, and all line segments are formed line-segment sets
Close L_set;Wherein, the colour LSD Line Segment Detection Algorithm is down-sampled and reduce figure by carrying out a Gauss to bill images
Picture carries out gradient detection to the RGB triple channel of image, determines that maximum gradient value is as benchmark gradient in three, by region
Increase operation and rectangle estimates operation, exports the line segment detected.
All line segments in line segment aggregate L_set are sorted from large to small by length, and algorithm is merged by line segment and is carried out
Line segment merges, and merges the line segment on a wherein approximate straight line.
Line segment after line segment merges is grouped, according to line segment both ends extreme coordinates difference, line segment is divided into 4
Group respectively corresponds four edge direction up and down of quadrangle.
Processing is filtered to 4 groups of line segments respectively, removes unqualified line segment, including deviateing and too short line segment.
By the method for exhaustion from 4 groups of line segments Jing Guo filtration treatment, according to the number order in grouping successively from each component
A line segment is not taken, so that each line segment of each group was combined with each other once, and calculates adjacent two lines section in every kind of combination
The sum of the distance between adjacent endpoint exports this four line segments when sum of the distance minimum.
By four line segment group quadrangularlies of output, the intersection point of adjacent two lines section straight line is calculated, obtains four intersection points, it is defeated
4 vertex of this 4 intersection points as bill out.
Line segment merges algorithm are as follows:
To vertex C, D of vertex A, B and L (j) of line segment L (i), line segment AC, AD, BC, BD and horizontal angle are judged
If 4, four ∠ 1, ∠ 2, ∠ 3, ∠ angles less than 1 degree, judge that two nearest vertex distances of distance are then whether less than 10
Judgement is successfully entered in next step, otherwise judgement failure;
To vertex C, D of vertex A, B and L (j) of line segment L (i), takes and do new line segment apart from longest two vertex, add
Enter into set, deletes original two lines section.
Group technology is to work as dx>dy and y1<y0 and y2<y0, then line segment L is classified as group 1;Work as dx > dy and y1 > y0 and y2 >
Line segment L is then classified as group 2 by y0;As dx < dy and x1 < x0 and x2 < x0, then line segment L is classified as group 3;As dx<dy and x1>x0 and x2
Line segment L is then classified as group 4 by > x0;Otherwise, line segment is rejected;Wherein, dx=| x2-x1 |, dy=| y2-y1 |, x0=w2/ 2, y0=
h2/2。
The step of colored LSD Line Segment Detection Algorithm are as follows:
To image progress, Gauss is down-sampled, downscaled images resolution ratio.
Gradient calculating is carried out respectively to each pixel for the image for reducing resolution ratio, wherein R, G, B triple channel of pixel
It is calculated respectively using the gradient that gradient algorithm carries out corresponding channel, takes the maximum value in three gradients as the gradient of current pixel
Value.
Each pixel is screened according to the gradient value of output, removal is wherein less than the pixel of Grads threshold, wherein institute
Stating Grads threshold is
Region is carried out according to its gradient value respectively to the pixel after screening and increases operation, is merged and current pixel gradient direction
Identical pixel obtains corresponding planning region.
Rectangle approximate calculation is carried out to all planning regions, obtains corresponding straightway.
Export the extreme coordinates of all straightways.
Filtration treatment method is, to any two lines section L1, L2 in current group, when ∠ (L1, L2) is less than 3 degree, and
Dst1 < dst2 is then deleted and is deviateed L1;When ∠ (L1, L2) is less than 3 degree, and dst1 > dst2, then it deletes and deviates L2, wherein ∠
(L1, L2) indicates that the angle of L1 and L2, dst1, dst2 respectively indicate L1, L2 place straight line and point (x0, y0) distance;
The too short line segment that length in all current groups is less than len/3 is deleted, wherein len is current group middle line segment length longest
Value.
The invention has the benefit that
1. by by image down, can reduce that step-length is long, gradient is small etc. and cause bill Edge check less than the problem of, lead to
Later phase connection and screening, can effectively find out true bill edge and vertex.
2. detecting line segment using improved colour LSD Line Segment Detection Algorithm, the detection of colored lines can adapt to, without warp
Greyscale image transitions are crossed, quickly identify colored bill line segment.
3. filtering and merging by line segment, the testing result of subpixel accuracy can be obtained in a short time, to bill
With background contrasts it is very low in the case where still can detecte out lines.
Detailed description of the invention
Fig. 1 is the bill frame method for rapidly positioning flow chart of the invention based on colored Line segment detection;
Fig. 2 is the bill original image of one embodiment of the present of invention;
Fig. 3 is the line segment result schematic diagram found by colored Line segment detection of one embodiment of the present of invention;
Fig. 4 is four groups of line segment result schematic diagrams for merging grouping by line segment of one embodiment of the present of invention;
Fig. 5 is one embodiment of the present of invention by the filtered bill frame positioning line segment schematic diagram of line segment;
Fig. 6 is one embodiment of the present of invention by the filtered bill frame quadrangle schematic diagram of line segment;
Fig. 7 is the colored LSD Line Segment Detection Algorithm flow chart used of the invention.
Specific embodiment
It is next in the following with reference to the drawings and specific embodiments that the present invention will be described in detail.
Embodiment one
As shown in Figure 1, the bill frame method for rapidly positioning based on colored Line segment detection, includes the following steps:
S1: obtaining the image that a frame includes bill, as shown in Fig. 2, original image is cromogram.
S2: diminution processing is carried out by the image that linear interpolation method includes bill to a frame in proportion, is reduced
Image.The ratio value lv=300/min (w, h) that linear interpolation method uses, wherein w, h are respectively that a frame includes bill
The width of image and length, the wide and high of the downscaled images is respectively w2=w × lv, h2=h × lv.
S3: by colored LSD Line Segment Detection Algorithm, identify that line segment all in the downscaled images, the line segment indicate
For L={ x1, y1, x2, y2 }, wherein (x1, y1) and (x2, y2) is two endpoints of line segment L, and all line segments are formed line
Duan Jihe L_set;Wherein, the colour LSD Line Segment Detection Algorithm is down-sampled and contract by carrying out a Gauss to bill images
Small image carries out gradient detection to the RGB triple channel of image, determines that maximum gradient value is passed through as benchmark gradient in three
Region increases operation and rectangle estimates operation, exports the line segment detected, as shown in Figure 3.
S4: being sorted from large to small all line segments in line segment aggregate L_set by length, then by line segment merge algorithm into
Line section merges, and merges the line segment on a wherein approximate straight line.
S5: being grouped line segment of the S4 step after line segment merges, according to line segment both ends extreme coordinates difference, by line
Section is divided into 4 groups, respectively corresponds four edge direction up and down of quadrangle.As shown in figure 4, being respectively side line segment aggregate up and down
Schematic diagram.
S6: being filtered processing to 4 groups of line segments respectively, remove unqualified line segment, including deviateing and too short line segment.
S7: by the method for exhaustion from 4 groups of line segments Jing Guo filtration treatment, according to the number order in grouping successively from each group
A line segment is taken respectively, so that each line segment of each group was combined with each other once, and calculates adjacent two lines section in every kind of combination
The sum of the distance between adjacent endpoint, when sum of the distance minimum, export this four line segments, as shown in Figure 5.
The frame of bill must be the maximum quadrangle of compositing range, should be theoretically that adjacent segments endpoint is directly heavy
It closes, distance is 0, it is contemplated that the factors such as missing are obscured in image procossing to be influenced, and be may cause part line segment and is lacked unrecognized, institute
With apart from minimum condition.
S8: four line segment group quadrangularlies that S7 step is exported, adjacent two lines section intersection between lines point obtain four friendships
Point exports this 4 intersection points, it is believed that is 4 vertex of bill.As shown in fig. 6, four sides using four line segments as quadrangle
Benchmark line segment extends each line segment, until obtaining complete quadrangle with another line segment intersection, exporting four intersecting point coordinates.
As shown in fig. 7, in S3 step, the step of colored LSD Line Segment Detection Algorithm are as follows:
To image progress, Gauss is down-sampled, downscaled images resolution ratio.
Gradient calculating is carried out respectively to each pixel for the image for reducing resolution ratio, wherein R, G, B triple channel of pixel
It is calculated respectively using the gradient that gradient algorithm carries out corresponding channel, takes the maximum value in three gradients as the gradient of current pixel
Value.
Each pixel is screened according to the gradient value of output, removal is wherein less than the pixel of Grads threshold, wherein institute
Stating Grads threshold is
Region is carried out according to its gradient value respectively to the pixel after screening and increases operation, is merged and current pixel gradient direction
Identical pixel obtains corresponding planning region.
Rectangle approximate calculation is carried out to all planning regions, obtains corresponding straightway.
Export the extreme coordinates of all straightways.
Colored LSD detection algorithm is the optimization carried out on the basis of traditional LSD Line Segment Detection Algorithm, comprising: to picture
It is down-sampled and reduce picture to carry out a Gauss, gradient detection is carried out to the RGB triple channel of picture, determines maximum ladder in three
Angle value increases as benchmark gradient, region, rectangle estimation, output test result.When sampled images are color image, without warp
Gray proces are crossed, determining gradient value is detected by carrying out gradient to original image triple channel, quickly and accurately detects colour edging line
Section.In the present embodiment, because of the difference of bill, information includes multi-color cord section and data, uses traditional Line Segment Detection Algorithm
Colour information can be lost, causes Partial key line segment that can not read.
In S4 step, in the present embodiment, line segment merges algorithm are as follows:
Wherein, analy_merge (L (i), L (j)) is expressed as, to vertex C, D of vertex A, B and L (j) of line segment L (i),
If judging that line segment AC, AD, BC, BD and 4, four horizontal angle ∠ 1, ∠ 2, ∠ 3, ∠ angles less than 1 degree, judge distance
Whether two nearest vertex distances are that judgement is successfully entered merge (L (i), L (j)) less than 10, otherwise judgement failure, threshold
Value 10 is the optimal values obtained by many experiments.
Merge (L (i), L (j)) is expressed as, and to vertex C, D of vertex A, B and L (j) of line segment L (i), is taken apart from longest
Two vertex do new line segment, be added in set, delete original two lines section.
Merged by line segment, the two lines section for being originally used for a line segment can be merged into a line segment, because in line segment
In detection process, because original image distorts, image taking, the influence of the factors such as algorithm process will lead to a line segment and be judged as
Tortuous two lines are disconnected, can be restored by line segment merging.
In S5 step, group technology is to work as dx>dy and y1<y0 and y2<y0, then line segment L is classified as group 1;Work as dx > dy and
Line segment L is then classified as group 2 by y1 > y0 and y2 > y0;As dx < dy and x1 < x0 and x2 < x0, then line segment L is classified as group 3;As dx < dy
And x1 > x0 and x2 > x0, then line segment L is classified as group 4;Otherwise, line segment is rejected;Wherein, dx=| x2-x1 |, dy=| y2-y1 |, x0
=w2/ 2, y0=h2/2。
Line segment is divided into the grouping on four sides up and down, wherein upper following then abscissa difference is greater than ordinate difference, on
Side is located at image top, then ordinate is greater than image ordinate median, is located at image lower part below, then ordinate is less than image
Ordinate median;Then abscissa difference is less than ordinate difference to left and right side, and the left side is located at image left part, then abscissa is less than figure
As abscissa median, the right is located at image right part, then abscissa is greater than image abscissa median.
In S6 step, filtration treatment method is, to any two lines section L1, L2 in current group, when ∠ (L1, L2) is less than
3 degree, and dst1 < dst2, then it deletes and deviates line segment L1;When ∠ (L1, L2) is less than 3 degree, and dst1 > dst2, then delete deviated line
Section L2, wherein ∠ (L1, L2) indicates that the angle of L1 and L2, dst1, dst2 respectively indicate L1, L2 place straight line and point (x0, y0)
Distance;If currently the longest value of group middle line segment length is len, the too short line segment for being less than len/3 in all current groups is deleted.It crosses
Filter processing is filtered out from the closer short-term section in center.
Beneficial effects of the present invention are, lead to bill edge by by image down, can reduce that step-length is long, gradient is small etc.
The problem of can't detect is connected and is screened by the later period, can effectively find out true bill edge and vertex.Use improvement
Colored LSD Line Segment Detection Algorithm detect line segment, can adapt to the detection of colored lines, need not move through greyscale image transitions, fastly
Speed identifies colored bill line segment.It filters and merges by line segment, can obtain the detection knot of subpixel accuracy in a short time
Fruit still can detecte out lines in the case where very low to bill and background contrasts.
Embodiment two
Bill frame quick positioning system based on colored Line segment detection, including memory and processor, the memory
It is stored with instruction, described instruction is suitable for being loaded by processor and executing following steps:
Obtain the image that a frame includes bill.
Diminution processing is carried out by the image that linear interpolation method includes bill to a frame in proportion, obtains diminution figure
Picture.The ratio value lv=300/min (w, h) that linear interpolation method uses, wherein w, h are respectively the figure that a frame includes bill
The width of picture and length, the wide and high of the downscaled images is respectively w2=w × lv, h2=h × lv.
Using colored LSD detection algorithm, line segment all in the downscaled images is found out, forms line segment aggregate L_set, institute
It states line segment and is expressed as L={ x1, y1, x2, y2 }, wherein (x1, y1) and (x2, y2) is two endpoints of line segment L, wherein described
RGB threeway of the colored LSD Line Segment Detection Algorithm by the down-sampled and downscaled images to Gauss of bill images progress, to image
Road carries out gradient detection, determines that maximum gradient value increases operation by region and rectangle is estimated as benchmark gradient in three
Operation exports the line segment detected.
All line segments in line segment aggregate L_set are sorted from large to small by length, then algorithm is merged by line segment and is carried out
Line segment merges, and merges the line segment on a wherein approximate straight line.
Line segment after line segment merges is grouped, according to line segment both ends extreme coordinates difference, line segment is divided into 4
Group respectively corresponds four edge direction up and down of quadrangle.
Processing is filtered to 4 groups of line segments respectively, removes unqualified line segment, including deviateing and too short line segment.
By the method for exhaustion from 4 groups of line segments Jing Guo filtration treatment, according to the number order in grouping successively from each component
A line segment is not taken, so that each line segment of each group was combined with each other once, and calculates adjacent two lines section in every kind of combination
The sum of the distance between adjacent endpoint when sum of the distance minimum, then exports this four line segments.
By four line segment group quadrangularlies of output, adjacent two lines section intersection between lines point obtains four intersection points, exports this
4 intersection points, it is believed that be 4 vertex of bill.
In the present embodiment, line segment merges algorithm are as follows:
Wherein, analy_merge (L (i), L (j)) is expressed as, to vertex C, D of vertex A, B and L (j) of line segment L (i),
If judging that line segment AC, AD, BC, BD and 4, four horizontal angle ∠ 1, ∠ 2, ∠ 3, ∠ angles less than 1 degree, judge distance
Whether two nearest vertex distances are that judgement is successfully entered merge (L (i), L (j)) less than 10, otherwise judgement failure.
Merge (L (i), L (j)) is expressed as, and to vertex C, D of vertex A, B and L (j) of line segment L (i), is taken apart from longest
Two vertex do new line segment, be added in set, delete original two lines section.
Group technology is to work as dx>dy and y1<y0 and y2<y0, then line segment L is classified as group 1;Work as dx > dy and y1 > y0 and y2 >
Line segment L is then classified as group 2 by y0;As dx < dy and x1 < x0 and x2 < x0, then line segment L is classified as group 3;As dx<dy and x1>x0 and x2
Line segment L is then classified as group 4 by > x0;Otherwise, line segment is rejected;Wherein, dx=| x2-x1 |, dy=| y2-y1 |, x0=w2/ 2, y0=
h2/2。
The step of colored LSD Line Segment Detection Algorithm are as follows:
To image progress, Gauss is down-sampled, downscaled images resolution ratio.
Gradient calculating is carried out respectively to each pixel for the image for reducing resolution ratio, wherein R, G, B triple channel of pixel
It is calculated respectively using the gradient that gradient algorithm carries out corresponding channel, takes the maximum value in three gradients as the gradient of current pixel
Value.
Each pixel is screened according to the gradient value of output, removal is wherein less than the pixel of Grads threshold, wherein institute
Stating Grads threshold is
Region is carried out according to its gradient value respectively to the pixel after screening and increases operation, is merged and current pixel gradient direction
Identical pixel obtains corresponding planning region.
Rectangle approximate calculation is carried out to all planning regions, obtains corresponding straightway.
Export the extreme coordinates of all straightways.
Filtration treatment method is that, to any two lines section L1, L2 in current group, ∠ (L1, L2) indicates the folder of L1 and L2
Angle, straight line and point (x0, y0) distance where dst1, dst2 respectively indicate L1, L2.If ∠ (L1, L2) less than 3 degree, and dst1 <
Dst2 is then deleted and is deviateed line segment L1;If ∠ (L1, L2) is less than 3 degree, and dst1 > dst2, then deletes and deviate line segment L2;If working as
The longest value of preceding group of middle line segment length is len, then deletes the too short line segment for being less than len/3 in all current groups.
Beneficial effects of the present invention are, lead to bill edge by by image down, can reduce that step-length is long, gradient is small etc.
The problem of can't detect is connected and is screened by the later period, can effectively find out true bill edge and vertex.Use improvement
Colored LSD Line Segment Detection Algorithm detect line segment, can adapt to the detection of colored lines, need not move through greyscale image transitions, fastly
Speed identifies colored bill line segment.It filters and merges by line segment, can obtain the detection knot of subpixel accuracy in a short time
Fruit still can detecte out lines in the case where very low to bill and background contrasts.
The above description is only an embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field is similarly included in scope of patent protection of the invention.
Claims (10)
1. the bill frame method for rapidly positioning based on colored Line segment detection, which comprises the steps of:
S1: the image that a frame includes bill is obtained;
S2: carrying out diminution processing by the image that linear interpolation method includes bill to a frame in proportion, obtain downscaled images,
The ratio value lv=300/min (w, h) that linear interpolation method uses, wherein w, h are respectively the image that a frame includes bill
It is wide and long, the width of the downscaled images and high respectively w2=w × lv, h2=h × lv;
S3: it by colored LSD Line Segment Detection Algorithm, identifies line segment all in the downscaled images, and exports the line segment form
It is shown as L={ x1, y1, x2, y2 }, wherein (x1, y1) and (x2, y2) is two endpoints of line segment L, and all line segments are formed
Line segment aggregate L_set;Wherein, the colour LSD Line Segment Detection Algorithm is down-sampled simultaneously by carrying out a Gauss to bill images
Downscaled images carry out gradient detection to the RGB triple channel of image, determine that maximum gradient value is as benchmark gradient, warp in three
It crosses region and increases operation and rectangle estimation operation, export the line segment detected;
S4: being sorted from large to small all line segments in line segment aggregate L_set by length, and is merged algorithm by line segment and carried out line
Section merges, and merges the line segment on a wherein approximate straight line;
S5: being grouped line segment of the S4 step after line segment merges, according to line segment both ends extreme coordinates difference, by line segment point
It is 4 groups, respectively corresponds four edge direction up and down of quadrangle;
S6: being filtered processing to 4 groups of line segments respectively, remove unqualified line segment, including deviateing and too short line segment;
S7: by the method for exhaustion from 4 groups of line segments Jing Guo filtration treatment, successively distinguish from each group according to the number order in grouping
A line segment is taken, so that each line segment of each group was combined with each other once, and calculates the phase of adjacent two lines section in every kind of combination
The sum of the distance between neighboring terminal point exports this four line segments when sum of the distance minimum;
S8: four line segment group quadrangularlies that S7 step is exported calculate the intersection point of adjacent two lines section straight line, obtain four friendships
Point exports 4 vertex of this 4 intersection points as bill.
2. the bill frame method for rapidly positioning according to claim 1 based on colored Line segment detection, which is characterized in that S3
In step, the step of colored LSD Line Segment Detection Algorithm are as follows:
To image progress, Gauss is down-sampled, downscaled images resolution ratio;
Gradient calculating is carried out respectively to each pixel for the image for reducing resolution ratio, wherein R, G, B triple channel of pixel are distinguished
It is calculated using the gradient that gradient algorithm carries out corresponding channel, takes the maximum value in three gradients as the gradient value of current pixel;
Each pixel is screened according to the gradient value of output, removal is wherein less than the pixel of Grads threshold, wherein the ladder
Spending threshold value is
Region is carried out according to its gradient value respectively to the pixel after screening and increases operation, is merged identical as current pixel gradient direction
Pixel, obtain corresponding planning region;
Rectangle approximate calculation is carried out to all planning regions, obtains corresponding straightway;
Export the extreme coordinates of all straightways.
3. the bill frame method for rapidly positioning according to claim 2 based on colored Line segment detection, which is characterized in that S4
In step, line segment merges algorithm are as follows:
To vertex C, D of vertex A, B and L (j) of line segment L (i), judge line segment AC, AD, BC, BD and horizontal angle ∠ 1,
If 4, four ∠ 2, ∠ 3, ∠ angles less than 1 degree, judge that two nearest vertex distances of distance are to judge whether less than 10
It is successfully entered in next step, otherwise judgement failure;
To vertex C, D of vertex A, B and L (j) of line segment L (i), takes and do new line segment apart from longest two vertex, be added to
In set, original two lines section is deleted.
4. the bill frame method for rapidly positioning according to claim 3 based on colored Line segment detection, which is characterized in that S5
In step, group technology is to work as dx>dy and y1<y0 and y2<y0, then line segment L is classified as group 1;Work as dx > dy and y1 > y0 and y2 >
Line segment L is then classified as group 2 by y0;As dx < dy and x1 < x0 and x2 < x0, then line segment L is classified as group 3;As dx<dy and x1>x0 and x2
Line segment L is then classified as group 4 by > x0;Otherwise, line segment is rejected;Wherein, dx=| x2-x1 |, dy=| y2-y1 |, x0=w2/ 2, y0=
h2/2。
5. the bill frame method for rapidly positioning according to claim 4 based on colored Line segment detection, which is characterized in that S6
In step, filtration treatment method is, to any two lines section L1, L2 in current group, when ∠ (L1, L2) is less than 3 degree, and dst1
< dst2 is then deleted and is deviateed line segment L1;When ∠ (L1, L2) is less than 3 degree, and dst1 > dst2, then it deletes and deviates line segment L2, wherein
∠ (L1, L2) indicates that the angle of L1 and L2, dst1, dst2 respectively indicate L1, L2 place straight line and point (x0, y0) distance;
Delete the too short line segment that length in all current groups is less than len/3, wherein len is that current group middle line segment length is longest
Value.
6. the bill frame quick positioning system based on colored Line segment detection, which is characterized in that including memory and processor, institute
It states memory and is stored with instruction, described instruction is suitable for being loaded by processor and executing following steps:
Obtain the image that a frame includes bill;
Diminution processing is carried out by the image that linear interpolation method includes bill to a frame in proportion, obtains downscaled images, line
Property the interpolation method ratio value lv=300/min (w, h) that uses, wherein w, h are respectively the width that a frame includes the image of bill
With length, the width of the downscaled images and high respectively w2=w × lv, h2=h × lv;
By colored LSD Line Segment Detection Algorithm, identify that line segment all in the downscaled images, the line segment are expressed as L=
{ x1, y1, x2, y2 }, wherein (x1, y1) and (x2, y2) is two endpoints of line segment L, and all line segments are formed line segment aggregate
L_set;Wherein, a Gauss is down-sampled and downscaled images by carrying out to bill images for the colour LSD Line Segment Detection Algorithm,
Gradient detection is carried out to the RGB triple channel of image, determines that maximum gradient value increases as benchmark gradient by region in three
Operation and rectangle estimate operation, export the line segment detected;
All line segments in line segment aggregate L_set are sorted from large to small by length, and algorithm is merged by line segment and carries out line segment
Merge, merges the line segment on a wherein approximate straight line;
Line segment after line segment merges is grouped, according to line segment both ends extreme coordinates difference, line segment is divided into 4 groups, point
Four edge direction up and down of quadrangle is not corresponded to;
Processing is filtered to 4 groups of line segments respectively, removes unqualified line segment, including deviateing and too short line segment;
By the method for exhaustion from 4 groups of line segments Jing Guo filtration treatment, successively taken respectively from each group according to the number order in grouping
One line segment so that each line segment of each group was combined with each other once, and calculates the adjacent of adjacent two lines section in every kind of combination
The sum of the distance between endpoint exports this four line segments when sum of the distance minimum;
By four line segment group quadrangularlies of output, the intersection point of adjacent two lines section straight line is calculated, four intersection points is obtained, exports this
4 vertex of 4 intersection points as bill.
7. the bill frame quick positioning system according to claim 6 based on colored Line segment detection, it is characterised in that: line
Section merges algorithm are as follows:
To vertex C, D of vertex A, B and L (j) of line segment L (i), judge line segment AC, AD, BC, BD and horizontal angle ∠ 1,
If 4, four ∠ 2, ∠ 3, ∠ angles less than 1 degree, judge that two nearest vertex distances of distance are to judge whether less than 10
It is successfully entered in next step, otherwise judgement failure;
To vertex C, D of vertex A, B and L (j) of line segment L (i), takes and do new line segment apart from longest two vertex, be added to
In set, original two lines section is deleted.
8. the bill frame quick positioning system according to claim 7 based on colored Line segment detection, which is characterized in that point
Group method is to work as dx>dy and y1<y0 and y2<y0, then line segment L is classified as group 1;Work as dx > dy and y1 > y0 and y2 > y0, then by line
Section L is classified as group 2;As dx < dy and x1 < x0 and x2 < x0, then line segment L is classified as group 3;As dx<dy and x1>x0 and x2>x0, then will
Line segment L is classified as group 4;Otherwise, line segment is rejected;Wherein, dx=| x2-x1 |, dy=| y2-y1 |, x0=w2/ 2, y0=h2/2。
9. the bill frame quick positioning system according to claim 8 based on colored Line segment detection, which is characterized in that color
The step of color LSD Line Segment Detection Algorithm are as follows:
To image progress, Gauss is down-sampled, downscaled images resolution ratio;
Gradient calculating is carried out respectively to each pixel for the image for reducing resolution ratio, wherein R, G, B triple channel of pixel are distinguished
It is calculated using the gradient that gradient algorithm carries out corresponding channel, takes the maximum value in three gradients as the gradient value of current pixel;
Each pixel is screened according to the gradient value of output, removal is wherein less than the pixel of Grads threshold, wherein the ladder
Spending threshold value is
Region is carried out according to its gradient value respectively to the pixel after screening and increases operation, is merged identical as current pixel gradient direction
Pixel, obtain corresponding planning region;
Rectangle approximate calculation is carried out to all planning regions, obtains corresponding straightway;
Export the extreme coordinates of all straightways.
10. the bill frame quick positioning system according to claim 9 based on colored Line segment detection, which is characterized in that
Filtration treatment method is, to any two lines section L1, L2 in current group, when ∠ (L1, L2) is less than 3 degree, and dst1 < dst2,
It then deletes and deviates line segment L1;When ∠ (L1, L2) is less than 3 degree, and dst1 > dst2, then it deletes piece and deviates line segment L2, wherein ∠
(L1, L2) indicates that the angle of L1 and L2, dst1, dst2 respectively indicate L1, L2 place straight line and point (x0, y0) distance;
The too short line segment that length in all current groups is less than len/3 is deleted, wherein len is that current group middle line segment length is longest
Value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910273966.5A CN109977910B (en) | 2019-04-04 | 2019-04-04 | Rapid bill positioning method and system based on color line segments |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910273966.5A CN109977910B (en) | 2019-04-04 | 2019-04-04 | Rapid bill positioning method and system based on color line segments |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109977910A true CN109977910A (en) | 2019-07-05 |
CN109977910B CN109977910B (en) | 2021-08-20 |
Family
ID=67083182
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910273966.5A Active CN109977910B (en) | 2019-04-04 | 2019-04-04 | Rapid bill positioning method and system based on color line segments |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109977910B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110414649A (en) * | 2019-07-29 | 2019-11-05 | 广州柔视智能科技有限公司 | Localization method, device, terminal and the storage medium of DM code |
CN110533646A (en) * | 2019-08-27 | 2019-12-03 | 上海零眸智能科技有限公司 | A kind of shelf method for detecting based on object detection |
CN116258724A (en) * | 2023-05-15 | 2023-06-13 | 合肥联宝信息技术有限公司 | Image-based target positioning method and device, electronic equipment and storage medium |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040165786A1 (en) * | 2003-02-22 | 2004-08-26 | Zhengyou Zhang | System and method for converting whiteboard content into an electronic document |
CN102236784A (en) * | 2010-05-07 | 2011-11-09 | 株式会社理光 | Screen area detection method and system |
CN103577817A (en) * | 2012-07-24 | 2014-02-12 | 阿里巴巴集团控股有限公司 | Method and device for identifying forms |
CN103871052A (en) * | 2014-02-21 | 2014-06-18 | 杭州奥视图像技术有限公司 | Straight line detection-based safety belt detecting algorithm |
CN105931239A (en) * | 2016-04-20 | 2016-09-07 | 北京小米移动软件有限公司 | Image processing method and device |
CN106446881A (en) * | 2016-07-29 | 2017-02-22 | 北京交通大学 | Method for extracting lab test result from medical lab sheet image |
CN106650608A (en) * | 2016-10-31 | 2017-05-10 | 广东工业大学 | Identification method for rectangle locating frame in test paper without locating points |
CN107038721A (en) * | 2017-03-27 | 2017-08-11 | 西安交通大学 | A kind of line detection method based on LAPJV algorithms |
CN107392141A (en) * | 2017-07-19 | 2017-11-24 | 武汉大学 | A kind of airport extracting method based on conspicuousness detection and LSD straight-line detections |
CN109300118A (en) * | 2018-09-11 | 2019-02-01 | 东北大学 | A kind of high-voltage electric power circuit unmanned plane method for inspecting based on RGB image |
CN109544577A (en) * | 2018-11-27 | 2019-03-29 | 辽宁工程技术大学 | A kind of improvement lines detection method based on marginal point marshalling |
-
2019
- 2019-04-04 CN CN201910273966.5A patent/CN109977910B/en active Active
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040165786A1 (en) * | 2003-02-22 | 2004-08-26 | Zhengyou Zhang | System and method for converting whiteboard content into an electronic document |
CN102236784A (en) * | 2010-05-07 | 2011-11-09 | 株式会社理光 | Screen area detection method and system |
CN103577817A (en) * | 2012-07-24 | 2014-02-12 | 阿里巴巴集团控股有限公司 | Method and device for identifying forms |
CN103871052A (en) * | 2014-02-21 | 2014-06-18 | 杭州奥视图像技术有限公司 | Straight line detection-based safety belt detecting algorithm |
CN105931239A (en) * | 2016-04-20 | 2016-09-07 | 北京小米移动软件有限公司 | Image processing method and device |
CN106446881A (en) * | 2016-07-29 | 2017-02-22 | 北京交通大学 | Method for extracting lab test result from medical lab sheet image |
CN106650608A (en) * | 2016-10-31 | 2017-05-10 | 广东工业大学 | Identification method for rectangle locating frame in test paper without locating points |
CN107038721A (en) * | 2017-03-27 | 2017-08-11 | 西安交通大学 | A kind of line detection method based on LAPJV algorithms |
CN107392141A (en) * | 2017-07-19 | 2017-11-24 | 武汉大学 | A kind of airport extracting method based on conspicuousness detection and LSD straight-line detections |
CN109300118A (en) * | 2018-09-11 | 2019-02-01 | 东北大学 | A kind of high-voltage electric power circuit unmanned plane method for inspecting based on RGB image |
CN109544577A (en) * | 2018-11-27 | 2019-03-29 | 辽宁工程技术大学 | A kind of improvement lines detection method based on marginal point marshalling |
Non-Patent Citations (1)
Title |
---|
杨芸芸: ""基于拍照的银行卡卡号检测"", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110414649A (en) * | 2019-07-29 | 2019-11-05 | 广州柔视智能科技有限公司 | Localization method, device, terminal and the storage medium of DM code |
CN110414649B (en) * | 2019-07-29 | 2023-06-06 | 广州柔视智能科技有限公司 | DM code positioning method, device, terminal and storage medium |
CN110533646A (en) * | 2019-08-27 | 2019-12-03 | 上海零眸智能科技有限公司 | A kind of shelf method for detecting based on object detection |
CN110533646B (en) * | 2019-08-27 | 2023-12-19 | 上海零眸智能科技有限公司 | Goods shelf detection method based on object detection |
CN116258724A (en) * | 2023-05-15 | 2023-06-13 | 合肥联宝信息技术有限公司 | Image-based target positioning method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN109977910B (en) | 2021-08-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107808378B (en) | Method for detecting potential defects of complex-structure casting based on vertical longitudinal and transverse line profile features | |
CN105913415B (en) | A kind of image sub-pixel edge extracting method with extensive adaptability | |
CN106295655B (en) | A kind of transmission line part extraction method for unmanned plane inspection image | |
CN104732227B (en) | A kind of Location Method of Vehicle License Plate based on definition and luminance evaluation | |
CN109977910A (en) | Bill method for rapidly positioning and its system based on colored line segment | |
CN107844683B (en) | Method for calculating concentration of digital PCR (polymerase chain reaction) liquid drops | |
CN103034848B (en) | A kind of recognition methods of form types | |
CN104680161A (en) | Digit recognition method for identification cards | |
CN110427966A (en) | One kind rejecting error hiding feature point methods based on characteristic point local feature | |
CN111814686A (en) | Vision-based power transmission line identification and foreign matter invasion online detection method | |
CN104680109B (en) | A kind of bar code area positioning method based on image recognition | |
CN105160682B (en) | Method for detecting image edge and device | |
CN113646801A (en) | Defect detection method and device for defect image and computer readable storage medium | |
CN107392139A (en) | A kind of method for detecting lane lines and terminal device based on Hough transformation | |
CN109949227A (en) | Image split-joint method, system and electronic equipment | |
Azad et al. | A novel and robust method for automatic license plate recognition system based on pattern recognition | |
CN108009522A (en) | A kind of Approach for road detection, device and terminal | |
CN109978878A (en) | Color image line segment detecting method and its system based on LSD | |
CN110288624A (en) | Detection method, device and the relevant device of straightway in a kind of image | |
CN116152261B (en) | Visual inspection system for quality of printed product | |
CN112016557B (en) | Method for removing form interference line | |
Abbas et al. | Automated pavement distress detection using image processing techniques | |
CN104648397A (en) | System and method for warning lane departure | |
CN116052152A (en) | License plate recognition system based on contour detection and deep neural network | |
Ying et al. | Research on an automatic counting method for steel bars' image |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |