CN110263597A - A kind of fast and accurately bearing calibration of QR code and system - Google Patents

A kind of fast and accurately bearing calibration of QR code and system Download PDF

Info

Publication number
CN110263597A
CN110263597A CN201910564802.8A CN201910564802A CN110263597A CN 110263597 A CN110263597 A CN 110263597A CN 201910564802 A CN201910564802 A CN 201910564802A CN 110263597 A CN110263597 A CN 110263597A
Authority
CN
China
Prior art keywords
image
vertex
coordinate
pixel coordinate
line
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
Application number
CN201910564802.8A
Other languages
Chinese (zh)
Other versions
CN110263597B (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.)
Shenzhen Youxiang Computing Technology Co Ltd
Original Assignee
Shenzhen Youxiang Computing 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 Shenzhen Youxiang Computing Technology Co Ltd filed Critical Shenzhen Youxiang Computing Technology Co Ltd
Priority to CN201910564802.8A priority Critical patent/CN110263597B/en
Publication of CN110263597A publication Critical patent/CN110263597A/en
Application granted granted Critical
Publication of CN110263597B publication Critical patent/CN110263597B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/146Methods for optical code recognition the method including quality enhancement steps
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/146Methods for optical code recognition the method including quality enhancement steps
    • G06K7/1473Methods for optical code recognition the method including quality enhancement steps error correction

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The present invention provides a kind of fast and accurately bearing calibration of QR code and system, comprising: is scanned to the binary image A (x, y) of QR code, obtains the center pixel coordinate of three position sensing figures in image A (x, y);Seek the first kind pixel coordinate on the 4th vertex in image A (x, y);Seek the second class pixel coordinate on the 4th vertex in image A (x, y);The first kind pixel coordinate on the 4th vertex in image A (x, y) is weighted and averaged with the second class pixel coordinate, obtains the pixel coordinate on the 4th vertex in image A (x, y);Anti- perspective transform is carried out to four vertex in image A (x, y), obtains the standard pixel coordinate on four vertex;Perspective transformation matrix is sought according to the original pixel coordinate Yu standard pixel coordinate on four vertex in image A (x, y), and the standard picture after being corrected.Its calculating process is simple and more accurate, can effectively make up the deficiency of existing QR code bearing calibration, have very high practical value.The present invention is applied to image procossing, technical field of computer vision.

Description

