WO2020220388A1 - Qr code recognition method and apparatus, qr code generation method and apparatus, qr code and trolley - Google Patents

Qr code recognition method and apparatus, qr code generation method and apparatus, qr code and trolley Download PDF

Info

Publication number
WO2020220388A1
WO2020220388A1 PCT/CN2019/086158 CN2019086158W WO2020220388A1 WO 2020220388 A1 WO2020220388 A1 WO 2020220388A1 CN 2019086158 W CN2019086158 W CN 2019086158W WO 2020220388 A1 WO2020220388 A1 WO 2020220388A1
Authority
WO
WIPO (PCT)
Prior art keywords
center
rotation angle
graphic
dimensional code
positioning
Prior art date
Application number
PCT/CN2019/086158
Other languages
French (fr)
Chinese (zh)
Inventor
杨树森
周韬宇
孙宇
Original Assignee
上海快仓智能科技有限公司
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 上海快仓智能科技有限公司 filed Critical 上海快仓智能科技有限公司
Priority to JP2021559117A priority Critical patent/JP7289927B2/en
Publication of WO2020220388A1 publication Critical patent/WO2020220388A1/en

Links

Images

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/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • 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/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1443Methods for optical code recognition including a method step for retrieval of the optical code locating of the code in an image
    • 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/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1456Methods for optical code recognition including a method step for retrieval of the optical code determining the orientation of the optical code with respect to the reader and correcting therefore

