CN101882214B - Method for determining directions of boundaries of bar code layers based on Hough transformation - Google Patents
Method for determining directions of boundaries of bar code layers based on Hough transformation Download PDFInfo
- Publication number
- CN101882214B CN101882214B CN201010189239XA CN201010189239A CN101882214B CN 101882214 B CN101882214 B CN 101882214B CN 201010189239X A CN201010189239X A CN 201010189239XA CN 201010189239 A CN201010189239 A CN 201010189239A CN 101882214 B CN101882214 B CN 101882214B
- Authority
- CN
- China
- Prior art keywords
- bar code
- value
- discrete value
- angle
- confirm
- 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
Links
Images
Landscapes
- Image Analysis (AREA)
- Character Discrimination (AREA)
Abstract
The invention discloses a method for determining the directions of the boundaries of bar code layers based on Hough transformation. The method comprises the following steps of: determining matrix elements with maximum accumulated value in a plurality of matrix elements corresponding to the discrete value of each distance from the matrices of a two-dimensional accumulator, selecting the matrix elements with a preset number and maximum accumulated value as primary matrix elements and carrying out weighted sum on the primary matrix elements to determine the parameters of the directions of the boundaries of the bar code layers. By the method, the directions of the boundaries of the bar code layers are determined by carrying out Hough transformation on demarcation points on the boundaries of a plurality of bar code layers, and the accuracy of the determination of the directions of the boundaries of the bar code layers can be enhanced.
Description
[technical field]
The present invention relates to a kind of bar code layers separatrix direction and confirm method, particularly a kind of bar code layers separatrix direction based on the Hough conversion is confirmed method.
[background technology]
Barcode technology is an appearance coding, printing, identification, the data acquisition and processing (DAP) emerging technology that on computer technology and infotech basis, grows up.Barcode technology is because its identification is quick, accurate, reliable and low cost and other advantages; Be widely used in fields such as commerce, taking care of books, storage, post and telecommunications, traffic and Industry Control, and certainly will in " Internet of Things " that rise gradually used, bring into play great function.
The bar code that is widely used at present comprises bar code and two-dimensional bar code.Bar code claims that again linear bar code is made up of a plurality of " bars " that are arranged in parallel and " sky " unit, and bar code information leans on bar and empty different in width and position to express.Bar code is not then expressed any information just in a direction (generally being horizontal direction) expressing information in vertical direction, so information capacity and space availability ratio are lower, and after bar code is damaged, promptly can't discern.
Two-dimensional bar code is made up of the chequered with black and white particular geometric figure that on two-dimensional directional, distributes according to certain rules, its can be on two-dimensional directional expressing information, so information capacity and space availability ratio are lower, and have certain verifying function.Two-dimensional bar code can be divided into stack two-dimensional bar code and matrix two-dimensional barcode.The stack two-dimensional bar code is that the bar code by the multirow cutting back piles up and forms, and representational stack two-dimensional bar code comprises PDF417, Code 49, Code 16K etc.Matrix two-dimensional barcode is made up of black, the white module that is distributed in by pre-defined rule in the matrix, and representational matrix two-dimensional barcode comprises Codeone, Aztec, Date Matrix, QR sign indicating number etc.
Often there is certain angle of inclination in bar code image, and in decode procedure, need confirm above-mentioned angle of inclination and it is proofreaied and correct through the marginal direction of bar code layers.Yet the marginal direction of bar code layers is generally only decided by a bar code layers separatrix in the prior art, has certain error.Therefore, need a kind of method that can accurately confirm the bar code image angle of inclination.
[summary of the invention]
In order to solve the problems of the technologies described above, the invention provides a kind of bar code layers separatrix direction and confirm method based on the Hough conversion, can confirm the marginal direction of bar code layers exactly thus.
The present invention solves the problems of the technologies described above the technical scheme that is adopted and provides a kind of bar code layers separatrix direction based on the Hough conversion and confirm method, and comprising: a. confirms scanning area and true origin; B. confirm bar code layers marginal position angle span and initial point apart from span according to scanning area and true origin, and in the span of position angle, select a plurality of angle discrete values, select in apart from span a plurality of apart from discrete value at initial point; C. obtain the rectangular coordinate of a plurality of layers of separation at least two bar code layers separatrix in the scanning area; Respectively with rectangular coordinate and each angle discrete value substitution formula ρ=xcos θ+ysin θ of a plurality of layers of separation; To confirm that to each layer separation each angle discrete value is pairing apart from discrete value; Wherein x, y are rectangular coordinate, and θ is the angle discrete value, and ρ is that each angle discrete value is pairing apart from discrete value; D. utilize two-dimentional totalizer matrix angle discrete value and pairing to add up, make the accumulated value of each matrix element in the two-dimentional totalizer matrix represent the angle discrete value and apart from the occurrence number of the correspondence combination of discrete value apart from discrete value; E. confirm the matrix element that each is maximum apart from accumulated value in the pairing a plurality of matrix elements of discrete value; And the matrix element of from the matrix element of accumulated value maximum, selecting predetermined quantity is as the primary election matrix element; F. the accumulated value of each primary election matrix element and the accumulated value of other primary election matrix elements are carried out weighted sum, wherein the weighted value of weighted sum is by the difference decision of each primary election matrix element and the pairing angle discrete value of other matrix elements; G. select the maximum pairing angle discrete value of primary election matrix element of weighted sum value as the marginal direction parameter of bar code layers.
According to one preferred embodiment of the present invention, in step f, the absolute value of the angle discrete value difference of each primary election matrix element and other matrix elements is big more, and the weighted value of weighted sum is more little.
According to one preferred embodiment of the present invention, step a comprises: a1. utilizes multi-strip scanning line search bar code border, with definite bar code row border and with reference to col width; A2. confirm scanning area and true origin according to bar code row border and with reference to col width.
According to one preferred embodiment of the present invention; In step a1; Confirm to be positioned at a plurality of black and white frontier points on each sweep trace, utilize the spacing of black and white frontier point to confirm bar code border and, and utilize the black and white frontier point on a plurality of sweep traces to confirm bar code row border near bar code inside with reference to col width.
According to one preferred embodiment of the present invention; In step a2; Chosen distance is first and second point of H on bar code row border; Through first and second and on perpendicular to the vertical line on bar code row border respectively first of chosen distance and second for reference to col width thirdly reach the 4th point, and will be with first point, second point, thirdly to reach at the 4th be that definite rectangular area, summit is as scanning area.
According to one preferred embodiment of the present invention, in step a2, first with thirdly or second arranged outside true origin with the 4th defined zone boundary, true origin distance areas border is L.
According to one preferred embodiment of the present invention, in step b, confirm the azimuth angle theta of the vertical direction relative coordinate initial point on bar code row border '; And definite position angle span be (θ '-Δ θ 1; θ '+Δ θ 1), and definite initial point apart from span be (H, H+L).
According to one preferred embodiment of the present invention, in said step b, a plurality of angle discrete values increase progressively with the fixed angle step-length successively, a plurality ofly increase progressively successively with the fixed range step-length apart from discrete value.
Through said method, through being carried out the Hough conversion, the separation on a plurality of bar code layers separatrix confirms the marginal direction of bar code layers, can improve the accuracy that bar code layers separatrix direction is confirmed.
[description of drawings]
Fig. 1 is a process flow diagram of confirming method according to bar code layers of the present invention separatrix direction;
Fig. 2 is a synoptic diagram of confirming method according to scanning area of the present invention and true origin;
Fig. 3 is the synoptic diagram according to two-dimentional totalizer matrix of the present invention.
[embodiment]
The invention provides a kind of bar code layers separatrix direction based on the Hough conversion and confirm method, this method improves the accuracy that bar code layers separatrix direction is confirmed through the separation on a plurality of bar code layers separatrix being carried out the Hough conversion.
As shown in Figure 1, direction is confirmed in the method in bar code layers of the present invention separatrix, at first on bar code image, confirms scanning area and true origin.
Specifically, as shown in Figure 2, utilize the multi-strip scanning line in bar code image, to search for bar code border.For example; With the PDF417 bar code is example, along each sweep trace bar code image is scanned, after scanning a black and white frontier point; With this black and white frontier point is that benchmark continues to scan 8 black and white frontier points forward; And confirm the spacing (for example, number of modules) between each black and white frontier point, and utilize corresponding border judgment rule to judge whether the spacing between each black and white frontier point meets corresponding border rule.In the present embodiment; Before not determining the bar code border type; Preferably utilize the judgement that walks abreast of spacing between each the black and white frontier point on 81111113 border judgment rules, 31111118 border judgment rules, 71111113 border judgment rules and sweep trace of 31111117 border judgment rules, improve judgement speed thus.After determining bar code border, can confirm with reference to col width W according to the spacing of the both sides black and white frontier point on each sweep trace.
Subsequently, utilize the black and white frontier point on the multi-strip scanning line to confirm bar code row border ab near bar code inside.In a preferred embodiment, traditional Hough changing method capable of using calculates the best straight line equation through a plurality of black and white frontier points, confirms bar code row border ab thus.
Behind definite bar code row border ab; Chosen distance is first A and second B of H on bar code row border ab, and at first A of chosen distance and second thirdly C and the 4th D that B is W (with reference to col width) respectively through first A and second B and on perpendicular to the vertical line of bar code row border ab.Subsequently, with first A, second B, thirdly C and the 4th D are that the summit confirms that a wide W of being and height are the rectangular area of L, and with this rectangular area as scanning area.
After having confirmed scanning area, at the arranged outside true origin O of scanning area.Specifically; In a preferred embodiment, can be at the arranged outside true origin O of first A with C thirdly or second B and the 4th the defined zone boundary of D, true origin O distance areas border is L; And in a preferred embodiment, L is smaller or equal to 50 pixels.
Behind definite scanning area and true origin O; Confirm that according to scanning area and true origin O bar code layers marginal position angle span and initial point are apart from span; And in the span of position angle, select a plurality of angle discrete values, select in apart from span a plurality of at initial point apart from discrete value.Specifically, initial point apart from span be taken as (H, H+L).In addition, confirm the azimuth angle theta of the vertical direction relative coordinate initial point O of bar code row border ab ', the position angle span is taken as (θ '-Δ θ 1, θ '+Δ θ 1).In a preferred embodiment, Δ θ is 1<30 °.The angle discrete value preferably increases progressively with fixed angle step-length (for example, 1 radian) successively, preferably increases progressively successively with fixed range step-length (for example, 1 pixel) apart from discrete value.
Subsequently; Obtain the rectangular coordinate of a plurality of layers of separation at least two bar code layers separatrix in the scanning area; With rectangular coordinate and each angle discrete value substitution formula ρ=xcos θ+ysin θ of a plurality of layers of separation, to confirm that to each layer separation each angle discrete value is pairing apart from discrete value, wherein x, y are rectangular coordinate respectively; θ is the angle discrete value, and ρ is that each angle discrete value is pairing apart from discrete value.
Then, utilize two-dimentional totalizer matrix angle discrete value and pairing to add up apart from discrete value.Specifically, produce a two-dimentional totalizer matrix A, and each matrix element A [i, j] is put 0.Corresponding matrix element A [i, j] in the two-dimentional totalizer matrix A is added up with the respective distances discrete value according to each the angle discrete value that draws through aforementioned calculation.Just; According to each angle discrete value with calculate apart from the matrix element A [i of discrete value with correspondence; J] add 1, make the accumulated value of each the matrix element A [i, j] in the two-dimentional totalizer matrix represent the angle discrete value and apart from the occurrence number of the correspondence combination of discrete value.After whole frontier points are carried out aforesaid operations, accumulated value matrix that can be as shown in Figure 3.
Subsequently, confirm the matrix element that each is maximum apart from accumulated value in the pairing a plurality of matrix elements of discrete value, and the matrix element of from the matrix element of accumulated value maximum, selecting predetermined quantity is as the primary election matrix element.For example, as shown in Figure 3 in the present embodiment, confirm at first respectively apart from the maximum matrix element of selection accumulated value in discrete value ρ 0 to the ρ 6 pairing matrix element row, and therefrom select the maximum matrix element A [2 of 6 accumulated values; 5]=17, A [4,6]=17, A [3; 4]=16, A [0,1]=16, A [4; 3]=14, A [6,2]=14 is as the primary election matrix element.
Behind definite primary election matrix element; The accumulated value of each primary election matrix element and the accumulated value of other primary election matrix elements are carried out weighted sum, and wherein the weighted value of weighted sum is by the difference decision of each primary election matrix element and the pairing angle discrete value of other matrix elements.Specifically, the absolute value of the angle discrete value difference of each primary election matrix element and other matrix elements is big more, and the weighted value of weighted sum is more little.
In the present embodiment, confirm the weighted sum value of each primary election matrix element through following mode:
S[2,5]=17×100/(|2-2|+1)+17×100/(|2-4|+1)+16×100/(|2-3|+1)+16×100/(|2-0|
+1)+14×100/(|2-4|+1)+14×100/(|2-6|+1)=4345
S[4,6]=17×100/(|4-4|+1)+17×100/(|4-2|+1)+16×100/(|4-3|+1)+16×100/(|4-0|
+1)+14×100/(|4-4|+1)+14×100/(|4-6|+1)=5252
S[3,4]=16×100/(|3-3|+1)+17×100/(|3-2|+1)+17×100/(|3-4|+1)+16×100/(|3
-0|+1)+14×100/(|3-4|+1)+14×100/(|3-6|+1)=4750
S[0,1]=16×100/(|0-0|+1)+17×100/(|0-2|+1)+17×100/(|0-4|+1)+16×100/(|0-3|
+1)+14×100/(|0-4|+1)+14×100/(|0-6|+1)=3386
S[4,3]=14×100/(|4-4|+1)+17×100/(|4-2|+1)+17×100/(|4-4|+1)+16×100/(|4-3|
+1)+16×100/(|4-0|+1)+14×100/(|4-6|+1)=5252
S[6,2]=14×100/(|6-6|+1)+17×100/(|6-2|+1)+17×100/(|6-4|+1)+16×100/(|6-3|+1)+16×100/(|6-4|+1)+14×100/(|6-4|+1)=3400
In the present embodiment; Calculate for ease, angle discrete value difference is directly replaced by the following target difference corresponding to the angle discrete value of this matrix element, and multiply by M as weighted value (in the present embodiment with the inverse that the absolute value of subscript difference adds N; N=1, M=100).Yet those skilled in the art can design the weighted value of other weighted sum fully, as long as this weighted value is along with the increase of the absolute value of the angle discrete value difference of each primary election matrix element and other matrix elements and diminish.
After the accumulated value to above-mentioned primary election matrix element carries out above-mentioned weighted sum, select the maximum pairing angle discrete value of primary election matrix element of weighted sum value as the marginal direction parameter of bar code layers.For example, in the present embodiment, selection weighted sum value is 5252 primary election matrix element A [4,6] and the pairing angle discrete value of A [4,3] θ
4As the marginal direction parameter of the bar code layers among the present invention.
Through said method, through being carried out the Hough conversion, the separation on a plurality of bar code layers separatrix confirms the marginal direction of bar code layers, can improve the accuracy that bar code layers separatrix direction is confirmed.
In the above-described embodiments, only the present invention has been carried out exemplary description, but those skilled in the art can carry out various modifications to the present invention after reading present patent application under the situation that does not break away from the spirit and scope of the present invention.
Claims (8)
1. the bar code layers separatrix direction based on the Hough conversion is confirmed method, it is characterized in that, said bar code layers separatrix direction confirms that method comprises:
A. confirm scanning area and true origin;
B. confirm that according to said scanning area and said true origin bar code layers marginal position angle span and initial point are apart from span; And in the span of said position angle, select a plurality of angle discrete values, select in apart from span a plurality of at said initial point apart from discrete value;
C. obtain the rectangular coordinate of a plurality of layers of separation at least two bar code layers separatrix in the said scanning area; Respectively with rectangular coordinate and each said angle discrete value substitution formula ρ=xcos θ+ysin θ of said a plurality of layers of separation; To confirm that to each layer separation each said angle discrete value is pairing apart from discrete value; Wherein x, y are said rectangular coordinate, and θ is said angle discrete value, and ρ is that each said angle discrete value is pairing apart from discrete value;
D. utilize two-dimentional totalizer matrix that said angle discrete value and pairing is added up apart from discrete value, make the accumulated value of each matrix element in the said two-dimentional totalizer matrix represent the occurrence number of said angle discrete value and said correspondence combination apart from discrete value;
E. confirm each said matrix element maximum, and the matrix element of from the matrix element of said accumulated value maximum, selecting predetermined quantity is as the primary election matrix element apart from accumulated value in the pairing a plurality of matrix elements of discrete value;
F. the accumulated value of each said primary election matrix element and the accumulated value of other primary election matrix elements are carried out weighted sum, wherein the weighted value of weighted sum is by the difference decision of said each primary election matrix element and the pairing angle discrete value of said other matrix elements;
G. select the maximum pairing angle discrete value of primary election matrix element of weighted sum value as the marginal direction parameter of said bar code layers.
2. bar code layers according to claim 1 separatrix direction is confirmed method; It is characterized in that; In said step f, the absolute value of the angle discrete value difference of said each primary election matrix element and said other matrix elements is big more, and the weighted value of said weighted sum is more little.
3. bar code layers according to claim 1 separatrix direction is confirmed method, it is characterized in that said step a comprises:
A1. utilize multi-strip scanning line search bar code border, with definite bar code row border and with reference to col width;
A2. according to said bar code row border and saidly confirm said scanning area and said true origin with reference to col width.
4. bar code layers according to claim 3 separatrix direction is confirmed method; It is characterized in that; In said step a1; Confirm to be positioned at a plurality of black and white frontier points on each said sweep trace, utilize the spacing of said black and white frontier point to confirm said bar code border and said, and utilize the black and white frontier point on said a plurality of sweep trace to confirm said bar code row border near bar code inside with reference to col width.
5. bar code layers according to claim 4 separatrix direction is confirmed method; It is characterized in that; In said step a2; Chosen distance is first and second point of H on said bar code row border; Through said first and said second and perpendicular to the vertical line on said bar code row border on respectively chosen distance said first and said second for said with reference to col width thirdly reach the 4th point, and will be with said first point, said second point, it is said that thirdly to reach at said the 4th be that definite rectangular area, summit is as said scanning area.
6. bar code layers according to claim 5 separatrix direction is confirmed method; It is characterized in that; In said step a2; Said first with said thirdly perhaps said second said true origin of arranged outside with said the 4th defined zone boundary, the said zone boundary of said true origin distance is L.
7. bar code layers according to claim 6 separatrix direction is confirmed method; It is characterized in that, in said step b, confirm the azimuth angle theta of the said relatively true origin of vertical direction on said bar code row border '; And confirm said position angle span be (θ '-Δ θ 1; θ '+Δ θ 1), and confirm said initial point apart from span be (H, H+L).
8. bar code layers according to claim 7 separatrix direction is confirmed method, it is characterized in that, in said step b, said a plurality of angle discrete values increase progressively with the fixed angle step-length successively, said a plurality ofly increase progressively successively with the fixed range step-length apart from discrete value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010189239XA CN101882214B (en) | 2010-06-01 | 2010-06-01 | Method for determining directions of boundaries of bar code layers based on Hough transformation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010189239XA CN101882214B (en) | 2010-06-01 | 2010-06-01 | Method for determining directions of boundaries of bar code layers based on Hough transformation |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101882214A CN101882214A (en) | 2010-11-10 |
CN101882214B true CN101882214B (en) | 2012-05-23 |
Family
ID=43054226
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201010189239XA Expired - Fee Related CN101882214B (en) | 2010-06-01 | 2010-06-01 | Method for determining directions of boundaries of bar code layers based on Hough transformation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101882214B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102930265B (en) * | 2012-09-19 | 2015-07-29 | 广州市中崎商业机器有限公司 | A kind of many I.D.s scan method and device |
CN106909956B (en) * | 2017-02-28 | 2019-11-19 | 浙江华睿科技有限公司 | A kind of the boundary independent positioning method and device of one-dimension code |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100020970A1 (en) * | 2006-11-13 | 2010-01-28 | Xu Liu | System And Method For Camera Imaging Data Channel |
CN100456314C (en) * | 2007-05-31 | 2009-01-28 | 中国农业大学 | QR two-dimensional bar code recognition method based on pickup head for chatting |
CN101510268B (en) * | 2009-03-20 | 2011-12-21 | 南京航空航天大学 | Automatic identification method for secret related drawings |
-
2010
- 2010-06-01 CN CN201010189239XA patent/CN101882214B/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN101882214A (en) | 2010-11-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101882205A (en) | Bar code image scanning method | |
CN103438826B (en) | The three-dimension measuring system of the steel plate that laser combines with vision and method | |
CN101398907B (en) | Two-dimension code structure and decoding method for movable robot | |
CN101833641B (en) | Bar code decoding chip | |
CN101840496A (en) | One-dimensional barcode decoding chip | |
CN101833644B (en) | Correction graph searching method based on dynamic template | |
CN101908122A (en) | Bar space margin processing module, bar code identifying device and method thereof | |
CN102763121B (en) | Method for decoding a linear bar code | |
CN101882214B (en) | Method for determining directions of boundaries of bar code layers based on Hough transformation | |
CN104036424A (en) | Two-dimensional code based quick parts selection method and system | |
CN106022426A (en) | Method and system for generating two-dimensional code with color pattern | |
CN103196514A (en) | Image-based micro-chemical process liquid level detecting method | |
CN107016318A (en) | A kind of bar code decoding method and device | |
CN110533028A (en) | Detection method, device, electronic equipment and the storage medium of commodity display state | |
CN201927055U (en) | Barcode layer boundary direction determining device based on Hough transform | |
CN110263597A (en) | A kind of fast and accurately bearing calibration of QR code and system | |
CN111738389B (en) | Two-dimensional code generation method and generation system | |
CN101825970B (en) | Tracking method and tracking system of touch-control points | |
CN101833640A (en) | Module for calculating bar space boundary pixel points and calculating method thereof | |
CN101908124B (en) | Bar code border search method based on Hough transformation | |
CN108253932A (en) | A kind of coding method of digital level bar code scale and device | |
CN109214486A (en) | Three-dimension code, the generation method of three-dimension code and device, recognition methods and device | |
CN101882204A (en) | Matrix type two-dimensional bar code searching method | |
CN105373793A (en) | Vertex positioning method for QR code image geometric correction | |
CN202003368U (en) | Hough transformation-based bar-code boundary searching device |
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 | ||
CP03 | Change of name, title or address |
Address after: 350015 No. 1 Rujiangxi Road, Mawei District, Fuzhou City, Fujian Province Patentee after: NEWLAND DIGITAL TECHNOLOGY Co.,Ltd. Address before: 350015 New Continental Science Park No. 1 Rujiangxi Road, Mawei District, Fuzhou City, Fujian Province Patentee before: Fujian Newland Computer Co.,Ltd. |
|
CP03 | Change of name, title or address | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20120523 |
|
CF01 | Termination of patent right due to non-payment of annual fee |