A kind of fast and accurately bearing calibration of QR code and system
Technical field
The present invention relates to image procossings, technical field of computer vision, more particularly to a kind of fast and accurately QR code to correct Method and system.
Background technique
With the arriving of information age, the progress of computer science and the intelligence of mobile phone, barcode technology meet the tendency of and It is raw.Barcode technology is a kind of important method that information automation obtains.Bar code stores the difference of dimension according to its information, usually has Point of bar code and two-dimensional bar code.For bar code, not only memory capacity is big for two-dimensional bar code, secrecy ability it is strong and And low in cost, good reliability.
China starts from the last century 90's for the exploration of 2D bar code technology, starts late.But due to section, China The rapid development of technology, the rapid rising of logistic industry and popularizing for smart phone, 2D bar code technology is answered China With further extensively.Currently, being QR code in the two-dimensional bar code that China occupies staple market.QR code is one of matrix two-dimensional barcode, QR is " Quick Response ", the meaning with fast reaction.QR code is first and directly encodes to non-English character Bar code, therefore the bar code is mainly used in China, Japan, many Asian countries such as South Korea.
The main task of QR code identification is to carry out a series of calculation process to collected QR code image, to obtain it Included in information.Entire identifying system mainly includes 3 parts: Image Pretreatment Algorithm, location algorithm and correcting algorithm These three aspects.Wherein correcting algorithm is essential key component.This is because QR code during Image Acquisition by The error caused by the error and environmental factor and human factor of acquisition equipment itself, so that collected QR code image is past Toward there are the distortions of various linearity and non-linearities.These distortions can generate tremendous influence to the precision of image.
Correcting algorithm mostly uses Hough transform to obtain the marginal information and tilt angle of image at present, and effect is general, quasi- Exactness is not high, directly affects subsequent decoding process.
Summary of the invention
Aiming at the shortcomings in the prior art, the object of the present invention is to provide a kind of fast and accurately QR code bearing calibration and it is System.
Itself the technical solution adopted is that:
A kind of fast and accurately QR code bearing calibration, the following steps are included:
Step 101, cluster is scanned to the binary image A (x, y) of QR code, obtains three vertex in image A (x, y) Pixel coordinate, i.e., the center pixel coordinate of three position sensing figures in QR code image;
Step 102, according to the pixel coordinate and parallelogram law on three vertex in image A (x, y), image is sought The first kind pixel coordinate on the 4th vertex in A (x, y);
Step 103, the peripheral straight line of image A (x, y), root are sought according to the pixel coordinate on three vertex in image A (x, y) The 4th vertex in image A (x, y) is sought according to the pixel coordinate on three vertex in image A (x, y) and the slope of peripheral straight line The second class pixel coordinate;
Step 104, the first kind pixel coordinate to the 4th vertex in image A (x, y) and the second class pixel coordinate carry out Weighted average obtains the pixel coordinate on the 4th vertex in image A (x, y);
Step 105, anti-perspective transform is carried out to four vertex in image A (x, y), obtains the standard pixel on four vertex Coordinate;
Step 106, perspective is sought according to the original pixel coordinate Yu standard pixel coordinate on four vertex in image A (x, y) to become Matrix is changed, and the standard picture after being corrected according to perspective transformation matrix.
It is further preferred that the binary image A (x, y) to QR code is scanned cluster in step 101, obtain The pixel coordinate on three vertex in image A (x, y), specifically:
Step 201, image A (x, y) is scanned line by line, will be connected with the identical pixel of adjacent and color in a line Come, forms the line segment of several black and white in each row;
Step 202, filtering out continuous and length ratio in every a line is five line segments of 1:1:3:1:1 as a row Line segment group, the starting pixels coordinate for filtering out the line segment that each line Duan Zuzhong length ratio is 3 clusters coordinate as row, right All row cluster coordinates carry out capable cluster by condition of mutual distance, and taking includes row cluster coordinate quantity at first three Three classifications are as row scanning result;
Step 203, image A (x, y) is scanned by column, the identical pixel of adjacent in same row and color is connected Come, forms the line segment of several black and white in each column;
Step 204, five line segments that continuous and length ratio in each column is 1:1:3:1:1 are filtered out to arrange as one Line segment group, the starting pixels coordinate for filtering out the line segment that each alignment Duan Zuzhong length ratio is 3 clusters coordinate as column, right All column cluster coordinates carry out column cluster by condition of mutual distance, and taking includes column cluster coordinate quantity at first three Three classifications are as column scan result;
Step 205, the intersection for seeking row scanning result Yu column scan result obtains the bianry image of three clusters, calculates Out three cluster bianry image center pixel coordinate, that is, image A (x, y) in three vertex pixel coordinate.
It is further preferred that row cluster coordinate carries out row less than 4 with mutual distance for condition and gathers in step 202 Class;In step 204, column cluster coordinate carries out column cluster less than 4 with mutual distance for condition.
It is further preferred that in step 102, the first kind pixel coordinate on the 4th vertex in described image A (x, y) are as follows:
Dot4_1=(x04_1,y04_1)=(x02+x03-x01,y02+y03-y01)
In formula, (x04_1,y04_1) be the 4th vertex in image A (x, y) first kind pixel coordinate;(x01,y01) it is figure As the pixel coordinate of first vertex dot1 in A (x, y);(x02,y02) be second vertex dot2 in image A (x, y) pixel Coordinate;(x03,y03) be third vertex dot3 in image A (x, y) pixel coordinate, wherein point dot2 and point dot3 are located at QR On a diagonal line in code image.
It is further preferred that the step 103 specifically includes:
Step 301, the column where point dot1 are scanned from bottom to up, the starting pixels for recording second of black line segment are sat Mark (x01 1,y01), the column where point dot2 are scanned from bottom to up, record the starting pixels coordinate of second of black line segment (x02 2,y02), and seek the slope angle, θ of line between point dot1 and point dot212
Step 302, with θ12Centered on, 0.1 degree of step-length is fluctuated, whole to be no more than 1 degree, acquisition includes 21 angle values Slope angle set;
Step 303, with point (x01 1,y01) be on straight line a bit, respectively using slope angle set 21 angle values as slope Angle obtains 21 straight lines;
Step 304, with point (x02 2,y02) be on straight line a bit, respectively using slope angle set 21 angle values as slope Angle obtains 21 straight lines, in conjunction with the straight line obtained in step 303 totally 42 straight lines;
Step 305, straight line most with image A (x, y) intersection in 42 straight lines is filtered out as point dot1 and point dot2 Between peripheral straight line, and record its slope n θ12
Step 306, the periphery between point dot1 and point dot3 is obtained directly using the same method of step 301- step 305 Line, and record its slope n θ13
Step 307, remembered according to the slope of the pixel coordinate of three vertex dot1, dot2 and dot3 and two peripheral straight lines For n θ12With n θ13, it can be in the hope of the last one apex coordinate of a quadrangle, i.e. the of the 4th vertex in image A (x, y) Two class pixel coordinate dot4_2 (x04_2,y04_2)。
It is further preferred that in step 104, the pixel coordinate on the 4th vertex in image A (x, y) are as follows:
Ndot4=t × dot4_1+ (1-t) × dot4_2
In formula, t is weighted factor.
It is further preferred that in step 105, the standard pixel coordinate on four vertex be dot1 '=(4,4), dot2 '= (4, LTH-3), dot3 '=(LTH-3,4), dot4 '=(LTH-3, LTH-3), wherein LTH is the side length of standard picture.
It is further preferred that the finding process of the side length LTH of the standard picture are as follows:
Step 401, the side length lth of image A (x, y) is sought:
In formula,Indicate the overall length of all line segments in same row or column, v (i) indicates line section group in the row or column Or the length of first line segment of alignment Duan Zuzhong;
Step 402, immediate integer is found as LTH in 4 incremental arrays to lth.
A kind of fast and accurately QR code correction system, including memory and processor, the memory are stored with computer The step of program, the processor realizes the above method when executing the computer program.
Advantageous effects of the invention:
The present invention passes through the method based on parallelogram law and the side based on QR code image periphery straight line information respectively Method seeks the pixel coordinate on the 4th vertex in QR code image, and two kinds of pixel coordinates on the 4th vertex are then weighted place Reason obtains final coordinate, and obtains perspective transformation matrix by the pixel coordinate on four vertex, finally according to perspective transform square Battle array can be corrected QR code original image, and calculating process is simple and more accurate, can effectively make up existing QR code school The deficiency of correction method has very high practical value.
Detailed description of the invention
Fig. 1 is QR code sign structural schematic diagram in the present embodiment;
Fig. 2 is the structural schematic diagram of QR code position detection figure in the present embodiment;
Fig. 3 is the flow diagram of fast and accurately QR code bearing calibration;
Fig. 4 is the finding process flow diagram of the pixel coordinate on three vertex;
Fig. 5 is the relation schematic diagram of three kinds of cluster centres in the present embodiment;
Fig. 6 is the finding process flow diagram of the second class pixel coordinate on the 4th vertex.
Specific embodiment
In order to which the purposes, technical schemes and advantages of the disclosure are more clearly understood, under in conjunction with specific embodiments, and according to Attached drawing, the present invention is described in more detail.It should be noted that in attached drawing or specification description, the content that does not describe with And part English is abbreviated as content known to those of ordinary skill in technical field.The some spies given in the present embodiment Parameter is determined only as demonstration, and the value can change accordingly to suitably be worth in various embodiments.
The binary image A (x, y) comprising QR code Jing Guo Primary Location is read in, in the collection process of QR code image, Generally there are a degree of burr and a small amount of noise in image vertex after positioning.Therefore, if directly passing through scanning Entire image, and the vertex for the outermost that will acquire can be generated directly as the outermost point in the identification process in QR code region Great error.
As shown in Figs. 1-2, QR code sign is a two-dimensional bar code array being made of a series of square modules, wherein Position sensing figure is successively with 1:1:3:1:1 depth checker, and this property is not too serious and any in anamorphose It is stabilized in the case where rotation.
The present embodiment finds 3 according to the characteristics of QR code image by carrying out scanning line by line to entire image Then vertex is obtained the coordinate on the 4th vertex by two different methods, is weighted and averaged to two times result, meter is improved The precision for calculating result calculates transformation matrix finally by the coordinate on this 4 vertex, and is completed according to transformation matrix to QR code image Correction, with reference to Fig. 3, specifically includes the following steps:
Step 101, cluster is scanned to the binary image A (x, y) of QR code, obtains three vertex in image A (x, y) Pixel coordinate, i.e., the center pixel coordinate of three position sensing figures in QR code image;
Step 102, according to the pixel coordinate and parallelogram law on three vertex in image A (x, y), image is sought The first kind pixel coordinate on the 4th vertex in A (x, y);
Step 103, the peripheral straight line of image A (x, y), root are sought according to the pixel coordinate on three vertex in image A (x, y) The 4th vertex in image A (x, y) is sought according to the pixel coordinate on three vertex in image A (x, y) and the slope of peripheral straight line The second class pixel coordinate, wherein the image A (x, y) that the peripheral straight line of image A (x, y) refers to is after removing surrounding margins region Contour line;
Step 104, the first kind pixel coordinate to the 4th vertex in image A (x, y) and the second class pixel coordinate carry out Weighted average obtains the pixel coordinate on the 4th vertex in image A (x, y);
Step 105, anti-perspective transform is carried out to four vertex in image A (x, y), obtains the standard pixel on four vertex Coordinate;
Step 106, perspective is sought according to the original pixel coordinate Yu standard pixel coordinate on four vertex in image A (x, y) to become Matrix is changed, and the standard picture after being corrected according to perspective transformation matrix.
With reference to Fig. 4, in a step 101, cluster is scanned to the binary image A (x, y) of QR code, obtain image A (x, Y) pixel coordinate on three vertex in, specifically:
Step 201, image A (x, y) is scanned line by line, will be connected with the identical pixel of adjacent and color in a line Come, since the pixel of binary image A (x, y) is non-black i.e. white, forms the line of several black and white in each row Section;
Step 202, filtering out continuous and length ratio in every a line is five line segments of 1:1:3:1:1 as a row Line segment group, the starting pixels coordinate for filtering out the line segment that each line Duan Zuzhong length ratio is 3 clusters coordinate as row, right All row cluster coordinates carry out capable cluster by condition of mutual distance, and taking includes row cluster coordinate quantity at first three Three classifications are as row scanning result;
By taking the first row as an example, it is assumed that the first row is divided into m line segment, and the number of pixels of each line segment is indicated with one-dimensional vector V=(v1,v2,...,vm), if it find that the ratio between the number of pixels of some line segment and 4 line segments thereafter meets 1:1:3:1:1 When, namely there are some serial number i, so that
V (i): v (i+1): v (i+2): v (i+3): v (i+4)=1:1:3:1:1
The starting pixels coordinate of the line segment of serial number i+2 is filtered out as row cluster coordinate, the row in every a line is gathered Class coordinate is summarized and is clustered, and is taken comprising row cluster coordinate quantity in first three three classifications as row scanning result, wherein Row cluster coordinate carries out capable cluster less than 4 with mutual distance for condition, and therefore, three obtained row scanning result exists The cluster of the pixel coordinate of three obtained position sensing figure in the case where progressive scan.
Step 203, image A (x, y) is scanned by column, the identical pixel of adjacent in same row and color is connected Come, forms the line segment of several black and white in each column;
Step 204, five line segments that continuous and length ratio in each column is 1:1:3:1:1 are filtered out to arrange as one Line segment group, the starting pixels coordinate for filtering out the line segment that each alignment Duan Zuzhong length ratio is 3 clusters coordinate as column, right All column cluster coordinates carry out column cluster less than 4 with mutual distance for condition, take and exist comprising column cluster coordinate quantity Three classifications of first three are as column scan result;Principle identical with step 201-202, the result of three obtained column scan here I.e. in the case where scanning by column the pixel coordinate of three obtained position sensing figure cluster.
Step 205, the intersection for seeking row scanning result Yu column scan result obtains the bianry image of three clusters, calculates Out in center pixel coordinate, that is, image A (x, y) of the bianry image of three clusters three vertex pixel coordinate, i.e. QR code figure In three position sensing figures center pixel coordinate;With reference to Fig. 5, in the present embodiment, three are indicated with dot1, dot2 and dot3 The central pixel point of a position sensing figure, wherein point dot2 and dot3 are located on a diagonal line in QR code image, specifically Finding process are as follows:
In formula, N1It is the total number of all pixels point in first cluster intersection;x′1With y '1It is that first cluster is handed over respectively The transverse and longitudinal coordinate of each pixel is concentrated, remembers dot1=(x01,y01) be first cluster intersection center pixel, i.e., first A vertex;Same method can cluster the center pixel dot2=(x of intersection in the hope of second02,y02), i.e. second vertex; With the center pixel dot3=(x of third cluster intersection03,y03), i.e. third vertex.
In a step 102, in image A (x, y) the 4th vertex first kind pixel coordinate are as follows:
Dot4_1=(x04_1,y04_1)=(x02+x03-x01,y02+y03-y01)
In formula, (x04_1,y04_1) be the 4th vertex in image A (x, y) first kind pixel coordinate;(x01,y01) it is figure As the pixel coordinate of first vertex dot1 in A (x, y);(x02,y02) be second vertex dot2 in image A (x, y) pixel Coordinate;(x03,y03) be third vertex dot3 in image A (x, y) pixel coordinate, wherein point dot2 and point dot3 are located at QR On a diagonal line in code image.
With reference to Fig. 6, in step 103, according to the peripheral information of QR bar code, peripheral slope is calculated, is then pushed up according to 3 The coordinate information of dot1, dot2 and dot3, peripheral slope information, calculate the second class pixel coordinate on the 4th vertex, process Include:
Step 301, two o'clock dot1 and dot2 group is in alignment, the column where point dot1 are swept from bottom to up It retouches, can successively pass through black line segment, white line section, black line segment, record the starting pixels coordinate (x of second of black line segment01 1,y01);Similarly Column where point dot2 are scanned from bottom to up, also can successively pass through black line segment, white line section, black line segment, record second Starting pixels coordinate (the x of secondary black line segment02 2,y02), while seeking the slope angle, θ of line between point dot1 and point dot212
Step 302, with θ12Centered on, 0.1 degree of step-length is fluctuated, whole to be no more than 1 degree, acquisition includes 21 angle values Slope angle set, specially { θ12-1,θ12-0.9,θ12-0.8,...,θ12-0.1,θ1212+0.1,...,θ12+0.8,θ12+ 0.9,θ12+1};
Step 303, with point (x01 1,y01) be on straight line a bit, respectively using slope angle set 21 angle values as slope Angle obtains 21 straight lines;
Step 304, with point (x02 2,y02) be on straight line a bit, respectively using slope angle set 21 angle values as slope Angle obtains 21 straight lines, in conjunction with the straight line obtained in step 303 totally 42 straight lines;
Step 305, straight line most with image A (x, y) intersection in 42 straight lines is filtered out as point dot1 and point dot2 Between peripheral straight line, and record its slope n θ12
Step 306, the periphery between point dot1 and point dot3 is obtained directly using the same method of step 301- step 305 Line, and record its slope n θ13
Step 307, remembered according to the slope of the pixel coordinate of three vertex dot1, dot2 and dot3 and two peripheral straight lines For n θ12With n θ13, it can be in the hope of the last one apex coordinate of a parallelogram, i.e. the 4th vertex in image A (x, y) The second class pixel coordinate dot4_2 (x04_2,y04_2)。
At step 104, in image A (x, y) the 4th vertex pixel coordinate are as follows:
Ndot4=t × dot4_1+ (1-t) × dot4_2.
In step 105, under the premise of known four vertex dot1, dot2, dot3 and dot4, available four The standard pixel coordinate on vertex be dot1 '=(4,4), dot2 '=(4, LTH-3), dot3 '=(LTH-3,4), dot4 '= (LTH-3, LTH-3), wherein LTH is the side length of standard picture, and standard picture is the square of LTH × LTH, wherein standard drawing The finding process of the side length LTH of picture are as follows:
Step 401, the side length lth of image A (x, y) is sought:
In formula,Indicate the overall length of all line segments in same row or column, v (i) indicates line section group in the row or column Or the length of first line segment of alignment Duan Zuzhong;
Step 402, immediate integer is found as LTH in 4 incremental arrays to lth.Wherein, it is incremented by with 4 Array is { 1,5,9,13,17,21,25,29 ..., 177 }, such as when lth is 24.1, then LTH is immediate integer It is exactly 25.
In step 106, the relationship of the standard picture after original image, perspective transformation matrix and correction are as follows:
In formula, the coordinate of original image is (x, y), and the coordinate of standard picture is (p, q), and H is perspective transformation matrix, and ω is Scale factor;
Wherein, perspective transformation matrix can be calculated according to the original pixel coordinate on four vertex and standard pixel coordinate.
Contain the explanation of the preferred embodiment of the present invention above, this be for the technical characteristic that the present invention will be described in detail, and Be not intended to for summary of the invention being limited in concrete form described in embodiment, according to the present invention content purport carry out other Modifications and variations are also protected by this patent.The purport of the content of present invention is to be defined by the claims, rather than by embodiment Specific descriptions are defined.

