CN106485255B - Method and system for positioning and identifying DM code - Google Patents

Method and system for positioning and identifying DM code Download PDF

Info

Publication number
CN106485255B
CN106485255B CN201610870469.XA CN201610870469A CN106485255B CN 106485255 B CN106485255 B CN 106485255B CN 201610870469 A CN201610870469 A CN 201610870469A CN 106485255 B CN106485255 B CN 106485255B
Authority
CN
China
Prior art keywords
code
edge
image
area
search
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
CN201610870469.XA
Other languages
Chinese (zh)
Other versions
CN106485255A (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.)
Yuanqi Industrial Technology (Qingdao) Co., Ltd
Original Assignee
Yuanqi Industrial Technology Qingdao Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yuanqi Industrial Technology Qingdao Co Ltd filed Critical Yuanqi Industrial Technology Qingdao Co Ltd
Priority to CN201610870469.XA priority Critical patent/CN106485255B/en
Publication of CN106485255A publication Critical patent/CN106485255A/en
Application granted granted Critical
Publication of CN106485255B publication Critical patent/CN106485255B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • G06V10/225Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition based on a marking or identifier characterising the area
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/153Segmentation of character regions using recognition of characters or words
    • 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/20048Transform domain processing
    • G06T2207/20061Hough transform
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

Abstract

The invention relates to a method and a system for positioning and identifying a DM code, wherein the method comprises the following steps: acquiring a binary image of an original image; extracting an effective area containing the DM code from the binary image; obtaining a confidence single-edge image from the effective region; carrying out Hough transformation on the positioning point, establishing an angle shielding area after searching a response point corresponding to a first search mode edge in a parameter space of a Hough transformation domain, searching a second search mode edge outside the angle shielding area, and acquiring three positioning points at the end points of the two search mode edges; acquiring two switching mode edges of the DM code by rotating a pixel accumulator with a direction and solving a fourth positioning point; performing inverse perspective transformation on the DM code according to the four positioning points to obtain a standard DM code image and performing grid division on the standard DM code image; and extracting code words of the DM codes after the grid division, and restoring code word information. The invention can still calibrate and identify the DM code under the condition that the DM image is seriously stained.

Description

