CN113705268B - Two-dimensional code positioning method and system - Google Patents

Two-dimensional code positioning method and system Download PDF

Info

Publication number
CN113705268B
CN113705268B CN202111006534.1A CN202111006534A CN113705268B CN 113705268 B CN113705268 B CN 113705268B CN 202111006534 A CN202111006534 A CN 202111006534A CN 113705268 B CN113705268 B CN 113705268B
Authority
CN
China
Prior art keywords
dimensional code
area
decoding
image
positioning
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111006534.1A
Other languages
Chinese (zh)
Other versions
CN113705268A (en
Inventor
周军
叶丰
皇攀凌
欧金顺
石少杰
高新彪
李文广
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Alesmart Intelligent Technology Co Ltd
Original Assignee
Shandong University
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 Shandong University filed Critical Shandong University
Priority to CN202111006534.1A priority Critical patent/CN113705268B/en
Publication of CN113705268A publication Critical patent/CN113705268A/en
Application granted granted Critical
Publication of CN113705268B publication Critical patent/CN113705268B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/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
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration by the use of local operators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • G06T2207/10008Still image; Photographic image from scanner, fax or copier
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20172Image enhancement details
    • G06T2207/20192Edge enhancement; Edge preservation

Abstract

The application discloses a two-dimensional code positioning method and a two-dimensional code positioning system, comprising the following steps: dividing the acquired image to be identified to obtain a target area image block; performing grid traversal on the target area image block to obtain a two-dimensional code area, and decoding a data area of the two-dimensional code area to obtain two-dimensional code information; positioning a boundary searching area of the two-dimensional code area, determining an edge line, and obtaining pixel coordinates of a two-dimensional code corner point; converting the pixel coordinates of the corner points into physical coordinates of the corner points under an absolute coordinate system with the center of the two-dimensional code area as an origin according to the conversion relation between the pixel coordinates and the physical coordinates; and according to the angular point physical coordinates, obtaining the deflection distance and the deflection angle of the edge line of the camera view center in the absolute coordinate system, so as to control the coincidence of the camera view center and the two-dimensional code area center and finish the positioning of the two-dimensional code. The two-dimensional code is decoded and positioned through image processing, pixel-by-pixel scanning positioning and position coordinate conversion, and the method has higher precision and stability.

Description

Two-dimensional code positioning method and system
Technical Field
The application relates to the technical field of two-dimensional code identification, in particular to a two-dimensional code positioning method and system.
Background
The statements in this section merely provide background information related to the present disclosure and may not necessarily constitute prior art.
The DataMatrix is a two-dimensional code consisting of black and white color blocks (cells) in square or rectangle, and consists of a data area, a blank area and a side finding area, and is widely used in the field of industrial manufacturing. Because of the large data capacity and error correcting code, the reliability of the code can be greatly improved, and even if the colored block is damaged and is unreadable, the information in the colored block can still be read. If in storage logistics system, can accurately learn real-time position and gesture of AGV dolly through the two-dimensional code, feedback mobile robot dispatch, control system guide work.
The difficulty of the two-dimensional code reader is mainly in positioning and identification, so that a plurality of expert students have a plurality of researches on the two-dimensional code reader, and the two-dimensional code reader is realized through a direct image processing method, a Hough detection method and a neural network, and the two-dimensional code reader has respective advantages and disadvantages. At present, the domestic DM recognition technology is mainly limited by a certain complex background, has noisy images, has low recognition rate and low recognition precision, and is used for pursuing efficiency and precision in the industrial field due to the complexity of the environment, so that the detail information of a target area can be excessively destroyed only by image processing for positioning and recognition, thereby influencing the recognition rate and precision; the neural network mainly searches for the target area, requires more high-quality training data, consumes time and is not easy to apply in industry. For example, in the industrial field, the AGV is used for guiding a trolley, the trolley acquires a DM code image attached to the ground in the travelling process, and needs to process and respond in time, otherwise, the next DM mark cannot be reached after the processing is performed, so that the domestic DM recognition technology is mostly used in the civil field, does not need to respond quickly, and cannot reach the speed once in the industry. And the bottom layer algorithm of most code reader products at present mainly depends on foreign importation, and the recognition rate is high, but the price is relatively high, and the cost is high.
Disclosure of Invention
In order to solve the problems, the application provides a two-dimensional code positioning method and a two-dimensional code positioning system, which realize decoding and positioning of a two-dimensional code through image processing, pixel-by-pixel scanning positioning and position coordinate conversion, and have higher precision and stability.
In order to achieve the above purpose, the present application adopts the following technical scheme:
in a first aspect, the present application provides a two-dimensional code positioning method, including:
dividing the acquired image to be identified to obtain a target area image block;
performing grid traversal on the target area image block to obtain a two-dimensional code area, and decoding a data area of the two-dimensional code area to obtain two-dimensional code information;
positioning a boundary searching area of the two-dimensional code area, determining an edge line, and obtaining pixel coordinates of a two-dimensional code corner point;
converting the pixel coordinates of the corner points into physical coordinates of the corner points under an absolute coordinate system with the center of the two-dimensional code area as an origin according to the conversion relation between the pixel coordinates and the physical coordinates;
and according to the angular point physical coordinates, obtaining the deflection distance and the deflection angle of the edge line of the camera view center in the absolute coordinate system, so as to control the coincidence of the camera view center and the two-dimensional code area center and finish the positioning of the two-dimensional code.
As an alternative embodiment, preprocessing is performed before the image to be identified is segmented, and the preprocessing includes gray scale processing, image filtering and rectangular detection in sequence.
In an alternative embodiment, in the process of decoding the data area of the two-dimensional code area, a decoded image is created for the target area image block, and a decoder is created for the decoded image, so that the data area is decoded.
In an alternative embodiment, in the process of decoding the data area of the two-dimensional code area, a decoding time threshold and a scanning time threshold are set, so as to judge whether the decoding is successful.
As an alternative implementation manner, a cross grid is adopted to traverse the image block of the target area, if the two-dimensional code area is not found after the cross traversal of the current grid is finished, the grid is further subdivided, and the grids are sequentially subdivided by setting a threshold value until the cross traversal cannot be performed.
As an optional implementation manner, the process of locating the edge searching area of the two-dimensional code area comprises the steps that the edge searching area comprises two solid line edge lines and two broken line edge lines, and the other solid line edge line is located according to one solid line edge line, so that the orientation of the two-dimensional code area is determined; and constructing a candidate two-dimensional code area transformation matrix, and positioning two dotted line edge lines.
As an alternative implementation manner, when the center of the camera view coincides with the center of the two-dimensional code area, acquiring the initial physical coordinates of the corner points under the absolute coordinate system, and obtaining the deflection distance and the deflection angle of the edge line according to the initial physical coordinates of the corner points and the initial physical coordinates of the corner points converted by the pixel coordinates.
In a second aspect, the present application provides a two-dimensional code positioning system, including:
the preprocessing module is configured to divide the acquired image to be identified to obtain a target area image block;
the decoding module is configured to perform grid traversal on the target area image block to obtain a two-dimensional code area, and decode a data area of the two-dimensional code area to obtain two-dimensional code information;
the corner point positioning module is configured to perform edge searching area positioning on the two-dimensional code area, determine edge lines and obtain pixel coordinates of two-dimensional code corners;
the angular point coordinate conversion module is configured to convert the angular point pixel coordinates into angular point physical coordinates in an absolute coordinate system with the center of the two-dimensional code area as an origin according to the conversion relation between the pixel coordinates and the physical coordinates;
the offset adjusting module is configured to obtain the edge line deflection distance and deflection angle of the camera view center in an absolute coordinate system according to the angular point physical coordinates, so as to control the camera view center to coincide with the two-dimensional code area center and complete the positioning of the two-dimensional code.
In a third aspect, the application provides an electronic device comprising a memory and a processor and computer instructions stored on the memory and running on the processor, which when executed by the processor, perform the method of the first aspect.
In a fourth aspect, the present application provides a computer readable storage medium storing computer instructions which, when executed by a processor, perform the method of the first aspect.
Compared with the prior art, the application has the beneficial effects that:
the application provides a positioning method for a DataMatrix two-dimensional code, which comprises the steps of firstly, acquiring each frame of image through a camera, and carrying out gray processing, image filtering, rectangular frame identification and image segmentation on each frame of image to obtain a target area; then positioning the coordinates of the corner points and the edge lines of the two-dimensional code and decoding the two-dimensional code information through decoding the image, a decoder, grid traversal and area searching; and finally, obtaining the deflection distance and deflection angle of the camera view center point in an absolute coordinate system through coordinate conversion, and guiding the AGV trolley to move so as to enable the camera view center point to coincide with the two-dimensional code center point. The image adaptability is strong, the recognition rate is high, the recognition is quick and the manufacturing cost is low.
Additional aspects of the application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application.
FIG. 1 is a schematic diagram showing the composition of a Data Matrix code according to embodiment 1 of the present application;
fig. 2 is a two-dimensional code positioning flowchart provided in embodiment 1 of the present application;
FIG. 3 is a diagram of a grid traversal provided by embodiment 1 of the present application;
fig. 4 is a schematic diagram of camera coordinate transformation according to embodiment 1 of the present application;
fig. 5 (a) -5 (f) are schematic diagrams of a two-dimensional code positioning process provided in embodiment 1 of the present application.
Detailed Description
The application is further described below with reference to the drawings and examples.
It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the application. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.
It is noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular forms also are intended to include the plural forms, and furthermore, it is to be understood that the terms "comprises" and "comprising" and any variations thereof are intended to cover non-exclusive inclusions, such as, for example, processes, methods, systems, products or devices that comprise a series of steps or units, are not necessarily limited to those steps or units that are expressly listed, but may include other steps or units that are not expressly listed or inherent to such processes, methods, products or devices.
Embodiments of the application and features of the embodiments may be combined with each other without conflict.
Example 1
Taking the DataMatrix two-dimensional code as shown in fig. 1 as an example, the embodiment provides a two-dimensional code positioning method, as shown in fig. 2, including:
s1: dividing the acquired image to be identified to obtain a target area image block;
s2: performing grid traversal on the target area image block to obtain a two-dimensional code area, and decoding a data area of the two-dimensional code area to obtain two-dimensional code information;
positioning a boundary searching area of the two-dimensional code area, determining an edge line, and obtaining pixel coordinates of a two-dimensional code corner point; converting the pixel coordinates of the corner points into physical coordinates of the corner points under an absolute coordinate system with the center of the two-dimensional code area as an origin according to the conversion relation between the pixel coordinates and the physical coordinates;
s3: and according to the angular point physical coordinates, obtaining the deflection distance and the deflection angle of the edge line of the camera view center in the absolute coordinate system, so as to control the coincidence of the camera view center and the two-dimensional code area center and finish the positioning of the two-dimensional code.
In this embodiment, the step S1 is a simple processing of an image, and may roughly locate a target area where the two-dimensional code is located, including: carrying out gray level processing, image filtering, rectangular detection and image segmentation on each frame of acquired image to obtain a target area; specifically:
s11: in the embodiment, a camera with a frame rate of 90 and 120 frames and a focal length of 2.15mm is adopted to acquire an image to be identified;
s12: when the acquired image is subjected to gray processing, three channels are converted into a single channel, so that the calculated amount and the processing speed are reduced.
S13: in the embodiment, the image filtering is performed by using the Laplace operator, which is an isotropic second-order differential operator, the template coefficient is determined by using the differential operator, and then the convolution operation is performed with the image to be identified, so that the sharpening filtering is realized, and the blurred detail or the edge of the target is enhanced.
According to the Las operator definition:
both second order partial derivatives along the X and Y directions can be calculated by means of difference:
combining:
the template is taken as 4 fields:
and convolving the 4-domain template with the image to be identified, so as to realize filtering enhancement edges and obtain a binarized image.
S14: and S13, filtering the reinforced edges, detecting the rectangles, adopting Canny to carry out edge detection separation channels, extracting contours, carrying out polygon fitting by using image contour points, calculating the contour area, obtaining each vertex of the rectangles, solving the maximum cosine of the angles between the contour edges, and finally selecting a rectangular frame.
S15: for image segmentation, image segmentation is performed according to the four corner coordinates of the rectangle by the rectangular frame detected in step S14, as shown in fig. 5 (c), to obtain a target area image block.
In this embodiment, the step S2 is decoding the two-dimensional code, and mainly includes creating a decoded image, creating a decoder, traversing a grid, searching a DM area, decoding a DataMatrix, and outputting two-dimensional code information. Specifically:
s21: the method comprises the steps of creating a decoded image, and creating a format required for decoding the segmented target area image, wherein the format is mainly used for acquiring information of a target area and comprises all pixel data, the width and the height of the image and the channel number of the image.
S22: the decoder is created for each decoded image on the created decoded image, and is mainly used for initializing decoding parameters and transforming basic parameters of the target area image, including storage and encapsulation of corner coordinate values of the target area, and providing initial pose for the next step of traversal.
S23: as shown in fig. 3, according to the basic composition mode of the two-dimensional code, the DM code has 24 size specifications, namely a minimum 10×10 module and a maximum size 144×144 module; when the number of modules exceeds 26×26, the blocks are divided, and each block does not exceed 26 modules, so that distortion can be prevented.
According to the embodiment, a cross grid is adopted to traverse the target area image, the cross grid lines are traversed from thick to thin, if the two-dimensional code is not found after the current grid is traversed, the grid is further subdivided, the cross is traversed again, and the cross is sequentially subdivided by setting a threshold value until the cross cannot be traversed; because the data grid size of the two-dimensional code has a minimum value, if the data grid size cannot be found after the traversal is minimum, the traversal is exited.
S24: searching a DM area, and positioning three corner coordinates of the two-dimensional code and deflection angles of a left line and a bottom line; searching an edge line at the current position according to a traversing result, wherein the edge searching area of the DM code comprises two solid lines and two broken lines, only one solid line is found, according to the found solid line edge line, the other solid line edge line is found, and the direction of the DM area is determined, namely, the left line and the bottom line of the DM code of the candidate area are determined; then, a DM area transformation matrix is preliminarily generated, the top edge and the right edge are positioned, and then, a translation transformation matrix, a rotation transformation matrix and the DM area transformation matrix are updated;
wherein the translation transformation matrix m 1 The method comprises the following steps:
rotating transformation matrix m 2 The method comprises the following steps:
wherein d x And d y For the amount of translation, α is the angle of deflection.
S25: and (3) decoding the data area of the two-dimensional code, and transmitting the grid data obtained after traversing in the step (S23) to a DM decoding module for decoding.
S26: judging whether the decoding is successful or not and judging that the decoding is overtime, wherein the decoding is influenced because the problems that the DM code is damaged, blocked or not exist in the target area image block sometimes can occur;
in this embodiment, a decoding timeout is set, and because the decoding of the two-dimensional code reader is real-time and the incomplete code cannot be decoded, the decoding time is set, if the decoding timeout is over, the decoding fails, the next frame target area is continued, and the blocking of the next frame cannot be caused;
the decoding also sets the scanning time, and if the scanning time exceeds the scanning time, the current target area is jumped out, so that the speed can be increased, and non-target interference can be eliminated.
S27: and outputting the two-dimensional code information after the decoding is successful.
In this embodiment, the step S3 is coordinate transformation after decoding, when the field of view center of the camera coincides with the center of the two-dimensional code, each angular point pixel coordinate under the camera is obtained, then the real physical coordinates of the angular point corresponding to the world coordinate are obtained (the physical coordinates may be according to the actual length of the two-dimensional code, the center is taken as the origin, the angular point physical coordinates are also the initial physical coordinates), and then the translational transformation matrix and the rotational transformation matrix are obtained according to the angular point physical coordinates of the two-dimensional code and the angular point pixel coordinates of the two-dimensional code;
obtaining a translation vector and a rotation vector through a conversion matrix, wherein the translation vector and the rotation vector are used for converting corner pixel labels under a camera into physical coordinates; and finally, performing deviation calculation to obtain a deflection distance X/Y and a deflection angle of a camera view center point in an absolute coordinate system by taking the DM code center of the calibration plate as an absolute coordinate system, and guiding the movement of the AGV trolley to enable the camera view center point to coincide with the DM code center point.
The method specifically comprises the following steps:
s31: the parameters of the internal reference matrix after the calibration of the camera adopted in the embodiment are as follows:
CameraMatrix=(448.9,0,331.9,0,449.8,206.7,0,0,1)。
s32: acquiring physical coordinates of each corner point of the DM code, wherein the dimension of the two-dimensional code adopted by the embodiment is 16 multiplied by 16mm, the absolute world coordinates are established by taking the DM center as the origin of coordinates, and the absolute world coordinates are respectively (-8, +8), (+8, -8) and (-8, -8) according to the clockwise acquisition from the coordinates of the upper left corner point;
s33: the pixel coordinates of each corner of the DM code are obtained, and the obtaining of the pixel coordinates of the DM code is also according to the above-mentioned order of obtaining the physical coordinates, wherein the pixel coordinates of the corner where the two solid lines at the lower left corner intersect are the average of the bottom coordinates of the left line and the left coordinates of the bottom line, such as numbers (2) and (3) in fig. 5 (d), and finally the number 3 in fig. 5 (e) is synthesized.
S34: firstly, acquiring internal parameters and distortion coefficients of a camera, and obtaining a translation conversion matrix and a rotation conversion matrix through PnP according to physical coordinates and pixel coordinates of each angular point of a two-dimensional code, wherein PnP solving is a motion method of 3D-2D points, as shown in fig. 4, each coordinate relation from world coordinates to pixel coordinates, and in the embodiment, 2D pixel coordinates are required to be converted into poses under the world coordinates.
The conversion relation is as follows: transforming pixel coordinates to camera coordinates:
the inverse of K is multiplied by two sides to derive:
then from the camera coordinate system to the world coordinate system:
multiplying the equation by R -1 It can be deduced that:
and solving the data obtained in S31, S32 and S33 to obtain a rotation vector rVector and a translation vector tVector, so as to convert the pixel coordinates into corresponding physical coordinate values.
S35: in order to output the X/Y deviation distance, the deviation is obtained by the physical coordinate value and the initial physical coordinate value obtained after conversion, and the deviation is the deviation between the center of the camera view and the DM center, as shown in fig. 5 (e), because the deviation between the center of the camera view is the whole deviation of the AGV trolley, the track of the AGV trolley can be regulated by obtaining the deviation value and the deflection angle, and the deflection angle refers to fig. 5 (f).
In the embodiment, the scheme is tested, the resolution is 640 multiplied by 480, the algorithm consumes 5-9 milliseconds when the single code test result is used in the Linux system, the frame rate reaches 100-200, and the application in the industrial field can be completely achieved.
Example 2
The embodiment provides a two-dimensional code positioning method, which comprises the following steps:
the preprocessing module is configured to divide the acquired image to be identified to obtain a target area image block;
the decoding module is configured to perform grid traversal on the target area image block to obtain a two-dimensional code area, and decode a data area of the two-dimensional code area to obtain two-dimensional code information;
the corner point positioning module is configured to perform edge searching area positioning on the two-dimensional code area, determine edge lines and obtain pixel coordinates of two-dimensional code corners;
the angular point coordinate conversion module is configured to convert the angular point pixel coordinates into angular point physical coordinates in an absolute coordinate system with the center of the two-dimensional code area as an origin according to the conversion relation between the pixel coordinates and the physical coordinates;
the offset adjusting module is configured to obtain the edge line deflection distance and deflection angle of the camera view center in an absolute coordinate system according to the angular point physical coordinates, so as to control the camera view center to coincide with the two-dimensional code area center and complete the positioning of the two-dimensional code.
It should be noted that the above modules correspond to the steps described in embodiment 1, and the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to those disclosed in embodiment 1. It should be noted that the modules described above may be implemented as part of a system in a computer system, such as a set of computer-executable instructions.
In further embodiments, there is also provided:
an electronic device comprising a memory and a processor and computer instructions stored on the memory and running on the processor, which when executed by the processor, perform the method described in embodiment 1. For brevity, the description is omitted here.
It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general purpose processors, digital signal processors DSP, application specific integrated circuits ASIC, off-the-shelf programmable gate array FPGA or other programmable logic device, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may include read only memory and random access memory and provide instructions and data to the processor, and a portion of the memory may also include non-volatile random access memory. For example, the memory may also store information of the device type.
A computer readable storage medium storing computer instructions which, when executed by a processor, perform the method described in embodiment 1.
The method in embodiment 1 may be directly embodied as a hardware processor executing or executed with a combination of hardware and software modules in the processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory, and the processor reads the information in the memory and, in combination with its hardware, performs the steps of the above method. To avoid repetition, a detailed description is not provided herein.
Those of ordinary skill in the art will appreciate that the elements of the various examples described in connection with the present embodiments, i.e., the algorithm steps, can be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
While the foregoing description of the embodiments of the present application has been presented in conjunction with the drawings, it should be understood that it is not intended to limit the scope of the application, but rather, it is intended to cover all modifications or variations within the scope of the application as defined by the claims of the present application.

Claims (8)

1. The two-dimensional code positioning method is characterized by comprising the following steps of:
dividing the acquired image to be identified to obtain a target area image block;
performing grid traversal on the target area image block to obtain a two-dimensional code area, and decoding a data area of the two-dimensional code area to obtain two-dimensional code information;
positioning a boundary searching area of the two-dimensional code area, determining an edge line, and obtaining pixel coordinates of a two-dimensional code corner point;
converting the pixel coordinates of the corner points into physical coordinates of the corner points under an absolute coordinate system with the center of the two-dimensional code area as an origin according to the conversion relation between the pixel coordinates and the physical coordinates;
according to the angular point physical coordinates, obtaining the deflection distance and the deflection angle of the edge line of the camera view center in an absolute coordinate system, so as to control the coincidence of the camera view center and the two-dimensional code area center and finish the positioning of the two-dimensional code;
the method for obtaining the two-dimensional code information comprises the steps of:
s21: creating a decoded image, and creating a format required by decoding the segmented target area image, wherein the format is mainly used for acquiring information of a target area, including all pixel data, the width and height of the image and the channel number of the image;
s22: the decoder is created for each decoded image on the created decoded image, and is mainly used for initializing decoding parameters and transforming basic parameters of the target area image, including storage and encapsulation of corner coordinate values of the target area, and providing initial pose for the next step of traversal;
s23: traversing the target area image by using a cross grid, traversing according to the cross grid lines from thick to thin, further subdividing the grid if the two-dimensional code is not found after the current grid is traversed, and then sequentially subdividing the grid by setting a threshold value until the two-dimensional code cannot be traversed; because the data grid sizes of the two-dimensional codes all have a minimum value, if the data grid sizes cannot be found after the data grid sizes are traversed to the minimum value, the traversal is exited;
s24: searching a DM area, and positioning three corner coordinates of the two-dimensional code and deflection angles of a left line and a bottom line; searching an edge line at the current position according to a traversing result, wherein the edge searching area of the DM code comprises two solid lines and two broken lines, only one solid line is found, according to the found solid line edge line, the other solid line edge line is found, and the direction of the DM area is determined, namely, the left line and the bottom line of the DM code of the candidate area are determined; then, a DM area transformation matrix is preliminarily generated, the top edge and the right edge are positioned, and then, a translation transformation matrix, a rotation transformation matrix and the DM area transformation matrix are updated;
wherein the translation transformation matrix m 1 The method comprises the following steps:
rotating transformation matrix m 2 The method comprises the following steps:
wherein d x And d y For translation, α is the deflection angle;
s25: decoding the data area of the two-dimensional code, and transmitting the grid data obtained after traversing in the step S23 to a DM decoding module for decoding;
s26: judging whether the decoding is successful or not and judging whether the decoding is overtime;
s27: and outputting the two-dimensional code information after the decoding is successful.
2. The two-dimensional code positioning method according to claim 1, wherein preprocessing is performed before dividing an image to be recognized, and the preprocessing comprises gray scale processing, image filtering and rectangular detection in sequence.
3. The two-dimensional code positioning method according to claim 1, wherein a decoding time threshold and a scanning time threshold are set in the process of decoding the data area of the two-dimensional code area, so as to judge whether the decoding is successful.
4. The two-dimensional code positioning method according to claim 1, wherein the process of positioning the edge searching area of the two-dimensional code area comprises the steps of positioning one solid line edge line according to two solid line edge lines and two broken line edge lines, and determining the orientation of the two-dimensional code area; and constructing a candidate two-dimensional code area transformation matrix, and positioning two dotted line edge lines.
5. The two-dimensional code positioning method of claim 1, wherein,
when the camera view center is coincident with the two-dimensional code area center, acquiring an angular point initial physical coordinate under an absolute coordinate system, and acquiring an edge line deflection distance and a deflection angle according to the angular point physical coordinate and the angular point initial physical coordinate converted by the pixel coordinate.
6. A two-dimensional code positioning system is characterized by comprising:
the preprocessing module is configured to divide the acquired image to be identified to obtain a target area image block;
the decoding module is configured to perform grid traversal on the target area image block to obtain a two-dimensional code area, and decode a data area of the two-dimensional code area to obtain two-dimensional code information;
the corner point positioning module is configured to perform edge searching area positioning on the two-dimensional code area, determine edge lines and obtain pixel coordinates of two-dimensional code corners;
the angular point coordinate conversion module is configured to convert the angular point pixel coordinates into angular point physical coordinates in an absolute coordinate system with the center of the two-dimensional code area as an origin according to the conversion relation between the pixel coordinates and the physical coordinates;
the offset adjusting module is configured to obtain the edge line deflection distance and deflection angle of the camera view center in an absolute coordinate system according to the angular point physical coordinates, so as to control the camera view center to coincide with the two-dimensional code area center and complete the positioning of the two-dimensional code;
the method for obtaining the two-dimensional code information comprises the steps of:
s21: creating a decoded image, and creating a format required by decoding the segmented target area image, wherein the format is mainly used for acquiring information of a target area, including all pixel data, the width and height of the image and the channel number of the image;
s22: the decoder is created for each decoded image on the created decoded image, and is mainly used for initializing decoding parameters and transforming basic parameters of the target area image, including storage and encapsulation of corner coordinate values of the target area, and providing initial pose for the next step of traversal;
s23: traversing the target area image by using a cross grid, traversing according to the cross grid lines from thick to thin, further subdividing the grid if the two-dimensional code is not found after the current grid is traversed, and then sequentially subdividing the grid by setting a threshold value until the two-dimensional code cannot be traversed; because the data grid sizes of the two-dimensional codes all have a minimum value, if the data grid sizes cannot be found after the data grid sizes are traversed to the minimum value, the traversal is exited;
s24: searching a DM area, and positioning three corner coordinates of the two-dimensional code and deflection angles of a left line and a bottom line; searching an edge line at the current position according to a traversing result, wherein the edge searching area of the DM code comprises two solid lines and two broken lines, only one solid line is found, according to the found solid line edge line, the other solid line edge line is found, and the direction of the DM area is determined, namely, the left line and the bottom line of the DM code of the candidate area are determined; then, a DM area transformation matrix is preliminarily generated, the top edge and the right edge are positioned, and then, a translation transformation matrix, a rotation transformation matrix and the DM area transformation matrix are updated;
wherein the translation transformation matrix m 1 The method comprises the following steps:
rotating transformation matrix m 2 The method comprises the following steps:
wherein d x And d y For translation, α is the deflection angle;
s25: decoding the data area of the two-dimensional code, and transmitting the grid data obtained after traversing in the step S23 to a DM decoding module for decoding;
s26: judging whether the decoding is successful or not and judging whether the decoding is overtime;
s27: and outputting the two-dimensional code information after the decoding is successful.
7. An electronic device comprising a memory and a processor and computer instructions stored on the memory and running on the processor, which when executed by the processor, perform the method of any one of claims 1-5.
8. A computer readable storage medium storing computer instructions which, when executed by a processor, perform the method of any of claims 1-5.
CN202111006534.1A 2021-08-30 2021-08-30 Two-dimensional code positioning method and system Active CN113705268B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111006534.1A CN113705268B (en) 2021-08-30 2021-08-30 Two-dimensional code positioning method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111006534.1A CN113705268B (en) 2021-08-30 2021-08-30 Two-dimensional code positioning method and system

Publications (2)

Publication Number Publication Date
CN113705268A CN113705268A (en) 2021-11-26
CN113705268B true CN113705268B (en) 2023-08-15

Family

ID=78655107

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111006534.1A Active CN113705268B (en) 2021-08-30 2021-08-30 Two-dimensional code positioning method and system

Country Status (1)

Country Link
CN (1) CN113705268B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117354709A (en) * 2022-06-28 2024-01-05 中兴通讯股份有限公司 2D marker, indoor positioning method and device
CN115229804B (en) * 2022-09-21 2023-02-17 荣耀终端有限公司 Method and device for attaching component
CN115880362B (en) * 2022-12-22 2023-08-08 深圳思谋信息科技有限公司 Code region positioning method, device, computer equipment and computer readable storage medium
CN116776909B (en) * 2023-08-28 2023-11-03 四川星点网络技术有限公司 Bottle lid two-dimensional code system of tracing to source

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102346850A (en) * 2011-10-13 2012-02-08 西北工业大学 DataMatrix bar code area positioning method under complex metal background
CN104933387A (en) * 2015-06-24 2015-09-23 上海快仓智能科技有限公司 Rapid positioning and identifying method based on two-dimensional code decoding
CN109543489A (en) * 2019-01-04 2019-03-29 广州广电研究院有限公司 Localization method, device and storage medium based on two dimensional code

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102346850A (en) * 2011-10-13 2012-02-08 西北工业大学 DataMatrix bar code area positioning method under complex metal background
CN104933387A (en) * 2015-06-24 2015-09-23 上海快仓智能科技有限公司 Rapid positioning and identifying method based on two-dimensional code decoding
CN109543489A (en) * 2019-01-04 2019-03-29 广州广电研究院有限公司 Localization method, device and storage medium based on two dimensional code

Also Published As

Publication number Publication date
CN113705268A (en) 2021-11-26

Similar Documents

Publication Publication Date Title
CN113705268B (en) Two-dimensional code positioning method and system
Romero-Ramirez et al. Speeded up detection of squared fiducial markers
Novatnack et al. Scale-dependent/invariant local 3D shape descriptors for fully automatic registration of multiple sets of range images
CN109903313B (en) Real-time pose tracking method based on target three-dimensional model
CN106863332B (en) Robot vision positioning method and system
JP6397354B2 (en) Human area detection apparatus, method and program
CN102721364A (en) Positioning method and positioning device for workpiece
CN104794421A (en) QR (quick response) code positioning and recognizing methods
CN115609591B (en) Visual positioning method and system based on 2D Marker and compound robot
CN111767780B (en) AI and vision combined intelligent integrated card positioning method and system
CN108256375B (en) One-dimensional bar code scanning method
CN111444778A (en) Lane line detection method
CN104715487A (en) Method for sub-pixel edge detection based on pseudo Zernike moments
CN104517109A (en) QR code image correction method and system
CN111429344A (en) Laser S L AM closed loop detection method and system based on perceptual hashing
CN113160075A (en) Processing method and system for Apriltag visual positioning, wall-climbing robot and storage medium
Truong et al. New lane detection algorithm for autonomous vehicles using computer vision
Küçükyildiz et al. Development and optimization of a DSP-based real-time lane detection algorithm on a mobile platform
CN110502948A (en) Restoring method, reduction apparatus and the barcode scanning equipment of sheet two-dimensional code image
Goronzy et al. QRPos: Indoor positioning system for self-balancing robots based on QR codes
Han et al. Auto-calibration method using stop signs for urban autonomous driving applications
Truong et al. Lane boundaries detection algorithm using vector lane concept
US20230030660A1 (en) Vehicle positioning method and system for fixed parking scenario
Jende et al. Low-level tie feature extraction of mobile mapping data (mls/images) and aerial imagery
CN115239822A (en) Real-time visual identification and positioning method and system for multi-module space of split type flying vehicle

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20240417

Address after: 102, Building 9, Zhongrun Century City, No. 13777 Jingshi Road, Lixia District, Jinan City, Shandong Province, 250000

Patentee after: SHANDONG ALESMART INTELLIGENT TECHNOLOGY CO.,LTD.

Country or region after: China

Address before: 250061, No. ten, No. 17923, Lixia District, Ji'nan City, Shandong Province

Patentee before: SHANDONG University

Country or region before: China