Claims (9)

1. a kind of fast and accurately QR code bearing calibration, which comprises the following steps:
Step 101, cluster is scanned to the binary image A (x, y) of QR code, obtains the picture on three vertex in image A (x, y) Plain coordinate, i.e., the center pixel coordinate of three position sensing figures in QR code image;
Step 102, according to the pixel coordinate and parallelogram law on three vertex in image A (x, y), seek image A (x, Y) first kind pixel coordinate on the 4th vertex in;
Step 103, the peripheral straight line that image A (x, y) is sought according to the pixel coordinate on three vertex in image A (x, y), according to figure As the pixel coordinate on three vertex in A (x, y) and the slope of peripheral straight line seek in image A (x, y) the of the 4th vertex Two class pixel coordinates;
Step 104, the first kind pixel coordinate on the 4th vertex in image A (x, y) is weighted with the second class pixel coordinate It is average, obtain the pixel coordinate on the 4th vertex in image A (x, y);
Step 105, anti-perspective transform is carried out to four vertex in image A (x, y), the standard pixel for obtaining four vertex is sat Mark;
Step 106, perspective transform square is sought according to the original pixel coordinate Yu standard pixel coordinate on four vertex in image A (x, y) Battle array, and the standard picture after being corrected according to perspective transformation matrix.
2. fast and accurately QR code bearing calibration according to claim 1, which is characterized in that described to QR code in step 101 Binary image A (x, y) be scanned cluster, obtain the pixel coordinate on three vertex in image A (x, y), specifically:
Step 201, image A (x, y) is scanned line by line, will be connected with the identical pixel of adjacent and color in a line, The line segment of several black and white is formed in each row;
Step 202, filtering out continuous and length ratio in every a line is five line segments of 1:1:3:1:1 as a line section Group filters out the starting pixels coordinate for the line segment that each line Duan Zuzhong length ratio is 3 as row cluster coordinate, to all Row cluster coordinate by condition of mutual distance carry out capable cluster, take and cluster coordinate quantity in first three three comprising row Classification is as row scanning result;
Step 203, image A (x, y) is scanned by column, the identical pixel of adjacent in same row and color is connected, The line segment of several black and white is formed in each column;
Step 204, filtering out continuous and length ratio in each column is five line segments of 1:1:3:1:1 as an alignment section Group filters out the starting pixels coordinate for the line segment that each alignment Duan Zuzhong length ratio is 3 as column cluster coordinate, to all Column cluster coordinate by condition of mutual distance carry out column cluster, take and cluster coordinate quantity in first three three comprising column Classification is as column scan result;
Step 205, the intersection for seeking row scanning result Yu column scan result obtains the bianry image of three clusters, calculates three The pixel coordinate on three vertex in center pixel coordinate, that is, image A (x, y) of the bianry image of a cluster.
3. fast and accurately QR code bearing calibration according to claim 2, which is characterized in that in step 202, row cluster coordinate It is clustered with mutual distance less than 4 for condition;In step 204, column cluster coordinate is with mutual distance less than 4 Column cluster is carried out for condition.
4. fast and accurately QR code bearing calibration according to claim 1, which is characterized in that in step 102, described image A The first kind pixel coordinate on the 4th vertex in (x, y) are as follows:
Dot4_1=(x04_1,y04_1)=(x02+x03-x01,y02+y03-y01)
In formula, (x04_1,y04_1) be the 4th vertex in image A (x, y) first kind pixel coordinate;(x01,y01) it is image A The pixel coordinate of first vertex dot1 in (x, y);(x02,y02) it is that the pixel of second vertex dot2 in image A (x, y) is sat Mark;(x03,y03) be third vertex dot3 in image A (x, y) pixel coordinate, wherein point dot2 and point dot3 are located at QR code On a diagonal line in image.
5. fast and accurately QR code bearing calibration according to claim 4, which is characterized in that the step 103 specifically includes:
Step 301, the column where point dot1 are scanned from bottom to up, record the starting pixels coordinate of second of black line segment (x01 1,y01), the column where point dot2 are scanned from bottom to up, record the starting pixels coordinate (x of second of black line segment02 2, y02), and seek the slope angle, θ of line between point dot1 and point dot212
Step 302, with θ12Centered on, 0.1 degree of step-length is fluctuated, whole to be no more than 1 degree, acquisition includes the slope of 21 angle values Angle set;
Step 303, with point (x01 1,y01) be on straight line a bit, respectively using slope angle gather 21 angle values as slope angle Degree, obtains 21 straight lines;
Step 304, with point (x02 2,y02) be on straight line a bit, respectively using slope angle gather 21 angle values as slope angle Degree, obtains 21 straight lines, in conjunction with the straight line obtained in step 303 totally 42 straight lines;
Step 305, straight line most with image A (x, y) intersection in 42 straight lines is filtered out as between point dot1 and point dot2 Peripheral straight line, and record its slope n θ12
Step 306, the peripheral straight line between point dot1 and point dot3 is obtained using the same method of step 301- step 305, and Record its slope n θ13
Step 307, n θ is denoted as according to the slope of the pixel coordinate of three vertex dot1, dot2 and dot3 and two peripheral straight lines12 With n θ13, it can be in the hope of the last one apex coordinate of a quadrangle, i.e. the second class picture on the 4th vertex in image A (x, y) Plain coordinate dot4_2 (x04_2,y04_2)。
6. fast and accurately QR code bearing calibration according to claim 5, which is characterized in that in step 104, image A (x, y) In the 4th vertex pixel coordinate are as follows:
Ndot4=t × dot4_1+ (1-t) × dot4_2
In formula, t is weighted factor.
7. fast and accurately QR code bearing calibration according to claim 2, which is characterized in that in step 105, four vertex Standard pixel coordinate be dot1 '=(4,4), dot2 '=(4, LTH-3), dot3 '=(LTH-3,4), dot4 '=(LTH-3, LTH-3), wherein LTH is the side length of standard picture.
8. fast and accurately QR code bearing calibration according to claim 7, which is characterized in that the side length of the standard picture The finding process of LTH are as follows:
Step 401, the side length lth of image A (x, y) is sought:
In formula,Indicate the overall length of all line segments in same row or column, v (i) indicates line section group or column in the row or column The length of first line segment in line segment group;
Step 402, immediate integer is found as LTH in 4 incremental arrays to lth.
9. a kind of fast and accurately QR code corrects system, including memory and processor, the memory are stored with computer journey Sequence, which is characterized in that the processor realizes any one of claims 1 to 8 the method when executing the computer program The step of.
CN201910564802.8A 2019-06-27 2019-06-27 Quick and accurate QR (quick response) code correction method and system Active CN110263597B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910564802.8A CN110263597B (en) 2019-06-27 2019-06-27 Quick and accurate QR (quick response) code correction method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910564802.8A CN110263597B (en) 2019-06-27 2019-06-27 Quick and accurate QR (quick response) code correction method and system