Definitions

  • the invention relates to the technical field of two-dimensional codes, in particular to a method, device, two-dimensional code and a small car for identifying and generating a two-dimensional code.
  • the existing two-dimensional code recognition technology obtains the two-dimensional code image by scanning and shooting, etc., to read the coding information carried in the coding area of the two-dimensional code.
  • the acquired two-dimensional code image usually has an angular offset.
  • the two-dimensional code image may be reversed and the coding area is also reversed.
  • the encoding information read based on the encoding area of the current angle is wrong. Therefore, it is necessary to determine at least three positioning blocks on the top of the two-dimensional code through image processing, and then determine the rotation angle based on these positioning blocks, and further determine the content of the encoding area of the two-dimensional code through image processing.
  • the existing technology relies on the recognition of image processing technology, and the amount of calculation is very large.
  • the embodiment of the present invention provides a method, device, two-dimensional code and trolley for recognizing and generating a two-dimensional code to solve one or more technical problems in the prior art.
  • an embodiment of the present invention provides a two-dimensional code recognition method, where the two-dimensional code includes a center positioning pattern and a rotation angle positioning pattern; the method includes:
  • the center positioning pattern includes a first center positioning pattern and a second center positioning pattern, and the center position of the first center positioning pattern and the center position of the second center positioning pattern are both the same as those of the The center positions of the two-dimensional codes coincide;
  • the determining center positioning graphic includes:
  • the determining the center position of the two-dimensional code according to the center positioning graphic includes:
  • the center position of the second center positioning graphic is determined as the center position of the two-dimensional code.
  • the second center positioning graphic is circular
  • the step of using the center position of the second center positioning graphic as a seed point for region growth, and determining the second center positioning graphic includes:
  • the determining the center position of the second center positioning graphic as the center position of the two-dimensional code includes:
  • the center position of the second center positioning pattern is determined as the center position of the two-dimensional code.
  • the first center positioning figure is a circular ring
  • the recognizing the first center positioning graphic includes:
  • the determining the center position of the first center positioning graphic according to the first center positioning graphic includes:
  • the determining the position of the rotation angle positioning graphic according to the center position of the two-dimensional code includes:
  • the determining the rotation angle of the two-dimensional code according to the position of the rotation angle positioning graphic includes:
  • the determining the preset edge point of the current rotation angle positioning graph includes:
  • the position of the preset edge point of the current rotation angle positioning graph is determined.
  • the two-dimensional code includes an encoding area and a rotation angle auxiliary graphic, wherein the encoding area includes encoding information, and the method further includes:
  • the two-dimensional code includes a coding area, wherein the coding area includes coding information, and the two-dimensional code lays out the coding information in a polar coordinate manner, and the method further includes:
  • the determining the coding area according to the center position of the two-dimensional code includes:
  • the center position of the two-dimensional code determine a number of code information collection circles with different preset radii; wherein, the code information collection circle is located in the code area;
  • the identifying the encoding information according to the encoding area and the rotation angle includes:
  • an embodiment of the present invention provides a method for generating a two-dimensional code.
  • the two-dimensional code includes a center positioning graphic, a rotation angle positioning graphic, and an encoding area; wherein the encoding area includes encoding information; the method includes:
  • the position of the center positioning pattern, the position of the rotation angle positioning pattern, and the position of the encoding area, the center positioning pattern, the rotation angle positioning pattern, and the encoding area are generated, in the encoding area Write the coding information to generate the two-dimensional code so that the center of the center positioning graphic coincides with the center position of the two-dimensional code, and a plurality of preset edge points on the rotation angle positioning graphic are set at In a predetermined angular orientation relative to the center position, the plurality of preset edge points are on the same virtual circle centered on the center position of the two-dimensional code, and the coding area is located between the center positioning graphic and the two The position between the center positions of the dimension code.
  • the center positioning pattern includes a first center positioning pattern and a second center positioning pattern, and the center position of the first center positioning pattern and the center position of the second center positioning pattern are both the same as those of the The center positions of the two-dimensional codes coincide;
  • the first center positioning pattern is a circle;
  • the second center positioning pattern is a circle;
  • the coding area is ring-shaped, and the coding area is located in an area between the first center positioning pattern and the second center positioning pattern;
  • the rotation angle positioning graphics include at least two, and there are at least two rotation angle positioning graphics that are not center-symmetric about the center position of the two-dimensional code.
  • the two-dimensional code further includes a rotation angle auxiliary graphic
  • the rotation angle auxiliary graphic includes a plurality of positioning circles
  • the method further includes:
  • the rotation angle auxiliary graphic is generated according to the position of the rotation angle auxiliary graphic.
  • an embodiment of the present invention provides a two-dimensional code recognition device, the two-dimensional code includes a center positioning pattern and a rotation angle positioning pattern; the device includes:
  • the central positioning graphic determining module is used to determine the central positioning graphic
  • a center position determination module configured to determine the center position of the two-dimensional code according to the center positioning graph
  • a rotation angle graphic determination module configured to determine the position of the rotation angle positioning graphic according to the center position of the two-dimensional code
  • the rotation angle determination module determines the rotation angle of the two-dimensional code according to the position of the rotation angle positioning graphic.
  • the center positioning pattern includes a first center positioning pattern and a second center positioning pattern, and the center position of the first center positioning pattern and the center position of the second center positioning pattern are both the same as those of the The center position of the QR code coincides;
  • the central positioning graphic determining module includes:
  • a first center positioning graphic unit for identifying the first center positioning graphic
  • the first center positioning graphic center unit is used to determine the center position of the first center positioning graphic according to the first center positioning graphic
  • the second center positioning graphic unit is configured to use the center position of the first center positioning graphic as a seed point for region growth, and determine the second center positioning graphic;
  • the center position determining module is specifically configured to determine the center position of the second center positioning graphic as the center position of the two-dimensional code.
  • the rotation angle graph determining module includes:
  • the virtual circle determining unit is used to determine a virtual circle with a preset radius by taking the center position of the two-dimensional code as the center of the circle;
  • a preset edge point determining unit configured to determine a preset edge point of the current rotation angle positioning graph on the virtual circle
  • the rotation angle determination module is configured to determine the two-dimensional code according to the position of the preset edge point of the current rotation angle positioning graph and the prestored position of the preset edge point of the original rotation angle positioning graph The angle of rotation.
  • the preset edge point determining unit includes:
  • the gray-scale sampling subunit is used to perform gray-scale sampling of pixels at a number of preset positions on the virtual circle to obtain coordinate information and gray-scale information of the sampled pixels;
  • the grayscale gradient subunit is used to obtain the grayscale gradient of adjacent sampling pixels according to the grayscale information of the sampling pixels;
  • the preset edge point subunit is configured to determine the position of the preset edge point of the current rotation angle positioning graph according to the position information of the sampling pixel corresponding to the maximum gray gradient.
  • the two-dimensional code includes an encoding area and a rotation angle auxiliary graphic, wherein the encoding area includes encoding information; the device further includes:
  • the first center position module is configured to determine the first center position of the rotation angle auxiliary graphic according to the rotation angle and the center position of the two-dimensional code;
  • a rotation angle auxiliary graphic module configured to perform area growth based on the center position of the rotation angle auxiliary graphic, and determine the rotation angle auxiliary graphic
  • the second center position module is configured to determine the second center position of the rotation angle auxiliary graphic according to the rotation angle auxiliary graphic;
  • An encoding area determination module configured to determine the encoding area according to the center position of the two-dimensional code
  • the recognition module is used for recognizing the coding information according to the coding area and the precise rotation angle.
  • an embodiment of the present invention provides a two-dimensional code generating device.
  • the two-dimensional code includes a center positioning graphic, a rotation angle positioning graphic, and a coding area; wherein the coding area includes coding information, and the device includes:
  • a two-dimensional code center position determining module configured to determine the center position of the two-dimensional code
  • a position determining module configured to determine the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the position of the coding area according to the center position of the two-dimensional code
  • the generating module is used to generate the center positioning graphic, the rotation angle positioning graphic and the coding area according to the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the position of the coding area.
  • the coding information is written in the coding area, thereby generating the two-dimensional code, so that the center of the center positioning graphic coincides with the center position of the two-dimensional code, and the rotation angle positioning a plurality of preset edge points on the graphic Set at a predetermined angle and orientation, the plurality of preset edge points are located on the same virtual circle centered on the center of the two-dimensional code, and the coding area is located at the center of the center positioning graphic and the two-dimensional code Location between locations.
  • the center positioning pattern includes a first center positioning pattern and a second center positioning pattern, and the center position of the first center positioning pattern and the center position of the second center positioning pattern are both the same as those of the The center positions of the two-dimensional codes coincide;
  • the rotation angle positioning graphics include at least two, and there are at least two rotation angle positioning graphics that are not centrally symmetric about the center position of the two-dimensional code;
  • the two-dimensional code further includes a rotation angle auxiliary graphic, and the device further includes:
  • a rotation angle auxiliary graphic determination module configured to determine the position of the rotation angle auxiliary graphic according to the center position of the two-dimensional code
  • the generating module is configured to generate the two-dimensional code according to the position of the center positioning graphic, the position of the rotation angle positioning graphic, the position of the coding area, and the position of the rotation angle auxiliary graphic.
  • an embodiment of the present invention provides a two-dimensional code recognition device, and the function of the device can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above-mentioned functions.
  • the structure of the device includes a processor and a memory, the memory is used to store a program that supports the device to execute the above two-dimensional code recognition method, and the processor is configured to execute all The program stored in the memory.
  • the device may also include a communication interface for communicating with other devices or a communication network.
  • an embodiment of the present invention provides a two-dimensional code generating device, and the function of the device can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above-mentioned functions.
  • the structure of the device includes a processor and a memory, the memory is used to store a program that supports the device to execute the above two-dimensional code generation method, and the processor is configured to execute all The program stored in the memory.
  • the device may also include a communication interface for communicating with other devices or a communication network.
  • an embodiment of the present invention further provides a small car, including the two-dimensional code recognition device provided by any embodiment of the present invention; and further includes:
  • the controller is used for controlling the operation of the trolley according to the recognition result of the two-dimensional code recognition device.
  • an embodiment of the present invention also provides a two-dimensional code, which is generated according to the two-dimensional code generating apparatus provided in any embodiment of the present invention.
  • an embodiment of the present invention also provides a product provided with a two-dimensional code, the two-dimensional code including a center positioning pattern, a rotation angle positioning pattern, and a coding area; wherein,
  • the center positioning graphic is used to determine the center position of the two-dimensional code
  • the rotation angle positioning graph is used to determine the rotation angle of the two-dimensional code
  • the coding area is used to carry coding information
  • the center of the center positioning graphic coincides with the center position of the two-dimensional code
  • the rotation angle positioning graphic has a plurality of preset edge points, and the plurality of preset edges The points are arranged at a predetermined angular orientation relative to the center position, and the plurality of preset edge points are on the same virtual circle with the center position of the two-dimensional code as the center.
  • the center positioning pattern includes a first center positioning pattern and a second center positioning pattern, and the center position of the first center positioning pattern and the center position of the second center positioning pattern are both the same as those of the The center positions of the QR codes coincide.
  • the two-dimensional code further includes a rotation angle auxiliary graphic, the rotation angle auxiliary graphic is used to obtain an accurate rotation angle of the two-dimensional code to replace the rotation angle of the two-dimensional code determined according to the rotation angle positioning graphic, each The angle of the predetermined angular orientation is a prime number.
  • an embodiment of the present invention provides a computer-readable storage medium for storing computer software instructions used by the two-dimensional code generation device and the two-dimensional code recognition device, which includes the two-dimensional code generation device and The program involved in the two-dimensional code recognition device.
  • One of the above technical solutions has the following advantages or beneficial effects: after the center position of the two-dimensional code is recognized according to the center positioning graphic, the position of the rotation angle positioning graphic can be determined correspondingly, and then the rotation angle can be obtained based on the position of the rotation angle positioning graphic , And determine the coding area according to the rotation angle and center position to realize the identification of coding information and reduce the amount of calculation for the identification of the two-dimensional code.
  • Fig. 1 shows a first example diagram of a two-dimensional code according to an embodiment of the present invention
  • Fig. 2 shows a second example diagram of a two-dimensional code according to an embodiment of the present invention
  • Fig. 3 shows a third example diagram of a two-dimensional code according to an embodiment of the present invention
  • Figure 4 shows a flowchart of a two-dimensional code recognition method according to an embodiment of the present invention
  • Fig. 5 shows an example diagram of scanning and recognizing a two-dimensional code according to an embodiment of the present invention
  • FIG. 6 shows an example diagram of determining the center position of a first center positioning graphic according to an embodiment of the present invention
  • FIG. 7 shows an example diagram of area growth based on the center position of the first center positioning graph as the seed point according to an embodiment of the present invention
  • FIG. 8 shows an example diagram of determining a preset edge point of a rotation angle positioning graphic through a virtual circle according to an embodiment of the present invention
  • FIG. 9 shows an example diagram of the growth of the rotation angle auxiliary pattern area according to an embodiment of the present invention.
  • Fig. 10 shows an example diagram of performing grayscale sampling on a coding region according to an embodiment of the present invention
  • FIG. 11 shows a flowchart of a method for generating a two-dimensional code according to an embodiment of the present invention
  • Figure 12 shows a structural block diagram of a two-dimensional code recognition device according to an embodiment of the present invention
  • Figure 13 shows a structural block diagram of a two-dimensional code generating device according to an embodiment of the present invention
  • Fig. 14 shows a hardware diagram of a two-dimensional code recognition device and a two-dimensional code generation device according to an embodiment of the present invention.
  • Fig. 1 shows a first example diagram of a two-dimensional code according to an embodiment of the present invention.
  • the two-dimensional code can be formed as a kind of label, or attached or printed on various products using the two-dimensional code.
  • a two-dimensional code according to an embodiment of the present invention includes a first center positioning pattern 11 and a second center positioning pattern 12, a rotation angle positioning pattern 13 and an encoding area 14; wherein the encoding area 14 includes encoding information.
  • the first center positioning pattern 11 and the second center positioning pattern 12 are collectively referred to as center positioning patterns.
  • the center position of the first center positioning pattern 11 coincides with the center position of the second center positioning pattern 12, which is the center position of the two-dimensional code.
  • the first center positioning pattern 11 and the second center positioning pattern 12 are symmetrical patterns whose centers are easily determined, such as circles and squares.
  • Other asymmetric graphics can also be used as the first center positioning graphics if the center can be calculated.
  • the intersection of the diagonals of the parallelogram can determine the center.
  • the interior of the first center positioning graphic 11 may be empty, and the first center positioning graphic 11 may be a ring as shown in FIG. 1 or a square with an empty interior as shown in FIG. 2; of course, it may also be empty inside.
  • the second center positioning graphic 12 may include a circle, a square, a triangle, or the like.
  • the size of the first center positioning pattern 11 is larger than the size of the second center positioning pattern 12, and the second center positioning pattern 12 is located inside the first center positioning pattern.
  • the coding area 14 is located between the second center positioning pattern 12 and the first center positioning pattern 11.
  • the coding area 14 may take various forms as long as it can effectively contain coding information.
  • the rotation angle positioning pattern 13 is located between the second central positioning pattern and the coding area 14. In one embodiment, the rotation angle positioning pattern 13 includes at least two, and there are at least two rotation angle positioning patterns 13 that are not centrally symmetric about the center position of the two-dimensional code. It is required that there are at least two rotation angle positioning graphics 13 that are not center-symmetric about the center position of the two-dimensional code, which is beneficial to determine the rotation angle of the two-dimensional code.
  • the rotation angle positioning graph 13 has a plurality of preset edge points, and these preset edge points are located on the same virtual circle.
  • the preset edge points of the rotation angle positioning graph (that is, the position where the rotation angle positioning graph intersects the virtual circle) Edge point)
  • the angle relative to the center position of the QR code (for example, the angle of the connection with the center position of the QR code relative to the horizontal direction) is a prime number, so that the angle of the edge point is preset There is no greatest common divisor between the values.
  • the two-dimensional code is laid out in polar coordinates, wherein the center position of the two-dimensional code is the origin of the polar coordinates.
  • Polar coordinates have the characteristics of rotation invariance, so in the process of two-dimensional code recognition and scanning, they are the same from all directions, which makes scanning more concise.
  • the layout In the coding area, the layout is generally rectangular, and the rectangular layout will waste space in the corner area. The layout of polar coordinates makes the space utilization more fully.
  • polar coordinates are preferred implementations, and the embodiment of the present invention may also adopt a non-polar coordinate two-dimensional code layout.
  • the two-dimensional code further includes a rotation angle auxiliary graphic 111.
  • a rotation angle auxiliary graphic 111 Referring to Figure 3, an example of four positioning circles is given. The four positioning circles are evenly distributed on the outside of the first central positioning pattern 11, which is beneficial to ensure accurate identification of the QR code when any positioning circle is contaminated. . In other embodiments, the number and distribution positions of the positioning circles can also be adjusted.
  • the two-dimensional code further includes a paste alignment mark 112, and the user can accurately paste the two-dimensional code according to the paste alignment mark 112.
  • Fig. 4 shows a flowchart of a two-dimensional code recognition method according to an embodiment of the present invention. Referring to Figure 4, the method includes:
  • S43 Determine the position of the rotation angle positioning graphic 13 according to the center position of the two-dimensional code
  • Step S41 determines the center positioning graphic, including steps A to C:
  • Step A Identify the first center positioning pattern 11.
  • the recognized first center positioning graphic may include the pixels of the entire first center positioning graphic, or may include the boundary of the first center positioning graphic or the key pixel points located on the first center positioning graphic Wait.
  • the specific selection needs to be determined according to the shape of the first center positioning graphic 11. For example, when the first center positioning graphic 11 is a circular ring, since the circular ring does not change with rotation, only a few key boundary pixels need to be identified. Can represent the first center positioning graphic.
  • the step S411 identifying the first central positioning pattern 11 may include identifying a number of preset points of the first central positioning pattern 11.
  • the several preset points can be obtained as follows.
  • the two-dimensional code is scanned horizontally, for example, once every 5 rows, and the scanning interval of each row is 3 columns, and the coordinate points on the circle are determined according to the gray value difference of adjacent pixels; and Perform the following steps during scanning from left to right:
  • the gray value of the adjacent pixel on the right minus the gray value of the adjacent pixel on the left is less than the first gray value difference, for example, the first gray value difference is -30, then the white color becomes black. Edge point.
  • the edge where black becomes white is solved point.
  • the center point between the two points is solved, For example, the center point C between point A and point B.
  • the plurality of preset points of the first center positioning graphic 11 determined in step A include a plurality of center points C determined in the above step.
  • Figure 6 shows three points C: C1, C2 and C0. Confirming only a few points can reduce the amount of calculation, save recognition time, and improve user experience.
  • the several preset points of the first center positioning graphic 11 determined in step A may also include the edge points determined in steps (1) and (2), such as point A and point B shown in FIG. 5.
  • Step B Determine the center position of the first center positioning pattern 11 according to the first center positioning pattern 11, such as the point G1 in FIG. 6.
  • the first center positioning graphic 11 as a circular ring as an example, if a number of pixels located on the boundary of the circular ring are determined, the center of the circle can be calculated by selecting pixels on the three boundaries according to the characteristics of the circle.
  • step B selects three points from a number of preset points of the first center positioning graphic 11 obtained in step A, as shown in FIG. 6, the point C1 and the point C2 in the center point of step (3) are optimized. And point C0.
  • the center of the circle defined by these three points can be determined according to C1, C2, and CO, as the center position of the first center positioning graph 11.
  • the point C1, the point C2, and the point C0 are selected as in step B of the previous embodiment.
  • the point C0 in this embodiment satisfies: it is the midpoint of all the central points located between the point C1 and the point C2.
  • the midpoint C12 of the two center points Connecting C12 and C0, the center of the circle must pass through the line where C12 and C0 are located.
  • the center of the circle can be determined based on the known diameter or radius of the ring. Since the radius or diameter of the ring is known in advance, this algorithm saves more computing resources than the algorithm that uses three points to define a circle to calculate the center of the circle.
  • Step C Use the center position of the first center positioning pattern 11 as the seed point to perform region growth, and determine the second center positioning pattern 12.
  • area growth refers to the process of developing groups of pixels or areas into larger areas. Starting from the seed point set, from the region of the growth of these points is similar attributes by each seed point image intensity, gray scale, texture color binning adjacent to this area.
  • the center position of the first center positioning pattern 11 is used as the seed point, and the growth is carried out in the vertical direction and the horizontal direction respectively, and the vertical direction is determined.
  • the growth path in the direction and the growth path in the horizontal direction, and the growth path in the vertical direction and the growth path in the horizontal direction constitute the cross growth path in FIG. 7. According to the cross growth path, the boundary of the first center positioning pattern 11 can be determined.
  • the second center positioning figure is a circle
  • the characteristics of the circle only the growth of the two paths in the vertical and horizontal directions is required, and the center of the circle can be determined by solving the midpoint of the path, which greatly saves Calculation amount.
  • the determination of the center position of the two-dimensional code according to the center positioning pattern in step S42 is to determine the center position of the second center positioning pattern 12 as the center position of the two-dimensional code.
  • step S42 when the second center positioning pattern 12 is circular, step S42 includes:
  • the center position of the second center positioning graph is determined as the center position of the two-dimensional code.
  • the above steps A to C adopt the method that the center positioning graphics include the first center positioning graphics and the second center positioning graphics.
  • the method of the second center positioning graphic is determined according to the first center positioning graphic, and the second center positioning graphic 12 is smaller in size.
  • step S43 is entered to determine the position of the rotation angle positioning graphic.
  • step S43 includes:
  • Step D Determine a virtual circle with a preset radius by taking the center position of the QR code as the center of the circle; the virtual circle is a closed curve, and the points on the virtual circle are all separated from the center position of the QR code by a preset radius.
  • Step E Referring to FIG. 8, on the virtual circle, determine the preset edge point of the current rotation angle positioning graph; wherein, the preset edge point is an edge point passing through the virtual circle among the edge points of the rotation angle positioning graph 13.
  • the relative distance relationship between the rotation angle positioning pattern 13 and the center position of the two-dimensional code is known, and it must pass through a virtual circle centered on the center of the two-dimensional code. Therefore, one is determined according to the center position of the two-dimensional code.
  • the edge point of the rotation angle positioning graphic is determined on the virtual circle, and the position of the preset edge point of the rotation angle positioning graphic 13 can be obtained.
  • step E is on the virtual circle, and determining the preset edge point of the current rotation angle positioning graph includes:
  • the gray gradient of the sampling pixel at position n is
  • the sampling pixel of the maximum gray gradient is the largest sampling pixel of
  • the sampled pixel points of the maximum gray gradient are the preset edge points of the rotation angle positioning graphic 13. The determination of these preset edge points is to determine the position of the rotation angle positioning graph.
  • preset edge points are shown in FIG. 8: P1, P2, P3, and P4.
  • the number of preset edge points is related to the number and shape of the rotation angle positioning graphics 13, and the preset virtual circle radius. It can be increased or decreased according to actual needs. Taking the center position of the two-dimensional code as the origin, selecting a predetermined direction (for example, vertical up/horizontal right) as the polar axis, and selecting the positive direction of the angle (for example, the clockwise direction is the positive direction) to establish polar coordinates.
  • the positions of these four preset edge points should be at the preset angle positions, assuming the orientation of ⁇ 1, ⁇ 2, ⁇ 3, ⁇ 4 (ie no rotation angle), that is, the polar coordinate position is P1( R, ⁇ 1), P2 (R, ⁇ 2), P3 (R, ⁇ 3), P4 (R, ⁇ 4).
  • step S44 the difference between the obtained angle of each preset edge point and the corresponding non-rotation angle (preset angle position) can be determined to obtain the rotation angle of the two-dimensional code.
  • the average value of the difference obtained based on the angles of these preset edge points can be calculated as the rotation angle of the two-dimensional code.
  • each preset edge point is at a predetermined angle
  • the rotation angles are -(K+ ⁇ 1), -(K+ ⁇ 2), -(K+ ⁇ 3), -(K+ ⁇ 4), and K is an optional
  • K is an optional
  • the angle of each preset edge point will appear K at least once, so the K value appears the most. If there is rotation and the rotation angle is Q, the angle K-Q appears the most times.
  • the difference between the K value and the angle that appears most in each rotation, that is, Q can be determined as the rotation angle of the two-dimensional code. That is, the rotation angle of the two-dimensional code can be determined as follows: rotate the two-dimensional code multiple times, respectively rotate the sum of the non-rotation angle of each preset edge point and the preset angle K, and obtain the value of each preset edge point after each rotation Angle, select the angle KQ with the most occurrences among these angles, and use the difference between the preset angle K and the angle KQ with the most occurrences as the rotation angle of the two-dimensional code.
  • the preset edge points of the rotation angle positioning graph are located at positions P1 (R, 10°), P2 (R, 30°), P3 (R , 170°), P4 (R, 240°).
  • the pixels located at the positions P1, P2, P3, and P4 obtain the largest gray gradient.
  • the total gray gradient value obtained is also the maximum, that is, the coordinate information corresponding to the maximum value of the prestored original gray gradient total value is ( R,0°)
  • the preset edge point of the rotation angle positioning graphic (that is, the edge point where the rotation angle positioning graphic intersects the virtual circle) is located at position P1' (R, 350°), P2 '(R, 10°), P3' (R, 150°), P4' (R, 220°).
  • the two-dimensional code is rotated counterclockwise by 10°, 30°, 170°, and 240°, and the grayscale samples of four sets of sampled pixels are obtained.
  • the maximum value of gray gradient in each group of data is located in the following position
  • Rotation 240° 150°, 130°, 270°, 340°
  • the rotation angle of the two-dimensional code can be determined more accurately.
  • the original position of the preset edge point of the rotation angle positioning graph (that is, the edge point where the rotation angle positioning graph intersects the virtual circle) usually satisfies the angle value as a prime number, so that the angle value of the preset edge point is between There is no greatest common divisor; for example, the original positions of the preset edge points in step S441 are respectively located in the azimuths of ⁇ 1, ⁇ 2, ⁇ 3, and ⁇ 4 of the center position of the two-dimensional code, and ⁇ 1, ⁇ 2, ⁇ 3, and ⁇ 4 are usually prime numbers. It is helpful to reduce the number and intensity of interference peaks when judging the maximum value of the total gray gradient.
  • a rotation angle positioning graphics and preset edge points of the rotation angle positioning graphics can also be added. quantity. In order to ensure reliability, it is usually required to include at least two rotation angle positioning graphics.
  • the rotation angle auxiliary graphic is added to further accurately rotate the value of the angle, and the accuracy of the two-dimensional code recognition is improved.
  • the boundary of the rotation angle auxiliary graphic is determined by the method of region growth and then accurately determined. The center position, based on the accurately determined center position, determines a more accurate rotation angle, which improves the accuracy of the rotation angle.
  • the two-dimensional code lays out the encoded information in a polar coordinate manner.
  • determining the encoding area according to the center position of the two-dimensional code may include: determining a number of encoding information collection circles with different preset radii according to the center position of the two-dimensional code, wherein the encoding area includes a number of different preset radii The area covered by the coded information collection circle.
  • Step S46 identifies the encoding information according to the encoding area and the rotation angle Q of the two-dimensional code, including:
  • Step F starting from the rotation angle Q, collect the coordinate information and gray value information of the pixel points on each coded information collection circle every preset angle;
  • Step G Identify the encoded information according to the collected coordinate information and gray value information of the pixel points.
  • the encoded information includes data information and error correction information.
  • the process of identifying coded information in step G may include:
  • the error location polynomial is determined by the value of the syndrome, and the root value, that is, the value of the error position, is calculated, and the error value is calculated according to the error position value, and the corresponding error is added to the corresponding error position Value, complete error correction.
  • step F to step G see Figure 10, under the condition that the rotation angle, the center position of the two-dimensional code, and the radius of the ring of the first center positioning graph are known, the coding area is located at the second center of the two-dimensional code The area between the positioning graphic and the first central positioning graphic.
  • the radius of the ring is multiplied by a coefficient less than 1 (for example, 3.4/4.6, 2.8/4.6, 2.2/4.6) to obtain a preset small radius (for example, 3 small radii), starting from the rotation angle every predetermined angle ( For example, 16.37 degrees) take a preset coordinate under a small radius (for example, 3 coordinates under 3 small radii), and you will get several coordinate information (for example, 66 coordinates). For this, several coordinate information (for example, 66 coordinates) )
  • the gray value of the corresponding pixel points is accumulated and averaged, and the gray value of several pixel coordinates (for example, 66 coordinates) is greater than this average value becomes 1, otherwise it becomes 0, thereby obtaining several binary values.
  • a number of bins contain corresponding bytes (for example, 66 bins contain 8 bytes), which represent data information and error correction information.
  • Step H Determine the first center position of the rotation angle auxiliary graphic 111 according to the rotation angle and the center position of the two-dimensional code
  • the rotation angle auxiliary graphic 111 can be determined.
  • the center position of the two-dimensional code is the coordinate origin
  • the center position of the rotation angle auxiliary pattern in the original two-dimensional code is (R7, ⁇ 7); when the rotation angle is ⁇ 8, the first rotation angle auxiliary pattern 111 can be obtained.
  • the center position is (R7, ⁇ 7- ⁇ 8).
  • Step I Use the first center position of the rotation angle auxiliary pattern 111 as a seed point to perform region growth to determine the rotation angle auxiliary pattern; wherein, region growth refers to a process of developing a group of pixels or regions into a larger area. Starting from the seed point set, from the region of the growth of these points is similar attributes by each seed point image intensity, gray scale, texture color binning adjacent to this area.
  • step I may include: taking the center position of the rotation angle auxiliary graphic as the seed point, grow the path along the horizontal and vertical directions to obtain the cross growth path, and determine the positioning circle.
  • Step J Determine the second center position of the rotation angle auxiliary graph 111 according to the rotation angle auxiliary graph 111;
  • Step J may include: determining the midpoint of the horizontal growth path and the midpoint of the vertical growth path in step I, Determine the center F of the positioning circle, that is, the second center position of the rotation angle auxiliary graphic.
  • Figure 9 shows the growth path and center F of one of the positioning circles. Other positioning circles can refer to this method to determine the center of the circle.
  • Step K Determine an accurate rotation angle according to the second center position of the rotation angle auxiliary graphic 111 and the center position of the two-dimensional code. Specifically, when the two-dimensional code is not rotated, the center position of the rotation angle auxiliary graphic relative to the center position of the two-dimensional code is determined, which is the same as the second center position of the rotation angle auxiliary graphic 111 and the center position of the two-dimensional code in step J Comparing the positional relationship of, it is possible to obtain the center position of the current rotation angle auxiliary graphic compared to the angle deflected when the two-dimensional code is not rotated, and then correct the rotation angle obtained in step S44 to obtain an accurate rotation angle.
  • Fig. 11 shows a flow chart of generating a two-dimensional code according to an embodiment of the present invention. This embodiment includes the steps:
  • S112 Determine the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the position of the coding area according to the center position of the two-dimensional code;
  • the first center positioning pattern is a circular ring
  • the second center positioning pattern is a circle or a circular ring, which is determined according to the center position and the radius of the circular or circular (inner circle and outer circle)
  • the positions of the first center positioning graphic and the second center positioning graphic are determined according to the non-rotation angle of the preset edge point (for example, ⁇ 1, ⁇ 2, ⁇ 3, ⁇ 4), for example, the code information area is determined according to the radius of the code information collection circle and so on.
  • the position of the center positioning graphic According to the position of the center positioning graphic, the position of the rotation angle positioning graphic and the position of the coding area, generate the center positioning graphic, the rotation angle positioning graphic and the coding area, and write coding information in the coding area, thereby generating a two-dimensional code, so that The center of the center positioning graphic coincides with the center position of the QR code, the multiple preset edge points on the rotation angle positioning graphic are set at a predetermined angle and orientation, and the multiple preset edge points are centered on the center of the QR code On the same virtual circle of, the coding area is located between the center positioning graphic and the center position of the QR code.
  • the center position of the two-dimensional code can be used as the origin, and the center positioning graphics, the rotation angle positioning graphics and the coding area can be generated according to the coordinates and shapes of these graphics. Any technical means known now and in the future can be used to write coding information in the coding area.
  • generating the two-dimensional code in step S113 includes generating an information code and printing the information code on a corresponding carrier to generate a product with a two-dimensional code, such as a paper two-dimensional code label.
  • the two-dimensional code further includes a rotation angle auxiliary graphic 111
  • the generating method further includes: determining the position of the rotation angle auxiliary graphic 111 according to the center position of the two-dimensional code.
  • This step includes: determining the center position of the positioning circle according to the center position of the two-dimensional code. In the case of multiple positioning circles, determine the center position of each positioning circle. According to the determined center of the positioning circle and the predetermined radius of the positioning circle, the position of the positioning circle can be determined.
  • the method for generating a two-dimensional code further includes: determining a position where the alignment mark 112 is pasted according to the center position of the two-dimensional code. Specifically, the pre-stored relative position relationship between the alignment mark 112 and the center of the two-dimensional code is acquired, and the position of the alignment mark 112 is determined according to the center position of the two-dimensional code. For example, referring to Figure 6, when establishing polar coordinates with the center position of the QR code as the origin, determine four preset marks that are separated from the center position of the QR code at 0°, 90°, 180° and 270° The distance position is used as the position to paste the alignment mark.
  • step S113 includes: generating a two-dimensional code according to the position of the center positioning graphic, the position of the rotation angle positioning graphic, the position of the coding area, and the position where the alignment mark is pasted.
  • the embodiment of the present invention also provides a two-dimensional code recognition device, referring to FIG. 12, including:
  • the center positioning pattern determining module 121 is used to determine the center positioning pattern
  • the center position determining module 122 is used to determine the center position of the QR code according to the center positioning graph;
  • the rotation angle graphic determination module 123 is used to determine the position of the rotation angle positioning graphic according to the center position of the QR code;
  • the rotation angle determination module 124 determines the rotation angle of the QR code according to the position of the rotation angle positioning graphic
  • the coding area determining module 125 is used to determine the coding area according to the center position of the two-dimensional code
  • the identification module 126 is used to identify encoded information according to the encoding area and the rotation angle.
  • the center positioning graphic includes a first center positioning graphic and a second center positioning graphic, and the center position of the first center positioning graphic and the center position of the second center positioning graphic both coincide with the center position of the two-dimensional code.
  • the center positioning graphic determining module 121 includes:
  • the first center positioning graphic unit is used to identify the first center positioning graphic
  • the first center positioning graphic center unit is used to determine the center position of the first center positioning graphic according to the first center positioning graphic
  • the second center positioning graphic unit is used to use the center position of the first center positioning graphic as the seed point to grow the area and determine the second center positioning graphic;
  • the center position determining module is used to determine the center position of the second center positioning graphic as the center position of the two-dimensional code.
  • the rotation angle graph determining module 123 includes:
  • the virtual circle determining unit is used to determine a virtual circle with a preset radius by taking the center position of the two-dimensional code as the center of the circle; wherein the virtual circle locates the figure through the rotation angle;
  • the preset edge point determining unit is used to determine the position of the preset edge point of the current rotation angle positioning graph; wherein the preset edge point is an edge point passing through the virtual circle among the edge points of the rotation angle positioning graph.
  • the rotation angle determination module is used for determining the rotation angle of the QR code according to the position of the preset edge point of the current rotation angle positioning graphic and the preset edge point of the original rotation angle positioning graphic.
  • the preset edge point determination unit includes:
  • the gray-scale sampling sub-unit is used to perform gray-scale sampling of pixels at a number of preset positions on the virtual circle to obtain coordinate information and gray-scale information of the sampled pixels;
  • the grayscale gradient subunit is used to obtain the grayscale gradient of adjacent sampling pixels according to the grayscale information of the sampling pixels;
  • the preset edge point subunit is used to determine the position of the preset edge point of the current rotation angle positioning graph according to the position information of the sampled pixel point of the maximum gray gradient.
  • the two-dimensional code further includes a rotation angle auxiliary graphic.
  • the first center position module is used to determine the first center position of the rotation angle auxiliary graphic according to the rotation angle and the center position of the two-dimensional code;
  • Rotation angle auxiliary graphics module used for regional growth based on the center position of the rotation angle auxiliary graphics, and determine the rotation angle auxiliary graphics
  • the second center position module is used to determine the second center position of the rotation angle auxiliary graphic according to the rotation angle auxiliary graphic;
  • the precise rotation angle module is used to determine the precise rotation angle according to the second center position of the rotation angle auxiliary graphic and the center position of the two-dimensional code.
  • the identification module 126 is used to identify the encoded information according to the encoding area and the precise rotation angle.
  • each module in each device in the embodiment of the present invention can be referred to the corresponding description in the above-mentioned two-dimensional code recognition method, which will not be repeated here.
  • an embodiment of the present invention provides a two-dimensional code generating device.
  • the two-dimensional code includes a center positioning graph, a rotation angle positioning graph, and a coding area; the device includes:
  • the center position acquisition module 131 of the two-dimensional code is used to determine the center position of the two-dimensional code
  • the position determining module 132 is used to determine the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the coding area according to the center position of the two-dimensional code;
  • the generating module 133 is used to generate a center positioning graphic, a rotation angle positioning graphic and a coding area according to the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the position of the coding area, and writing coding information in the coding area to generate a two-dimensional Code so that the center of the center positioning graph coincides with the center position of the QR code, the multiple preset edge points on the rotation angle positioning graph are set at a predetermined angle and orientation, and the multiple preset edge points are at the center of the QR code On the same virtual circle whose position is the center of the circle, the coding area is located between the center positioning graphic and the center position of the two-dimensional code.
  • the center position of the two-dimensional code can be used as the origin, and the center positioning graphics, the rotation angle positioning graphics and the coding area can be generated according to the coordinates and shapes of these graphics. Any technical means known now and in the future can be used to write the coding information in the coding area.
  • the center positioning graphic includes a first center positioning graphic and a second center positioning graphic, and the center position of the first center positioning graphic and the center position of the second center positioning graphic both coincide with the center position of the two-dimensional code.
  • the rotation angle positioning graphics include at least two, and there are at least two rotation angle positioning graphics that are not center-symmetric about the center position of the two-dimensional code.
  • the two-dimensional code further includes a rotation angle auxiliary graphic
  • the device further includes:
  • the rotation angle auxiliary graphic determination module is used to determine the position of the rotation angle auxiliary graphic according to the center position of the QR code
  • the generating module is used to generate a two-dimensional code according to the position of the center positioning graphic, the position of the rotation angle positioning graphic, the coding area and the position of the rotation angle auxiliary graphic.
  • each module in each device in the embodiment of the present invention can be referred to the corresponding description in the above-mentioned two-dimensional code generation method or identification method, which will not be repeated here.
  • Fig. 14 shows a hardware diagram of a two-dimensional code generation device and a two-dimensional code recognition device according to an embodiment of the present invention.
  • the device includes a memory 910 and a processor 920, and the memory 910 stores a computer program that can run on the processor 920.
  • the processor 920 executes the computer program, the two-dimensional code generation method and the two-dimensional code recognition method in the foregoing embodiments are implemented.
  • the number of the memory 910 and the processor 920 may be one or more.
  • the device also includes:
  • the communication interface 930 is used to communicate with external devices and perform data interactive transmission.
  • the memory 910 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), for example, at least one disk memory.
  • the bus may be an Industry Standard Architecture (ISA, Industry Standard Architecture) bus, a Peripheral Component Interconnect (PCI, Peripheral Component Interconnect) bus, or an Extended Industry Standard Architecture (EISA, Extended Industry Standard Architecture) bus, etc.
  • ISA Industry Standard Architecture
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the bus can be divided into address bus, data bus, control bus, etc. For ease of presentation, only a thick line is used in FIG. 15, but it does not mean that there is only one bus or one type of bus.
  • the memory 910, the processor 920, and the communication interface 930 may communicate with each other through internal interfaces.
  • the embodiment of the present invention provides a computer-readable storage medium that stores a computer program, and when the program is executed by a processor, the method described in any of the above embodiments is implemented.
  • first and second are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features.
  • the features defined with “first” and “second” may explicitly or implicitly include at least one of the features.
  • “plurality” means two or more than two, unless specifically defined otherwise.
  • a "computer-readable medium” can be any device that can contain, store, communicate, propagate, or transmit a program for use by an instruction execution system, device, or device or in combination with these instruction execution systems, devices, or devices.
  • computer readable media include the following: electrical connections (electronic devices) with one or more wiring, portable computer disk cases (magnetic devices), random access memory (RAM), Read only memory (ROM), erasable and editable read only memory (EPROM or flash memory), fiber optic devices, and portable read only memory (CDROM).
  • the computer-readable medium may even be paper or other suitable media on which the program can be printed, because it can be used, for example, by optically scanning the paper or other media, and then editing, interpreting, or other suitable media if necessary. The program is processed in a manner to obtain the program electronically and then stored in the computer memory.
  • each part of the present invention can be implemented by hardware, software, firmware or a combination thereof.
  • multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.
  • a logic gate circuit for implementing logic functions on data signals
  • PGA programmable gate array
  • FPGA field programmable gate array
  • the functional units in the various embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software functional modules. If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
  • the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
  • the embodiment of the present invention also provides a trolley, including the two-dimensional code recognition device provided by any embodiment of the present invention.
  • the trolley further includes:
  • the controller is used to control the operation of the trolley according to the recognition result of the two-dimensional code recognition device.
  • the recognition result of the two-dimensional code recognition device includes the rotation angle recognition result of the two-dimensional code and the code information recognition result.
  • the rotation angle recognition result of the two-dimensional code can be used to know the deflection angle of the car relative to the captured two-dimensional code, so that the car can know the current position.
  • the coded information can include cart task instructions, etc.
  • the trolley in this embodiment may be an AGV (Automated Guided Vehicle, AGV for short), which is also commonly referred to as an AGV trolley. It is equipped with electromagnetic or optical automatic guidance devices, can travel along a prescribed guidance path, has safety protection and various A transport vehicle with transfer function), the AGV car is equipped with an embedded computing platform and a camera, which can continuously collect images and perform image analysis, and can calculate its current pose according to the position and rotation angle of the QR code in the field of view .
  • AGV Automated Guided Vehicle
  • QR code which is posted on the warehouse floor and is mainly used to locate and navigate the AVG trolley.
  • the position where the QR code is pasted is fixed, and each QR code carries unique information that can be used to mark the location of the current QR code.
  • the pattern of the two-dimensional code has a certain center position and main direction.
  • the AGV trolley can infer the current position and rotation direction of the AGV trolley according to the imaging of the two-dimensional code in the down-view camera.
  • the AGV car is equipped with an embedded computing platform and a camera, which can continuously collect images and perform image analysis. It can calculate its current pose based on the position and rotation angle of the QR code in the field of view.
  • the embodiment of the present invention also provides a two-dimensional code, which is generated according to the two-dimensional code generating device provided in any embodiment of the present invention.
  • a two-dimensional code which is generated according to the two-dimensional code generating device provided in any embodiment of the present invention.
  • For the content of the generated two-dimensional code reference may be made to the description of the foregoing embodiment, which will not be repeated here.
  • the embodiment of the present invention also provides a product provided with a two-dimensional code.
  • the two-dimensional code includes a center positioning graphic, a rotation angle positioning graphic and a coding area; wherein,
  • the center positioning graphic is used to determine the center position of the QR code
  • the rotation angle positioning graphic is used to determine the rotation angle of the QR code
  • the coding area is used to carry coding information.
  • the center of the center positioning graphic coincides with the center position of the QR code.
  • the rotation angle positioning graphic has multiple preset edge points, and the multiple preset edge points are set at a predetermined angle relative to the center position. In terms of orientation, multiple preset edge points are located on the same virtual circle with the center position of the QR code as the center.
  • the center positioning graphic includes a first center positioning graphic and a second center positioning graphic.
  • the center position of the first center positioning graphic and the center position of the second center positioning graphic coincide with the center position of the two-dimensional code.
  • the two-dimensional code also includes a rotation angle auxiliary graphic.
  • the rotation angle auxiliary graphic is used to obtain the precise rotation angle of the two-dimensional code to replace the rotation angle of the two-dimensional code determined according to the rotation angle positioning graphic.
  • the angle of each predetermined angle is a prime number. .
  • the product provided with the two-dimensional code referred to in this embodiment may include paper, board or metal plate printed or coated with the two-dimensional code of this embodiment; it may also include the two-dimensional code of this embodiment.
  • Electronic equipment such as mobile phones, computers, TVs, LED displays, etc.