Method and system for positioning and identifying DM code
Technical Field
The invention relates to a method and a system for positioning and identifying a DM code, belonging to the field of digital image processing, coding and decoding.
Background
The Direct Part Marking (Direct Part Marking, hereinafter referred to as DPM) method can record permanent marks on products. In the industrial field, a DPM method is generally used to mark a one-dimensional barcode or a two-dimensional barcode on the surface of a product, and barcode information is extracted through image positioning and recognition technology and encoding and decoding technology, so as to realize production tracking, assembly management, life cycle maintenance and the like of the product in a production link, and further realize functions of dynamic numbering management, assembly sequencing, product statistics and the like. In addition, the combination of the technologies can also play an important role in serial number reading, maintenance record tracing and the like in the process of product repair and maintenance, and the production, circulation, management and maintenance efficiency of the product is greatly accelerated.
The DataMatrix (hereinafter, referred to as a DM code) is a two-dimensional matrix image, and is composed of a probe pattern and a data area. The detection graph is the width of one module and is the boundary of the data area, wherein two adjacent sides which are all composed of dark modules form two search mode sides of an L-shaped solid line, and adjacent sides which are opposite to the L and are composed of alternate light and dark modules form two switching mode sides. The detection pattern is mainly used for limiting the unit structure of the symbol, and can also be used for determining the physical size of the symbol and solving the problems of symbol positioning, distortion and the like. The data area is a square area formed by a plurality of square depth modules, the information storage mode is different permutation and combination of the depth modules, and the data is coded by a binary code mode, so that a computer can directly read the data. The DM code is the smallest size of all the current bar codes, is easy to mark on small parts, is particularly suitable for marking and identifying the small parts, and is further convenient for industrial serial number management, product tracking and the like of products. In addition, the edge of the DM code used in the search mode for positioning and searching is easy to detect in the line detection operation, so the DM code is widely used for direct part marking of industrial products in the DPM method. However, such applications are generated directly on the surface of industrial products by a chemical or physical collision method, so that unlike conventional printed two-dimensional codes, the positioning and identification of industrial DM codes have the following problems: (1) industrial DM codes are usually printed directly on the surface of a workpiece, such as metal, plastic, glass, etc., and then the DM codes printed on such surface are read by optical means, but due to illumination, angle, etc., the image is easily over-exposed or under-exposed locally, so that the DM codes cannot be read normally; (2) the industrial DM code runs through the whole life cycle of the product, after long-time work and use, the DM code marked on the surface of the product can generate physical defects such as abrasion, incomplete defect, scratch and the like, and the defects of the key parts can directly cause that the DM code area cannot be effectively positioned and the DM code reading fails.
The invention patent CN201010564851.0 improves the traditional Hough transform, and traverses Hough domain by using a neighborhood adding template, thereby obtaining good effect for detecting jagged DM code edge. And the actual DM codes are matched one by using all the meshing modes, and the meshing mode with the maximum matching degree is used as the actual meshing mode of the DM codes. However, due to the above-mentioned defects of the DM code, the DM code may be different according to the damaged procedure, and some modules in the DM code detection pattern and the data area may be missing, thereby causing a positioning error of the DM code detection pattern and a unit length error of the data block when the DM code is subjected to the grid division.
Disclosure of Invention
The present invention is directed to overcome the drawbacks of the prior art and to provide a method and system for locating and identifying a DM code.
In order to achieve the purpose, the invention adopts the following technical scheme:
according to a first aspect of the present invention, there is provided a method for locating and identifying a DM code, comprising the steps of:
s1, acquiring a binary image of the original image;
s2, extracting an effective area containing the DM code from the binary image;
s3, performing single-edge extraction on the effective area to obtain a confidence single-edge image of the DM code;
s4, obtaining an effective single-edge image through the confidence single-edge image, carrying out Hough transformation on the effective single-edge image, establishing an angle shielding area after finding a response point corresponding to a first search mode edge in a parameter space of a Hough transformation domain, finding a response point corresponding to a second search mode edge outside the angle shielding area, further positioning two search mode edges of the DM code, and obtaining three positioning points at the end points of the first search mode edge and the second search mode edge of the DM code;
s5, two switching mode edges of the DM code are obtained by rotating the pixel accumulator with the direction, and a fourth positioning point at the intersection point of the two switching mode edges is solved;
s6, according to the four positioning points of the DM code, performing reverse perspective transformation on the DM code, restoring to obtain a standard DM code image, and performing grid division on the standard DM code image;
and S7, extracting code words of the DM code after grid division, and restoring code word information.
Further, preferably, the step S2 may extract the effective region containing the DM code from the binarized image using a region growing method based on a "kernel" finder which responds only to the corner information and is set to include the steps of:
s21, extracting corner points of the binary image;
s22, locating the maximum response area of the corner point, wherein the maximum response area is square, and the maximum response area in the step is a part of the effective area of the DM code;
s23, independently drawing rectangles of corresponding sides by taking growth radiuses as step sizes towards the direction departing from the maximum response area respectively by each side of the maximum response area, wherein the growth radiuses are larger than or equal to 5 pixel lengths and smaller than or equal to 50 pixel lengths;
and S24, setting a first threshold, if the number of corner points included in one or more rectangle ranges is larger than the first threshold, updating the side length of the maximum response area after the corresponding rectangle is used as a part of the effective area of the DM code, continuing to independently draw the rectangle of the corresponding side along the corresponding direction by taking the growth radius as the step length, and otherwise, terminating the growth of the effective area in the corresponding direction, wherein the size of the first threshold is more than or equal to 10 and less than or equal to 100.
Further, preferably, the step S2 may extract the valid region containing the DM code from the binarized image using a line statistic method, which is responsive only to the corner information and is set to include the steps of:
s21, extracting corner points of the binary image;
s22, carrying out region division on the binary image, wherein the length of the side of the regions with the same size in different regions is more than or equal to 8 pixels and less than or equal to 32 pixels;
s23, counting the number of corner points in each area, taking the area with the most dense corner points as a starting area, and setting a second threshold, wherein the starting area in the step is a part of an effective area of the DM code, and the size of the second threshold is more than or equal to 10 and less than or equal to 100;
s24, taking the line of the starting area as the search line, independently searching in the left and right directions of the starting area, if the number of the corner points of the adjacent area is larger than the second threshold, taking the corresponding adjacent area as a part of the effective area of the DM code, and continuing to search and judge along the corresponding direction, otherwise, terminating the search of the effective area in the corresponding direction;
s25, continuously moving the search line upwards, independently taking two end point areas and a middle point area of the effective area in the previous search line as new starting point areas, and repeating the step S24 until the number of corner points of the new starting point areas is smaller than a second threshold value;
s26, continuously moving the search line downwards in the step S24, independently taking two end point areas and a middle point area of the effective area in the last search line as new starting point areas, and repeating the step S24 until the number of corner points of the new starting point areas is smaller than a second threshold value.
Further, preferably, the step S2 may extract the effective region containing the DM code from the binarized image using a coordinate projection method, which is responsive only to the corner information and is set to include the steps of:
s21, extracting corner points of the binary image;
s22, counting the horizontal and vertical coordinate values corresponding to all the corner points;
s23, setting a third threshold, performing one-dimensional expansion operation on all coordinate values, and stopping the expansion operation when the length of the maximum connected domain is larger than the third threshold times of the lengths of other connected domains;
and S24, extracting the overlapped areas of all the expanded horizontal and vertical coordinate values to obtain the effective area of the DM code.
Further, preferably, after the step S2, the filtering preprocessing may be performed on the valid region of the DM code to filter out noise.
Further, preferably, in step S3, a canny edge detection operator may be used to perform single-edge extraction on the effective region, so as to obtain a confidence single-edge image of the DM code.
Further, step S4 includes the steps of:
s41, obtaining the width and the height of the effective area of the DM code, if the ratio of the width to the height basically meets the square condition, performing hollowing operation on the single edge image to exclude a data area far away from the detection graph in the DM code, otherwise, not performing hollowing operation, and finally obtaining an effective single edge image;
s42, carrying out Hough transform on the effective single-edge image to obtain a parameter space of a Hough transform domain;
s43, carrying out maximum value detection on the parameter space of the Hough transform domain, and acquiring a central pixel value corresponding to the maximum response point, wherein the parameter corresponding to the central pixel value is the linear parameter of the first search mode edge;
s44, establishing an angle shielding area in a parameter space of the Hough transform domain;
s45, detecting the maximum value of the parameter space of the Hough transform domain outside the angle shielding area, and acquiring the central pixel value corresponding to the maximum response point, wherein the parameter corresponding to the central pixel value is the linear parameter of the second search mode edge;
s46, three positioning points at the end points of the first and second lookup mode edges of the DM code are obtained, wherein the three positioning points comprise the intersection point of the first and second lookup mode edges and the other two end points of the first and second lookup mode edges.
Further, preferably, when the maximum value of the parameter space of the hough transform domain is detected in step S43 and/or step S45, a hough transform voting search method may be used, which is configured to: firstly, searching a parameter space of a Hough transform domain, weighting the parameter space through a template, and acquiring a central pixel value coordinate corresponding to a maximum response point; secondly, establishing a search area in the distance direction of the parameter space by taking the coordinate as a center, wherein the radius of the search area is r, and the value of the radius r is 3-10 degrees; thirdly, retrieving M-1 secondary large response points in the search area and recording the coordinates of the secondary large response points; thirdly, searching and acquiring straight lines corresponding to M response points in the effective single-edge image, and calculating the number of edge pixels respectively contained in the M straight lines, wherein the value of M is more than or equal to 5 and less than or equal to 10; and finally, selecting the straight line containing the most edge pixels as the straight line where the search mode edge is located, and taking the parameter defined by the straight line as the parameter of the maximum response point.
Further, step S5 includes the steps of:
s51, finding a first switching mode edge by using a rotating pixel accumulator in the belt direction, wherein the rotating pixel accumulator in the belt direction is set to rotate around a vertex in an effective area from the first searching mode edge by taking an end point of the first searching mode edge as the vertex and taking a first rotating line segment with a fixed radius from the first searching mode edge, when the accumulated value of each pixel point on the first rotating line segment is 0, the first rotating line segment at the moment is a part of the outer edge of the first switching mode edge or is overlapped with the first switching mode edge, and the fixed radius is half of the length of the first/second switching mode edge;
s52, finding a second switching mode edge by using a pixel accumulator in a rotating belt direction, wherein the pixel accumulator in the rotating belt direction is set to rotate around a vertex in an effective area from the second searching mode edge by taking an end point of the second searching mode edge as the vertex and taking a second rotating line segment with a fixed radius, and when the accumulated value of each pixel point on the second rotating line segment is 0, the second rotating line segment at the moment is a part of the outer edge of the second switching mode edge or is partially overlapped with the second switching mode edge;
and S53, taking the intersection point of the first rotating line segment and the second rotating line segment or the intersection point of the extension lines as a fourth positioning point of the DM code.
Further, step S6 includes the steps of:
s61, according to the four positioning points of the DM code, carrying out reverse perspective transformation on the DM code, and restoring to obtain a standard DM code image;
s62, obtaining the stable segment length of the standard DM code image through the switching mode edge of the standard DM code image;
and S63, carrying out grid division on the standard DM code image according to the segment length.
Further, step S62 includes the steps of:
s621, taking a straight line where the outer edge of the first switching mode edge is located as an initial search line;
s622, recording the switching times of the pixel values from 0 to 1 or from 1 to 0, introducing a delay recorder for recording the number of the same pixel values, and defining a to-be-written region flag, if the pixel values change, setting the flag to be high, and when the number of the same pixel values recorded by the delay recorder is greater than a fourth threshold value, the switching condition is met at the moment, and recording the segmentation coordinates, wherein the fourth threshold value is the length of the recorder when the number of the same pixel values is maximum;
s623, continuously moving the search line in parallel by taking the fixed pixel number as a step length, wherein the direction is towards a search mode side opposite to the search line, and repeating the step S622 to obtain and record n times of module switching times, wherein n is equal to the number of times of parallel movement of the search line;
s624, when the parallel movement time N is larger than or equal to the sampling time N, comparing the recorded N module switching times, if the N module switching times are the same, considering that the module switching times are stable, otherwise, replacing the earlier module switching times, and repeating the steps by taking the current search line as the initial position to obtain the module switching times of all data areas on the first switching mode side, namely the number of all black and white modules;
s625, recording the middle point of the module switching according to the module switching times obtained in the step S624, and further obtaining the stable segment lengths of all data areas of the standard DM code image parallel to the first switching mode edge;
s626, repeating the above steps with the straight line where the outer edge of the second switching pattern side is located as the initial search line, and the standard DM code image is parallel to the segment lengths of all data areas of the second switching pattern side.
Further, preferably, the stable segment length of the standard DM code image is obtained in step S625 and/or step S626, and the length with the highest frequency of occurrence may be taken as the segment length by performing frequency statistics on the corresponding length of the module switching coordinate position.
According to a second aspect of the present invention, there is provided a system for positioning and identifying DM codes, which is used for implementing the method for positioning and identifying DM codes according to claim 1, comprising:
the first module is used for acquiring a binary image of the original image;
a second module configured to extract an effective area containing the DM code from the binarized image;
the third module is used for extracting a single edge of the effective area to obtain a confidence single edge image of the DM code;
a fourth module, configured to obtain an effective edge image by using a confidence single edge image, perform hough transform on the effective single edge image, establish an angle shielding region after finding a response point corresponding to a first search mode edge in a parameter space of a hough transform domain, find a response point corresponding to a second search mode edge outside the angle shielding region, further locate two search mode edges of the DM code, and obtain three locating points at end points of the first search mode edge and the second search mode edge of the DM code;
the fifth module is set to obtain two switching mode edges of the DM code by rotating the pixel accumulator with the direction, and solve a fourth positioning point at the intersection point of the two switching mode edges;
the sixth module is configured to perform inverse perspective transformation on the DM code according to the four positioning points of the DM code, restore the DM code to obtain a standard DM code image, and perform meshing on the standard DM code image;
and the seventh module is used for extracting code words of the DM codes after the grid division and restoring the code word information.
According to a third aspect of the present invention, there is provided a DM code locating and identifying system, comprising:
the device comprises an image acquisition device, a processor, a memory and a display, wherein the image acquisition device acquires an original image containing DM codes, the processor is used for sending instructions for executing the method, the memory is used for storing data or intermediate data of the method and instructions for executing the method, and the display is used for displaying the result of the method.
Compared with the prior art, the invention has the following remarkable advantages and beneficial effects:
according to the method, the effective region containing the DM code is extracted from the binary image by utilizing the angular point information, and then the edge detection operator is used for carrying out single-edge extraction on the effective region to obtain the confidence single-edge image of the DM code, so that the detection region can be effectively reduced, and the time loss and the complexity of DM code extraction are reduced;
the invention establishes the angle shielding area after searching the response point corresponding to the first search mode edge in the Hough transform domain of the effective area, searches the response point corresponding to the second search mode edge outside the angle shielding area, and further positions the two search mode edges of the DM code, thereby improving the positioning quality and effectively eliminating the search of the invalid area;
according to the invention, the weighted parameter space of the Hough transform domain in the DM code effective area is weighted, and the maximum value detection is carried out on the weighted parameter space, so that the linear detection interference caused by local maximum value can be effectively avoided;
when the maximum value detection is carried out on the parameter space of the Hough transform domain, aiming at the condition that the DM code is seriously stained, the Hough transform voting searching method is provided, the straight line with the largest number of edge pixels is selected as the straight line where the searching mode edge is located, the Hough transform domain and the single edge are combined, and the error that the searching mode edge is positioned in a data area can be effectively avoided;
according to the invention, two switching mode edges of the DM code are obtained by rotating the pixel accumulator with the direction and the fourth positioning point of the DM code is positioned, so that the accuracy of positioning the switching mode edges can be improved;
the invention relates to a dynamic switching mode edge statistical method, which aims at correcting the segment length of a DM code by recording the switching times of modules on the switching mode edge when certain modules are non-rectangular due to the fact that the switching mode edge of the DM code is damaged or polluted, belongs to the dynamic switching mode edge statistical method and can realize high-quality restoration of the DM code;
according to the invention, frequency statistics is carried out on the corresponding length of the switching coordinate position of the module, and the length with the highest occurrence frequency is taken as the segment length, so that the DM code extraction error caused by adhesion among the side modules of the switching mode can be effectively solved.
Drawings
Embodiments of the invention are described in detail below with reference to the attached drawing figures, wherein:
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a flowchart illustrating the steps of the "kernel" finder-based region growing method setup in step S2 according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a "kernel" finder-based region growing method in step S2 according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating the steps of the line statistics setting in step S2 according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating the region division of the binarized image in step S2 according to an embodiment of the present invention;
FIG. 6 is a flowchart illustrating the steps of the coordinate projection setup of step S2 according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating the step S2 of extracting the overlapped areas of the horizontal and vertical coordinate values after expansion according to an embodiment of the present invention;
FIG. 8 is a flowchart of step S4 of the present invention;
FIG. 9 is a diagram of a preferred embodiment of the weighting template of step S43 according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of a DM code with severe corruption;
FIG. 11 is a schematic diagram illustrating the detection error of the search pattern edge when the DM code is severely damaged;
FIG. 12 is a diagram illustrating the step S43 and/or the step S45 of selecting the straight line containing the largest number of edge pixels as the straight line where the edge of the search pattern is located;
FIG. 13 is a flowchart of step S5 of the present invention;
FIG. 14 is a diagram illustrating the step S5 of finding the switching pattern edge using the rotating band-direction pixel accumulator according to one embodiment of the present invention;
FIG. 15 is a flowchart of step S6 of the present invention;
FIG. 16 is a flowchart of step S62 of the present invention;
FIG. 17 is a diagram illustrating the result of one embodiment of the present invention that is performed to obtain the correct DM code segment length and then perform meshing on the DM according to step S62;
FIG. 18 is a schematic flow chart illustrating how to introduce a delay recorder for recording the number of the same pixel values when determining whether the pixel values are switched from 0 to 1 or from 1 to 0 in step S622 according to the present invention;
FIG. 19 is a schematic view of the mode switching edge being fouled during flow-through to produce adhesion between the modules of the mode switching edge;
fig. 20 is a schematic diagram illustrating that frequency statistics is performed on the corresponding lengths of the module switching coordinate positions in step S625 and/or step S626, and the length with the highest occurrence frequency is taken as the segment length, and then the DM is restored according to the corrected segment length;
fig. 21 is a block diagram of a DM locating and identifying system according to the present invention.
Detailed Description
Before implementing the present invention, it is first necessary to capture an original image containing DM codes using an image capture device.
According to a first aspect of the present invention, a method for locating and identifying a DM code is provided.
Fig. 1 shows an embodiment of a method for locating and identifying a DM code according to the present invention, which includes the following steps:
and S1, acquiring a binary image of the original image. The original image captured by the camera is an 8-bit grayscale image, and even if the original image is an 8-bit color image, the 8-bit color image is usually converted into an 8-bit grayscale image. And (3) carrying out binarization operation in the gray level image, namely dividing the gray level into 256 gray levels of 0-255, selecting a gray level threshold value, setting 1 when the gray level value in the gray level image is greater than the gray level threshold value, and setting 0 when the gray level value in the gray level image is less than the gray level threshold value, so as to obtain the binarization image of the original image.
And S2, extracting the effective area containing the DM code from the binary image. The effective area is a coarse positioning area of the DM code, which may contain one or more DM codes.
And S3, performing single-edge extraction on the effective area to obtain a confidence single-edge image of the DM code.
S4, obtaining an effective single-edge image through the confidence single-edge image, carrying out Hough transformation on the effective single-edge image, establishing an angle shielding area after finding a response point corresponding to a first search mode edge in a parameter space of a Hough transformation domain, finding a response point corresponding to a second search mode edge outside the angle shielding area, further positioning two search mode edges of the DM code, and obtaining three positioning points at the end points of the first search mode edge and the second search mode edge of the DM code.
S5, two switching mode edges of the DM code are obtained by rotating the pixel accumulator with the direction, and a fourth positioning point at the intersection point of the two switching mode edges is solved.
And S6, according to the four positioning points of the DM code, performing reverse perspective transformation on the DM code, restoring to obtain a standard DM code image, and performing grid division on the standard DM code image.
And S7, extracting code words of the DM code after grid division, and restoring code word information.
According to an embodiment of the method for locating and identifying a DM code of the present invention, step S1 may use an OTSU operator to obtain a binarized image of an original image.
According to an embodiment of the method for locating and identifying a DM code of the present invention, step S1 may use a blocking OTSU operator to obtain a binarized image of an original image. The blocking OTSU operator is set to divide the gray image into a plurality of sub-blocks, and then the threshold value of each sub-block is calculated respectively, so that the binarization effect of the original image in uneven illumination can be improved in a certain procedure.
According to an embodiment of the method for locating and identifying a DM code of the present invention, step S1 may use a modified Wellner adaptive binarization operator to obtain a binarized image of an original image. The improved Wellner self-adaptive binarization operator replaces a statistical single line of a Wellner binarization method with a statistical square region, and the side length of the square region is 3 pixels.
For the purposes of a clearer description of the following embodiments of the present invention, some of the binarized DM codes in the drawings utilize grayscale display in order to highlight the operations performed on the binarized DM code.
According to an embodiment of the method for locating and identifying a DM code of the present invention, step S2 may use a "kernel" finder-based region growing method to extract the effective region containing the DM code from the binarized image, wherein the "kernel" finder-based region growing method is only responsive to the corner information, as shown in fig. 2, and is configured to include the following steps:
and S21, extracting corner points of the binary image. Wherein, the SUSAN operator or Harris operator can be used for extracting the corner points of the binary image. Preferably, the Harris operator is used to extract the corner points of the binarized image.
And S22, locating the maximum response area of the corner points. As shown in fig. 3, the maximum response area of a corner point falls within a square containing a large amount of corner point information with O as the center and originRadius as the initial radius, and the left, upper, right, and lower sides of the square are defined as sides a, b, c, and d, respectively. The maximum response area in this step is a part of the valid area of the DM code.
S23, drawing the rectangle of the corresponding side independently by taking the growth radiuses Ra, Rb, Rc and Rd as step sizes towards the direction departing from the maximum response area, wherein the growth radiuses are larger than or equal to 5 pixel lengths and smaller than or equal to 50 pixel lengths.
And S24, setting a first threshold, if the number of corner points included in one or more rectangle ranges is larger than the first threshold, updating the side length of the maximum response area after the corresponding rectangle is used as a part of the effective area of the DM code, continuing to independently draw the rectangle of the corresponding side along the corresponding direction by taking the growth radius as the step length, and otherwise, terminating the growth of the effective area in the corresponding direction until the searching is finished or the growth area touches the picture boundary, wherein the size of the first threshold is more than or equal to 10 and less than or equal to 100. Further, preferably, the growth radius of each side of the maximum response area in the above embodiments may be the same or different.
Further, it is preferable that the value of the growth radius in the above embodiment step S23 is 10 pixel length.
Further, it is preferable that the size of the first threshold in step S24 is set in relation to the growth radius, and the smaller the growth radius, the smaller the first threshold. Preferably, when the value of the growth radius is set to 10 pixels in length, the magnitude of the first threshold is preferably set to 20.
According to an embodiment of the method for locating and identifying a DM code of the present invention, step S2 may use a row statistics method to extract a valid region containing a DM code from a binarized image, wherein the row statistics method is only responsive to corner point information, as shown in fig. 4, and is configured to include the following steps:
and S21, extracting corner points of the binary image. Wherein, the SUSAN operator or Harris operator can be used for extracting the corner points of the binary image. Preferably, the Harris operator is used to extract the corner points of the binarized image.
And S22, dividing the binary image into areas, wherein the length of the side of each area with the same size of different areas is more than or equal to 8 pixels and less than or equal to 32 pixels as shown in FIG. 5.
S23, counting the number of corner points in each region, taking the region with the most dense corner points in fig. 5 as a starting region, and setting a second threshold, where the starting region is a part of the effective region of the DM code, and the size of the second threshold is greater than or equal to that of the effective region of the DM code
S24, taking the line of the starting area as the search line, independently searching in the left and right directions of the X axis of the starting area, if the number of the corner points of the adjacent area is larger than a second threshold value, taking the corresponding adjacent area as a part of the effective area of the DM code, and continuing to search and judge along the corresponding direction, otherwise, terminating the search of the effective area in the corresponding direction;
s25, continuously moving the search line upwards, namely searching along the negative direction of the Y axis, independently taking two end point areas and a middle point area of the effective area in the previous search line as new starting point areas, and repeating the step S24 until the number of corner points of the new starting point areas is less than a second threshold value;
and S26, continuously moving the search line in the step S24 downward by one line, namely searching along the positive direction of the Y axis, independently taking two end point areas and a middle point area of the effective area in the previous search line as new starting point areas, and repeating the step S24 until the number of corner points of the new starting point areas is less than a second threshold value.
Further, it is preferable that the length of the side of the region in step S22 is 8 pixels.
Further, it is preferable that the size of the second threshold in step S23 of the above embodiment is 20.
According to an embodiment of the method for locating and identifying a DM code of the present invention, step S2 may extract the effective region containing the DM code from the binarized image using a coordinate projection method, which is only responsive to the corner information, as shown in fig. 6, and is configured to include the following steps:
and S21, extracting corner points of the binary image. Wherein, the SUSAN operator or Harris operator can be used for extracting the corner points of the binary image. Preferably, the Harris operator is used to extract the corner points of the binarized image.
And S22, counting X, Y coordinate values corresponding to all the corner points.
And S23, setting a third threshold value, performing one-dimensional expansion operation on all coordinate values, and stopping the expansion operation when the length of the maximum connected domain is larger than the third threshold value times of the lengths of other connected domains. The third threshold value is preferably 0.5.
S24, extracting the overlapped area of all the expanded abscissa and ordinate values, and obtaining the effective area of the DM code as shown in fig. 7.
According to an embodiment of the method for locating and identifying a DM code of the present invention, after step S2, the effective region of the DM code may be subjected to a filtering preprocessing to filter out noise. The filtering pre-process, preferably, pre-processes the active area using a median filter.
According to an embodiment of the method for locating and identifying a DM code of the present invention, in step S3, a canny edge detection operator may be used to perform single edge extraction on the effective region, so as to obtain a confidence single edge image of the DM code.
In an embodiment of the method for locating and identifying a DM code according to the present invention, as shown in fig. 8, step S4 includes the following steps:
s41, obtaining the width and height of the DM code effective area, if the ratio of the width to the height basically meets the square condition, hollowing the single edge image to eliminate the data area far away from the detection graph in the DM code, otherwise, not hollowing, and finally obtaining the effective single edge image. The condition that the square is basically met means that the ratio of the width to the height is 1-1.3 in the method.
And S42, carrying out Hough transform on the effective single-edge image to obtain a parameter space of a Hough transform domain. The preferred angle step size is 1 degree when Hough transform is carried out, and the preferred angle range is-90 to 180 degrees.
S43, carrying out maximum value detection on the parameter space of the Hough transform domain, and acquiring a central pixel value corresponding to the maximum response point, wherein the parameter corresponding to the central pixel value is the linear parameter of the first search mode edge;
and S44, establishing an angle shielding area in the parameter space of the Hough transform domain. Preferably, the angle mask is a range with a radius of 30 ° centered on the angle of the first finding-pattern side, and an angle complementary to the angle of the first finding-pattern side is also included, if the angle corresponding to the straight line a is-30 °, then there is no angle corresponding to the second finding-pattern side around 150 °.
S45, detecting the maximum value of the parameter space of the Hough transform domain outside the angle shielding area, and acquiring the central pixel value corresponding to the maximum response point, wherein the parameter corresponding to the central pixel value is the linear parameter of the second search mode edge;
s46, three positioning points at the end points of the first and second lookup mode edges of the DM code are obtained, wherein the three positioning points comprise the intersection point of the first and second lookup mode edges and the other two end points of the first and second lookup mode edges.
According to an embodiment of the method for locating and identifying a DM code of the present invention, when the maximum value of the parameter space of the hough transform domain is detected in step S43 and/or step S45, if the DM code has a serious contamination as shown in fig. 9, a hough transform voting search method may be used to avoid a search mode edge detection error as shown in fig. 10, and the method is configured as follows: firstly, searching a parameter space of a Hough transform domain, weighting the parameter space through a template if the DM code is seriously contaminated so as to effectively avoid straight line detection interference caused by a local maximum value, preferably, as shown in FIG. 11, performing maximum value detection on the weighted parameter space, and acquiring a central pixel value coordinate corresponding to a maximum response point; secondly, establishing a search area in the distance direction of the parameter space by taking the coordinate as a center, wherein the radius of the search area is r, and the value of the radius r is 3-10 degrees; thirdly, retrieving M-1 secondary large response points in the search area and recording the coordinates of the secondary large response points, wherein the value of M is more than or equal to 5 and less than or equal to 10; thirdly, searching and acquiring straight lines corresponding to the M response points in the effective single-edge image, and calculating the number of edge pixels respectively contained in the M straight lines; finally, the straight line containing the largest number of edge pixels is selected as the straight line where the search mode edge is located, as shown in fig. 12, and the parameter defined by the straight line is used as the parameter of the maximum response point.
Further, it is preferable that the radius r has a value of 5 ° in the above embodiment step S43 and/or step S45.
Further, it is preferable that the value of M in step S43 and/or step S45 of the above embodiment is 5.
In an embodiment of the method for locating and identifying a DM code according to the present invention, as shown in fig. 13, step S5 includes the following steps:
s51, finding the first switching mode edge by using the rotating band direction pixel accumulator, the rotating band direction pixel accumulator is set to rotate around the vertex B in the effective area from the first searching mode edge with the end point of the first searching mode edge as the vertex B and with the first rotating line segment with a fixed radius, the direction is as shown in fig. 14a, the accumulated value of each pixel point on the first rotating line segment is 0 when the first rotating line segment rotates to the position of BD1, the first rotating line segment at this time is a part of the outer edge of the first switching mode edge or coincides with the first switching mode edge part, and the fixed radius is preferably half of the length of the first/second switching mode edge or half of the distance of 1/1.414 times of the two end points of B, C.
S52, finding out a second switching pattern edge by using a rotating band direction pixel accumulator, wherein the rotating band direction pixel accumulator is set to rotate around the vertex C in the effective area from the second search pattern edge by a second rotating line segment with a fixed radius, the direction of the second rotating line segment is as shown in fig. 14b, when the second rotating line segment rotates to the position of CD2, the accumulated value of each pixel point on the second rotating line segment is 0, and the second rotating line segment at this time is a part of the outer edge of the second switching pattern edge or is partially overlapped with the second switching pattern edge;
s53, using the intersection point of the first rotation line segment and the second rotation line segment or the intersection point D of the extension lines as the fourth positioning point of the DM code, as shown in fig. 14 c.
In an embodiment of the method for locating and identifying a DM code according to the present invention, as shown in fig. 15, step S6 includes the following steps:
s61, according to the four positioning points of the DM code, carrying out reverse perspective transformation on the DM code, and restoring to obtain a standard DM code image;
s62, obtaining the stable segment length of the standard DM code image by the switching mode edge of the standard DM code image, as shown in the flowchart of fig. 16, when it is determined in step S622 whether the pixel value is switched from 0 to 1 or from 1 to 0, a delay recorder may be introduced to record the number of the same pixel values and define an area to be written, if the pixel value changes, the flag is set to a high position, and when the number of the same pixel values recorded by the delay recorder is greater than a fourth threshold T4, the switching condition is already satisfied at this time, and the segment coordinate is recorded, where the fourth threshold is the length when the number of the same pixel values appearing in the recorder is the maximum. At this time, since the fourth threshold T4 pixels have been delayed, writing the coordinate position requires adjusting the fourth threshold T4 pixel positions;
and S63, carrying out grid division on the standard DM code image according to the segment length.
When the switching mode edge of the DM code is damaged or contaminated to cause some modules to be non-rectangular, if the switching mode edge of the DM code image is directly obtained, the segment length thereof is easily obtained to cause errors. Therefore, according to an embodiment of the method for locating and identifying a DM code of the present invention, as shown in fig. 17, step S62 includes the following steps:
s621, taking a straight line where the outer edge of the first switching mode edge is located as an initial search line;
s622, recording the switching times of the pixel values from 0 to 1 or from 1 to 0;
s623, continuously moving the search line in parallel by taking the fixed pixel number as a step length, wherein the direction is towards a search mode side opposite to the search line, and repeating the step S622 to obtain and record n times of module switching times, wherein n is equal to the number of times of parallel movement of the search line;
s624, when the parallel movement time N is larger than or equal to the sampling time N, comparing the recorded N module switching times, if the N module switching times are the same, considering that the module switching times are stable, otherwise, replacing the earlier module switching times, and repeating the steps by taking the current search line as the initial position to obtain the module switching times of all data areas on the first switching mode side, namely the number of all black and white modules;
s625, recording the middle point of the module switching according to the module switching times obtained in the step S624, and further obtaining the stable segment lengths of all data areas of the standard DM code image parallel to the first switching mode edge;
s626, repeating the above steps with the straight line where the outer edge of the second switching pattern side is located as the initial search line, so as to obtain the segment lengths of all data areas of the standard DM code image parallel to the second switching pattern side. When the switching mode edge of the DM code is damaged or contaminated to cause some modules to be non-rectangular, the result of obtaining the correct length of the DM code segment through the above steps and then performing the trellis division on the DM is shown in fig. 18.
As shown in fig. 19, when the switching mode edge is stained in the circulation process, so that the modules of the switching mode edge are stuck, for example, 5 modules of the stained switching mode edge BD are stuck together, and three modules of the CD edge are stuck together, which will result in an error in the length of the recorded DM code, as shown in tables 1 and 2. Wherein the module serial number direction is as shown in figure 19.
TABLE 1 BD switching mode edge fragment Length data
Module serial number 0 1 2 3 4 5 6 7 8 9 10 11 12
Length of module 0 12 24 35 47 59 70 80 92 103 115 173 185
Module serial number 13 14 15 16 17 18 19 20 21 22 23 24 25
Length of module 196 208 220 231 243 255 265 279 289 299
Table 2 CD switching pattern edge fragment length data
Table 1 shows that the number of module divisions of the BD switching mode edge of the DM code is 23, the average segment length of each module is 12 pixel units, and the 10 th to 11 th modules span 5 module units due to module adhesion. Similarly, table 2 shows that the number of the module divisions of the CD switching mode edge of the DM code is 25, and the 6 th to 7 th modules span 3 module units. The segmented data will cause codeword extraction error, and the BD switching mode edge and the CD switching mode edge have different module division numbers, which eventually causes DM code extraction failure.
Therefore, according to an embodiment of the method for locating and identifying a DM code of the present invention, the stable segment length of the standard DM code image is obtained in step S625 and/or step S626, and the length with the highest frequency of occurrence can be taken as the segment length by performing frequency statistics on the corresponding length of the module switching coordinate position. Table 3 is a statistical table of the segment lengths and frequency counts of the BD switching mode edge modules, and as shown in the table, when the number of occurrences of a module with a length of 12 pixels is the largest, it is considered that the number of pixels 12 occupied by the module length is the reference module length. And setting a threshold T5, preferably, T5 is set to 1.5, that is, the maximum module length is 12 × 1.5 — 18, and performing a dividing operation on modules larger than 18 pixel units, where the dividing operation is performed for the current module length divided by the reference module length. For example, if a certain block has a length of 58 pixels, 58 > 18, and 58/12 ≈ 4.83 ≈ 5, the block is divided into 5 equal parts, and the average length of the division is 12 pixels. In the above method, the BD switching mode edge is re-segmented, and the segment length data is shown in table 4. The same step of dividing operation is performed on the CD edge, the segment data of the CD edge is obtained by calculation, and the division operation is performed according to the segment data, so as to obtain the restored standard DM code, as shown in fig. 20.
TABLE 3
Length of 10 11 12 14 58
Frequency of occurrence 4 4 10 1 1
TABLE 4
According to a second aspect of the present invention, there is provided a system for locating and identifying a DM code, comprising:
the first module is used for acquiring a binary image of the original image;
a second module configured to extract an effective area containing the DM code from the binarized image;
the third module is used for extracting a single edge of the effective area to obtain a confidence single edge image of the DM code;
a fourth module, configured to obtain an effective edge image by using a confidence single edge image, perform hough transform on the effective single edge image, establish an angle shielding region after finding a response point corresponding to a first search mode edge in a parameter space of a hough transform domain, find a response point corresponding to a second search mode edge outside the angle shielding region, further locate two search mode edges of the DM code, and obtain three locating points at end points of the first search mode edge and the second search mode edge of the DM code;
the fifth module is set to obtain two switching mode edges of the DM code by rotating the pixel accumulator with the direction, and solve a fourth positioning point at the intersection point of the two switching mode edges;
the sixth module is configured to perform inverse perspective transformation on the DM code according to the four positioning points of the DM code, restore the DM code to obtain a standard DM code image, and perform meshing on the standard DM code image;
and the seventh module is used for extracting code words of the DM codes after the grid division and restoring the code word information.
Fig. 21 is a diagram illustrating a DM locating and identifying system according to a third aspect of the present invention, and the DM locating and identifying system includes:
an image capture device for capturing an original image containing DM code, a processor for issuing instructions for use in any of the methods described above, a memory for storing data or intermediate data for use in any of the methods described above and instructions for carrying out any of the methods described above, and a display for displaying the results of any of the methods described above.
The above description is only a preferred embodiment of the present invention, and the present invention is not limited to the above embodiment, and the present invention shall fall within the protection scope of the present invention as long as the technical effects of the present invention are achieved by the same means. The invention is capable of other modifications and variations in its technical solution and/or its implementation, within the scope of protection of the invention. Even if individual features are cited in different claims, the invention may also comprise embodiments sharing these features.