Publications (2)

Publication Number Publication Date
CN110263597A true CN110263597A (en) 2019-09-20
CN110263597B CN110263597B (en) 2022-08-19

Family

ID=67922064

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910564802.8A Active CN110263597B (en) 2019-06-27 2019-06-27 Quick and accurate QR (quick response) code correction method and system

Country Status (1)

Country Link
CN (1) CN110263597B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113378595A (en) * 2020-03-10 2021-09-10 顺丰科技有限公司 Two-dimensional code positioning method, device, equipment and storage medium
CN114140330A (en) * 2021-11-26 2022-03-04 武汉理工大学 Bar code correction method and device based on perspective coordinate transformation and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070071320A1 (en) * 2005-09-20 2007-03-29 Fuji Xerox Co., Ltd. Detection method of two-dimensional code, detection device for the same, and storage medium storing detection program for the same
CN101398895A (en) * 2007-09-26 2009-04-01 杨高波 Image preprocess method based on data matrix two-dimension bar code identification

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070071320A1 (en) * 2005-09-20 2007-03-29 Fuji Xerox Co., Ltd. Detection method of two-dimensional code, detection device for the same, and storage medium storing detection program for the same
CN101398895A (en) * 2007-09-26 2009-04-01 杨高波 Image preprocess method based on data matrix two-dimension bar code identification

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113378595A (en) * 2020-03-10 2021-09-10 顺丰科技有限公司 Two-dimensional code positioning method, device, equipment and storage medium
CN113378595B (en) * 2020-03-10 2023-09-22 顺丰科技有限公司 Two-dimensional code positioning method, device, equipment and storage medium
CN114140330A (en) * 2021-11-26 2022-03-04 武汉理工大学 Bar code correction method and device based on perspective coordinate transformation and electronic equipment