Abstract

A QR code recognition method. A QR code comprises a central positioning pattern and a rotation angle positioning pattern. The recognition method comprises: determining a central positioning pattern; according to the central positioning pattern, determining the central position of a QR code; according to the central position of the QR code, determining the position of a rotation angle positioning pattern; and according to the position of the rotation angle positioning pattern, determining a rotation angle of the QR code. The present invention further relates to a QR code generation method and apparatus, a QR code recognition apparatus, a trolley, a QR code, a product with the QR code, and a computer-readable storage medium. The solution helps to reduce the amount of calculation during QR code recognition.

Description

二维码识别和生成的方法、装置、二维码和小车Method, device, two-dimensional code and trolley for identifying and generating two-dimensional code
本申请要求于2019年04月28日提交中国专利局、申请号为201910349876.X、发明名称为“二维码识别和生成的方法、装置、二维码和小车”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires the priority of a Chinese patent application filed with the Chinese Patent Office on April 28, 2019, the application number is 201910349876.X, and the invention title is "Methods, devices, QR codes and trolleys for QR code recognition and generation" , Its entire content is incorporated in this application by reference.
技术领域Technical field
本发明涉及二维码技术领域,尤其涉及一种二维码识别和生成的方法、装置、二维码和小车。The invention relates to the technical field of two-dimensional codes, in particular to a method, device, two-dimensional code and a small car for identifying and generating a two-dimensional code.
背景技术Background technique
现有的二维码识别技术,通过扫描拍摄等手法获取二维码图像,来读取二维码的编码区域所携带的编码信息。但是由于拍摄或者扫描时,获取的二维码图像通常会有角度偏移,例如可能拍摄到的二维码图像为颠倒的,编码区域也是颠倒的。基于当前角度的编码区域读取的编码信息是有误的。因此需要通过图像处理手法,确定二维码至少三个顶端上的定位块,然后再根据这些定位块确定旋转角度,并进一步通过图像处理确定二维码的编码区域的内容。现有技术较为依赖图像处理技术的识别,计算量十分大。The existing two-dimensional code recognition technology obtains the two-dimensional code image by scanning and shooting, etc., to read the coding information carried in the coding area of the two-dimensional code. However, during shooting or scanning, the acquired two-dimensional code image usually has an angular offset. For example, the two-dimensional code image may be reversed and the coding area is also reversed. The encoding information read based on the encoding area of the current angle is wrong. Therefore, it is necessary to determine at least three positioning blocks on the top of the two-dimensional code through image processing, and then determine the rotation angle based on these positioning blocks, and further determine the content of the encoding area of the two-dimensional code through image processing. The existing technology relies on the recognition of image processing technology, and the amount of calculation is very large.
发明内容Summary of the invention
本发明实施例提供一种二维码识别和生成的方法、装置、二维码和小车,以解决现有技术中的一个或多个技术问题。The embodiment of the present invention provides a method, device, two-dimensional code and trolley for recognizing and generating a two-dimensional code to solve one or more technical problems in the prior art.
第一方面,本发明实施例提供一种二维码识别方法,所述二维码包括中心定位图形、旋转角度定位图形;所述方法包括:In a first aspect, an embodiment of the present invention provides a two-dimensional code recognition method, where the two-dimensional code includes a center positioning pattern and a rotation angle positioning pattern; the method includes:
确定所述中心定位图形;Determining the center positioning graphic;
根据所述中心定位图形,确定所述二维码的中心位置;Determining the center position of the two-dimensional code according to the center positioning graph;
根据所述二维码的中心位置,确定所述旋转角度定位图形的位置;Determine the position of the rotation angle positioning graphic according to the center position of the two-dimensional code;
根据所述旋转角度定位图形的位置,确定所述二维码的旋转角度。Determine the rotation angle of the two-dimensional code according to the position of the rotation angle positioning graphic.
在一种实施方式中,所述中心定位图形包括第一中心定位图形和第二中心定位图形,所述第一中心定位图形的中心位置和所述第二中心定位图形的中心位置均与所述二维码的中心位置重合;所述确定中心定位图形,包括:In one embodiment, the center positioning pattern includes a first center positioning pattern and a second center positioning pattern, and the center position of the first center positioning pattern and the center position of the second center positioning pattern are both the same as those of the The center positions of the two-dimensional codes coincide; the determining center positioning graphic includes:
识别所述第一中心定位图形;Identifying the first center positioning graphic;
根据所述第一中心定位图形,确定所述第一中心定位图形的中心位置;Determine the center position of the first center positioning graphic according to the first center positioning graphic;
以所述第一中心定位图形的中心位置为种子点进行区域生长,确定所述第二中心定位图形;Use the center position of the first center positioning graphic as a seed point to perform region growth, and determine the second center positioning graphic;
所述根据所述中心定位图形,确定所述二维码的中心位置,包括:The determining the center position of the two-dimensional code according to the center positioning graphic includes:
确定所述第二中心定位图形的中心位置,作为所述二维码的中心位置。The center position of the second center positioning graphic is determined as the center position of the two-dimensional code.
在一种实施方式中,所述第二中心定位图形为圆形;In one embodiment, the second center positioning graphic is circular;
所述以所述第二中心定位图形的中心位置为种子点进行区域生长,确定所述第二中心定位图形包括:The step of using the center position of the second center positioning graphic as a seed point for region growth, and determining the second center positioning graphic includes:
以所述第一中心定位图形的中心位置为种子点,分别沿竖直方向和水平方向进行生长,确定竖直方向的生长路径和水平方向的生长路径;Taking the center position of the first center positioning graph as the seed point, grow in the vertical direction and the horizontal direction respectively, and determine the growth path in the vertical direction and the growth path in the horizontal direction;
所述确定所述第二中心定位图形的中心位置,作为所述二维码的中心位置,包括:The determining the center position of the second center positioning graphic as the center position of the two-dimensional code includes:
根据所述竖直方向的生长路径的中点和水平方向的生长路径的中点,确定所述第二中心定位图形的中心位置,作为所述二维码的中心位置。According to the midpoint of the growth path in the vertical direction and the midpoint of the growth path in the horizontal direction, the center position of the second center positioning pattern is determined as the center position of the two-dimensional code.
在一种实施方式中,所述第一中心定位图形为圆环;In one embodiment, the first center positioning figure is a circular ring;
所述识别所述第一中心定位图形,包括:The recognizing the first center positioning graphic includes:
扫描所述二维码,并根据相邻像素的灰度值差值,确定所述第一中心定位图形的若干边缘点;Scanning the two-dimensional code, and determining a number of edge points of the first center positioning pattern according to the gray value difference of adjacent pixels;
所述根据所述第一中心定位图形,确定所述第一中心定位图形的中心位置,包括:The determining the center position of the first center positioning graphic according to the first center positioning graphic includes:
根据所述第一中心定位图形的若干边缘点,选取位于所述第一中心定位图形上的两个点;Selecting two points located on the first central positioning graph according to several edge points of the first central positioning graph;
根据选取的所述位于所述第一中心定位图形上的两个点和预设的所述第一中心定位图形的圆环半径,确定所述第一中心定位图形的中心位置。Determine the center position of the first center positioning graphic according to the selected two points on the first center positioning graphic and the preset ring radius of the first center positioning graphic.
在一种实施方式中,所述根据所述二维码的中心位置,确定所述旋转角度定位图形的位置,包括:In an embodiment, the determining the position of the rotation angle positioning graphic according to the center position of the two-dimensional code includes:
以所述的二维码的中心位置为圆心,确定一预设半径的虚拟圆;Using the center position of the two-dimensional code as the center of the circle, determine a virtual circle with a preset radius;
在所述虚拟圆上,确定当前所述旋转角度定位图形的预设边缘点;On the virtual circle, determine the preset edge point of the current rotation angle positioning graph;
所述根据所述旋转角度定位图形的位置,确定所述二维码的旋转角度,包括:The determining the rotation angle of the two-dimensional code according to the position of the rotation angle positioning graphic includes:
根据所述当前所述旋转角度定位图形的预设边缘点的位置和预知的所述旋转角度定位图形的无旋转时预设边缘点的位置,确定所述二维码的旋转角度。Determine the rotation angle of the two-dimensional code according to the position of the preset edge point of the current rotation angle positioning graph and the predicted position of the preset edge point of the rotation angle positioning graph without rotation.
在一种实施方式中,所述确定当前所述旋转角度定位图形的预设边缘点,包括:In an embodiment, the determining the preset edge point of the current rotation angle positioning graph includes:
对所述虚拟圆上的若干预设位置的像素点进行灰度采样,获取采样像素点的坐标信息和灰度信息;Performing grayscale sampling on pixels at a number of preset positions on the virtual circle to obtain coordinate information and grayscale information of the sampled pixels;
根据所述采样像素点的灰度信息,获取相邻的采样像素点的灰度梯度;Obtaining the grayscale gradient of adjacent sampling pixels according to the gray information of the sampling pixels;
根据灰度梯度最大值对应的采样像素点的位置信息,确定当前所述旋转角度定位图形的预设边缘点的位置。According to the position information of the sampling pixel corresponding to the maximum value of the gray gradient, the position of the preset edge point of the current rotation angle positioning graph is determined.
在一种实施方式中,所述二维码包括编码区域和旋转角度辅助图形,其中,所述编码区域包括编码信息,所述方法还包括:In an embodiment, the two-dimensional code includes an encoding area and a rotation angle auxiliary graphic, wherein the encoding area includes encoding information, and the method further includes:
根据所述旋转角度和所述二维码的中心位置,确定所述旋转角度辅助图形的第一中心位置;Determining the first center position of the rotation angle auxiliary graphic according to the rotation angle and the center position of the two-dimensional code;
以所述旋转角度辅助图形的中心位置进行区域生长,确定所述旋转角度辅助图形;Performing region growth using the center position of the rotation angle auxiliary graphic to determine the rotation angle auxiliary graphic;
根据所述旋转角度辅助图形,确定所述旋转角度辅助图形的第二中心位置;Determine the second center position of the rotation angle auxiliary graphic according to the rotation angle auxiliary graphic;
根据所述旋转角度辅助图形的第二中心位置和所述二维码的中心位置,确定精确的旋转角度;Determine an accurate rotation angle according to the second center position of the rotation angle auxiliary graphic and the center position of the two-dimensional code;
根据所述二维码的中心位置,确定所述编码区域;Determining the coding area according to the center position of the two-dimensional code;
根据所述编码区域和所述精确的旋转角度,识别所述编码信息。Identify the encoded information according to the encoded area and the precise rotation angle.
在一种实施方式中,所述二维码包括编码区域,其中,所述编码区域包括编码信息,所述二维码以极坐标方式布局所述编码信息,所述方法还包括:In an embodiment, the two-dimensional code includes a coding area, wherein the coding area includes coding information, and the two-dimensional code lays out the coding information in a polar coordinate manner, and the method further includes:
根据所述二维码的中心位置,确定所述编码区域;Determining the coding area according to the center position of the two-dimensional code;
根据所述编码区域和所述旋转角度,识别所述编码信息;Identifying the encoding information according to the encoding area and the rotation angle;
所述根据所述二维码的中心位置,确定所述编码区域,包括:The determining the coding area according to the center position of the two-dimensional code includes:
根据所述二维码的中心位置,确定若干不同预设半径的编码信息采集 圆;其中,所述编码信息采集圆位于所述编码区域内;According to the center position of the two-dimensional code, determine a number of code information collection circles with different preset radii; wherein, the code information collection circle is located in the code area;
所述根据所述编码区域和所述旋转角度,识别所述编码信息,包括:The identifying the encoding information according to the encoding area and the rotation angle includes:
从所述旋转角度开始,每隔预设角度采集每一所述编码信息采集圆上的像素点的坐标信息和灰度值信息;Starting from the rotation angle, collecting coordinate information and gray value information of each pixel on the code information collecting circle at intervals of a preset angle;
根据采集的所述像素点的坐标信息和灰度值信息,识别所述编码信息。Identify the encoded information according to the collected coordinate information and gray value information of the pixel points.
第二方面,本发明实施例提供一种二维码生成方法,所述二维码包括中心定位图形、旋转角度定位图形和编码区域;其中,所述编码区域包括编码信息;所述方法包括:In a second aspect, an embodiment of the present invention provides a method for generating a two-dimensional code. The two-dimensional code includes a center positioning graphic, a rotation angle positioning graphic, and an encoding area; wherein the encoding area includes encoding information; the method includes:
确定所述二维码的中心位置;Determining the center position of the two-dimensional code;
根据所述二维码的中心位置,确定所述中心定位图形的位置、所述旋转角度定位图形的位置和所述编码区域的位置;Determining the position of the center positioning pattern, the position of the rotation angle positioning pattern, and the position of the coding area according to the center position of the two-dimensional code;
根据所述中心定位图形的位置、所述旋转角度定位图形的位置和所述编码区域的位置,生成所述中心定位图形、所述旋转角度定位图形和所述编码区域,在所述编码区域中写入所述编码信息,从而生成所述二维码,使得所述中心定位图形的中心与所述二维码的中心位置重合,所述旋转角度定位图形上的多个预设边缘点设置在相对所述中心位置的预定的角度方位上,所述多个预设边缘点处于以所述二维码的中心位置为圆心的同一虚拟圆上,所述编码区域处于中心定位图形和所述二维码的中心位置之间的位置。According to the position of the center positioning pattern, the position of the rotation angle positioning pattern, and the position of the encoding area, the center positioning pattern, the rotation angle positioning pattern, and the encoding area are generated, in the encoding area Write the coding information to generate the two-dimensional code so that the center of the center positioning graphic coincides with the center position of the two-dimensional code, and a plurality of preset edge points on the rotation angle positioning graphic are set at In a predetermined angular orientation relative to the center position, the plurality of preset edge points are on the same virtual circle centered on the center position of the two-dimensional code, and the coding area is located between the center positioning graphic and the two The position between the center positions of the dimension code.
在一种实施方式中,所述中心定位图形包括第一中心定位图形和第二中心定位图形,所述第一中心定位图形的中心位置和所述第二中心定位图形的中心位置均与所述二维码的中心位置重合;所述第一中心定位图形为 圆环;所述第二中心定位图形为圆形;In one embodiment, the center positioning pattern includes a first center positioning pattern and a second center positioning pattern, and the center position of the first center positioning pattern and the center position of the second center positioning pattern are both the same as those of the The center positions of the two-dimensional codes coincide; the first center positioning pattern is a circle; the second center positioning pattern is a circle;
所述编码区域为环形,所述编码区域位于所述第一中心定位图形和所述第二中心定位图形之间的区域;The coding area is ring-shaped, and the coding area is located in an area between the first center positioning pattern and the second center positioning pattern;
所述旋转角度定位图形包括至少两个,且至少存在两个所述旋转角度定位图形不关于所述二维码的中心位置中心对称。The rotation angle positioning graphics include at least two, and there are at least two rotation angle positioning graphics that are not center-symmetric about the center position of the two-dimensional code.
在一种实施方式中,所述二维码还包括旋转角度辅助图形,所述旋转角度辅助图形包括若干定位圆,所述方法还包括:In an embodiment, the two-dimensional code further includes a rotation angle auxiliary graphic, the rotation angle auxiliary graphic includes a plurality of positioning circles, and the method further includes:
根据所述二维码的中心位置,确定各所述定位圆的圆心位置;Determine the center position of each positioning circle according to the center position of the two-dimensional code;
根据所述旋转角度辅助图形的位置,生成所述旋转角度辅助图形。The rotation angle auxiliary graphic is generated according to the position of the rotation angle auxiliary graphic.
第三方面,本发明实施例提供一种二维码识别装置,所述二维码包括中心定位图形和旋转角度定位图形;所述装置包括:In a third aspect, an embodiment of the present invention provides a two-dimensional code recognition device, the two-dimensional code includes a center positioning pattern and a rotation angle positioning pattern; the device includes:
中心定位图形确定模块,用于确定中心定位图形;The central positioning graphic determining module is used to determine the central positioning graphic;
中心位置确定模块,用于根据所述中心定位图形,确定所述二维码的中心位置;A center position determination module, configured to determine the center position of the two-dimensional code according to the center positioning graph;
旋转角度图形确定模块,用于根据所述二维码的中心位置,确定所述旋转角度定位图形的位置;A rotation angle graphic determination module, configured to determine the position of the rotation angle positioning graphic according to the center position of the two-dimensional code;
旋转角度确定模块,根据所述旋转角度定位图形的位置,确定所述二维码的旋转角度。The rotation angle determination module determines the rotation angle of the two-dimensional code according to the position of the rotation angle positioning graphic.
在一种实施方式中,所述中心定位图形包括第一中心定位图形和第二中心定位图形,所述第一中心定位图形的中心位置和所述第二中心定位图形的中心位置均与所述二维码的中心位置重合;In one embodiment, the center positioning pattern includes a first center positioning pattern and a second center positioning pattern, and the center position of the first center positioning pattern and the center position of the second center positioning pattern are both the same as those of the The center position of the QR code coincides;
所述中心定位图形确定模块包括:The central positioning graphic determining module includes:
第一中心定位图形单元,用于识别所述第一中心定位图形;A first center positioning graphic unit for identifying the first center positioning graphic;
第一中心定位图形中心单元,用于根据所述第一中心定位图形,确定所述第一中心定位图形的中心位置;The first center positioning graphic center unit is used to determine the center position of the first center positioning graphic according to the first center positioning graphic;
第二中心定位图形单元,用于以所述第一中心定位图形的中心位置为种子点进行区域生长,确定所述第二中心定位图形;The second center positioning graphic unit is configured to use the center position of the first center positioning graphic as a seed point for region growth, and determine the second center positioning graphic;
所述中心位置确定模块具体用于确定所述第二中心定位图形的中心位置,作为所述二维码的中心位置。The center position determining module is specifically configured to determine the center position of the second center positioning graphic as the center position of the two-dimensional code.
在一种实施方式中,所述旋转角度图形确定模块包括:In an embodiment, the rotation angle graph determining module includes:
虚拟圆确定单元,用于以所述的二维码的中心位置为圆心,确定一预设半径的虚拟圆;The virtual circle determining unit is used to determine a virtual circle with a preset radius by taking the center position of the two-dimensional code as the center of the circle;
预设边缘点确定单元,用于在所述虚拟圆上,确定当前所述旋转角度定位图形的预设边缘点;A preset edge point determining unit, configured to determine a preset edge point of the current rotation angle positioning graph on the virtual circle;
所述旋转角度确定模块用于根据所述当前所述旋转角度定位图形的预设边缘点的位置和预存的原始的所述旋转角度定位图形的预设边缘点的位置,确定所述二维码的旋转角度。The rotation angle determination module is configured to determine the two-dimensional code according to the position of the preset edge point of the current rotation angle positioning graph and the prestored position of the preset edge point of the original rotation angle positioning graph The angle of rotation.
在一种实施方式中,所述预设边缘点确定单元包括:In an embodiment, the preset edge point determining unit includes:
灰度采样子单元,用于对所述虚拟圆上的若干预设位置的像素点进行灰度采样,获取采样像素点的坐标信息和灰度信息;The gray-scale sampling subunit is used to perform gray-scale sampling of pixels at a number of preset positions on the virtual circle to obtain coordinate information and gray-scale information of the sampled pixels;
灰度梯度子单元,用于根据所述采样像素点的灰度信息,获取相邻的采样像素点的灰度梯度;The grayscale gradient subunit is used to obtain the grayscale gradient of adjacent sampling pixels according to the grayscale information of the sampling pixels;
预设边缘点子单元,用于根据灰度梯度最大值对应的所述采样像素点的位置信息,确定当前所述旋转角度定位图形的预设边缘点的位置。The preset edge point subunit is configured to determine the position of the preset edge point of the current rotation angle positioning graph according to the position information of the sampling pixel corresponding to the maximum gray gradient.
在一种实施方式中,所述二维码包括编码区域和旋转角度辅助图形,其中,所述编码区域包括编码信息;所述装置还包括:In an embodiment, the two-dimensional code includes an encoding area and a rotation angle auxiliary graphic, wherein the encoding area includes encoding information; the device further includes:
第一中心位置模块,用于根据所述旋转角度和所述二维码的中心位置,确定所述旋转角度辅助图形的第一中心位置;The first center position module is configured to determine the first center position of the rotation angle auxiliary graphic according to the rotation angle and the center position of the two-dimensional code;
旋转角度辅助图形模块,用于以所述旋转角度辅助图形的中心位置进行区域生长,确定所述旋转角度辅助图形;A rotation angle auxiliary graphic module, configured to perform area growth based on the center position of the rotation angle auxiliary graphic, and determine the rotation angle auxiliary graphic;
第二中心位置模块,用于根据所述旋转角度辅助图形,确定所述旋转角度辅助图形的第二中心位置;The second center position module is configured to determine the second center position of the rotation angle auxiliary graphic according to the rotation angle auxiliary graphic;
编码区域确定模块,用于根据所述二维码的中心位置,确定所述编码区域;An encoding area determination module, configured to determine the encoding area according to the center position of the two-dimensional code;
识别模块,用于根据所述编码区域和所述精确的旋转角度,识别所述编码信息。The recognition module is used for recognizing the coding information according to the coding area and the precise rotation angle.
第四方面,本发明实施例提供一种二维码生成装置,所述二维码包括中心定位图形、旋转角度定位图形和编码区域;其中,所述编码区域包括编码信息,所述装置包括:In a fourth aspect, an embodiment of the present invention provides a two-dimensional code generating device. The two-dimensional code includes a center positioning graphic, a rotation angle positioning graphic, and a coding area; wherein the coding area includes coding information, and the device includes:
二维码中心位置确定模块,用于确定所述二维码的中心位置;A two-dimensional code center position determining module, configured to determine the center position of the two-dimensional code;
位置确定模块,用于根据所述二维码的中心位置,确定所述中心定位图形的位置、所述旋转角度定位图形的位置和编码区域的位置;A position determining module, configured to determine the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the position of the coding area according to the center position of the two-dimensional code;
生成模块,用于根据所述中心定位图形位置、所述旋转角度定位图形的位置和所述编码区域的位置,生成所述中心定位图形,所述旋转角度定位图形和所述编码区域,在所述编码区域中写入编码信息,从而生成所述二维码,使得所述中心定位图形的中心与所述二维码的中心位置重合,所 述旋转角度定位图形上的多个预设边缘点设置在预定的角度方位上,所述多个预设边缘点处于以所述二维码的中心位置为圆心的同一虚拟圆上,所述编码区域处于中心定位图形和所述二维码的中心位置之间的位置。The generating module is used to generate the center positioning graphic, the rotation angle positioning graphic and the coding area according to the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the position of the coding area. The coding information is written in the coding area, thereby generating the two-dimensional code, so that the center of the center positioning graphic coincides with the center position of the two-dimensional code, and the rotation angle positioning a plurality of preset edge points on the graphic Set at a predetermined angle and orientation, the plurality of preset edge points are located on the same virtual circle centered on the center of the two-dimensional code, and the coding area is located at the center of the center positioning graphic and the two-dimensional code Location between locations.
在一种实施方式中,所述中心定位图形包括第一中心定位图形和第二中心定位图形,所述第一中心定位图形的中心位置和所述第二中心定位图形的中心位置均与所述二维码的中心位置重合;所述旋转角度定位图形包括至少两个,且至少存在两个所述旋转角度定位图形不关于所述二维码的中心位置中心对称;In one embodiment, the center positioning pattern includes a first center positioning pattern and a second center positioning pattern, and the center position of the first center positioning pattern and the center position of the second center positioning pattern are both the same as those of the The center positions of the two-dimensional codes coincide; the rotation angle positioning graphics include at least two, and there are at least two rotation angle positioning graphics that are not centrally symmetric about the center position of the two-dimensional code;
所述二维码还包括旋转角度辅助图形,所述装置还包括:The two-dimensional code further includes a rotation angle auxiliary graphic, and the device further includes:
旋转角度辅助图形确定模块,用于根据所述二维码的中心位置,确定所述旋转角度辅助图形的位置;A rotation angle auxiliary graphic determination module, configured to determine the position of the rotation angle auxiliary graphic according to the center position of the two-dimensional code;
所述生成模块用于根据所述中心定位图形位置、所述旋转角度定位图形的位置、所述编码区域的位置和所述旋转角度辅助图形的位置,生成所述二维码。The generating module is configured to generate the two-dimensional code according to the position of the center positioning graphic, the position of the rotation angle positioning graphic, the position of the coding area, and the position of the rotation angle auxiliary graphic.
第五方面,本发明实施例提供了一种二维码识别装置,所述装置的功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。In a fifth aspect, an embodiment of the present invention provides a two-dimensional code recognition device, and the function of the device can be realized by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned functions.
在一个可能的设计中,所述装置的结构中包括处理器和存储器,所述存储器用于存储支持所述装置执行上述二维码识别方法的程序,所述处理器被配置为用于执行所述存储器中存储的程序。所述装置还可以包括通信接口,用于与其他设备或通信网络通信。In a possible design, the structure of the device includes a processor and a memory, the memory is used to store a program that supports the device to execute the above two-dimensional code recognition method, and the processor is configured to execute all The program stored in the memory. The device may also include a communication interface for communicating with other devices or a communication network.
第六方面,本发明实施例提供了一种二维码生成装置,所述装置的功 能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。In the sixth aspect, an embodiment of the present invention provides a two-dimensional code generating device, and the function of the device can be realized by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned functions.
在一个可能的设计中,所述装置的结构中包括处理器和存储器,所述存储器用于存储支持所述装置执行上述二维码生成方法的程序,所述处理器被配置为用于执行所述存储器中存储的程序。所述装置还可以包括通信接口,用于与其他设备或通信网络通信。In a possible design, the structure of the device includes a processor and a memory, the memory is used to store a program that supports the device to execute the above two-dimensional code generation method, and the processor is configured to execute all The program stored in the memory. The device may also include a communication interface for communicating with other devices or a communication network.
第七方面,本发明实施例还提供一种小车,包括本发明任一实施例提供的二维码识别装置;还包括:In a seventh aspect, an embodiment of the present invention further provides a small car, including the two-dimensional code recognition device provided by any embodiment of the present invention; and further includes:
摄像头,用于拍摄二维码图像;Camera, used to take two-dimensional code images;
控制器,用于根据所述二维码识别装置的识别结果控制所述小车的运行。The controller is used for controlling the operation of the trolley according to the recognition result of the two-dimensional code recognition device.
第八方面,本发明实施例还提供一种二维码,根据本发明任一实施例提供的二维码生成装置所生成。In an eighth aspect, an embodiment of the present invention also provides a two-dimensional code, which is generated according to the two-dimensional code generating apparatus provided in any embodiment of the present invention.
第九方面,本发明实施例还提供一种设置有二维码的产品,所述二维码包括中心定位图形、旋转角度定位图形和编码区域;其中,In a ninth aspect, an embodiment of the present invention also provides a product provided with a two-dimensional code, the two-dimensional code including a center positioning pattern, a rotation angle positioning pattern, and a coding area; wherein,
所述中心定位图形用于确定所述二维码的中心位置;The center positioning graphic is used to determine the center position of the two-dimensional code;
所述旋转角度定位图形用于确定所述二维码的旋转角度;The rotation angle positioning graph is used to determine the rotation angle of the two-dimensional code;
所述编码区域用于携带编码信息,所述中心定位图形的中心与所述二维码的中心位置重合,所述旋转角度定位图形上具有多个预设边缘点,所述多个预设边缘点相对于所述中心位置设置在预定的角度方位上,所述多个预设边缘点处于以所述二维码的中心位置为圆心的同一虚拟圆上。The coding area is used to carry coding information, the center of the center positioning graphic coincides with the center position of the two-dimensional code, the rotation angle positioning graphic has a plurality of preset edge points, and the plurality of preset edges The points are arranged at a predetermined angular orientation relative to the center position, and the plurality of preset edge points are on the same virtual circle with the center position of the two-dimensional code as the center.
在一种实施方式中,所述中心定位图形包括第一中心定位图形和第二 中心定位图形,所述第一中心定位图形的中心位置和所述第二中心定位图形的中心位置均与所述二维码的中心位置重合。In one embodiment, the center positioning pattern includes a first center positioning pattern and a second center positioning pattern, and the center position of the first center positioning pattern and the center position of the second center positioning pattern are both the same as those of the The center positions of the QR codes coincide.
所述二维码还包括旋转角度辅助图形,所述旋转角度辅助图形用于获取精确的二维码的旋转角度以替换根据所述旋转角度定位图形确定的所述二维码的旋转角度,各预定的角度方位的角度为素数。The two-dimensional code further includes a rotation angle auxiliary graphic, the rotation angle auxiliary graphic is used to obtain an accurate rotation angle of the two-dimensional code to replace the rotation angle of the two-dimensional code determined according to the rotation angle positioning graphic, each The angle of the predetermined angular orientation is a prime number.
第十方面,本发明实施例提供了一种计算机可读存储介质,用于存储二维码生成装置和二维码识别装置所用的计算机软件指令,其包括用于执行上述二维码生成装置和二维码识别装置所涉及的程序。In a tenth aspect, an embodiment of the present invention provides a computer-readable storage medium for storing computer software instructions used by the two-dimensional code generation device and the two-dimensional code recognition device, which includes the two-dimensional code generation device and The program involved in the two-dimensional code recognition device.
上述技术方案中的一个技术方案具有如下优点或有益效果:依据中心定位图形识别到二维码中心位置后,即可对应确定旋转角度定位图形的位置,进而基于旋转角度定位图形的位置获取旋转角度,并依据旋转角度和中心位置,确定编码区域,以实现识别编码信息,降低二维码的识别计算量。One of the above technical solutions has the following advantages or beneficial effects: after the center position of the two-dimensional code is recognized according to the center positioning graphic, the position of the rotation angle positioning graphic can be determined correspondingly, and then the rotation angle can be obtained based on the position of the rotation angle positioning graphic , And determine the coding area according to the rotation angle and center position to realize the identification of coding information and reduce the amount of calculation for the identification of the two-dimensional code.
上述概述仅仅是为了说明书的目的,并不意图以任何方式进行限制。除上述描述的示意性的方面、实施方式和特征之外,通过参考附图和以下的详细描述,本发明进一步的方面、实施方式和特征将会是容易明白的。The above summary is only for the purpose of description and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments, and features described above, by referring to the accompanying drawings and the following detailed description, further aspects, embodiments, and features of the present invention will be easily understood.
附图说明Description of the drawings
在附图中,除非另外规定,否则贯穿多个附图相同的附图标记表示相同或相似的部件或元素。这些附图不一定是按照比例绘制的。应该理解,这些附图仅描绘了根据本发明公开的一些实施方式,而不应将其视为是对本发明范围的限制。In the drawings, unless otherwise specified, the same reference numerals refer to the same or similar parts or elements throughout the multiple drawings. The drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed according to the present invention, and should not be considered as limiting the scope of the present invention.
图1示出根据本发明实施例的二维码的第一种示例图;Fig. 1 shows a first example diagram of a two-dimensional code according to an embodiment of the present invention;
图2示出根据本发明实施例的二维码的第二种示例图;Fig. 2 shows a second example diagram of a two-dimensional code according to an embodiment of the present invention;
图3示出根据本发明实施例的二维码的第三种示例图;Fig. 3 shows a third example diagram of a two-dimensional code according to an embodiment of the present invention;
图4示出根据本发明实施例的二维码识别方法的流程图;Figure 4 shows a flowchart of a two-dimensional code recognition method according to an embodiment of the present invention;
图5示出根据本发明实施例的二维码扫描识别的示例图;Fig. 5 shows an example diagram of scanning and recognizing a two-dimensional code according to an embodiment of the present invention;
图6示出根据本发明实施例的第一中心定位图形确定其中心位置的示例图;FIG. 6 shows an example diagram of determining the center position of a first center positioning graphic according to an embodiment of the present invention; FIG.
图7示出根据本发明实施例的基于第一中心定位图形的中心位置为种子点进行区域生长的示例图;FIG. 7 shows an example diagram of area growth based on the center position of the first center positioning graph as the seed point according to an embodiment of the present invention;
图8示出根据本发明实施例的通过虚拟圆确定旋转角度定位图形的预设边缘点的示例图;FIG. 8 shows an example diagram of determining a preset edge point of a rotation angle positioning graphic through a virtual circle according to an embodiment of the present invention;
图9示出根据本发明实施例的旋转角度辅助图形区域生长示例图;FIG. 9 shows an example diagram of the growth of the rotation angle auxiliary pattern area according to an embodiment of the present invention;
图10示出根据本发明实施例的对编码区域进行灰度采样的示例图;Fig. 10 shows an example diagram of performing grayscale sampling on a coding region according to an embodiment of the present invention;
图11示出根据本发明实施例的二维码生成方法的流程图;FIG. 11 shows a flowchart of a method for generating a two-dimensional code according to an embodiment of the present invention;
图12示出根据本发明实施例的二维码识别装置的结构框图;Figure 12 shows a structural block diagram of a two-dimensional code recognition device according to an embodiment of the present invention;
图13示出根据本发明实施例的二维码生成装置的结构框图;Figure 13 shows a structural block diagram of a two-dimensional code generating device according to an embodiment of the present invention;
图14示出根据本发明实施例的二维码识别装置和二维码生成装置的硬件图。Fig. 14 shows a hardware diagram of a two-dimensional code recognition device and a two-dimensional code generation device according to an embodiment of the present invention.
具体实施方式Detailed ways
在下文中,仅简单地描述了某些示例性实施例。正如本领域技术人员可认识到的那样,在不脱离本发明的精神或范围的情况下,可通过各种不 同方式修改所描述的实施例。因此,附图和描述被认为本质上是示例性的而非限制性的。In the following, only certain exemplary embodiments are briefly described. As those skilled in the art can realize, the described embodiments may be modified in various different ways without departing from the spirit or scope of the present invention. Therefore, the drawings and description are to be regarded as illustrative in nature and not restrictive.
图1示出了根据本发明实施例的二维码的第一种示例图。该二维码可以形成为一种标签,或附着或者印刷到使用二维码的各种产品上。参见图1,根据本发明的一种实施方式的二维码包括第一中心定位图形11和第二中心定位图形12、旋转角度定位图形13和编码区域14;其中,编码区域14包括编码信息。Fig. 1 shows a first example diagram of a two-dimensional code according to an embodiment of the present invention. The two-dimensional code can be formed as a kind of label, or attached or printed on various products using the two-dimensional code. Referring to FIG. 1, a two-dimensional code according to an embodiment of the present invention includes a first center positioning pattern 11 and a second center positioning pattern 12, a rotation angle positioning pattern 13 and an encoding area 14; wherein the encoding area 14 includes encoding information.
第一中心定位图形11和第二中心定位图形12统称为中心定位图形。第一中心定位图形11的中心位置和第二中心定位图形12的中心位置重合,为二维码的中心位置。The first center positioning pattern 11 and the second center positioning pattern 12 are collectively referred to as center positioning patterns. The center position of the first center positioning pattern 11 coincides with the center position of the second center positioning pattern 12, which is the center position of the two-dimensional code.
根据优选的实施方式,第一中心定位图形11和第二中心定位图形12为容易确定中心的对称图形,例如圆形和正方形等。当然,其它非对称图形若可以计算出中心的也可以作为第一中心定位图形。例如,第一中心定位图形为平行四边形时,平行四边形的对角线的交点即可确定中心。According to a preferred embodiment, the first center positioning pattern 11 and the second center positioning pattern 12 are symmetrical patterns whose centers are easily determined, such as circles and squares. Of course, other asymmetric graphics can also be used as the first center positioning graphics if the center can be calculated. For example, when the first center positioning figure is a parallelogram, the intersection of the diagonals of the parallelogram can determine the center.
根据一种示例,第一中心定位图形11的内部可以为空,第一中心定位图形11为图1所示的圆环,也可为图2所示的内部空的方形;当然还可以内部空的三角形或矩形等。第二中心定位图形12可以包括圆形、方形或三角形等。According to an example, the interior of the first center positioning graphic 11 may be empty, and the first center positioning graphic 11 may be a ring as shown in FIG. 1 or a square with an empty interior as shown in FIG. 2; of course, it may also be empty inside. Triangle or rectangle etc. The second center positioning graphic 12 may include a circle, a square, a triangle, or the like.
优选的,第一中心定位图形11的尺寸大于第二中心定位图形12的尺寸,第二中心定位图形12位于第一中心定位图形的内部。Preferably, the size of the first center positioning pattern 11 is larger than the size of the second center positioning pattern 12, and the second center positioning pattern 12 is located inside the first center positioning pattern.
编码区域14位于第二中心定位图形12和第一中心定位图形11之间。编码区域14可以采用各种形式,只要其可以有效地包含编码信息即可。The coding area 14 is located between the second center positioning pattern 12 and the first center positioning pattern 11. The coding area 14 may take various forms as long as it can effectively contain coding information.
在一种实施方式中,旋转角度定位图形13位于第二中心定位图形和编码区域14之间。在一种实施方式中,旋转角度定位图形13包括至少两个,且至少存在两个旋转角度定位图形13不关于二维码的中心位置中心对称。要求至少存在两个旋转角度定位图形13不关于二维码的中心位置中心对称,有利于确定二维码的旋转角度。In one embodiment, the rotation angle positioning pattern 13 is located between the second central positioning pattern and the coding area 14. In one embodiment, the rotation angle positioning pattern 13 includes at least two, and there are at least two rotation angle positioning patterns 13 that are not centrally symmetric about the center position of the two-dimensional code. It is required that there are at least two rotation angle positioning graphics 13 that are not center-symmetric about the center position of the two-dimensional code, which is beneficial to determine the rotation angle of the two-dimensional code.
根据一种实施方式,旋转角度定位图形13具有多个预设边缘点,这些预设边缘点位于同一虚拟圆上,旋转角度定位图形的预设边缘点(即旋转角度定位图形与虚拟圆相交的边缘点)在二维码无旋转的情况,相对二维码中心位置的角度(例如与二维码中心位置的连线相对水平方位的角度)的角度值为素数,使预设边缘点的角度值之间没有最大公约数。According to one embodiment, the rotation angle positioning graph 13 has a plurality of preset edge points, and these preset edge points are located on the same virtual circle. The preset edge points of the rotation angle positioning graph (that is, the position where the rotation angle positioning graph intersects the virtual circle) Edge point) In the case of the QR code without rotation, the angle relative to the center position of the QR code (for example, the angle of the connection with the center position of the QR code relative to the horizontal direction) is a prime number, so that the angle of the edge point is preset There is no greatest common divisor between the values.
在一种实施方式中,二维码以极坐标布局,其中,二维码的中心位置为极坐标的原点。In one embodiment, the two-dimensional code is laid out in polar coordinates, wherein the center position of the two-dimensional code is the origin of the polar coordinates.
极坐标具有旋转不变的特性,因此在二维码识别扫描的过程中,从各个方向看都是一样的,这使得扫描更加简洁。在编码区域,一般是矩形的布局,矩形的布局会造成边角区域空间浪费。采用极坐标的布局,使得空间利用的更为充分。Polar coordinates have the characteristics of rotation invariance, so in the process of two-dimensional code recognition and scanning, they are the same from all directions, which makes scanning more concise. In the coding area, the layout is generally rectangular, and the rectangular layout will waste space in the corner area. The layout of polar coordinates makes the space utilization more fully.
上述极坐标为优选实施方式,本发明实施例也可以采用非极坐标的二维码布局。The above-mentioned polar coordinates are preferred implementations, and the embodiment of the present invention may also adopt a non-polar coordinate two-dimensional code layout.
在一种实施方式中,二维码还包括旋转角度辅助图形111。参见图3,给出了四个定位圆的示例,四个定位圆均匀分布于第一中心定位图形11的外侧,有利于当任一个定位圆被污染时,也能保证二维码的准确识别。在其它实施方式中也可以对定位圆的数量和分布位置进行调整。In an embodiment, the two-dimensional code further includes a rotation angle auxiliary graphic 111. Referring to Figure 3, an example of four positioning circles is given. The four positioning circles are evenly distributed on the outside of the first central positioning pattern 11, which is beneficial to ensure accurate identification of the QR code when any positioning circle is contaminated. . In other embodiments, the number and distribution positions of the positioning circles can also be adjusted.
在一种实施方式中,参见图3,二维码还包括粘贴对齐标识112,根据该粘贴对齐标识112,用户可以准确粘贴二维码。In one embodiment, referring to FIG. 3, the two-dimensional code further includes a paste alignment mark 112, and the user can accurately paste the two-dimensional code according to the paste alignment mark 112.
图4示出了根据本发明实施例的二维码识别方法的流程图。参见图4,该方法包括:Fig. 4 shows a flowchart of a two-dimensional code recognition method according to an embodiment of the present invention. Referring to Figure 4, the method includes:
S41、确定中心定位图形;S41. Determine the center positioning graphic;
S42、根据中心定位图形,确定二维码的中心位置;S42. Determine the center position of the QR code according to the center positioning graphic;
S43、根据二维码的中心位置,确定旋转角度定位图形13的位置;S43: Determine the position of the rotation angle positioning graphic 13 according to the center position of the two-dimensional code;
S44、根据旋转角度定位图形13的位置,确定二维码的旋转角度;S44. Position the position of the graphic 13 according to the rotation angle, and determine the rotation angle of the two-dimensional code;
S45、根据二维码的中心位置,确定编码区域14;S45. Determine the coding area 14 according to the center position of the two-dimensional code;
S46、根据编码区域14和旋转角度,识别编码信息。S46. Identify the encoded information according to the encoding area 14 and the rotation angle.
下面对每个步骤进行更详细的说明。Each step is described in more detail below.
步骤S41确定中心定位图形,包括步骤A~步骤C:Step S41 determines the center positioning graphic, including steps A to C:
步骤A、识别第一中心定位图形11。根据一种实施方式,识别出的第一中心定位图形既可以包括整个第一中心定位图形的像素点,也可以包括第一中心定位图形的边界或者是位于第一中心定位图形上的关键像素点等。具体的选择需要根据第一中心定位图形11的形状来确定,例如第一中心定位图形11为圆环时,由于圆环不会随着旋转而发生改变,只需要识别出若干边界关键像素点即可代表第一中心定位图形。Step A: Identify the first center positioning pattern 11. According to an embodiment, the recognized first center positioning graphic may include the pixels of the entire first center positioning graphic, or may include the boundary of the first center positioning graphic or the key pixel points located on the first center positioning graphic Wait. The specific selection needs to be determined according to the shape of the first center positioning graphic 11. For example, when the first center positioning graphic 11 is a circular ring, since the circular ring does not change with rotation, only a few key boundary pixels need to be identified. Can represent the first center positioning graphic.
因此在第一中心定位图形11为圆环的情况下,步骤S411识别第一中心定位图形11可以包括识别出第一中心定位图形11的若干预设点。Therefore, in the case where the first central positioning pattern 11 is a circular ring, the step S411 identifying the first central positioning pattern 11 may include identifying a number of preset points of the first central positioning pattern 11.
根据一种实施方式,可以如下地获得该若干个预设点。According to an embodiment, the several preset points can be obtained as follows.
示例地,参见图5,对二维码进行水平扫描,例如每5行扫描一次, 每行扫描间距为3列,并根据相邻像素的灰度值差值确定圆环上坐标点;并在从左往右扫描的过程中执行下述步骤:For example, referring to Figure 5, the two-dimensional code is scanned horizontally, for example, once every 5 rows, and the scanning interval of each row is 3 columns, and the coordinate points on the circle are determined according to the gray value difference of adjacent pixels; and Perform the following steps during scanning from left to right:
(1)确定白色变成黑色的边缘点,例如图5中所示的点A:(1) Determine the edge point where white becomes black, such as point A shown in Figure 5:
若右边相邻像素点的灰度值减去左边相邻像素的灰度值差值小于第一灰度差值,例如第一灰度差值取值-30,则求解出白色变成黑色的边缘点。If the gray value of the adjacent pixel on the right minus the gray value of the adjacent pixel on the left is less than the first gray value difference, for example, the first gray value difference is -30, then the white color becomes black. Edge point.
(2)确定黑色变成白色的边缘点,例如图5中所示的点B:(2) Determine the edge point where black becomes white, such as point B shown in Figure 5:
若右边相邻像素点的灰度值减去左边相邻像素的灰度值差值大于第二灰度差值,例如第二灰度差值取值30,则求解出黑色变成白色的边缘点。If the gray value of the adjacent pixel on the right minus the gray value of the adjacent pixel on the left is greater than the second gray difference, for example, the second gray difference is 30, then the edge where black becomes white is solved point.
(3)在同一行中,相邻的两个边缘点(白色变成黑色的边缘点和黑色变成白色的边缘点)的距离小于预设阈值,则求解出两点之间的中心点,例如点A和点B之间的中心点C。(3) In the same row, if the distance between two adjacent edge points (the edge point where white becomes black and the edge point where black becomes white) is less than the preset threshold, the center point between the two points is solved, For example, the center point C between point A and point B.
根据一种实施方式,步骤A里所确定的第一中心定位图形11的若干预设点包括上述步骤所确定的多个中心点C。如图6示出了三个点C:C1、C2和C0。只确若干点可以降低运算量,节省识别时间,提高用户体验。当然,步骤A里所确定的第一中心定位图形11的若干预设点也可以包括步骤(1)和(2)的所确定的边缘点,例如图5示的点A和点B。According to an embodiment, the plurality of preset points of the first center positioning graphic 11 determined in step A include a plurality of center points C determined in the above step. Figure 6 shows three points C: C1, C2 and C0. Confirming only a few points can reduce the amount of calculation, save recognition time, and improve user experience. Of course, the several preset points of the first center positioning graphic 11 determined in step A may also include the edge points determined in steps (1) and (2), such as point A and point B shown in FIG. 5.
步骤B、根据第一中心定位图形11,确定第一中心定位图形11的中心位置,例如图6的点G1。以第一中心定位图形11为圆环为例,若确定了位于圆环边界上的若干像素点,根据圆的特性,选取三个边界上的像素点可计算出圆心。Step B: Determine the center position of the first center positioning pattern 11 according to the first center positioning pattern 11, such as the point G1 in FIG. 6. Taking the first center positioning graphic 11 as a circular ring as an example, if a number of pixels located on the boundary of the circular ring are determined, the center of the circle can be calculated by selecting pixels on the three boundaries according to the characteristics of the circle.
根据一种实施方式,步骤B根据步骤A中获取的第一中心定位图形11的若干预设点中选取三个点,如图6中优选了步骤(3)中心点中的点C1、 点C2和点C0。可以根据C1、C2和CO确定这三点所限定的圆的圆心,作为第一中心定位图形11的中心位置。According to one embodiment, step B selects three points from a number of preset points of the first center positioning graphic 11 obtained in step A, as shown in FIG. 6, the point C1 and the point C2 in the center point of step (3) are optimized. And point C0. The center of the circle defined by these three points can be determined according to C1, C2, and CO, as the center position of the first center positioning graph 11.
根据另一种实施方式,和上一实施方式步骤B同样都选取了点C1、点C2和点C0。不同的是,本实施方式的点C0满足:为所有位于点C1和点C2之间的中心点合集中的中点。然后求解两个中心点的中点C12。连接C12和C0,圆心必定经过的C12和C0所在的直线。根据已知的圆环的直径或半径即可确定圆心,由于预先知道了圆环半径或直径,因而这个算法比利用三个点限定一个圆来计算圆心的算法更加节省计算资源。According to another embodiment, the point C1, the point C2, and the point C0 are selected as in step B of the previous embodiment. The difference is that the point C0 in this embodiment satisfies: it is the midpoint of all the central points located between the point C1 and the point C2. Then solve the midpoint C12 of the two center points. Connecting C12 and C0, the center of the circle must pass through the line where C12 and C0 are located. The center of the circle can be determined based on the known diameter or radius of the ring. Since the radius or diameter of the ring is known in advance, this algorithm saves more computing resources than the algorithm that uses three points to define a circle to calculate the center of the circle.
步骤C、以第一中心定位图形11的中心位置为种子点进行区域生长,确定第二中心定位图形12。其中,区域生长是指将成组的像素或区域发展成更大区域的过程。从种子点的集合开始,从这些点的区域 增长是通过将与每个种子点有相似属性像强度、 灰度级、纹理颜色等的相邻像素合并到此区域。 Step C: Use the center position of the first center positioning pattern 11 as the seed point to perform region growth, and determine the second center positioning pattern 12. Among them, area growth refers to the process of developing groups of pixels or areas into larger areas. Starting from the seed point set, from the region of the growth of these points is similar attributes by each seed point image intensity, gray scale, texture color binning adjacent to this area.
根据一种实施方式,当第二中心定位图形12为圆形时,参见图7,以第一中心定位图形11的中心位置为种子点,分别沿竖直方向和水平方向进行生长,确定竖直方向的生长路径和水平方向的生长路径,竖直方向的生长路径和水平方向的生长路径构成图7中的十字生长路径。根据十字生长路径可以确定第一中心定位图形11的边界。According to one embodiment, when the second center positioning pattern 12 is circular, referring to FIG. 7, the center position of the first center positioning pattern 11 is used as the seed point, and the growth is carried out in the vertical direction and the horizontal direction respectively, and the vertical direction is determined. The growth path in the direction and the growth path in the horizontal direction, and the growth path in the vertical direction and the growth path in the horizontal direction constitute the cross growth path in FIG. 7. According to the cross growth path, the boundary of the first center positioning pattern 11 can be determined.
上述实施方式,当第二中心定位图形为圆形时,根据圆的特性,只需要进行竖直方向和水平方向进行两路路径的生长,求解路径的中点即可确定圆的圆心,大大节省计算量。In the above embodiment, when the second center positioning figure is a circle, according to the characteristics of the circle, only the growth of the two paths in the vertical and horizontal directions is required, and the center of the circle can be determined by solving the midpoint of the path, which greatly saves Calculation amount.
步骤S42的根据中心定位图形确定二维码的中心位置即为确定第二中 心定位图形12的中心位置作为二维码的中心位置。The determination of the center position of the two-dimensional code according to the center positioning pattern in step S42 is to determine the center position of the second center positioning pattern 12 as the center position of the two-dimensional code.
根据一种实施方式,当第二中心定位图形12为圆形时,步骤S42包括:According to one embodiment, when the second center positioning pattern 12 is circular, step S42 includes:
根据竖直方向的生长路径的中点和水平方向的生长路径的中点,即求解十字生长路径的行和列的均值,确定第二中心定位图形的中心位置,作为二维码的中心位置。According to the midpoint of the vertical growth path and the midpoint of the horizontal growth path, that is, the average value of the rows and columns of the cross growth path is calculated, the center position of the second center positioning graph is determined as the center position of the two-dimensional code.
上述步骤A~步骤C采用了中心定位图形包括第一中心定位图形和第二中心定位图形的方式,借助第一中心定位图形11尺寸较大较为容易被识别的优势,先确定第一中心定位图形后,根据第一中心定位图形再来确定第二中心定位图形的方式,而第二中心定位图形12尺寸较小,通过计算第二中心定位图形的中心位置直接作为二维码的中心位置,其准确率高。The above steps A to C adopt the method that the center positioning graphics include the first center positioning graphics and the second center positioning graphics. With the advantage of the larger size of the first center positioning graphics 11 and easier recognition, first determine the first center positioning graphics Then, the method of the second center positioning graphic is determined according to the first center positioning graphic, and the second center positioning graphic 12 is smaller in size. By calculating the center position of the second center positioning graphic directly as the center position of the QR code, it is accurate The rate is high.
回到图4,在确定了二维码的中心位置之后,进入步骤S43,确定旋转角度定位图形的位置。在一种实施方式中,步骤S43包括:Returning to FIG. 4, after the center position of the two-dimensional code is determined, step S43 is entered to determine the position of the rotation angle positioning graphic. In an embodiment, step S43 includes:
步骤D、以二维码的中心位置为圆心,确定一预设半径的虚拟圆;虚拟圆为一封闭曲线,虚拟圆上的点均与二维码的中心位置相距预设半径。Step D: Determine a virtual circle with a preset radius by taking the center position of the QR code as the center of the circle; the virtual circle is a closed curve, and the points on the virtual circle are all separated from the center position of the QR code by a preset radius.
步骤E、参见图8,在虚拟圆上,确定当前旋转角度定位图形的预设边缘点;其中,预设边缘点为旋转角度定位图形13的边缘点中经过虚拟圆的边缘点。Step E. Referring to FIG. 8, on the virtual circle, determine the preset edge point of the current rotation angle positioning graph; wherein, the preset edge point is an edge point passing through the virtual circle among the edge points of the rotation angle positioning graph 13.
需要说明的是,旋转角度定位图形13和二维码的中心位置的相对距离关系为已知的,必定经过以二维码的中心为圆心的虚拟圆,因此根据二维码的中心位置确定一虚拟圆,在虚拟圆上确定旋转角度定位图形的边缘点,即可获取旋转角度定位图形13的预设边缘点的位置。It should be noted that the relative distance relationship between the rotation angle positioning pattern 13 and the center position of the two-dimensional code is known, and it must pass through a virtual circle centered on the center of the two-dimensional code. Therefore, one is determined according to the center position of the two-dimensional code. In the virtual circle, the edge point of the rotation angle positioning graphic is determined on the virtual circle, and the position of the preset edge point of the rotation angle positioning graphic 13 can be obtained.
在一种实施方式中,步骤E在虚拟圆上,确定当前旋转角度定位图形 的预设边缘点包括:In one embodiment, step E is on the virtual circle, and determining the preset edge point of the current rotation angle positioning graph includes:
E1、对虚拟圆上的若干预设位置的像素点进行灰度采样,获取采样像素点的坐标信息和灰度信息;E1. Perform grayscale sampling of pixels at a number of preset positions on the virtual circle, and obtain coordinate information and grayscale information of the sampled pixels;
E2、根据采样像素点的灰度信息,获取相邻的采样像素点的灰度梯度;E2, according to the gray information of the sampled pixel, obtain the gray gradient of the adjacent sampled pixel;
E3、根据灰度梯度最大值对应采样像素点的位置信息,确定当前旋转角度定位图形的预设边缘点的位置。其中,位置n的采样像素点的灰度梯度为|S n+1-S n|;Sn表示位置n的采样像素点的灰度信息;S n+1表示与位置n的采样像素点相邻的上一采样像素点的灰度信息。灰度梯度最大值的采样像素点即为|S n+1-S n|最大的采样像素点。这些灰度梯度最大值的采样像素点即为旋转角度定位图形13的预设边缘点。确定了这些预设边缘点,即为确定了旋转角度定位图形的位置。 E3. Determine the position of the preset edge point of the current rotation angle positioning graph according to the position information of the sampling pixel corresponding to the maximum value of the gray gradient. Among them, the gray gradient of the sampling pixel at position n is |S n+1 -S n |; Sn represents the gray information of the sampling pixel at position n; S n+1 represents adjacent to the sampling pixel at position n The gray information of the last sampled pixel. The sampling pixel of the maximum gray gradient is the largest sampling pixel of |S n+1 -S n |. The sampled pixel points of the maximum gray gradient are the preset edge points of the rotation angle positioning graphic 13. The determination of these preset edge points is to determine the position of the rotation angle positioning graph.
出于示例的目的,在图8中示出了4个预设边缘点:P1、P2、P3和P4。预设边缘点的数量与旋转角度定位图形13的个数、形状,预设的虚拟圆的半径有关。可根据实际需要进行增减。以二维码的中心位置为原点,选取预定方向(例如竖直向上/水平向右)为极轴,并选定角度的正方向(例如顺时针方向为正方向),建立极坐标。如果二维码没有旋转,则这四个预设边缘点的位置应该处于预设的角度位置,假定为θ1、θ2、θ3、θ4的方位(即无旋转角度),即极坐标位置为P1(R,θ1),P2(R,θ2),P3(R,θ3),P4(R,θ4)。For the purpose of example, 4 preset edge points are shown in FIG. 8: P1, P2, P3, and P4. The number of preset edge points is related to the number and shape of the rotation angle positioning graphics 13, and the preset virtual circle radius. It can be increased or decreased according to actual needs. Taking the center position of the two-dimensional code as the origin, selecting a predetermined direction (for example, vertical up/horizontal right) as the polar axis, and selecting the positive direction of the angle (for example, the clockwise direction is the positive direction) to establish polar coordinates. If the QR code is not rotated, the positions of these four preset edge points should be at the preset angle positions, assuming the orientation of θ1, θ2, θ3, θ4 (ie no rotation angle), that is, the polar coordinate position is P1( R, θ1), P2 (R, θ2), P3 (R, θ3), P4 (R, θ4).
根据一种实施方式,在步骤S44中,确定所得的各预设边缘点的角度与对应的无旋转角度(预设的角度位置)之间的差即可得到二维码的旋转角度。可以计算基于这些预设边缘点的角度所获得的差的均值,作为二维 码的旋转角度。According to one embodiment, in step S44, the difference between the obtained angle of each preset edge point and the corresponding non-rotation angle (preset angle position) can be determined to obtain the rotation angle of the two-dimensional code. The average value of the difference obtained based on the angles of these preset edge points can be calculated as the rotation angle of the two-dimensional code.
另外,如果分别依据各预设边缘点的无旋转角度将二维码围绕自身中心位置进行旋转,分别使各预设边缘点处于预定角度,则每次都会处于该预定的角度。例如,在图8的情况下,如果旋转四次,旋转角为-(K+θ1)、-(K+θ2)、-(K+θ3)、-(K+θ4),K为一可选的角度常数,则在无旋转时,各个预设边缘点的角度都会出现至少一次的K,因而出现K值的情况最多。如果有旋转,旋转角度为Q,则角度K-Q出现的次数最多。因而可将K值与各次旋转中出现的最多的角度之间的差,即Q确定为二维码的旋转角度。即可以如下地确定二维码的旋转角度:将二维码旋转多次,分别旋转各预设边缘点的无旋转角度与预设角度K之和,获得每次旋转之后各预设边缘点的角度,选取这些角度中出现次数最多的角度K-Q,将预设角度K与该出现次数最多的角度K-Q的差作为二维码的旋转角度。In addition, if the two-dimensional code is rotated around its center position according to the non-rotation angle of each preset edge point, and each preset edge point is at a predetermined angle, it will be at the predetermined angle each time. For example, in the case of Figure 8, if you rotate four times, the rotation angles are -(K+θ1), -(K+θ2), -(K+θ3), -(K+θ4), and K is an optional When there is no rotation, the angle of each preset edge point will appear K at least once, so the K value appears the most. If there is rotation and the rotation angle is Q, the angle K-Q appears the most times. Therefore, the difference between the K value and the angle that appears most in each rotation, that is, Q, can be determined as the rotation angle of the two-dimensional code. That is, the rotation angle of the two-dimensional code can be determined as follows: rotate the two-dimensional code multiple times, respectively rotate the sum of the non-rotation angle of each preset edge point and the preset angle K, and obtain the value of each preset edge point after each rotation Angle, select the angle KQ with the most occurrences among these angles, and use the difference between the preset angle K and the angle KQ with the most occurrences as the rotation angle of the two-dimensional code.
上述实施方式,由于预设边缘点的数量和位置都是恒定的,计算量较小。In the foregoing embodiment, since the number and positions of the preset edge points are constant, the amount of calculation is small.
通过下面的案例更好理解步骤以上的处理。假定K=0,θ1、θ2、θ3、θ4分别为10°、30°、170°、240°。Use the following case to better understand the processing above the steps. Assuming K=0, θ1, θ2, θ3, and θ4 are 10°, 30°, 170°, and 240°, respectively.
参考图8可知,旋转角度定位图形的预设边缘点(即旋转角度定位图形与虚拟圆相交的边缘点)分别位于位置P1(R,10°),P2(R,30°),P3(R,170°),P4(R,240°)。此时位于虚拟圆上的采样像素点中,位于位置P1、P2、P3和P4的像素点取得的灰度梯度最大。With reference to Figure 8, it can be seen that the preset edge points of the rotation angle positioning graph (ie the edge points where the rotation angle positioning graph intersects the virtual circle) are located at positions P1 (R, 10°), P2 (R, 30°), P3 (R , 170°), P4 (R, 240°). At this time, among the sampled pixels located on the virtual circle, the pixels located at the positions P1, P2, P3, and P4 obtain the largest gray gradient.
选取K=0°,如果没有旋转,则将二维码分别逆时针旋转10°、30°、170°和240°,并进行四组采样像素点的灰度采样。那么灰度梯度的最大 值(即各预设边缘点)位于下述位置(下述位置省略了R):Select K=0°, if there is no rotation, rotate the two-dimensional code counterclockwise by 10°, 30°, 170°, and 240°, and perform grayscale sampling of four sets of sampled pixels. Then the maximum value of the gray gradient (that is, each preset edge point) is located in the following position (R is omitted in the following position):
旋转10°:0°、20°、160°、230°Rotation 10°: 0°, 20°, 160°, 230°
旋转30°:340°、0°、170°、210°Rotate 30°: 340°, 0°, 170°, 210°
旋转170°:200°、220°、0°、70°Rotate 170°: 200°, 220°, 0°, 70°
旋转240°:130°、150°、290°、0°Rotation 240°: 130°, 150°, 290°, 0°
此时在0°方位在四组数据中总共得到四个梯度最大值,那么得到的灰度梯度总值也最大,即预存的原始的灰度梯度总值中的最大值对应的坐标信息为(R,0°)At this time, a total of four maximum values of gradients are obtained in the four sets of data at 0° azimuth, then the total gray gradient value obtained is also the maximum, that is, the coordinate information corresponding to the maximum value of the prestored original gray gradient total value is ( R,0°)
如果二维码的旋转角度为逆时针旋转20°,则旋转角度定位图形的预设边缘点(即旋转角度定位图形与虚拟圆相交的边缘点)位于位置P1'(R,350°),P2'(R,10°),P3'(R,150°),P4'(R,220°)。此时,将二维码分别逆时针旋转10°、30°、170°和240°,并获得四组采样像素点的灰度采样。每组数据中灰度梯度的最大值位于下述位置If the rotation angle of the QR code is 20° counterclockwise, the preset edge point of the rotation angle positioning graphic (that is, the edge point where the rotation angle positioning graphic intersects the virtual circle) is located at position P1' (R, 350°), P2 '(R, 10°), P3' (R, 150°), P4' (R, 220°). At this time, the two-dimensional code is rotated counterclockwise by 10°, 30°, 170°, and 240°, and the grayscale samples of four sets of sampled pixels are obtained. The maximum value of gray gradient in each group of data is located in the following position
旋转10°:340°、0°、140°、210°Rotation 10°: 340°, 0°, 140°, 210°
旋转30°:320°、340°、120°、210°Rotate 30°: 320°, 340°, 120°, 210°
旋转170°:180°、200°、340°、50°Rotation 170°: 180°, 200°, 340°, 50°
旋转240°:150°、130°、270°、340°Rotation 240°: 150°, 130°, 270°, 340°
此时在340°得到四个梯度极大值。At this time, four gradient maxima are obtained at 340°.
此时根据上述四组数据可知,在340°方位总共得到四个梯度最大值,那么以上步骤计算四组采样像素点的灰度梯度中,得到的灰度梯度最大值对应的坐标信息为(R,340°)。将该340°与0°比较,可以得到二维码的旋转角度为逆时针旋转20°。At this time, according to the above four sets of data, a total of four maximum gradients are obtained at the 340° orientation. Then the above steps calculate the gray gradients of the four sets of sampled pixels, and the coordinate information corresponding to the maximum gray gradient is (R , 340°). Comparing this 340° with 0°, it can be obtained that the rotation angle of the two-dimensional code is 20° counterclockwise.
依据上述的方法,可以更精确地确定二维码的旋转角度。According to the above method, the rotation angle of the two-dimensional code can be determined more accurately.
在一种实施方式中,旋转角度定位图形的预设边缘点(即旋转角度定位图形与虚拟圆相交的边缘点)的原始位置通常满足角度值为素数,使预设边缘点的角度值之间没有最大公约数;例如步骤S441示例的预设边缘点的原始位置分别位于二维码的中心位置的θ1、θ2、θ3、θ4的方位,θ1、θ2、θ3、θ4通常为素数。有利于判断灰度梯度总值中的最大值时减少干扰峰值的数量和强度。除了上述举例采用了两个旋转角度定位图形,以及旋转角度定位图形的预设边缘点总共四个,在其它实施例中,还可以增加旋转角度定位图形,以及旋转角度定位图形的预设边缘点的数量。为了保证可靠性,通常要求至少包括两个旋转角度定位图形。In one embodiment, the original position of the preset edge point of the rotation angle positioning graph (that is, the edge point where the rotation angle positioning graph intersects the virtual circle) usually satisfies the angle value as a prime number, so that the angle value of the preset edge point is between There is no greatest common divisor; for example, the original positions of the preset edge points in step S441 are respectively located in the azimuths of θ1, θ2, θ3, and θ4 of the center position of the two-dimensional code, and θ1, θ2, θ3, and θ4 are usually prime numbers. It is helpful to reduce the number and intensity of interference peaks when judging the maximum value of the total gray gradient. In addition to the above example using two rotation angle positioning graphics, and a total of four preset edge points of the rotation angle positioning graphics, in other embodiments, a rotation angle positioning graphics and preset edge points of the rotation angle positioning graphics can also be added. quantity. In order to ensure reliability, it is usually required to include at least two rotation angle positioning graphics.
上述实施方式中,一方面增加旋转角度辅助图形来进一步精确旋转角度的值,提高了二维码识别的准确率,另一方面,通过区域生长的方式确定旋转角度辅助图形的边界再精确确定其中心位置,基于精确确定的中心位置再来确定更精确的旋转角度,提高了旋转角度的精确度。In the above embodiment, on the one hand, the rotation angle auxiliary graphic is added to further accurately rotate the value of the angle, and the accuracy of the two-dimensional code recognition is improved. On the other hand, the boundary of the rotation angle auxiliary graphic is determined by the method of region growth and then accurately determined. The center position, based on the accurately determined center position, determines a more accurate rotation angle, which improves the accuracy of the rotation angle.
在一种实施方式中,二维码以极坐标方式布局编码信息。In one embodiment, the two-dimensional code lays out the encoded information in a polar coordinate manner.
对应的,步骤S45根据二维码的中心位置,确定编码区域可以包括:根据二维码的中心位置,确定若干不同预设半径的编码信息采集圆,其中,编码区域包括若干不同预设半径的编码信息采集圆所覆盖的区域。Correspondingly, in step S45, determining the encoding area according to the center position of the two-dimensional code may include: determining a number of encoding information collection circles with different preset radii according to the center position of the two-dimensional code, wherein the encoding area includes a number of different preset radii The area covered by the coded information collection circle.
步骤S46根据编码区域和二维码旋转角度Q,识别编码信息,包括:Step S46 identifies the encoding information according to the encoding area and the rotation angle Q of the two-dimensional code, including:
步骤F、从旋转角度Q开始,每隔预设角度采集每一编码信息采集圆上的像素点的坐标信息和灰度值信息;Step F, starting from the rotation angle Q, collect the coordinate information and gray value information of the pixel points on each coded information collection circle every preset angle;
步骤G、根据采集的像素点的坐标信息和灰度值信息,识别编码信息。Step G: Identify the encoded information according to the collected coordinate information and gray value information of the pixel points.
在一种实施方式中,编码信息包括数据信息和纠错信息。步骤G识别编码信息的过程可以包括:In one embodiment, the encoded information includes data information and error correction information. The process of identifying coded information in step G may include:
根据数据信息和纠错信息计算若干伴随式值,若伴随式值全等于0,则获取的数据信息和纠错信息没有错误。Calculate several syndrome values according to the data information and error correction information. If the syndrome values are all equal to 0, the acquired data information and error correction information have no errors.
当伴随式值不全等于0时,由伴随式值确定差错定位多项式,并求出根值,即错误位置值,根据错误位置值计算求得错误值,在对应的错误位置,加上相应的错误值,完成纠错。When the value of the syndrome is not all equal to 0, the error location polynomial is determined by the value of the syndrome, and the root value, that is, the value of the error position, is calculated, and the error value is calculated according to the error position value, and the corresponding error is added to the corresponding error position Value, complete error correction.
步骤F~步骤G的一种示例:参见图10,在旋转角度、二维码的中心位置,第一中心定位图形的圆环半径已知的条件下,编码区域位于二维码的第二中心定位图形和第一中心定位图形之间的区域。在编码区域,圆环半径分别乘以小于1的系数(例如3.4/4.6、2.8/4.6、2.2/4.6)得到预设个小半径(例如3个小半径),从旋转角度开始每预定角度(例如16.37度)取预设个小半径下的坐标(例如3个小半径下对应3个坐标),会得到若干个坐标信息(例如66个坐标),对此若干个坐标信息(例如66个坐标)对应的像素点的灰度值累加求均值,若干个像素点坐标(例如66个坐标)的灰度值大于此均值的变为1,否则变为0,由此得到若干个二进制的数值。若干个二进制中包含表示对应个字节(例如66个二进制包含8个字节),代表着数据信息和纠错信息。An example of step F to step G: see Figure 10, under the condition that the rotation angle, the center position of the two-dimensional code, and the radius of the ring of the first center positioning graph are known, the coding area is located at the second center of the two-dimensional code The area between the positioning graphic and the first central positioning graphic. In the coding area, the radius of the ring is multiplied by a coefficient less than 1 (for example, 3.4/4.6, 2.8/4.6, 2.2/4.6) to obtain a preset small radius (for example, 3 small radii), starting from the rotation angle every predetermined angle ( For example, 16.37 degrees) take a preset coordinate under a small radius (for example, 3 coordinates under 3 small radii), and you will get several coordinate information (for example, 66 coordinates). For this, several coordinate information (for example, 66 coordinates) ) The gray value of the corresponding pixel points is accumulated and averaged, and the gray value of several pixel coordinates (for example, 66 coordinates) is greater than this average value becomes 1, otherwise it becomes 0, thereby obtaining several binary values. A number of bins contain corresponding bytes (for example, 66 bins contain 8 bytes), which represent data information and error correction information.
假如需要编码的信息为M1、M2、M3、M4四个数值,¥表示规定的一种运算,令M1¥M2=u,M1¥M3=v,M1¥M4=w,M2¥M3=x,M2¥M4=y,M3¥M4=z,根据多项式求解原则,四个多项式可以求出四个解,那么只需要知道u、v、w、x、y、z六个数值中的任意四个,就可以解出M1、M2、M3、M4。通常情 况下,将u、v、w、x、y、z全部编入二维码中,那么在读码的时候,就算读错或者漏掉任意两个,也能正常解码。此时,二维码的纠错率为(6-4)/6=33.3%。If the information to be coded is four values M1, M2, M3, and M4, ¥ represents a specified operation, let M1¥M2=u, M1¥M3=v, M1¥M4=w, M2¥M3=x, M2¥M4=y, M3¥M4=z, according to the principle of polynomial solving, four polynomials can find four solutions, so you only need to know any four of the six values u, v, w, x, y, z , You can solve M1, M2, M3, M4. Normally, if u, v, w, x, y, z are all encoded into a QR code, then when reading the code, even if any two of them are read incorrectly or missed, it can be decoded normally. At this time, the error correction rate of the two-dimensional code is (6-4)/6=33.3%.
本实施例的二维码识别方法还包括步骤:The two-dimensional code recognition method of this embodiment further includes the steps:
步骤H、根据旋转角度和二维码的中心位置,确定旋转角度辅助图形111的第一中心位置;Step H: Determine the first center position of the rotation angle auxiliary graphic 111 according to the rotation angle and the center position of the two-dimensional code;
具体地,由于在原始的二维码(即旋转角度为0°的二维码)中,旋转角度辅助图形111的中心与二维码中心的相对位置是固定的。因此,根据旋转角度定位图形所确定的旋转角度和二维码的中心位置,可以确定旋转角度辅助图形111。例如,假设二维码的中心位置为坐标原点,原始的二维码中旋转角度辅助图形的中心位置为(R7,θ7);当旋转角度为θ8,可以求得旋转角度辅助图形111的第一中心位置为(R7,θ7-θ8)。Specifically, since in the original two-dimensional code (ie, the two-dimensional code with a rotation angle of 0°), the relative position of the center of the rotation angle auxiliary pattern 111 and the center of the two-dimensional code is fixed. Therefore, according to the rotation angle determined by the rotation angle positioning graphic and the center position of the two-dimensional code, the rotation angle auxiliary graphic 111 can be determined. For example, assuming that the center position of the two-dimensional code is the coordinate origin, the center position of the rotation angle auxiliary pattern in the original two-dimensional code is (R7, θ7); when the rotation angle is θ8, the first rotation angle auxiliary pattern 111 can be obtained. The center position is (R7, θ7-θ8).
步骤I、以旋转角度辅助图形111的第一中心位置为种子点进行区域生长,确定旋转角度辅助图形;其中,区域生长是指将成组的像素或区域发展成更大区域的过程。从种子点的集合开始,从这些点的区域 增长是通过将与每个种子点有相似属性像强度、 灰度级、纹理颜色等的相邻像素合并到此区域。 Step I: Use the first center position of the rotation angle auxiliary pattern 111 as a seed point to perform region growth to determine the rotation angle auxiliary pattern; wherein, region growth refers to a process of developing a group of pixels or regions into a larger area. Starting from the seed point set, from the region of the growth of these points is similar attributes by each seed point image intensity, gray scale, texture color binning adjacent to this area.
当旋转角度辅助图形111包括若干定位圆时,步骤I可以包括:以旋转角度辅助图形的中心位置为种子点,沿水平方向和竖直方向进行路径进行生长,得到十字生长路径,确定定位圆。When the rotation angle auxiliary graphic 111 includes several positioning circles, step I may include: taking the center position of the rotation angle auxiliary graphic as the seed point, grow the path along the horizontal and vertical directions to obtain the cross growth path, and determine the positioning circle.
步骤J、根据旋转角度辅助图形111,确定旋转角度辅助图形111的第二中心位置;步骤J可以包括:确定步骤I中,水平方向的生长路径的中 点和竖直方向生长路径的中点,确定定位圆的圆心F,即旋转角度辅助图形的第二中心位置。图9所示的是其中一个定位圆的生长路径和圆心F,其它定位圆均可参照该方式进行确定圆心。Step J: Determine the second center position of the rotation angle auxiliary graph 111 according to the rotation angle auxiliary graph 111; Step J may include: determining the midpoint of the horizontal growth path and the midpoint of the vertical growth path in step I, Determine the center F of the positioning circle, that is, the second center position of the rotation angle auxiliary graphic. Figure 9 shows the growth path and center F of one of the positioning circles. Other positioning circles can refer to this method to determine the center of the circle.
步骤K、根据旋转角度辅助图形111的第二中心位置和二维码的中心位置,确定精确的旋转角度。具体地,二维码没有旋转时,旋转角度辅助图形的中心位置相对于二维码的中心位置为确定的,与步骤J中旋转角度辅助图形111的第二中心位置与二维码的中心位置的位置关系进行比对,可以得到当前旋转角度辅助图形的中心位置相较于二维码没有旋转时所偏转的角度,进而对步骤S44中得到的旋转角度进行矫正,求得精确的旋转角度。Step K: Determine an accurate rotation angle according to the second center position of the rotation angle auxiliary graphic 111 and the center position of the two-dimensional code. Specifically, when the two-dimensional code is not rotated, the center position of the rotation angle auxiliary graphic relative to the center position of the two-dimensional code is determined, which is the same as the second center position of the rotation angle auxiliary graphic 111 and the center position of the two-dimensional code in step J Comparing the positional relationship of, it is possible to obtain the center position of the current rotation angle auxiliary graphic compared to the angle deflected when the two-dimensional code is not rotated, and then correct the rotation angle obtained in step S44 to obtain an accurate rotation angle.
图11示出根据本发明实施例的一种二维码生成的流程图。本实施例包括步骤:Fig. 11 shows a flow chart of generating a two-dimensional code according to an embodiment of the present invention. This embodiment includes the steps:
S111、确定二维码的中心位置;S111. Determine the center position of the QR code;
S112、根据二维码的中心位置,确定中心定位图形的位置、旋转角度定位图形的位置和编码区域的位置;S112: Determine the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the position of the coding area according to the center position of the two-dimensional code;
根据一种实施方式,第一中心定位图形为圆环形,第二中心定位图形为圆形或圆环形,根据中心位置和圆形或圆环形(内圆和外圆)的半径来确定第一中心定位图形和第二中心定位图形的位置。根据预设边缘点的无旋转角度(例如θ1、θ2、θ3、θ4)确定旋转角度定位图形的位置,例如根据编码信息采集圆的半径确定编码信息区域等等。According to one embodiment, the first center positioning pattern is a circular ring, and the second center positioning pattern is a circle or a circular ring, which is determined according to the center position and the radius of the circular or circular (inner circle and outer circle) The positions of the first center positioning graphic and the second center positioning graphic. The position of the rotation angle positioning pattern is determined according to the non-rotation angle of the preset edge point (for example, θ1, θ2, θ3, θ4), for example, the code information area is determined according to the radius of the code information collection circle and so on.
S113、根据中心定位图形的位置、旋转角度定位图形的位置和编码区域的位置,生成中心定位图形,旋转角度定位图形和编码区域,在编码区 域中写入编码信息,从而生成二维码,使得中心定位图形的中心与二维码的中心位置重合,旋转角度定位图形上的多个预设边缘点设置在预定的角度方位上,多个预设边缘点处于以二维码的中心位置为圆心的同一虚拟圆上,编码区域处于中心定位图形和二维码的中心位置之间的位置。S113. According to the position of the center positioning graphic, the position of the rotation angle positioning graphic and the position of the coding area, generate the center positioning graphic, the rotation angle positioning graphic and the coding area, and write coding information in the coding area, thereby generating a two-dimensional code, so that The center of the center positioning graphic coincides with the center position of the QR code, the multiple preset edge points on the rotation angle positioning graphic are set at a predetermined angle and orientation, and the multiple preset edge points are centered on the center of the QR code On the same virtual circle of, the coding area is located between the center positioning graphic and the center position of the QR code.
在已知中心定位图形,旋转角度定位图形和编码区域的位置情况下,可以以二维码的中心位置为原点,根据这些图形的坐标和形状生成中心定位图形,旋转角度定位图形和编码区域。可以使用现在已知和未来知悉的任何技术手段在编码区域中写入编码信息。When the position of the center positioning graphics, the rotation angle positioning graphics and the coding area is known, the center position of the two-dimensional code can be used as the origin, and the center positioning graphics, the rotation angle positioning graphics and the coding area can be generated according to the coordinates and shapes of these graphics. Any technical means known now and in the future can be used to write coding information in the coding area.
在一种实施方式中,步骤S113的生成二维码包括生成信息码并将信息码印刷至对应的载体上,生成带有二维码产品,例如纸质二维码标签等。In one embodiment, generating the two-dimensional code in step S113 includes generating an information code and printing the information code on a corresponding carrier to generate a product with a two-dimensional code, such as a paper two-dimensional code label.
在一种实施方式中,参见图3,二维码还包括旋转角度辅助图形111,该生成方法还包括:根据二维码的中心位置,确定旋转角度辅助图形111的位置。In an embodiment, referring to FIG. 3, the two-dimensional code further includes a rotation angle auxiliary graphic 111, and the generating method further includes: determining the position of the rotation angle auxiliary graphic 111 according to the center position of the two-dimensional code.
该步骤包括:根据二维码的中心位置,确定定位圆的圆心位置。在多个定位圆的情况下,确定各定位圆的圆心位置。根据确定的定位圆的圆心,并依据预定的定位圆半径,可以确定定位圆的位置。This step includes: determining the center position of the positioning circle according to the center position of the two-dimensional code. In the case of multiple positioning circles, determine the center position of each positioning circle. According to the determined center of the positioning circle and the predetermined radius of the positioning circle, the position of the positioning circle can be determined.
二维码生成方法还包括:根据二维码的中心位置,确定粘贴对齐标识112的位置。具体,获取预存的粘贴对齐标识112和二维码的中心的相对位置关系,根据二维码的中心位置,确定粘贴对齐标识112的位置。例如,参见图6,当建立以二维码的中心位置为原点的极坐标,在0°、90°、180°和270°的方位,确定四个与二维码的中心位置相距预设标识距离的位置,作为粘贴对齐标识的位置。The method for generating a two-dimensional code further includes: determining a position where the alignment mark 112 is pasted according to the center position of the two-dimensional code. Specifically, the pre-stored relative position relationship between the alignment mark 112 and the center of the two-dimensional code is acquired, and the position of the alignment mark 112 is determined according to the center position of the two-dimensional code. For example, referring to Figure 6, when establishing polar coordinates with the center position of the QR code as the origin, determine four preset marks that are separated from the center position of the QR code at 0°, 90°, 180° and 270° The distance position is used as the position to paste the alignment mark.
对应的,步骤S113包括:根据中心定位图形的位置、旋转角度定位图形的位置、编码区域的位置和粘贴对齐标识的位置,生成二维码。Correspondingly, step S113 includes: generating a two-dimensional code according to the position of the center positioning graphic, the position of the rotation angle positioning graphic, the position of the coding area, and the position where the alignment mark is pasted.
本发明实施例还提供一种二维码识别装置,参见图12,包括:The embodiment of the present invention also provides a two-dimensional code recognition device, referring to FIG. 12, including:
中心定位图形确定模块121,用于确定中心定位图形;The center positioning pattern determining module 121 is used to determine the center positioning pattern;
中心位置确定模块122,用于根据中心定位图形,确定二维码的中心位置;The center position determining module 122 is used to determine the center position of the QR code according to the center positioning graph;
旋转角度图形确定模块123,用于根据二维码的中心位置,确定旋转角度定位图形的位置;The rotation angle graphic determination module 123 is used to determine the position of the rotation angle positioning graphic according to the center position of the QR code;
旋转角度确定模块124,根据旋转角度定位图形的位置,确定二维码的旋转角度;The rotation angle determination module 124 determines the rotation angle of the QR code according to the position of the rotation angle positioning graphic;
编码区域确定模块125,用于根据二维码的中心位置,确定编码区域;The coding area determining module 125 is used to determine the coding area according to the center position of the two-dimensional code;
识别模块126,用于根据编码区域和旋转角度,识别编码信息。The identification module 126 is used to identify encoded information according to the encoding area and the rotation angle.
在一种实施方式中,中心定位图形包括第一中心定位图形和第二中心定位图形,第一中心定位图形的中心位置和第二中心定位图形的中心位置均与二维码的中心位置重合。In one embodiment, the center positioning graphic includes a first center positioning graphic and a second center positioning graphic, and the center position of the first center positioning graphic and the center position of the second center positioning graphic both coincide with the center position of the two-dimensional code.
中心定位图形确定模块121包括:The center positioning graphic determining module 121 includes:
第一中心定位图形单元,用于通过识别第一中心定位图形;The first center positioning graphic unit is used to identify the first center positioning graphic;
第一中心定位图形中心单元,用于根据第一中心定位图形,确定第一中心定位图形的中心位置;The first center positioning graphic center unit is used to determine the center position of the first center positioning graphic according to the first center positioning graphic;
第二中心定位图形单元,用于以第一中心定位图形的中心位置为种子点进行区域生长,确定第二中心定位图形;The second center positioning graphic unit is used to use the center position of the first center positioning graphic as the seed point to grow the area and determine the second center positioning graphic;
中心位置确定模块用于确定第二中心定位图形的中心位置,作为二维 码的中心位置。The center position determining module is used to determine the center position of the second center positioning graphic as the center position of the two-dimensional code.
在一种实施方式中,旋转角度图形确定模块123包括:In an embodiment, the rotation angle graph determining module 123 includes:
虚拟圆确定单元,用于以的二维码的中心位置为圆心,确定一预设半径的虚拟圆;其中,虚拟圆经过旋转角度定位图形;The virtual circle determining unit is used to determine a virtual circle with a preset radius by taking the center position of the two-dimensional code as the center of the circle; wherein the virtual circle locates the figure through the rotation angle;
预设边缘点确定单元,用于确定当前旋转角度定位图形的预设边缘点的位置;其中,预设边缘点为旋转角度定位图形的边缘点中经过虚拟圆的边缘点。The preset edge point determining unit is used to determine the position of the preset edge point of the current rotation angle positioning graph; wherein the preset edge point is an edge point passing through the virtual circle among the edge points of the rotation angle positioning graph.
旋转角度确定模块用于根据当前旋转角度定位图形的预设边缘点的位置和预存的原始的旋转角度定位图形的预设边缘点的位置,确定二维码的旋转角度。The rotation angle determination module is used for determining the rotation angle of the QR code according to the position of the preset edge point of the current rotation angle positioning graphic and the preset edge point of the original rotation angle positioning graphic.
在一种实施方式中,预设边缘点确定单元包括:In an embodiment, the preset edge point determination unit includes:
灰度采样子单元,用于对虚拟圆上的若干预设位置的像素点进行灰度采样,获取采样像素点的坐标信息和灰度信息;The gray-scale sampling sub-unit is used to perform gray-scale sampling of pixels at a number of preset positions on the virtual circle to obtain coordinate information and gray-scale information of the sampled pixels;
灰度梯度子单元,用于根据采样像素点的灰度信息,获取相邻的采样像素点的灰度梯度;The grayscale gradient subunit is used to obtain the grayscale gradient of adjacent sampling pixels according to the grayscale information of the sampling pixels;
预设边缘点子单元,用于根据灰度梯度最大值的采样像素点的位置信息,确定当前旋转角度定位图形的预设边缘点的位置。The preset edge point subunit is used to determine the position of the preset edge point of the current rotation angle positioning graph according to the position information of the sampled pixel point of the maximum gray gradient.
在一种实施方式中,二维码还包括旋转角度辅助图形。In an embodiment, the two-dimensional code further includes a rotation angle auxiliary graphic.
本实施例的装置还包括:The device of this embodiment further includes:
第一中心位置模块,用于根据旋转角度和二维码的中心位置,确定旋转角度辅助图形的第一中心位置;The first center position module is used to determine the first center position of the rotation angle auxiliary graphic according to the rotation angle and the center position of the two-dimensional code;
旋转角度辅助图形模块,用于以旋转角度辅助图形的中心位置进行区 域生长,确定旋转角度辅助图形;Rotation angle auxiliary graphics module, used for regional growth based on the center position of the rotation angle auxiliary graphics, and determine the rotation angle auxiliary graphics;
第二中心位置模块,用于根据旋转角度辅助图形,确定旋转角度辅助图形的第二中心位置;The second center position module is used to determine the second center position of the rotation angle auxiliary graphic according to the rotation angle auxiliary graphic;
精确的旋转角度模块,用于根据旋转角度辅助图形的第二中心位置和二维码的中心位置,确定精确的旋转角度。The precise rotation angle module is used to determine the precise rotation angle according to the second center position of the rotation angle auxiliary graphic and the center position of the two-dimensional code.
识别模块126用于根据编码区域和精确的旋转角度,识别编码信息。The identification module 126 is used to identify the encoded information according to the encoding area and the precise rotation angle.
本发明实施例各装置中的各模块的功能可以参见上述二维码识别方法中的对应描述,在此不再赘述。The function of each module in each device in the embodiment of the present invention can be referred to the corresponding description in the above-mentioned two-dimensional code recognition method, which will not be repeated here.
参见图13,本发明实施例提供一种二维码生成装置,二维码包括中心定位图形、旋转角度定位图形和编码区域;装置包括:Referring to FIG. 13, an embodiment of the present invention provides a two-dimensional code generating device. The two-dimensional code includes a center positioning graph, a rotation angle positioning graph, and a coding area; the device includes:
二维码中心位置获取模块131,用于确定二维码的中心位置;The center position acquisition module 131 of the two-dimensional code is used to determine the center position of the two-dimensional code;
位置确定模块132,用于根据二维码的中心位置,确定中心定位图形的位置、旋转角度定位图形的位置和编码区域;The position determining module 132 is used to determine the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the coding area according to the center position of the two-dimensional code;
生成模块133,用于根据中心定位图形位置、旋转角度定位图形的位置和编码区域的位置,生成中心定位图形,旋转角度定位图形和编码区域,在编码区域中写入编码信息,从而生成二维码,使得中心定位图形的中心与二维码的中心位置重合,旋转角度定位图形上的多个预设边缘点设置在预定的角度方位上,多个预设边缘点处于以二维码的中心位置为圆心的同一虚拟圆上,编码区域处于中心定位图形和二维码的中心位置之间的位置。The generating module 133 is used to generate a center positioning graphic, a rotation angle positioning graphic and a coding area according to the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the position of the coding area, and writing coding information in the coding area to generate a two-dimensional Code so that the center of the center positioning graph coincides with the center position of the QR code, the multiple preset edge points on the rotation angle positioning graph are set at a predetermined angle and orientation, and the multiple preset edge points are at the center of the QR code On the same virtual circle whose position is the center of the circle, the coding area is located between the center positioning graphic and the center position of the two-dimensional code.
在已知中心定位图形,旋转角度定位图形和编码区域的位置情况下,可以以二维码的中心位置为原点,根据这些图形的坐标和形状生成中心定位图形,旋转角度定位图形和编码区域。可以使用现在已知和未来知悉的 任何技术手段在编码区域中写入编码信息。When the position of the center positioning graphics, the rotation angle positioning graphics and the coding area is known, the center position of the two-dimensional code can be used as the origin, and the center positioning graphics, the rotation angle positioning graphics and the coding area can be generated according to the coordinates and shapes of these graphics. Any technical means known now and in the future can be used to write the coding information in the coding area.
在一种实施方式中,中心定位图形包括第一中心定位图形和第二中心定位图形,第一中心定位图形的中心位置和第二中心定位图形的中心位置均与二维码的中心位置重合。In one embodiment, the center positioning graphic includes a first center positioning graphic and a second center positioning graphic, and the center position of the first center positioning graphic and the center position of the second center positioning graphic both coincide with the center position of the two-dimensional code.
在一种实施方式中,旋转角度定位图形包括至少两个,且至少存在两个旋转角度定位图形不关于二维码的中心位置中心对称。In one embodiment, the rotation angle positioning graphics include at least two, and there are at least two rotation angle positioning graphics that are not center-symmetric about the center position of the two-dimensional code.
在一种实施方式中,二维码还包括旋转角度辅助图形,装置还包括:In an embodiment, the two-dimensional code further includes a rotation angle auxiliary graphic, and the device further includes:
旋转角度辅助图形确定模块,用于根据二维码的中心位置,确定旋转角度辅助图形的位置;The rotation angle auxiliary graphic determination module is used to determine the position of the rotation angle auxiliary graphic according to the center position of the QR code;
生成模块用于根据中心定位图形位置、旋转角度定位图形的位置、编码区域和旋转角度辅助图形的位置,生成二维码。The generating module is used to generate a two-dimensional code according to the position of the center positioning graphic, the position of the rotation angle positioning graphic, the coding area and the position of the rotation angle auxiliary graphic.
本发明实施例各装置中的各模块的功能可以参见上述二维码生成方法或识别方法中的对应描述,在此不再赘述。The function of each module in each device in the embodiment of the present invention can be referred to the corresponding description in the above-mentioned two-dimensional code generation method or identification method, which will not be repeated here.
图14示出根据本发明实施例的二维码生成装置和二维码识别装置的硬件图。如图14所示,该装置包括:存储器910和处理器920,存储器910内存储有可在处理器920上运行的计算机程序。所述处理器920执行所述计算机程序时实现上述实施例中的二维码生成方法和二维码识别方法。所述存储器910和处理器920的数量可以为一个或多个。Fig. 14 shows a hardware diagram of a two-dimensional code generation device and a two-dimensional code recognition device according to an embodiment of the present invention. As shown in FIG. 14, the device includes a memory 910 and a processor 920, and the memory 910 stores a computer program that can run on the processor 920. When the processor 920 executes the computer program, the two-dimensional code generation method and the two-dimensional code recognition method in the foregoing embodiments are implemented. The number of the memory 910 and the processor 920 may be one or more.
该装置还包括:The device also includes:
通信接口930,用于与外界设备进行通信,进行数据交互传输。The communication interface 930 is used to communicate with external devices and perform data interactive transmission.
存储器910可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。The memory 910 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), for example, at least one disk memory.
如果存储器910、处理器920和通信接口930独立实现,则存储器910、处理器920和通信接口930可以通过总线相互连接并完成相互间的通信。所述总线可以是工业标准体系结构(ISA,Industry Standard Architecture)总线、外部设备互连(PCI,Peripheral Component Interconnect)总线或扩展工业标准体系结构(EISA,Extended Industry Standard Architecture)总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图15中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。If the memory 910, the processor 920, and the communication interface 930 are implemented independently, the memory 910, the processor 920, and the communication interface 930 may be connected to each other through a bus and complete mutual communication. The bus may be an Industry Standard Architecture (ISA, Industry Standard Architecture) bus, a Peripheral Component Interconnect (PCI, Peripheral Component Interconnect) bus, or an Extended Industry Standard Architecture (EISA, Extended Industry Standard Architecture) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of presentation, only a thick line is used in FIG. 15, but it does not mean that there is only one bus or one type of bus.
可选的,在具体实现上,如果存储器910、处理器920及通信接口930集成在一块芯片上,则存储器910、处理器920及通信接口930可以通过内部接口完成相互间的通信。Optionally, in specific implementation, if the memory 910, the processor 920, and the communication interface 930 are integrated on a single chip, the memory 910, the processor 920, and the communication interface 930 may communicate with each other through internal interfaces.
本发明实施例提供了一种计算机可读存储介质,其存储有计算机程序,该程序被处理器执行时实现上述实施例中任一所述的方法。The embodiment of the present invention provides a computer-readable storage medium that stores a computer program, and when the program is executed by a processor, the method described in any of the above embodiments is implemented.
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本发明的至少一个实施例或示例中。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。In the description of this specification, descriptions with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" etc. mean specific features described in conjunction with the embodiment or example , Structure, materials or features are included in at least one embodiment or example of the present invention. Moreover, the described specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine the different embodiments or examples and the characteristics of the different embodiments or examples described in this specification without contradicting each other.
此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、 “第二”的特征可以明示或隐含地包括至少一个该特征。在本发明的描述中,“多个”的含义是两个或两个以上,除非另有明确具体的限定。In addition, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, "plurality" means two or more than two, unless specifically defined otherwise.
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本发明的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本发明的实施例所属技术领域的技术人员所理解。Any process or method description in the flowchart or described in other ways herein can be understood as a module, segment, or part of code that includes one or more executable instructions for implementing specific logical functions or steps of the process , And the scope of the preferred embodiment of the present invention includes additional implementations, which may not be in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order according to the functions involved. It is understood by those skilled in the art to which the embodiments of the present invention belong.
在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,可以被认为是用于实现逻辑功能的可执行指令的定序列表,可以具体实现在任何计算机可读介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。就本说明书而言,“计算机可读介质”可以是任何可以包含、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。计算机可读介质的更具体的示例(非穷尽性列表)包括以下:具有一个或多个布线的电连接部(电子装置),便携式计算机盘盒(磁装置),随机存取存储器(RAM),只读存储器(ROM),可擦除可编辑只读存储器(EPROM或闪速存储器),光纤装置,以及便携式只读存储器(CDROM)。另外,计算机可读介质甚至可以是可在其上打印所述程序的纸或其他合适的介质,因为可以例如通过对纸或其他介质进行光学扫描,接着进行编辑、解译或必要时以其他合适方式进行处理来以电子方式获得 所述程序,然后将其存储在计算机存储器中。The logic and/or steps represented in the flowchart or described in other ways herein, for example, can be considered as a sequenced list of executable instructions for implementing logic functions, and can be embodied in any computer-readable medium, For use by instruction execution systems, devices, or equipment (such as computer-based systems, systems including processors, or other systems that can fetch instructions from instruction execution systems, devices, or equipment and execute instructions), or combine these instruction execution systems, devices Or equipment. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transmit a program for use by an instruction execution system, device, or device or in combination with these instruction execution systems, devices, or devices. More specific examples (non-exhaustive list) of computer readable media include the following: electrical connections (electronic devices) with one or more wiring, portable computer disk cases (magnetic devices), random access memory (RAM), Read only memory (ROM), erasable and editable read only memory (EPROM or flash memory), fiber optic devices, and portable read only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable media on which the program can be printed, because it can be used, for example, by optically scanning the paper or other media, and then editing, interpreting, or other suitable media if necessary. The program is processed in a manner to obtain the program electronically and then stored in the computer memory.
应当理解,本发明的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。It should be understood that each part of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if it is implemented by hardware, as in another embodiment, it can be implemented by any one or a combination of the following technologies known in the art: a logic gate circuit for implementing logic functions on data signals Discrete logic circuits, application-specific integrated circuits with suitable combinational logic gates, programmable gate array (PGA), field programmable gate array (FPGA), etc.
本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。Those of ordinary skill in the art can understand that all or part of the steps carried in the method of the foregoing embodiments can be implemented by a program instructing relevant hardware to complete. The program can be stored in a computer-readable storage medium. When executed, it includes one of the steps of the method embodiment or a combination thereof.
此外,在本发明各个实施例中的各功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读存储介质中。所述存储介质可以是只读存储器,磁盘或光盘等。In addition, the functional units in the various embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or software functional modules. If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
本发明实施例还提供一种小车,包括本发明任一实施例提供的二维码识别装置。根据一种实施方式,该小车还包括:The embodiment of the present invention also provides a trolley, including the two-dimensional code recognition device provided by any embodiment of the present invention. According to an embodiment, the trolley further includes:
摄像头,用于拍摄二维码图像;Camera, used to take two-dimensional code images;
控制器,用于根据二维码识别装置的识别结果控制小车的运行。二维 码识别装置的识别结果包括的二维码的旋转角度识别结果和编码信息识别结果。其中,利用二维码的旋转角度识别结果可以知道小车相对于的所拍摄的二维码的偏转角度,由此小车可以获知当前方位。编码信息中可以包括小车任务指令等。The controller is used to control the operation of the trolley according to the recognition result of the two-dimensional code recognition device. The recognition result of the two-dimensional code recognition device includes the rotation angle recognition result of the two-dimensional code and the code information recognition result. Among them, the rotation angle recognition result of the two-dimensional code can be used to know the deflection angle of the car relative to the captured two-dimensional code, so that the car can know the current position. The coded information can include cart task instructions, etc.
本实施例的小车可以为AGV小车(Automated Guided Vehicle,简称AGV,通常也称为AGV小车,指装备有电磁或光学等自动导引装置,能够沿规定的导引路径行驶,具有安全保护以及各种移载功能的运输车),AGV小车上搭载有嵌入式计算平台和摄像头,可以持续采图并进行图像分析,可以根据视野中二维码的位置和旋转角度,来计算自己当前的位姿。The trolley in this embodiment may be an AGV (Automated Guided Vehicle, AGV for short), which is also commonly referred to as an AGV trolley. It is equipped with electromagnetic or optical automatic guidance devices, can travel along a prescribed guidance path, has safety protection and various A transport vehicle with transfer function), the AGV car is equipped with an embedded computing platform and a camera, which can continuously collect images and perform image analysis, and can calculate its current pose according to the position and rotation angle of the QR code in the field of view .
具体的运用场景为:二维码,二维码贴在仓库地面上,主要用来为AVG小车定位和导航。二维码粘贴的位置是固定的,每个二维码都承载有独特的信息,可用来标记当前二维码的位置。二维码的图案都有一个确定的中心位置和主方向,AGV小车可以根据下视摄像头中二维码的成像,来反推出AGV小车当前的位置和旋转方向。The specific application scenarios are: QR code, which is posted on the warehouse floor and is mainly used to locate and navigate the AVG trolley. The position where the QR code is pasted is fixed, and each QR code carries unique information that can be used to mark the location of the current QR code. The pattern of the two-dimensional code has a certain center position and main direction. The AGV trolley can infer the current position and rotation direction of the AGV trolley according to the imaging of the two-dimensional code in the down-view camera.
AGV小车,AGV小车上搭载有嵌入式计算平台和摄像头,可以持续采图并进行图像分析,可以根据视野中二维码的位置和旋转角度,来计算自己当前的位姿。The AGV car is equipped with an embedded computing platform and a camera, which can continuously collect images and perform image analysis. It can calculate its current pose based on the position and rotation angle of the QR code in the field of view.
本发明实施例还提供一种二维码,根据本发明任一实施例提供的二维码生成装置所生成的。所生成的二维码的内容可以参照上述实施例的说明,此处不再赘述。The embodiment of the present invention also provides a two-dimensional code, which is generated according to the two-dimensional code generating device provided in any embodiment of the present invention. For the content of the generated two-dimensional code, reference may be made to the description of the foregoing embodiment, which will not be repeated here.
本发明实施例还提供一种设置有二维码的产品,二维码包括中心定位图形、旋转角度定位图形和编码区域;其中,The embodiment of the present invention also provides a product provided with a two-dimensional code. The two-dimensional code includes a center positioning graphic, a rotation angle positioning graphic and a coding area; wherein,
中心定位图形用于确定二维码的中心位置;The center positioning graphic is used to determine the center position of the QR code;
旋转角度定位图形用于确定二维码的旋转角度;The rotation angle positioning graphic is used to determine the rotation angle of the QR code;
编码区域用于携带编码信息,中心定位图形的中心与二维码的中心位置重合,旋转角度定位图形上具有多个预设边缘点,多个预设边缘点相对于中心位置设置在预定的角度方位上,多个预设边缘点处于以二维码的中心位置为圆心的同一虚拟圆上。The coding area is used to carry coding information. The center of the center positioning graphic coincides with the center position of the QR code. The rotation angle positioning graphic has multiple preset edge points, and the multiple preset edge points are set at a predetermined angle relative to the center position. In terms of orientation, multiple preset edge points are located on the same virtual circle with the center position of the QR code as the center.
中心定位图形包括第一中心定位图形和第二中心定位图形,第一中心定位图形的中心位置和第二中心定位图形的中心位置均与二维码的中心位置重合。The center positioning graphic includes a first center positioning graphic and a second center positioning graphic. The center position of the first center positioning graphic and the center position of the second center positioning graphic coincide with the center position of the two-dimensional code.
二维码还包括旋转角度辅助图形,旋转角度辅助图形用于获取精确的二维码的旋转角度以替换根据旋转角度定位图形确定的二维码的旋转角度,各预定的角度方位的角度为素数。The two-dimensional code also includes a rotation angle auxiliary graphic. The rotation angle auxiliary graphic is used to obtain the precise rotation angle of the two-dimensional code to replace the rotation angle of the two-dimensional code determined according to the rotation angle positioning graphic. The angle of each predetermined angle is a prime number. .
另外,二维码的内容未详细叙述之处可以参照上述实施例的说明,此处不再赘述。In addition, for the content of the two-dimensional code that is not described in detail, reference may be made to the description of the foregoing embodiment, which will not be repeated here.
另外,本实施例所指的设置有二维码的产品可以包括印刷或涂覆有本实施例二维码的纸本、本板或金属板等;还可以包括显示有本实施例二维码的电子设备,例如手机、电脑、电视、LED显示屏等。In addition, the product provided with the two-dimensional code referred to in this embodiment may include paper, board or metal plate printed or coated with the two-dimensional code of this embodiment; it may also include the two-dimensional code of this embodiment. Electronic equipment, such as mobile phones, computers, TVs, LED displays, etc.
以上,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到其各种变化或替换,这些都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of various changes or substitutions within the technical scope disclosed by the present invention. These should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims (25)

  1. 一种二维码识别方法,其特征在于,所述二维码包括中心定位图形、旋转角度定位图形;所述方法包括:A method for recognizing a two-dimensional code, wherein the two-dimensional code includes a center positioning pattern and a rotation angle positioning pattern; the method includes:
    确定所述中心定位图形;Determining the center positioning graphic;
    根据所述中心定位图形,确定所述二维码的中心位置;Determining the center position of the two-dimensional code according to the center positioning graph;
    根据所述二维码的中心位置,确定所述旋转角度定位图形的位置;Determine the position of the rotation angle positioning graphic according to the center position of the two-dimensional code;
    根据所述旋转角度定位图形的位置,确定所述二维码的旋转角度。Determine the rotation angle of the two-dimensional code according to the position of the rotation angle positioning graphic.
  2. 根据权利要求1所述的方法,其特征在于,所述中心定位图形包括第一中心定位图形和第二中心定位图形,所述第一中心定位图形的中心位置和所述第二中心定位图形的中心位置均与所述二维码的中心位置重合;The method according to claim 1, wherein the center positioning graphic comprises a first center positioning graphic and a second center positioning graphic, the center position of the first center positioning graphic and the second center positioning graphic The center position coincides with the center position of the two-dimensional code;
    所述确定中心定位图形,包括:The determining center positioning graphic includes:
    识别所述第一中心定位图形;Identifying the first center positioning graphic;
    根据所述第一中心定位图形,确定所述第一中心定位图形的中心位置;Determine the center position of the first center positioning graphic according to the first center positioning graphic;
    以所述第一中心定位图形的中心位置为种子点进行区域生长,确定所述第二中心定位图形;Use the center position of the first center positioning graphic as a seed point to perform region growth, and determine the second center positioning graphic;
    所述根据所述中心定位图形,确定所述二维码的中心位置,包括:The determining the center position of the two-dimensional code according to the center positioning graphic includes:
    确定所述第二中心定位图形的中心位置,作为所述二维码的中心位置。The center position of the second center positioning graphic is determined as the center position of the two-dimensional code.
  3. 根据权利要求2所述的方法,其特征在于,所述第二中心定位图形为圆形;The method according to claim 2, wherein the second center positioning figure is a circle;
    所述以所述第二中心定位图形的中心位置为种子点进行区域生长,确 定所述第二中心定位图形包括:The performing region growth using the center position of the second center positioning graphic as a seed point, and determining the second center positioning graphic includes:
    以所述第一中心定位图形的中心位置为种子点,分别沿竖直方向和水平方向进行生长,确定竖直方向的生长路径和水平方向的生长路径;Taking the center position of the first center positioning graph as the seed point, grow in the vertical direction and the horizontal direction respectively, and determine the growth path in the vertical direction and the growth path in the horizontal direction;
    所述确定所述第二中心定位图形的中心位置,作为所述二维码的中心位置,包括:The determining the center position of the second center positioning graphic as the center position of the two-dimensional code includes:
    根据所述竖直方向的生长路径的中点和水平方向的生长路径的中点,确定所述第二中心定位图形的中心位置,作为所述二维码的中心位置。According to the midpoint of the growth path in the vertical direction and the midpoint of the growth path in the horizontal direction, the center position of the second center positioning pattern is determined as the center position of the two-dimensional code.
  4. 根据权利要求2所述的方法,其特征在于,所述第一中心定位图形为圆环;The method according to claim 2, wherein the first center positioning figure is a circular ring;
    所述识别所述第一中心定位图形,包括:The recognizing the first center positioning graphic includes:
    扫描所述二维码,并根据相邻像素的灰度值差值,确定所述第一中心定位图形的若干边缘点;Scanning the two-dimensional code, and determining a number of edge points of the first center positioning pattern according to the gray value difference of adjacent pixels;
    所述根据所述第一中心定位图形,确定所述第一中心定位图形的中心位置,包括:The determining the center position of the first center positioning graphic according to the first center positioning graphic includes:
    根据所述第一中心定位图形的若干边缘点,选取位于所述第一中心定位图形上的两个点;Selecting two points located on the first central positioning graph according to several edge points of the first central positioning graph;
    根据选取的所述位于所述第一中心定位图形上的两个点和预设的所述第一中心定位图形的圆环半径,确定所述第一中心定位图形的中心位置。Determine the center position of the first center positioning graphic according to the selected two points on the first center positioning graphic and the preset ring radius of the first center positioning graphic.
  5. 根据权利要求1所述的方法,其特征在于,所述根据所述二维码的中心位置,确定所述旋转角度定位图形的位置,包括:The method according to claim 1, wherein the determining the position of the rotation angle positioning graph according to the center position of the two-dimensional code comprises:
    以所述的二维码的中心位置为圆心,确定一预设半径的虚拟圆;Using the center position of the two-dimensional code as the center of the circle, determine a virtual circle with a preset radius;
    在所述虚拟圆上,确定当前所述旋转角度定位图形的预设边缘点;On the virtual circle, determine the preset edge point of the current rotation angle positioning graph;
    所述根据所述旋转角度定位图形的位置,确定所述二维码的旋转角度,包括:The determining the rotation angle of the two-dimensional code according to the position of the rotation angle positioning graphic includes:
    根据所述当前所述旋转角度定位图形的预设边缘点的位置和预知的所述旋转角度定位图形无旋转时的预设边缘点的位置,确定所述二维码的旋转角度。Determine the rotation angle of the two-dimensional code according to the position of the preset edge point of the current rotation angle positioning graphic and the predicted position of the preset edge point when the rotation angle positioning graphic has no rotation.
  6. 根据权利要求5所述的方法,其特征在于,所述确定当前所述旋转角度定位图形的预设边缘点,包括:The method according to claim 5, wherein the determining the preset edge point of the current rotation angle positioning graph comprises:
    对所述虚拟圆上的若干预设位置的像素点进行灰度采样,获取采样像素点的坐标信息和灰度信息;Performing grayscale sampling on pixels at a number of preset positions on the virtual circle to obtain coordinate information and grayscale information of the sampled pixels;
    根据所述采样像素点的灰度信息,获取相邻的采样像素点的灰度梯度;Obtaining the grayscale gradient of adjacent sampling pixels according to the gray information of the sampling pixels;
    根据灰度梯度最大值对应的采样像素点的位置信息,确定当前所述旋转角度定位图形的预设边缘点的位置。According to the position information of the sampling pixel corresponding to the maximum value of the gray gradient, the position of the preset edge point of the current rotation angle positioning graph is determined.
  7. 根据权利要求5所述的方法,其特征在于,所述二维码包括编码区域和旋转角度辅助图形,其中,所述编码区域包括编码信息;The method according to claim 5, wherein the two-dimensional code includes an encoding area and a rotation angle auxiliary graphic, wherein the encoding area includes encoding information;
    所述方法还包括:The method also includes:
    根据所述旋转角度和所述二维码的中心位置,确定所述旋转角度辅助图形的第一中心位置;Determining the first center position of the rotation angle auxiliary graphic according to the rotation angle and the center position of the two-dimensional code;
    以所述旋转角度辅助图形的中心位置进行区域生长,确定所述旋转角 度辅助图形;Perform region growth using the center position of the rotation angle auxiliary graphic to determine the rotation angle auxiliary graphic;
    根据所述旋转角度辅助图形,确定所述旋转角度辅助图形的第二中心位置;Determine the second center position of the rotation angle auxiliary graphic according to the rotation angle auxiliary graphic;
    根据所述旋转角度辅助图形的第二中心位置和所述二维码的中心位置,确定精确的旋转角度;Determine an accurate rotation angle according to the second center position of the rotation angle auxiliary graphic and the center position of the two-dimensional code;
    根据所述二维码的中心位置,确定所述编码区域;Determining the coding area according to the center position of the two-dimensional code;
    根据所述编码区域和所述精确的旋转角度,识别所述编码信息。Identify the encoded information according to the encoded area and the precise rotation angle.
  8. 根据权利要求1所述的方法,其特征在于,所述二维码包括编码区域,其中,所述编码区域包括编码信息,所述二维码以极坐标方式布局所述编码信息,所述方法还包括:The method according to claim 1, wherein the two-dimensional code includes a coding area, wherein the coding area includes coding information, the two-dimensional code lays out the coding information in polar coordinates, and the method Also includes:
    根据所述二维码的中心位置,确定所述编码区域;Determining the coding area according to the center position of the two-dimensional code;
    根据所述编码区域和所述旋转角度,识别所述编码信息;Identifying the encoding information according to the encoding area and the rotation angle;
    所述根据所述二维码的中心位置,确定所述编码区域,包括:The determining the coding area according to the center position of the two-dimensional code includes:
    根据所述二维码的中心位置,确定若干不同预设半径的编码信息采集圆;其中,所述编码信息采集圆位于所述编码区域内;Determine a number of code information collection circles with different preset radii according to the center position of the two-dimensional code; wherein, the code information collection circle is located in the coding area;
    所述根据所述编码区域和所述旋转角度,识别所述编码信息,包括:The identifying the encoding information according to the encoding area and the rotation angle includes:
    从所述旋转角度开始,每隔预设角度采集每一所述编码信息采集圆上的像素点的坐标信息和灰度值信息;Starting from the rotation angle, collecting coordinate information and gray value information of each pixel on the code information collecting circle at intervals of a preset angle;
    根据采集的所述像素点的坐标信息和灰度值信息,识别所述编码信息。Identify the encoded information according to the collected coordinate information and gray value information of the pixel points.
  9. 一种二维码生成方法,其特征在于,所述二维码包括中心定位图形、 旋转角度定位图形和编码区域;其中,所述编码区域包括编码信息;A method for generating a two-dimensional code, characterized in that the two-dimensional code includes a center positioning graphic, a rotation angle positioning graphic, and an encoding area; wherein the encoding area includes encoding information;
    所述方法包括:The method includes:
    确定所述二维码的中心位置;Determining the center position of the two-dimensional code;
    根据所述二维码的中心位置,确定所述中心定位图形的位置、所述旋转角度定位图形的位置和编码区域;Determining the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the coding area according to the center position of the two-dimensional code;
    根据所述中心定位图形的位置、所述旋转角度定位图形的位置和所述编码区域的位置,生成所述中心定位图形、所述旋转角度定位图形和所述编码区域,在所述编码区域中写入所述编码信息,从而生成所述二维码,使得所述中心定位图形的中心与所述二维码的中心位置重合,所述旋转角度定位图形上的多个预设边缘点设置在相对所述中心位置的预定的角度方位上,所述多个预设边缘点处于以所述二维码的中心位置为圆心的同一虚拟圆上,所述编码区域处于中心定位图形和所述二维码的中心位置之间的位置。According to the position of the center positioning pattern, the position of the rotation angle positioning pattern, and the position of the encoding area, the center positioning pattern, the rotation angle positioning pattern, and the encoding area are generated, in the encoding area Write the coding information to generate the two-dimensional code so that the center of the center positioning graphic coincides with the center position of the two-dimensional code, and a plurality of preset edge points on the rotation angle positioning graphic are set at In a predetermined angular orientation relative to the center position, the plurality of preset edge points are on the same virtual circle centered on the center position of the two-dimensional code, and the coding area is located between the center positioning graphic and the two The position between the center positions of the dimension code.
  10. 根据权利要求9所述的方法,其特征在于,所述中心定位图形包括第一中心定位图形和第二中心定位图形,所述第一中心定位图形的中心位置和所述第二中心定位图形的中心位置均与所述二维码的中心位置重合;所述第一中心定位图形为圆环;所述第二中心定位图形为圆形;The method according to claim 9, wherein the center positioning graphic comprises a first center positioning graphic and a second center positioning graphic, the center position of the first center positioning graphic and the second center positioning graphic The center position is coincident with the center position of the two-dimensional code; the first center positioning pattern is a circle; the second center positioning pattern is a circle;
    所述编码区域为环形,所述编码区域位于所述第一中心定位图形和所述第二中心定位图形之间的区域;The coding area is ring-shaped, and the coding area is located in an area between the first center positioning pattern and the second center positioning pattern;
    所述旋转角度定位图形包括至少两个,且至少存在两个所述旋转角度定位图形不关于所述二维码的中心位置中心对称。The rotation angle positioning graphics include at least two, and there are at least two rotation angle positioning graphics that are not center-symmetric about the center position of the two-dimensional code.
  11. 根据权利要求10所述的方法,其特征在于,所述二维码还包括旋转角度辅助图形,所述旋转角度辅助图形包括若干定位圆,所述方法还包括:The method according to claim 10, wherein the two-dimensional code further includes a rotation angle auxiliary graphic, the rotation angle auxiliary graphic includes a plurality of positioning circles, and the method further comprises:
    根据所述二维码的中心位置,确定各所述定位圆的圆心位置;Determine the center position of each positioning circle according to the center position of the two-dimensional code;
    根据所述旋转角度辅助图形的位置,生成所述旋转角度辅助图形。The rotation angle auxiliary graphic is generated according to the position of the rotation angle auxiliary graphic.
  12. 一种二维码识别装置,其特征在于,A two-dimensional code recognition device, characterized in that:
    所述二维码包括中心定位图形和旋转角度定位图形;所述装置包括:The two-dimensional code includes a center positioning graphic and a rotation angle positioning graphic; the device includes:
    中心定位图形确定模块,用于确定中心定位图形;The central positioning graphic determining module is used to determine the central positioning graphic;
    中心位置确定模块,用于根据所述中心定位图形,确定所述二维码的中心位置;A center position determination module, configured to determine the center position of the two-dimensional code according to the center positioning graph;
    旋转角度图形确定模块,用于根据所述二维码的中心位置,确定所述旋转角度定位图形的位置;A rotation angle graphic determination module, configured to determine the position of the rotation angle positioning graphic according to the center position of the two-dimensional code;
    旋转角度确定模块,根据所述旋转角度定位图形的位置,确定所述二维码的旋转角度。The rotation angle determination module determines the rotation angle of the two-dimensional code according to the position of the rotation angle positioning graphic.
  13. 根据权利要求12所述的装置,其特征在于,所述中心定位图形包括第一中心定位图形和第二中心定位图形,所述第一中心定位图形的中心位置和所述第二中心定位图形的中心位置均与所述二维码的中心位置重合;The device according to claim 12, wherein the center positioning graphic comprises a first center positioning graphic and a second center positioning graphic, and the center position of the first center positioning graphic and the second center positioning graphic The center position coincides with the center position of the two-dimensional code;
    所述中心定位图形确定模块包括:The central positioning graphic determining module includes:
    第一中心定位图形单元,用于识别所述第一中心定位图形;A first center positioning graphic unit for identifying the first center positioning graphic;
    第一中心定位图形中心单元,用于根据所述第一中心定位图形,确定所述第一中心定位图形的中心位置;The first center positioning graphic center unit is used to determine the center position of the first center positioning graphic according to the first center positioning graphic;
    第二中心定位图形单元,用于以所述第一中心定位图形的中心位置为种子点进行区域生长,确定所述第二中心定位图形;The second center positioning graphic unit is configured to use the center position of the first center positioning graphic as a seed point for region growth, and determine the second center positioning graphic;
    所述中心位置确定模块具体用于确定所述第二中心定位图形的中心位置,作为所述二维码的中心位置。The center position determining module is specifically configured to determine the center position of the second center positioning graphic as the center position of the two-dimensional code.
  14. 根据权利要求12所述的装置,其特征在于,所述旋转角度图形确定模块包括:The device according to claim 12, wherein the rotation angle graph determining module comprises:
    虚拟圆确定单元,用于以所述的二维码的中心位置为圆心,确定一预设半径的虚拟圆;The virtual circle determining unit is used to determine a virtual circle with a preset radius by taking the center position of the two-dimensional code as the center of the circle;
    预设边缘点确定单元,用于在所述虚拟圆上,确定当前所述旋转角度定位图形的预设边缘点;A preset edge point determining unit, configured to determine a preset edge point of the current rotation angle positioning graph on the virtual circle;
    所述旋转角度确定模块用于根据所述当前所述旋转角度定位图形的预设边缘点的位置和预存的原始的所述旋转角度定位图形的预设边缘点的位置,确定所述二维码的旋转角度。The rotation angle determination module is configured to determine the two-dimensional code according to the position of the preset edge point of the current rotation angle positioning graph and the prestored position of the preset edge point of the original rotation angle positioning graph The angle of rotation.
  15. 根据权利要求14所述的装置,其特征在于,所述预设边缘点确定单元包括:The device according to claim 14, wherein the predetermined edge point determination unit comprises:
    灰度采样子单元,用于对所述虚拟圆上的若干预设位置的像素点进行灰度采样,获取采样像素点的坐标信息和灰度信息;The gray-scale sampling subunit is used to perform gray-scale sampling of pixels at a number of preset positions on the virtual circle to obtain coordinate information and gray-scale information of the sampled pixels;
    灰度梯度子单元,用于根据所述采样像素点的灰度信息,获取相邻的采样像素点的灰度梯度;The grayscale gradient subunit is used to obtain the grayscale gradient of adjacent sampling pixels according to the grayscale information of the sampling pixels;
    预设边缘点子单元,用于根据灰度梯度最大值对应的所述采样像素点的位置信息,确定当前所述旋转角度定位图形的预设边缘点的位置。The preset edge point subunit is configured to determine the position of the preset edge point of the current rotation angle positioning graph according to the position information of the sampling pixel corresponding to the maximum gray gradient.
  16. 根据权利要求12所述的装置,其特征在于,所述二维码包括编码区域和旋转角度辅助图形,其中,所述编码区域包括编码信息;所述装置还包括:The device according to claim 12, wherein the two-dimensional code includes a coding area and a rotation angle auxiliary graphic, wherein the coding area includes coding information; the device further comprises:
    第一中心位置模块,用于根据所述旋转角度和所述二维码的中心位置,确定所述旋转角度辅助图形的第一中心位置;The first center position module is configured to determine the first center position of the rotation angle auxiliary graphic according to the rotation angle and the center position of the two-dimensional code;
    旋转角度辅助图形模块,用于以所述旋转角度辅助图形的中心位置进行区域生长,确定所述旋转角度辅助图形;A rotation angle auxiliary graphic module, configured to perform area growth based on the center position of the rotation angle auxiliary graphic, and determine the rotation angle auxiliary graphic;
    第二中心位置模块,用于根据所述旋转角度辅助图形,确定所述旋转角度辅助图形的第二中心位置;The second center position module is configured to determine the second center position of the rotation angle auxiliary graphic according to the rotation angle auxiliary graphic;
    编码区域确定模块,用于根据所述二维码的中心位置,确定所述编码区域;An encoding area determination module, configured to determine the encoding area according to the center position of the two-dimensional code;
    识别模块,用于根据所述编码区域和所述精确的旋转角度,识别所述编码信息。The recognition module is used for recognizing the coding information according to the coding area and the precise rotation angle.
  17. 一种二维码生成装置,其特征在于,所述二维码包括中心定位图形、旋转角度定位图形和编码区域;其中,所述编码区域包括编码信息;所述装置包括:A two-dimensional code generating device, characterized in that the two-dimensional code includes a center positioning graphic, a rotation angle positioning graphic, and a coding area; wherein the coding area includes coding information; the device includes:
    二维码中心位置确定模块,用于确定所述二维码的中心位置;A two-dimensional code center position determining module, configured to determine the center position of the two-dimensional code;
    位置确定模块,用于根据所述二维码的中心位置,确定所述中心定位图形的位置、所述旋转角度定位图形的位置和编码区域;A position determining module, configured to determine the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the coding area according to the center position of the two-dimensional code;
    生成模块,用于根据所述中心定位图形的位置、所述旋转角度定位图形的位置和所述编码区域的位置,生成所述中心定位图形、所述旋转角度定位图形和所述编码区域,在所述编码区域中写入所述编码信息,从而生成所述二维码,使得所述中心定位图形的中心与所述二维码的中心位置重合,所述旋转角度定位图形上的多个预设边缘点设置在预定的角度方位上,所述多个预设边缘点处于以所述二维码的中心位置为圆心的同一虚拟圆上,所述编码区域处于中心定位图形和所述二维码的中心位置之间的位置。The generating module is used to generate the center positioning graphic, the rotation angle positioning graphic and the coding area according to the position of the center positioning graphic, the position of the rotation angle positioning graphic, and the position of the coding area, and The coding information is written in the coding area to generate the two-dimensional code so that the center of the center positioning graphic coincides with the center position of the two-dimensional code, and the rotation angle positioning graphic has multiple presets It is assumed that the edge points are set at a predetermined angle and orientation, the plurality of preset edge points are on the same virtual circle centered on the center position of the two-dimensional code, and the coding area is located between the center positioning graphic and the two-dimensional The position between the center positions of the code.
  18. 根据权利要求17所述的装置,其特征在于,所述中心定位图形包括第一中心定位图形和第二中心定位图形,所述第一中心定位图形的中心位置和所述第二中心定位图形的中心位置均与所述二维码的中心位置重合;所述旋转角度定位图形包括至少两个,且至少存在两个所述旋转角度定位图形不关于所述二维码的中心位置中心对称;The device according to claim 17, wherein the center positioning graphic comprises a first center positioning graphic and a second center positioning graphic, the center position of the first center positioning graphic and the second center positioning graphic The center position coincides with the center position of the two-dimensional code; the rotation angle positioning pattern includes at least two, and there are at least two rotation angle positioning patterns that are not center-symmetric about the center position of the two-dimensional code;
    所述二维码还包括旋转角度辅助图形,所述装置还包括:The two-dimensional code further includes a rotation angle auxiliary graphic, and the device further includes:
    旋转角度辅助图形确定模块,用于根据所述二维码的中心位置,确定所述旋转角度辅助图形的位置;A rotation angle auxiliary graphic determination module, configured to determine the position of the rotation angle auxiliary graphic according to the center position of the two-dimensional code;
    所述生成模块用于根据所述中心定位图形位置、所述旋转角度定位图形的位置、所述编码区域的位置和所述旋转角度辅助图形的位置,生成所述二维码。The generating module is configured to generate the two-dimensional code according to the position of the center positioning graphic, the position of the rotation angle positioning graphic, the position of the coding area, and the position of the rotation angle auxiliary graphic.
  19. 一种二维码识别装置,其特征在于,包括:A two-dimensional code recognition device, characterized in that it comprises:
    一个或多个处理器;One or more processors;
    存储装置,用于存储一个或多个程序;Storage device for storing one or more programs;
    当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器实现如权利要求1至8中任一项所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method according to any one of claims 1 to 8.
  20. 一种二维码生成装置,其特征在于,包括:A two-dimensional code generating device, characterized in that it comprises:
    一个或多个处理器;One or more processors;
    存储装置,用于存储一个或多个程序;Storage device for storing one or more programs;
    当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器实现如权利要求9至11中任一项所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method according to any one of claims 9 to 11.
  21. 一种小车,其特征在于,包括如权利要求12至16和19中任一项所述的二维码识别装置;A trolley, characterized by comprising the two-dimensional code recognition device according to any one of claims 12 to 16 and 19;
    还包括:Also includes:
    摄像头,用于拍摄二维码图像;Camera, used to take two-dimensional code images;
    控制器,用于根据所述二维码识别装置的识别结果控制所述小车的运行。The controller is used for controlling the operation of the trolley according to the recognition result of the two-dimensional code recognition device.
  22. 一种二维码,其特征在于,根据权利要求17、18、20中任一项所述的装置所生成。A two-dimensional code, characterized in that it is generated according to the device of any one of claims 17, 18, and 20.
  23. 一种设置有二维码的产品,其特征在于,所述二维码包括中心定位图形、旋转角度定位图形和编码区域;其中,A product provided with a two-dimensional code, characterized in that the two-dimensional code includes a center positioning graphic, a rotation angle positioning graphic, and a coding area; wherein,
    所述中心定位图形用于确定所述二维码的中心位置;The center positioning graphic is used to determine the center position of the two-dimensional code;
    所述旋转角度定位图形用于确定所述二维码的旋转角度;The rotation angle positioning graph is used to determine the rotation angle of the two-dimensional code;
    所述编码区域用于携带编码信息,所述中心定位图形的中心与所述二维码的中心位置重合,所述旋转角度定位图形上具有多个预设边缘点,所述多个预设边缘点相对于所述二维码的中心位置设置在预定的角度方位上,所述多个预设边缘点处于以所述二维码的中心位置为圆心的同一虚拟圆上。The coding area is used to carry coding information, the center of the center positioning graphic coincides with the center position of the two-dimensional code, the rotation angle positioning graphic has a plurality of preset edge points, and the plurality of preset edges The point is set at a predetermined angular position relative to the center position of the two-dimensional code, and the plurality of preset edge points are located on the same virtual circle with the center position of the two-dimensional code as the center.
  24. 根据权利要求23所述的产品,其特征在于,所述中心定位图形包括第一中心定位图形和第二中心定位图形,所述第一中心定位图形的中心位置和所述第二中心定位图形的中心位置均与所述二维码的中心位置重合;The product according to claim 23, wherein the center positioning graphic comprises a first center positioning graphic and a second center positioning graphic, the center position of the first center positioning graphic and the second center positioning graphic The center position coincides with the center position of the two-dimensional code;
    所述二维码还包括旋转角度辅助图形,所述旋转角度辅助图形用于获取精确的二维码的旋转角度以替换根据所述旋转角度定位图形确定的所述二维码的旋转角度,各预定的角度方位的角度为素数。The two-dimensional code further includes a rotation angle auxiliary graphic, the rotation angle auxiliary graphic is used to obtain an accurate rotation angle of the two-dimensional code to replace the rotation angle of the two-dimensional code determined according to the rotation angle positioning graphic, each The angle of the predetermined angular orientation is a prime number.
  25. 一种计算机可读存储介质,其存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1至11中任一项所述的方法。A computer-readable storage medium, which stores a computer program, wherein the program is executed by a processor to implement the method according to any one of claims 1 to 11.