Claims (9)

1. A method for locating and identifying DM codes is characterized by comprising the following steps:
s1, acquiring a binary image of the original image;
s2, extracting an effective area containing the DM code from the binary image;
s3, performing single-edge extraction on the effective area to obtain a confidence single-edge image of the DM code;
s4, obtaining an effective single-edge image through the confidence single-edge image, carrying out Hough transformation on the effective single-edge image, establishing an angle shielding area after finding a response point corresponding to a first search mode edge in a parameter space of a Hough transformation domain, finding a response point corresponding to a second search mode edge outside the angle shielding area, further positioning two search mode edges of the DM code, and obtaining three positioning points at the end points of the first search mode edge and the second search mode edge of the DM code;
s5, two switching mode edges of the DM code are obtained by rotating the pixel accumulator with the direction, and a fourth positioning point at the intersection point of the two switching mode edges is solved;
s6, according to the four positioning points of the DM code, performing reverse perspective transformation on the DM code, restoring to obtain a standard DM code image, and performing grid division on the standard DM code image; step S6 includes the following steps:
s61, according to the four positioning points of the DM code, carrying out reverse perspective transformation on the DM code, and restoring to obtain a standard DM code image;
s62, obtaining the segment length of the standard DM code image through the switching mode edge of the standard DM code image;
s63, according to the length of the segment, carrying out grid division on the standard DM code image;
and S7, extracting code words of the DM code after grid division, and restoring code word information.
2. The method of claim 1, wherein the step S2 comprises the following steps:
s21, extracting corner points of the binary image;
s22, locating the maximum response area of the corner point, wherein the maximum response area is square, and the maximum response area in the step is a part of the effective area of the DM code;
s23, independently drawing rectangles of corresponding sides by taking growth radiuses as step sizes towards the direction departing from the maximum response area respectively by each side of the maximum response area, wherein the growth radiuses are larger than or equal to 5 pixel lengths and smaller than or equal to 50 pixel lengths;
and S24, setting a first threshold, if the number of corner points included in one or more rectangle ranges is larger than the first threshold, updating the side length of the maximum response area after the corresponding rectangle is used as a part of the effective area of the DM code, continuing to independently draw the rectangle of the corresponding side along the corresponding direction by taking the growth radius as the step length, and otherwise, terminating the growth of the effective area in the corresponding direction, wherein the size of the first threshold is more than or equal to 10 and less than or equal to 100.
3. The method of claim 1, wherein the step S2 comprises the following steps:
s21, extracting corner points of the binary image;
s22, carrying out region division on the binary image, wherein the sizes of different regions are the same, and the length of the side length of each region is more than or equal to 8 pixels and less than or equal to 32 pixels;
s23, counting the number of corner points in each area, taking the area with the most dense corner points as a starting area, and setting a second threshold, wherein the starting area in the step is a part of an effective area of the DM code, and the size of the second threshold is more than or equal to 10 and less than or equal to 100;
s24, taking the line of the starting area as the search line, independently searching in the left and right directions of the starting area, if the number of the corner points of the adjacent area is larger than the second threshold, taking the corresponding adjacent area as a part of the effective area of the DM code, and continuing to search and judge along the corresponding direction, otherwise, terminating the search of the effective area in the corresponding direction;
s25, continuously moving the search line upwards, independently taking two end point areas and a middle point area of the effective area in the previous search line as new starting point areas, and repeating the step S24 until the number of corner points of the new starting point areas is smaller than a second threshold value;
s26, continuously moving the search line downwards in the step S24, independently taking two end point areas and a middle point area of the effective area in the last search line as new starting point areas, and repeating the step S24 until the number of corner points of the new starting point areas is smaller than a second threshold value.
4. The method of claim 1, wherein the step S2 comprises the following steps:
s21, extracting corner points of the binary image;
s22, counting the horizontal and vertical coordinate values corresponding to all the corner points;
s23, setting a third threshold value, performing one-dimensional expansion operation on all coordinate values, and stopping the expansion operation when the length of the maximum connected domain is larger than the third threshold value times of the lengths of other connected domains;
and S24, extracting the overlapped areas of all the expanded horizontal and vertical coordinate values to obtain the effective area of the DM code.
5. The method of claim 1, wherein the step S4 comprises the following steps:
s41, obtaining the width and the height of the effective area of the DM code, if the ratio of the width to the height basically meets the square condition, performing hollowing operation on the single edge image to exclude a data area far away from the detection graph in the DM code, otherwise, not performing hollowing operation, and finally obtaining an effective single edge image;
s42, carrying out Hough transform on the effective single-edge image to obtain a parameter space of a Hough transform domain;
s43, carrying out maximum value detection on the parameter space of the Hough transform domain, and acquiring a central pixel value corresponding to the maximum response point, wherein the parameter corresponding to the central pixel value is the linear parameter of the first search mode edge;
s44, establishing an angle shielding area in a parameter space of the Hough transform domain;
s45, detecting the maximum value of the parameter space of the Hough transform domain outside the angle shielding area, and acquiring the central pixel value corresponding to the maximum response point, wherein the parameter corresponding to the central pixel value is the linear parameter of the second search mode edge;
s46, three positioning points at the end points of the first and second lookup mode edges of the DM code are obtained, wherein the three positioning points comprise the intersection point of the first and second lookup mode edges and the other two end points of the first and second lookup mode edges.
6. The method of claim 5, wherein in the step of detecting the maximum value in the parameter space of the hough transform domain in step S43 and/or step S45, a hough transform voting search method is used, which is configured to: firstly, searching a parameter space of a Hough transform domain, weighting the parameter space through a template, and acquiring a central pixel value coordinate corresponding to a maximum response point; secondly, establishing a search area in the distance direction of the parameter space by taking the coordinate as a center, wherein the radius of the search area is r, and the value of the radius r is 3-10 degrees; thirdly, retrieving M-1 secondary large response points in the search area and recording the coordinates of the secondary large response points, wherein the value of M is more than or equal to 5 and less than or equal to 10; thirdly, searching and acquiring straight lines corresponding to the M response points in the effective single-edge image, and calculating the number of edge pixels respectively contained in the M straight lines; and finally, selecting the straight line containing the most edge pixels as the straight line where the search mode edge is located, and taking the parameter defined by the straight line as the parameter of the maximum response point.
7. The method of claim 1, wherein the step S5 comprises the following steps:
s51, finding a first switching mode edge by using a rotating pixel accumulator in the belt direction, wherein the rotating pixel accumulator in the belt direction is set to rotate around a vertex in an effective area from the first searching mode edge by taking an end point of the first searching mode edge as the vertex and taking a first rotating line segment with a fixed radius from the first searching mode edge, when the accumulated value of each pixel point on the first rotating line segment is 0, the first rotating line segment at the moment is a part of the outer edge of the first switching mode edge or is overlapped with the first switching mode edge, and the fixed radius is half of the length of the first/second switching mode edge;
s52, finding a second switching mode edge by using a pixel accumulator in a rotating belt direction, wherein the pixel accumulator in the rotating belt direction is set to rotate around a vertex in an effective area from the second searching mode edge by taking an end point of the second searching mode edge as the vertex and taking a second rotating line segment with a fixed radius, and when the accumulated value of each pixel point on the second rotating line segment is 0, the second rotating line segment at the moment is a part of the outer edge of the second switching mode edge or is partially overlapped with the second switching mode edge;
and S53, taking the intersection point of the first rotating line segment and the second rotating line segment or the intersection point of the extension lines as a fourth positioning point of the DM code.
8. The method of claim 1, wherein the step S62 comprises the following steps:
s621, taking a straight line where the outer edge of the first switching mode edge is located as an initial search line;
s622, recording the switching times of the pixel values from 0 to 1 or from 1 to 0, introducing a delay recorder for recording the number of the same pixel values, and defining a to-be-written region flag, if the pixel values change, setting the flag to be high, and when the number of the same pixel values recorded by the delay recorder is greater than a fourth threshold value, the switching condition is met at the moment, and recording the segmentation coordinates, wherein the fourth threshold value is the length of the recorder when the number of the same pixel values is maximum;
s623, continuously moving the search line in parallel by taking the fixed pixel number as a step length, wherein the direction is towards a search mode side opposite to the search line, and repeating the step S622 to obtain and record n times of module switching times, wherein n is equal to the number of times of parallel movement of the search line;
s624, when the parallel movement time N is larger than or equal to the sampling time N, comparing the recorded N module switching times, if the N module switching times are the same, considering the module switching times to be stable, otherwise, replacing the earlier module switching times, and repeating the steps from S621 to S624 by taking the current search line as the initial position to obtain the module switching times of all the data areas on the first switching mode side, namely the number of all the black and white modules;
s625, recording the middle point of module switching according to the module switching times obtained in the step S624, and further obtaining the segment lengths of all data areas of the standard DM code image parallel to the first switching mode edge;
s626, repeating steps S621 to S625 with the straight line where the outer edge of the second switching pattern side is located as the initial search line, and obtaining the segment lengths of all data areas of the standard DM code image parallel to the second switching pattern side.
9. A system for locating and identifying DM codes, for implementing the method of claim 1, comprising:
the first module is used for acquiring a binary image of the original image;
a second module configured to extract an effective area containing the DM code from the binarized image;
the third module is used for extracting a single edge of the effective area to obtain a confidence single edge image of the DM code;
a fourth module, configured to obtain an effective edge image by using a confidence single edge image, perform hough transform on the effective single edge image, establish an angle shielding region after finding a response point corresponding to a first search mode edge in a parameter space of a hough transform domain, find a response point corresponding to a second search mode edge outside the angle shielding region, further locate two search mode edges of the DM code, and obtain three locating points at end points of the first search mode edge and the second search mode edge of the DM code;
the fifth module is set to obtain two switching mode edges of the DM code by rotating the pixel accumulator with the direction, and solve a fourth positioning point at the intersection point of the two switching mode edges;
the sixth module is configured to perform inverse perspective transformation on the DM code according to the four positioning points of the DM code, restore the DM code to obtain a standard DM code image, and perform meshing on the standard DM code image;
and the seventh module is used for extracting code words of the DM codes after the grid division and restoring the code word information.
CN201610870469.XA 2016-09-29 2016-09-29 Method and system for positioning and identifying DM code Active CN106485255B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610870469.XA CN106485255B (en) 2016-09-29 2016-09-29 Method and system for positioning and identifying DM code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610870469.XA CN106485255B (en) 2016-09-29 2016-09-29 Method and system for positioning and identifying DM code