Also Published As

Publication number Publication date
CN110263597B (en) 2022-08-19

Similar Documents

Publication Publication Date Title
CN107633192B (en) Bar code segmentation and reading method based on machine vision under complex background
US10679175B2 (en) Two-dimensional code, system for creation of two-dimensional code, and analysis program
CN100390807C (en) Trilateral poly-dimensional bar code easy for omnibearing recognition and reading method thereof
CN107609451A (en) A kind of high-precision vision localization method and system based on Quick Response Code
CN105989317B (en) Two-dimensional code identification method and device
US20150339508A1 (en) Two-dimensional code
CN104346597B (en) A kind of QR codes detection and correction extracting method and IP kernel
US9898637B2 (en) Two-dimensional code
CN105095822B (en) A kind of Chinese letter co pattern image detection method and system
KR20150044848A (en) Method for decoding matrix-type two-dimensional code
CN112801094B (en) Pointer instrument image inclination correction method
CN101794404A (en) Method for coding and reading invisible two-dimensional codes
CN103593826A (en) Image ring artifact correcting method
CN113506276B (en) Marker and method for measuring structural displacement
CN101882220B (en) Bar code image correction method based on dynamic template and method for acquiring correction point
CN105095937B (en) A kind of visual identity method of the circular array graphic code based on straight line cluster
CN102763121B (en) Method for decoding a linear bar code
CN110263597A (en) A kind of fast and accurately bearing calibration of QR code and system
CN101833644A (en) Correction graph searching method based on dynamic template
CN114399677A (en) Pointer instrument identification method based on text region reading
CN112184825B (en) Calibration plate and calibration method
CN103413319A (en) Industrial camera parameter on-site calibration method
CN111583191B (en) Light field EPI Fourier transform-based refraction characteristic detection method
CN101882213B (en) Method for sampling barcode images
CN101908144B (en) Bar code image correction method and correction point acquisition method

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