PCT/CN2019/086158 2019-04-28 2019-05-09 Qr code recognition method and apparatus, qr code generation method and apparatus, qr code and trolley WO2020220388A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2021559117A JP7289927B2 (en) 2019-04-28 2019-05-09 Two-dimensional code recognition method, generation method, device, two-dimensional code and small car

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910349876.XA CN110084080B (en) 2019-04-28 2019-04-28 Two-dimensional code identification and generation method and device, two-dimensional code and trolley
CN201910349876.X 2019-04-28

Publications (1)

Publication Number Publication Date
WO2020220388A1 true WO2020220388A1 (en) 2020-11-05

Family

ID=67417326

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/086158 WO2020220388A1 (en) 2019-04-28 2019-05-09 Qr code recognition method and apparatus, qr code generation method and apparatus, qr code and trolley

Country Status (3)

Country Link
JP (1) JP7289927B2 (en)
CN (1) CN110084080B (en)
WO (1) WO2020220388A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113361292A (en) * 2021-05-25 2021-09-07 广州市东崇科技有限公司 AGV driving optimization method and system based on artificial intelligence and two-dimensional code navigation
CN114239631A (en) * 2021-11-19 2022-03-25 支付宝(杭州)信息技术有限公司 Two-dimensional code identification method and device, storage medium and electronic equipment

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110610219B (en) * 2019-08-12 2020-11-06 上海交通大学 Color annular two-dimensional code and generation and decoding method thereof
CN113033743A (en) * 2019-12-25 2021-06-25 北京极智嘉科技股份有限公司 Positioning identifier, robot for identifying positioning identifier and positioning method
CN113050612A (en) * 2019-12-26 2021-06-29 北京极智嘉科技股份有限公司 Medium printed with positioning identification, image processing method and automatic guided vehicle
CN111798532B (en) * 2020-08-03 2021-03-16 广州市宝绅科技应用有限公司 Screen coding method and system based on centroid coincidence
CN112070814B (en) * 2020-08-31 2024-04-02 杭州迅蚁网络科技有限公司 Target angle recognition method and device
CN112414225A (en) * 2020-11-13 2021-02-26 中国船舶重工集团公司第七0七研究所 Target combining two-dimensional code and circular coding disc and identification method thereof

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070278316A1 (en) * 2005-04-25 2007-12-06 Gregory Hovis Concentric-ring circular bar code
US20090090786A1 (en) * 2005-04-25 2009-04-09 Gregory Hovis Segmented circular bar code
CN104331689A (en) * 2014-11-13 2015-02-04 清华大学 Cooperation logo and recognition method of identities and poses of a plurality of intelligent individuals
CN106447001A (en) * 2016-09-19 2017-02-22 华南农业大学 Circular two-dimensional code, circular two-dimensional code coding method and application thereof
CN108763996A (en) * 2018-03-23 2018-11-06 南京航空航天大学 A kind of plane positioning coordinate based on Quick Response Code and direction angle measuring method

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101086761A (en) * 2006-06-08 2007-12-12 姜晓航 Efficient information lattice image and its generation and decoding method
CN102944236B (en) * 2012-11-20 2015-03-18 无锡普智联科高新技术有限公司 Mobile robot positioning system and method based on a plurality of two-dimensional code readers
CN104346597B (en) * 2014-10-29 2018-04-27 中山大学 A kind of QR codes detection and correction extracting method and IP kernel
JP6537262B2 (en) * 2014-12-10 2019-07-03 ワム・システム・デザイン株式会社 Color code, color code reader, color code reading method, and program.
CN105989317B (en) * 2015-02-11 2021-10-08 北京鼎九信息工程研究院有限公司 Two-dimensional code identification method and device
CN106382934A (en) * 2016-11-16 2017-02-08 深圳普智联科机器人技术有限公司 High-precision moving robot positioning system and method
CN107748855B (en) * 2017-08-29 2021-01-08 广东顺德中山大学卡内基梅隆大学国际联合研究院 Detection method for two-dimensional code image finding graph
CN109190437B (en) * 2018-08-01 2021-03-16 飞天诚信科技股份有限公司 Method and device for reading two-dimensional code

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070278316A1 (en) * 2005-04-25 2007-12-06 Gregory Hovis Concentric-ring circular bar code
US20090090786A1 (en) * 2005-04-25 2009-04-09 Gregory Hovis Segmented circular bar code
CN104331689A (en) * 2014-11-13 2015-02-04 清华大学 Cooperation logo and recognition method of identities and poses of a plurality of intelligent individuals
CN106447001A (en) * 2016-09-19 2017-02-22 华南农业大学 Circular two-dimensional code, circular two-dimensional code coding method and application thereof
CN108763996A (en) * 2018-03-23 2018-11-06 南京航空航天大学 A kind of plane positioning coordinate based on Quick Response Code and direction angle measuring method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113361292A (en) * 2021-05-25 2021-09-07 广州市东崇科技有限公司 AGV driving optimization method and system based on artificial intelligence and two-dimensional code navigation
CN113361292B (en) * 2021-05-25 2023-04-28 北京航宇荣康科技股份有限公司 AGV driving optimization method and system based on artificial intelligence and two-dimensional code navigation
CN114239631A (en) * 2021-11-19 2022-03-25 支付宝(杭州)信息技术有限公司 Two-dimensional code identification method and device, storage medium and electronic equipment
CN114239631B (en) * 2021-11-19 2024-03-26 支付宝(杭州)信息技术有限公司 Two-dimensional code identification method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN110084080A (en) 2019-08-02
JP2022528895A (en) 2022-06-16
CN110084080B (en) 2021-07-09
JP7289927B2 (en) 2023-06-12