Publications (2)

Publication Number Publication Date
CN106485255A CN106485255A (en) 2017-03-08
CN106485255B true CN106485255B (en) 2019-12-24

Family

ID=58268381

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610870469.XA Active CN106485255B (en) 2016-09-29 2016-09-29 Method and system for positioning and identifying DM code

Country Status (1)

Country Link
CN (1) CN106485255B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301368B (en) * 2017-06-28 2023-12-22 昂视智能(深圳)有限公司 Recognition method of DataMatrix two-dimensional code
CN107437085A (en) * 2017-08-09 2017-12-05 厦门商集企业咨询有限责任公司 A kind of method, apparatus and readable storage medium storing program for executing of lifting OCR discriminations
CN107818582B (en) * 2017-11-22 2020-02-28 航天科工智能机器人有限责任公司 Detection system and method for full-automatically identifying carrier tape reel angle and bar code information
CN108573184B (en) * 2018-03-12 2021-04-27 青岛乾程科技股份有限公司 Two-dimensional code positioning method, module and computer readable storage medium
CN109492453A (en) * 2018-11-12 2019-03-19 凌云光技术集团有限责任公司 A kind of DM code localization method and device based on geometry location
CN110264488B (en) * 2019-06-20 2021-03-16 合肥工业大学 Binary image edge extraction device
CN110414649B (en) * 2019-07-29 2023-06-06 广州柔视智能科技有限公司 DM code positioning method, device, terminal and storage medium
CN110688999B (en) * 2019-10-08 2020-08-28 合肥海诺恒信息科技有限公司 Mach-band effect simulated point light source metal steel seal character detection method
WO2022036482A1 (en) * 2020-08-17 2022-02-24 江苏瑞科科技有限公司 Technique of locating and reading dpm code on complex background
CN113313226B (en) * 2021-07-29 2021-11-02 北京紫光青藤微系统有限公司 Method and device for determining DM code version information, equipment and storage medium
CN114548136A (en) * 2021-11-18 2022-05-27 福建星网天合智能科技有限公司 Method, device, equipment and medium for analyzing light-reflecting two-dimensional code picture
CN116452580B (en) * 2023-06-13 2023-09-01 山东古天电子科技有限公司 Notebook appearance quality detection method

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1160720A3 (en) * 2000-06-02 2003-01-02 Matsushita Electric Industrial Co., Ltd. A method for locating and reading a two-dimensional barcode
CN101017527A (en) * 2006-04-18 2007-08-15 珠海炬力集成电路设计有限公司 Identification method for data matrix code
EP2209078A1 (en) * 2009-01-15 2010-07-21 ETH Zürich Method and portable device for recognising barcodes
CN102096795A (en) * 2010-11-25 2011-06-15 西北工业大学 Method for recognizing worn two-dimensional barcode image
CN102708351A (en) * 2012-05-24 2012-10-03 江南大学 Method for fast identifying Data Matrix two-dimensional bar code under complicated working condition background
CN102831428A (en) * 2012-06-30 2012-12-19 东南大学 Method for extracting quick response matrix code region in image
CN102902945A (en) * 2012-09-28 2013-01-30 南京汇兴博业数字设备有限公司 Distortion correction method of outer contour based on quick response matrix code
CN102930268A (en) * 2012-08-31 2013-02-13 西北工业大学 Accurate positioning method for data matrix code under pollution and multi-view situation
CN104424457A (en) * 2013-08-20 2015-03-18 复旦大学 Method for identifying two-dimensional code under the condition of nonlinear distortion
CN104732511A (en) * 2013-12-24 2015-06-24 华为技术有限公司 Convex polygonal image block detection method, device and equipment
CN104915951A (en) * 2015-05-08 2015-09-16 天津大学 Stippled DPM two-dimensional code area positioning method

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1160720A3 (en) * 2000-06-02 2003-01-02 Matsushita Electric Industrial Co., Ltd. A method for locating and reading a two-dimensional barcode
CN101017527A (en) * 2006-04-18 2007-08-15 珠海炬力集成电路设计有限公司 Identification method for data matrix code
EP2209078A1 (en) * 2009-01-15 2010-07-21 ETH Zürich Method and portable device for recognising barcodes
CN102096795A (en) * 2010-11-25 2011-06-15 西北工业大学 Method for recognizing worn two-dimensional barcode image
CN102708351A (en) * 2012-05-24 2012-10-03 江南大学 Method for fast identifying Data Matrix two-dimensional bar code under complicated working condition background
CN102831428A (en) * 2012-06-30 2012-12-19 东南大学 Method for extracting quick response matrix code region in image
CN102930268A (en) * 2012-08-31 2013-02-13 西北工业大学 Accurate positioning method for data matrix code under pollution and multi-view situation
CN102902945A (en) * 2012-09-28 2013-01-30 南京汇兴博业数字设备有限公司 Distortion correction method of outer contour based on quick response matrix code
CN104424457A (en) * 2013-08-20 2015-03-18 复旦大学 Method for identifying two-dimensional code under the condition of nonlinear distortion
CN104732511A (en) * 2013-12-24 2015-06-24 华为技术有限公司 Convex polygonal image block detection method, device and equipment
CN104915951A (en) * 2015-05-08 2015-09-16 天津大学 Stippled DPM two-dimensional code area positioning method

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
Data Matrix Code Location Based on Finder Pattern Detection and Bar Code Border Fitting;Qiang Huang 等;《Mathematical Problems in Engineering》;20121231;第2012卷;1-13 *
DataMatrix码的嵌入式识别算法;王根源 等;《吉林大学学报( 信息科学版)》;20160531;第34卷(第3期);419-426 *
基于复杂背景的二维条码提取技术;陈文艺 等;《西安邮电大学学报》;20140331;第19卷(第2期);48-51 *
基于投影算法的二维条码识别;刘宁钟 等;《计算机工程》;20020930;第28卷(第9期);32-33、56 *
污染及多视角下DataMatrix码精确定位;王伟 等;《计算机辅助设计与图形学学报》;20130930;第25卷(第9期);1345-1353 *