Similar Documents

Publication Publication Date Title
WO2020220388A1 (en) Qr code recognition method and apparatus, qr code generation method and apparatus, qr code and trolley
CN107818290B (en) Heuristic finger detection method based on depth map
US20160162720A1 (en) Decoding machine-readable optical codes with aesthetic component
CN104331689B (en) The recognition methods of a kind of cooperation mark and how intelligent individual identity and pose
EP3048555A1 (en) Image processing device, image processing method, and image processing program
CN111767965B (en) Image matching method and device, electronic equipment and storage medium
WO2020121622A1 (en) Reading assistance system, moving body, reading assistance method, program, and recording medium
CN108090486A (en) Image processing method and device in a kind of game of billiards
CN108734161B (en) Method, device and equipment for identifying prefix number area and storage medium
CN114897669A (en) Labeling method and device and electronic equipment
US11100670B2 (en) Positioning method, positioning device and nonvolatile computer-readable storage medium
CN110262685B (en) Touch detection method, touch detection device, storage medium and touch screen
CN110879593A (en) Positioning method, reading method, positioning system and positioning device
CN111598911B (en) Autonomous line patrol method and device for robot platform and storage medium
CN111598917A (en) Data embedding method, device, equipment and computer readable storage medium
JPH01243104A (en) Mark identifying device in image pickup means
CN111738389A (en) Two-dimensional code generation method and generation system
CN109934185A (en) Data processing method and device, medium and calculating equipment
CN109615658B (en) Method and device for taking articles by robot, computer equipment and storage medium
WO2024016809A1 (en) Palm scan verification guidance method and apparatus, terminal, storage medium, and program product
CN112541943A (en) Robot positioning method based on visual road signs
CN112614181B (en) Robot positioning method and device based on highlight target
JP3303748B2 (en) Registration method of reference one-dimensional data string, image recognition method, registration device, image recognition device, and recording medium
CN111027621A (en) Training method, system, equipment and storage medium of image recognition model
CN117831082A (en) Palm area detection method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19927298

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2021559117

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19927298

Country of ref document: EP

Kind code of ref document: A1