Also Published As

Publication number Publication date
CN106485255A (en) 2017-03-08

Similar Documents

Publication Publication Date Title
CN106485255B (en) Method and system for positioning and identifying DM code
EP2393037B1 (en) Data matrix decoding chip and decoding method thereof
US10095903B2 (en) Block decoding method and system for two-dimensional code
CN106960208B (en) Method and system for automatically segmenting and identifying instrument liquid crystal number
CN111612781B (en) Screen defect detection method and device and head-mounted display equipment
CN105989317B (en) Two-dimensional code identification method and device
US8550352B2 (en) QR barcode decoding chip and decoding method thereof
JP2007317184A (en) Two-dimensional bar code, and encoding and decoding method thereof
CN102945368B (en) Method for positioning and identifying laser character of beer bottle cap
EP2393038A1 (en) Matrix-type two-dimensional barcode decoding chip and decoding method thereof
CN107301368B (en) Recognition method of DataMatrix two-dimensional code
CN103294980A (en) Micro-QR (Quick Response) code recognition method based on picture processing
US20220172337A1 (en) Character defect detection method and device
CN113392669B (en) Image information detection method, detection device and storage medium
CN113177959B (en) QR code real-time extraction method in rapid movement process
CN112329496B (en) Rectangular two-dimensional code identification method and device and electronic equipment
CN109190434B (en) Bar code recognition algorithm based on sub-pixel level corner detection
CN115456003A (en) DPM two-dimensional code identification method and storage medium
CN110288619B (en) Vision-based sunflower module surface screw hole position detection method
CN112418242B (en) Color identification system suitable for large-scale targets and identification method thereof
CN111241860A (en) Positioning and decoding method for arbitrary material annular code
WO2022021687A1 (en) Method for positioning quick response code area, and electronic device and storage medium
CN112419225B (en) SOP type chip detection method and system based on pin segmentation
CN102521559A (en) 417 bar code identification method based on sub-pixel edge detection
CN116167394A (en) Bar code recognition method and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20191118

Address after: Room 303, floor 3, building 1, No. 130, jiushui East Road, Licang District, Qingdao, Shandong Province

Applicant after: Yuanqi Industrial Technology (Qingdao) Co., Ltd

Address before: 518000 Guangdong city of Shenzhen province Nanshan District Xili street Zhongshan Road No. 1001 TCL International Science Park E building D1 6A

Applicant before: SHENZHEN YUANQI INTELLIGENT TECHNOLOGY CO., LTD.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant