A method for identifying binary dot codes on mold surface

Through YOLOv8 network model and image processing technology, the recognition problem of mold binary encoding on the dynamically changing surface is solved, and high-accurate mold encoding recognition is achieved.

CN119538954BActive Publication Date: 2025-08-19GUANGDONG POLYTECHNIC NORMAL UNIV +3
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411599803.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-08-19
Estimated Expiration
2044-11-11

AI Technical Summary

Technical Problem

The existing mold binary encoding recognition technology is difficult to adapt to light changes, pattern rotation, pattern blurring and dimensional changes on the dynamically changing mold metal surface, resulting in low recognition accuracy and unable to meet the needs of industrial production.

Method used

The YOLOv8 network model is combined with image processing technology, and accurate identification of binary dot matrix codes on the mold surface is achieved through data acquisition, model training, positioning identification detection, perspective correction and code point recognition.

Benefits of technology

The recognition rate of the binary encoding of the mold surface is improved, and the mold encoding can be accurately identified under different lighting, rotation and size changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119538954B_ABST
    Figure CN119538954B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for recognizing binary dot codes on mold surfaces, comprising the steps of: collecting a binary dot code image on the mold surface; training the collected data input into a YOLOv8 model; collecting a test image again and inputting it into an upgraded YOLOv8 network model for detection output; calculating the position coordinates of the outermost vertices of four target detection frames based on the output results to obtain a distorted quadrilateral, which is converted into a square pattern through perspective transformation; inputting the square pattern into the upgraded YOLOv8 network model for detection output results, calculating the counterclockwise rotation angle θ; obtaining a standard pattern by rotating the square pattern by the angle θ; dividing the standard pattern into image blocks of equal size, identifying circular code points on the image blocks, and concatenating the recognition results to obtain a binary code sequence data. Finally, decoding the binary code sequence data according to binary code decoding rules to obtain character information corresponding to the binary code. The present invention realizes the recognition of mold binary codes under different lighting, rotation, and size changes, and greatly improves the recognition rate of binary codes on mold surfaces.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of binary dot matrix code recognition, and in particular to a method for recognizing binary dot matrix codes on a mold surface. Background Art

[0002] Molds, known as the "mother of industry," are tools used to process raw materials, giving them a complete configuration and precise dimensions. They are essential, critical process equipment in industrial production. Precision metal molds have two characteristics: first, they are non-standardized due to their wide variety, wide range of sizes, and varying requirements; second, they are expensive, making them high-value consumables. Therefore, to extend the lifespan of precision metal molds, intelligent management throughout their lifecycle is crucial. The key lies in uniquely coding the molds and accurately identifying these codings to obtain mold information. Because molds are often used in harsh environments such as high temperatures, high pressures, metal fluid erosion, and corrosion, they can cause wear and tear on the mold coding. Furthermore, the mold surface is rough and uneven, and due to oxidation, the color of the mold surface varies. Therefore, accurately identifying the mold coding presents a difficult and complex technical challenge.

[0003] Currently, there are four types of mold information marking and identification technologies used in the industry. The first is the mold surface engraved character ORC recognition technology, the second is the mold surface paper barcode recognition technology, the third is the mold coding recognition technology based on the mold QR code, and the fourth is the binary-based mold coding recognition technology (a binary-based mold coding and recognition method, storage device and intelligent terminal, patent number ZL202311308579.3).

[0004] (1) Technology of engraving mold ID characters on mold surface based on ORC recognition

[0005] This method uses a milling cutter or steel stamp to engrave the mold's ID character code on the mold surface, and then uses image processing methods to segment the processed image and separate the engraved characters from the background. The mold code characters are then recognized using character recognition technology (OCR). However, as the mold is used in different processes and different environments, the coded characters may become unclear and rust may appear on the mold. In addition, character code recognition errors may occur due to changes in lighting, image scaling, and image rotation. However, when coded characters are recognized incorrectly, the recognition method based on ORC technology lacks the necessary error correction and verification mechanisms to ensure the accuracy of character recognition. In industrial production, the accuracy requirement is much higher than the missed detection rate. If the recognition error occurs, the entire mold process record will be wrong, greatly reducing the quality and efficiency of the mold's full life cycle management.

[0006] (2) Mold surface paper barcode recognition technology

[0007] This method is to attach a paper barcode label to the surface of the mold, and then use a barcode scanning device to scan and identify the barcode. However, this method has certain limitations in practical applications. During daily maintenance, the mold will undergo polishing (physical friction), alkaline washing (corrosion), nitriding (high temperature) and other treatment processes, which will destroy the paper barcode pasted on the surface of the mold. For example, the polishing process may wear off the barcode, alkaline washing may cause the label to fall off or become blurred, and high temperature and high pressure treatments such as nitriding will directly damage the paper label. During the entire life cycle of the mold, it is necessary to repeatedly re-paste the paper barcode on the mold many times. However, the production status of the mold (high temperature, high pressure) causes the barcode to be damaged and cannot be re-pasted immediately. Therefore, this method is not suitable for extrusion molds that perform information labeling management under high temperature and high pressure environments.

[0008] (3) Mold QR code recognition technology

[0009] The encoding technology used in this method is a QR code. Laser technology is used to engrave a QR code pattern on the mold surface, which is then scanned and recognized using a QR code scanner. The advantage of this method is that it eliminates the need to develop a separate scanning program; existing, mature QR code scanning programs can be used for code recognition. However, during routine maintenance, molds undergo polishing, alkali cleaning, electrosparking, and nitriding processes, all of which damage the QR code. Due to the complexity of the QR code pattern, if excessive areas of the QR code are damaged, the code may become unrecognizable. Furthermore, after EDM processing, the mold turns black, which closely resembles the color of the QR code's markings, resulting in recognition failure.

[0010] (4) Mold binary code recognition technology based on image processing

[0011] Patent No. ZL202311308579.3 discloses a binary-based mold encoding and recognition method, storage device, and intelligent terminal. This method redesigns a binary dot matrix mold encoding pattern that is much simpler than a QR code pattern, greatly reducing the difficulty of code recognition. This method uses edge detection and morphological operations to identify and separate coding features, such as length, width, and shape. Template matching technology is then used for comparison to achieve code recognition. However, the image processing-based mold binary code recognition method requires specific selection of parameters for image processing methods such as edge detection, morphological operations, and template matching based on the specific position, angle, and lighting of the coded image. Therefore, the recognition effect of mold code images with different lighting, angles, and scales is poor, with low accuracy, and cannot meet the needs of actual production. More importantly, since the mold surface changes from a shiny metallic color to black and even rust spots throughout its life cycle, fixed parameters are not applicable to the changing mold surface color.

[0012] Therefore, in view of the shortcomings of the existing mold binary code recognition technology based on image processing, it is necessary to improve the existing recognition technology to make it suitable for the dynamically changing mold metal surface, and at the same time be able to cope with the binary dot code illumination changes, pattern rotation, pattern blur, size changes and other situations. Summary of the Invention

[0013] In order to solve the above technical problems, the present invention proposes a binary dot matrix code recognition method that combines deep learning and image processing. This method is not only applicable to dynamically changing mold metal surfaces, but also can cope with situations such as binary dot matrix code illumination changes, pattern rotation, pattern blur, and size changes.

[0014] To achieve the above object, the present invention adopts the following technical solution: a method for recognizing binary dot codes on a mold surface, the method comprising the following steps:

[0015] Step S1: Data collection: A large number of binary dot matrix code images of the mold surface are collected by a camera. A positioning mark pattern is set on each of the four corners of the binary dot matrix code image. A target detection frame is marked on each positioning mark pattern to form a training set;

[0016] Step S2: training the model by inputting the training set data into the YOLOv8 network model to train the model, obtaining the optimal weight data of the YOLOv8 network model, and loading the obtained optimal weight data into the YOLOv8 network model again to obtain the trained and upgraded YOLOv8 network model;

[0017] Step S3: Positioning mark detection: The camera collects a binary dot code image of the surface of the mold to be tested to form a test set. The test set image is input into the upgraded YOLOv8 network model. The model detects and outputs the corner points of the four target detection boxes corresponding to the test set data. Each target detection box has 4 corner points, for a total of 16 corner points.

[0018] Step S4: Calculate the outer vertices: Filter the 16 corner points using a screening strategy to calculate the position coordinates of the outermost vertices of the four target detection frames;

[0019] Step S5: perspective correction: a distorted quadrilateral is obtained according to the position coordinates of the outermost vertices of the four target detection frames, and then the distorted quadrilateral is converted into a standard L×L square pattern through perspective transformation;

[0020] Step S6 calculates the counterclockwise rotation angle: the square pattern obtained in step S5 is input into the Yolov8 network model upgraded in step S2 for detection, and the four corner points of the target detection frame corresponding to the square pattern positioning mark are output;

[0021] Get the center point G coordinate of the target detection frame according to the four corner points of the target detection frame;

[0022] Compare the center point G coordinate of the target detection frame with the center point of the square pattern obtained in step S5 The coordinate position of the square pattern is obtained by rotating the square pattern counterclockwise at an angle θ;

[0023] Step S7: Rotation correction: rotate the square pattern counterclockwise by θ to the correct position through perspective transformation to obtain the standard pattern of the binary dot code image to be tested;

[0024] Step S8: Code point recognition: The standard pattern is divided into image blocks of equal size according to the scale of the binary code points; the image blocks are then input into the YOLOv8 network model upgraded in step S2 for recognition in order from top to bottom and from left to right;

[0025] If the code point exists in the image block, the output is 1, if the code point does not exist in the image block, the output is 0;

[0026] Finally, the recognition results are connected to obtain a binary coded sequence data;

[0027] Step S9: decoding: decoding the binary coded sequence data according to the binary coded decoding rules to obtain the corresponding binary coded character information.

[0028] There are two screening strategies in step S4, which are set as the first screening strategy and the second screening strategy, wherein:

[0029] The screening method of the first screening strategy is as follows:

[0030] Step S4-a1: Construct the 16 corner points of the four target detection boxes output by the YOLOv8 network model in step S3 into a set P,

[0031] Let each corner point be a ij Its coordinates are represented by (x ij ,y ij ), where i represents the number of the target detection box, and its value range is i∈{1,2,3,4}; j represents the jth corner point among the four corner points of the box, and its value range is j∈{1,2,3,4};

[0032] Step S4-a2: The coordinate information of the four corner points of the first target detection frame is:

[0033] a 11 The coordinates are: (x 11 ,y 11 ), a 12 The coordinates are: (x 12 ,y 12 ), a 13 The coordinates are: (x 13 ,y 13 ), a 14 The coordinates are: (x 14 ,y 14 );

[0034] Step S4-a3: Assume that the position coordinates of the outermost vertices of the four target detection frames are Q1(x Q1 ,y Q1 ), Q2(x Q2 ,y Q2 ), Q3(x Q3 ,y Q3 ), Q4(x Q4 ,y Q4 ), and Q1 is at the top of the binary dot matrix code, Q2 is at the bottom of the binary dot matrix code, Q3 is at the leftmost side of the binary dot matrix code, and Q4 is at the rightmost side of the binary dot matrix code. The coordinates of the outermost vertices are calculated as follows:

[0035] Q1 is at the top of the binary dot code pattern, so its vertical coordinate is the point with the smallest ordinate in the point set P, as shown in the following formulas (1) and (2):

[0036]

[0037] Q2 is at the bottom of the binary dot matrix code, so its vertical coordinate is the point with the largest ordinate in the point set P, as shown in the following formulas (3) and (4):

[0038]

[0039] Q3 is located at the leftmost side of the binary dot code pattern, so its horizontal coordinate is the point with the smallest horizontal coordinate in the point set P, as shown in the following formulas (5) and (6):

[0040]

[0041] Q4 is located at the rightmost side of the binary dot code pattern, so its horizontal coordinate is the point with the largest horizontal coordinate in the point set P, as shown in the following formulas (7) and (8):

[0042]

[0043] The screening method of the second screening strategy is as follows:

[0044] The 16 corner points of the four target detection boxes output by the YOLOv8 network model in step S3 are constructed into a set W, where each point w m The coordinates are expressed as (x m ,y m ).

[0045] For any corner point w m With the other 15 corner points w n The distance (m≠n) is defined as d(w m ,w n ), calculated using the Euclidean distance formula (9):

[0046]

[0047] Next, the corner point w m The sum of the distances to the other 15 corner points is calculated using the following formula (10):

[0048]

[0049] By comparing all , select the first 4 largest The corner point w corresponding to the value m These are the four outer vertices of the binary dot code, and the expression formula is as follows:

[0050] Assume that all Arranged in descending order, the sorted sequence is as follows (11):

[0051]

[0052] Then select the first 4 largest The corresponding point set P' is:

[0053] P = {w1, w2, w3, w4} (12).

[0054] Preferably, the transformation formula of the perspective transformation is a transformation process of transforming the pixel coordinates (u, v) from a point on a three-dimensional world coordinate system to a two-dimensional plane pixel coordinate (x', y').

[0055] The transformation formula (13) of perspective transformation is as follows:

[0056]

[0057] Where: the coordinates of the original image in the two-dimensional plane are (u, v), w = 1. (x', y', z') are the three-dimensional space coordinates after transformation;

[0058] Perspective transformation matrix Split into 3 parts, Used as a linear transformation, Used as perspective transformation, (b 31 ,b 32 ) for translation operations.

[0059] Preferably, in the perspective transformation, the pixel coordinates (u, v) are transformed to a point on a three-dimensional world coordinate system, and then transformed to a new two-dimensional plane, and the corrected coordinates are obtained as (x, y). The calculation formulas are shown in (14) and (15):

[0060]

[0061] Preferably, the steps of obtaining the counterclockwise rotation angle θ of the square pattern in step S6 are as follows:

[0062] Step S6-1: Assume that the four corner points of the square positioning mark target detection box are represented as T r , the coordinates are expressed as (x r ,y r ), where r∈[1,4], the target detection box center point G(x G ,y G ), the coordinates of the center point G of the target detection frame can be calculated by formulas (16) and (17) as follows:

[0063]

[0064] Step S6-2: By comparing the target detection frame center point coordinates G(x G ,y G) and the center point coordinates of the square pattern obtained in step S5 Determine the angle θ of the counterclockwise rotation of the square pattern, and the corresponding relationship is as follows:

[0065]

[0066] Preferably, the steps of obtaining the standard pattern in step S7 are as follows:

[0067] Assume that a certain point U(x u ,y u ) is rotated counterclockwise by an angle of θ. The steps of the rotation process are as follows:

[0068] Calculate point U(x u ,y u ) relative to the center point The coordinates (x c ,y c ):

[0069]

[0070] Apply the rotation matrix R to rotate the coordinates (x c ,y c ) to get the coordinates (x h ,y h ):

[0071]

[0072] (x h ,y h ) translates back to the original position and obtains the final rotation point U'(x new ,y new ):

[0073]

[0074] Combining the above steps, we can get U(x u ,y u ) The coordinate U′(x) after rotating θ degrees around the center of the image new ,y new ):

[0075]

[0076] Preferably, the code point identification in step S8 includes the following steps:

[0077] S8-1 dot matrix code is divided into image blocks: the dot matrix code rotated to the correct position in step S7 is divided into image blocks of the same size according to the size of the binary code points;

[0078] S8-2 Image block code point recognition: Use the YOLOv8 network model upgraded in step S2 for code point recognition. Identify the circular binary code points of the image block in order from top to bottom and from left to right. If the code point exists in the image block, it is recorded as 1. If the binary code point does not exist in the image block, it is recorded as 0. Finally, a binary 01 code sequence is recognized and read.

[0079] The beneficial technical effects of the present invention are as follows: the present invention uses the YOLOv8 network model to perform positioning identification detection on the binary dot code image on the mold surface, then calculates the outermost vertices of the target detection frame through a screening strategy, and then uses perspective correction, calculation of the counterclockwise rotation angle, rotation correction, code point recognition and decoding to achieve recognition of the binary code of the mold with different lighting, rotation and size changes, and greatly improves the recognition rate of the binary code on the mold surface. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] Figure 1 This is an overall flow chart of a method for identifying a mold surface based on binary dot matrix code according to the present invention;

[0081] Figure 2 It is a standard pattern of a binary dot matrix code in an embodiment of a method for identifying a mold surface based on a binary dot matrix code of the present invention;

[0082] Figure 3 Schematic diagram of positioning mark target detection in an embodiment of a recognition method based on a binary dot matrix code on a mold surface according to the present invention;

[0083] Figure 4 A schematic diagram of binary dot matrix code vertices in an embodiment of a recognition method based on a binary dot matrix code on a mold surface according to the present invention;

[0084] Figure 5 Schematic diagram of a pixel coordinate system of a digital image in an embodiment of a recognition method based on a binary dot matrix code on a mold surface of the present invention;

[0085] Figure 6 Schematic diagram of dividing image blocks in an embodiment of a recognition method based on binary dot matrix code on mold surface of the present invention. DETAILED DESCRIPTION

[0086] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the embodiments, but the scope of protection claimed in the present invention is not limited to the following specific embodiments.

[0087] The production rules of the binary dot code image on the mold surface in this embodiment adopt the existing patent CN

[0088] 117375623B discloses a binary-based mold coding method. The method includes character encoding: converting the ID characters of the marking mold into a character binary code using a character encoding table; generating an error correction code: generating an error correction code based on the Reed-Solomon coding principle and converting it into an error correction binary code; generating a coding pattern: sequentially arranging the error correction binary code after the character binary code to generate a combined binary code and an N*M rectangular coding pattern; coding: intaglioing the coding pattern on the mold surface; and code recognition and decoding: using image recognition technology to identify the coding pattern, converting it into a binary code, and decoding it. Detailed coding steps are described in the patent's specific implementation method.

[0089] This patented method is a method for identifying the binary dot matrix code on the mold surface obtained by encoding based on the above patents. The specific embodiment is as follows.

[0090] like Figure 1 As shown, a method for identifying a binary dot matrix code on a mold surface comprises the following steps:

[0091] Step S1: Data collection: A large number of binary dot matrix code images of the mold surface are collected by a camera. A positioning mark pattern is set on each of the four corners of the binary dot matrix code image. A target detection frame is marked on each positioning mark pattern to form a training set;

[0092] As attached Figure 3 and attached Figure 4 As shown in the figure, the gray box represents the target detection box, and the black dots in the box represent the corner points of the target detection box, where 0 represents a normal corner point and 1 represents the outermost vertex of the binary dot code image.

[0093] Step S2: training the model by inputting the training set data into the YOLOv8 network model to train the model, obtaining the optimal weight data of the YOLOv8 network model, and loading the obtained optimal weight data into the YOLOv8 network model again to obtain the trained and upgraded YOLOv8 network model;

[0094] The YOLOv8 network model here is an existing network model and a SOTA (State of the Art) model. It builds on the success of previous YOLO versions and introduces new features and improvements, including a new backbone network, a new Anchor-Free detection head, and a new loss function. It can run on a variety of hardware platforms from CPUs to GPUs. It supports a full range of visual AI tasks, including detection, segmentation, pose estimation, tracking, and classification.

[0095] Step S3: Positioning mark detection: The binary dot code image of the mold surface to be tested is collected again by the camera to form a test set. The test set image is input into the upgraded YOLOv8 network model. The model detects and outputs the corner points of the four positioning mark target detection frames corresponding to the binary dot code image of the test set. Each target detection frame has 4 corner points, for a total of 16 corner points.

[0096] As attached Figure 3 As shown in the figure, the points marked as 0 and 1 are the corner points of the target detection box.

[0097] Step S4: Detection of peripheral vertices: Filter the 16 corner points through the screening strategy and calculate the position coordinates of the outermost vertices of the four target detection frames. Figure 4 As shown in the figure, the points marked as 1 are the outermost vertices of the four target detection frames. The positions of the outermost vertices here correspond to the positions in the four target detection frames: at the top, bottom, leftmost and rightmost of the entire binary dot code pattern respectively.

[0098] There are two screening strategies here:

[0099] The screening method of the first screening strategy is as follows:

[0100] Step S4-a1: Construct the 16 corner points of the four target detection boxes output by the YOLOv8 network model in step S3 into a set P,

[0101] Let each corner point be a ij Its coordinates are represented by (x ij ,y ij ), where i represents the number of the target detection box, and its value range is i∈{1,2,3,4}; j represents the jth corner point among the four corner points of the box, and its value range is j∈{1,2,3,4}.

[0102] The coordinates mentioned in this application are coordinates in a digital image, where the origin (0, 0) of the coordinates is at the upper left corner, which is different from the origin (0, 0) of conventional two-dimensional coordinates at the lower left corner.

[0103] The coordinates mentioned in this application are pixel coordinates in digital images. In digital images, the origin of pixel coordinates (0,0) is usually located in the upper left corner of the image. The x-coordinate represents the horizontal position of the pixel: x = 0 is the leftmost side of the image, and as the x value increases, the pixel moves to the right. The y-coordinate represents the vertical position of the pixel: y = 0 is the top of the image, and as the y value increases, the pixel moves downward.

[0104] As attached Figure 5As shown in the figure, the gray area represents a digital image, the point marked as R is the origin of the pixel coordinate (0,0), the point marked as X represents the X axis (the horizontal direction of the image), and the point marked as Y represents the Y axis (the vertical direction of the image).

[0105] Step S4-a2: The coordinate information of the four corner points of the first target detection frame is:

[0106] a 11 The coordinates are: (x 11 ,y 11 ), a 12 The coordinates are: (x 12 ,y 12 ), a 13 The coordinates are: (x 13 ,y 13 ), a 14 The coordinates are: (x 14 ,y 14 );

[0107] Step S4-a3: Assume that the position coordinates of the outermost vertices of the four target detection frames of the binary dot matrix code are Q1(x Q1 ,y Q1 ), Q2(x Q2 ,y Q2 ), Q3(x Q3 ,y Q3 ), Q4(x Q4 ,y Q4 ), and Q1 is at the top of the binary dot code, Q2 is at the bottom of the binary dot code, Q3 is at the leftmost side of the binary dot code, and Q4 is at the bottom of the binary dot code. The coordinates of each vertex are calculated as follows:

[0108] Q1 is at the top of the binary dot code pattern, so its vertical coordinate is the point with the smallest ordinate in the point set P, as shown in the following formulas (1) and (2):

[0109]

[0110] Q2 is at the bottom of the binary dot code pattern, so its vertical coordinate is the point with the largest ordinate in the point set P, as shown in the following formulas (3) and (4):

[0111]

[0112]

[0113] Q3 is located at the leftmost side of the binary dot code pattern, so its horizontal coordinate is the point with the smallest horizontal coordinate in the point set P, as shown in the following formulas (5) and (6):

[0114]

[0115] Q4 is located at the rightmost side of the binary dot code pattern, so its horizontal coordinate is the point with the largest horizontal coordinate in the point set P, as shown in the following formulas (7) and (8):

[0116]

[0117] The screening method of the second screening strategy is as follows:

[0118] The 16 corner points of the four target detection boxes output by the Yolov8 network model in step S3 are constructed into a set W, where each point w m The coordinates are (x m ,y m );

[0119] For any point w m With the other 15 corner points w n The distance (m≠n) is defined as d(w m ,w n ), calculated using the Euclidean distance formula (9):

[0120]

[0121] Next, the corner point w m The sum of the distances to the other 15 corner points is calculated using the following formula (10):

[0122]

[0123] By comparing all , select the first 4 largest The corner point w corresponding to the value m These are the four outer vertices of the binary dot code, and the expression formula is as follows:

[0124] Assume that all Arranged in descending order, the sorted sequence is as follows (11):

[0125]

[0126] Then select the first 4 largest The corresponding point set P' is:

[0127] P = {w1, w2, w3, w4} (12).

[0128] Both of the above methods can select the outermost vertices corresponding to the four target detection boxes.

[0129] Step S5: Perspective correction: A distorted quadrilateral is obtained based on the position coordinates of the outermost vertices of the four target detection frames. The four vertices are connected to form an irregular quadrilateral, and then the distorted quadrilateral is converted into a standard L×L square pattern through perspective transformation.

[0130] The transformation formula of the perspective transformation here is the transformation process of transforming the pixel coordinates (u, v) from the point on the three-dimensional world coordinate system to the two-dimensional plane pixel coordinates (x', y').

[0131] The transformation formula (13) of perspective transformation is as follows:

[0132]

[0133] Where: the coordinates of the original image in the two-dimensional plane are (u, v), w = 1. (x', y', z') are the three-dimensional space coordinates after transformation;

[0134] Perspective transformation matrix Split into 3 parts, Used as a linear transformation, Used as perspective transformation, (b 31 ,b 32 ) for translation operations.

[0135] The pixel coordinates (u, v) are transformed to a point on the three-dimensional world coordinate system, and then transformed to a new two-dimensional plane to obtain the corrected coordinates (x, y). The calculation formulas are shown in (14) and (15):

[0136]

[0137] Assuming that the size of the standard binary dot code is L, the four outer vertices of the standard binary dot code defined on the new two-dimensional plane are Q'1(0,0), Q'2(L,0), Q'3(0,L), and Q'4(L,L); through step S4, the corresponding points of the four vertices Q1, Q2, Q3, and Q4 of the binary dot code after perspective transformation are Q'1, Q'2, Q'3, and Q'4.

[0138] Specifically, here is an example of perspective transformation. Assuming that the size of the standard binary dot code pattern is L=300, the size of the binary dot code is 300×300, and the coordinates of its four vertices are: Q′1(0,0), Q′2(300,0), Q′3(0,300), Q′4(300,300).

[0139] Assume that the coordinates of the outer vertices Q1, Q2, Q3, and Q4 of the original binary dot code pattern are:

[0140] Q1(23.3625,10.4983), Q2(185.0730,206.0371), Q3(2.3291,189.7386), Q4(211.6296,26.8318).

[0141] Substituting the outer vertices Q1, Q2, Q3, Q4 of the original binary dot code pattern and the outer vertices Q'1, Q'2, Q'3, Q'4 of the standard binary dot code pattern after perspective transformation into formula (13), the perspective transformation matrix can be obtained as follows:

[0142]

[0143] Step S6 calculates the counterclockwise rotation angle: the square pattern obtained in step S5 is input into the YOLOv8 network model upgraded in step S2 for training, and the 16 corner points of the target detection box corresponding to the square pattern positioning mark are output;

[0144] The coordinates of the center point G of the target detection frame are obtained according to the 16 corner points of the target detection frame;

[0145] Compare the center point G coordinate of the target detection frame with the center point of the square pattern obtained in step S5 The coordinate position of the square pattern is obtained by rotating the square pattern counterclockwise at an angle θ;

[0146] Specifically, the steps for obtaining the counterclockwise rotation angle θ are as follows:

[0147] Step S6-1: Assume that the four corner points of the square positioning mark target detection box are represented as T r , the coordinates are expressed as (x r ,y r ), where r∈[1,4], the target detection box center point G(x G ,y G ), the coordinates of the center point G of the target detection frame can be calculated by formulas (16) and (17) as follows:

[0148]

[0149] Step S6-2: By comparing the target detection frame center point coordinates G(x G ,y G ) and the center point coordinates of the square pattern obtained in step S5 Determine the angle θ of the counterclockwise rotation of the square pattern, and the corresponding relationship is as follows:

[0150]

[0151] Specifically, here is an example of calculating the rotation angle. Assuming that the center coordinate of the target detection frame is G(40,80), and the size of the square pattern is 100×100, then Then the coordinates have the following relationship:

[0152]

[0153] So we can get θ=90.

[0154] Step S7: Rotation correction: rotate the square pattern counterclockwise to the correct position θ by perspective transformation to obtain the standard pattern of the binary dot code image to be tested;

[0155] The specific operations are as follows:

[0156] Assume that a certain point U(x u ,y u ) is rotated counterclockwise by an angle of θ. The steps of the rotation process are as follows:

[0157] Calculate point U(x u ,y u ) relative to the center point The coordinates (x c ,y c ):

[0158]

[0159] Apply the rotation matrix R to rotate the coordinates (x c ,y c ) to get the coordinates (x h ,y h ):

[0160]

[0161] (x h ,y h ) translates back to the original position and obtains the final rotation point U'(x new ,y new ):

[0162]

[0163] Combining the above steps, we can get U(x u ,y u ) The coordinate U′(x) after rotating θ degrees around the center of the image new ,y new ):

[0164]

[0165]

[0166] Step S8: Code point recognition: The standard pattern is divided into image blocks of equal size according to the binary code point scale; the image blocks are then input into the YOLOv8 network model upgraded in step S2 in order from top to bottom and from left to right for recognition and output of the results;

[0167] If the image block has a code point, the output is 1; if the image block does not have a code point, the output is 0;

[0168] Finally, the recognition results are connected to obtain a binary coded sequence data;

[0169] The specific operations are as follows:

[0170] S8-1 dot matrix code is divided into image blocks: According to the scale of the binary code points, the dot matrix code rotated to the correct position in step S7 is divided into image blocks of the same size. Figure 6 As shown;

[0171] S8-2 image block code point recognition: The YOLOv8 network model upgraded from S2 is used to identify the circular binary code points of the image block in order from top to bottom and from left to right. If the code point exists in the image block, it is recorded as 1; if the binary code point does not exist in the image block, it is recorded as 0. The final recognition and reading result is a binary 01 code sequence.

[0172] Step S9: decoding: decoding the binary coded sequence data according to the binary coded decoding rules to obtain the corresponding binary coded character information.

[0173] Specifically, the two screening methods in step 6 of this embodiment are described as follows:

[0174] For the first screening method, assume that after a binary dot code image is detected by positioning markers, the YOLOv8 network outputs the coordinates of the 16 corner points of the four target detection boxes as follows:

[0175] The first target detection box: a 11 (2.3291,189.7386),a 12 (31.8235,190.5836),

[0176] a 13 (32.6759,160.8312),a 14 (3.1815,159.9861)

[0177] The second target detection box: a21 (55.0101,42.9026),a 22 (56.1172,11.6590),

[0178] a 23 (23.3625,10.4983),a 24 (22.2553,41.7419)

[0179] The third target detection box: a 31 (180.4171,57.0028),a 32 (210.5101,58.0810),

[0180] a 33 (211.6296,26.8318),a 34 (181.5367,25.7537)

[0181] The fourth target detection box: a 41 (185.0730,206.0371),a 42 (185.9736,177.9098),

[0182] a 43 (154.1791,176.8919),a 44 (153.2786,205.0192)

[0183] Applying vertex screening rules to the coordinates of its 16 corner points yields:

[0184] Q1 is at the top of the binary dot code pattern, so its vertical coordinate is the point with the smallest ordinate in the point set P, then the corresponding corner point is a 23 (23.3625,10.4983).

[0185] Q2 is at the bottom of the binary dot code pattern, so its vertical coordinate is the point with the largest ordinate in the point set P, then the corresponding corner point is a 41 (185.0730,206.0371).

[0186] Q3 is located at the leftmost side of the binary dot code pattern, so its horizontal coordinate is the point with the smallest horizontal coordinate in the point set P, then the corresponding corner point is a 11 (2.3291,189.7386).

[0187] Q4 is located at the rightmost side of the binary dot code pattern, so its horizontal coordinate is the point with the largest horizontal coordinate in the point set P, then the corresponding corner point is a 33 (211.6296,26.8318).

[0188] For the second screening method, let's take an example to describe it in detail: suppose a binary dot code image is detected by positioning markers, and the YOLOv8 network outputs the coordinates of the 16 corner points of the four target detection boxes as follows:

[0189] w1(9,3),w2(6,9),w3(1,5),w4(7,10),w5(3,7),w6(3,10),w7(9,2),w8(7,6),w9(5,0),w 10 (2,6),w 11 (1,10),w 12 (3,6),w 13 (8,2),w 14 (9,7),w 15 (3,5),w 16 (7,8).

[0190] Then click w m With other points w n The sum of the distances (Keep two decimal places) as follows:

[0191] The sum of the distances between point w1(9,3) and other points is: 90.35;

[0192] The sum of the distances between point w2(6,9) and other points is: 72.77;

[0193] The sum of the distances between point w3(1,5) and other points is: 84.92;

[0194] The sum of the distances between point w4(7,10) and other points is: 86.08;

[0195] The sum of the distances between point w5(3,7) and other points is: 66.07;

[0196] The sum of the distances between point w6(3,10) and other points is: 86.36;

[0197] The sum of the distances between point w7(9,2) and other points is: 97.78;

[0198] The sum of the distances between point w8(7,6) and other points is: 66.12;

[0199] The sum of the distances between point w9(5,0) and other points is: 108.03;

[0200] Point w 10The sum of the distances between (2,6) and other points is: 71.95;

[0201] Point w 11 The sum of the distances between (1,10) and other points is: 101.11;

[0202] Point w 12 The sum of the distances between (3,6) and other points is: 64.81;

[0203] Point w 13 The sum of the distances between (8,2) and other points is: 90.86;

[0204] Point w 14 The sum of the distances between (9,7) and other points is: 82.82;

[0205] Point w 15 The sum of the distances between (3,5) and other points is: 67.90;

[0206] Point w 16 The sum of the distances between (7,8) and other points is: 70.17;

[0207] Through all Sort and select the top 4 largest Here are the results:

[0208] The sum of the distances between point w9(5,0) and other points is: 108.03;

[0209] Point w 11 The sum of the distances between (1,10) and other points is: 101.11;

[0210] The sum of the distances between point w7(9,2) and other points is: 97.78;

[0211] Point w 13 The sum of the distances between (8,2) and other points is: 90.86;

[0212] Therefore, P'={w9,w 11 ,w7,w 13}.

[0213] The present invention uses the YOLOv8 network model to perform positioning and identification detection on the binary dot code image on the mold surface, and then calculates the outermost vertices of the target detection frame through a screening strategy. Finally, through perspective correction, calculation of the counterclockwise rotation angle, rotation correction, code point recognition and decoding, it realizes the recognition of the binary code of the mold under different lighting, rotation and size changes, and greatly improves the recognition rate of the binary code on the mold surface.

[0214] Based on the disclosure and teachings of the above description, those skilled in the art may also make changes and modifications to the above embodiments. Therefore, the present invention is not limited to the specific embodiments disclosed and described above, and any modifications and variations of the invention should also fall within the scope of protection of the claims of the present invention. In addition, although certain specific terms are used in this description, these terms are for convenience of description only and do not constitute any limitation to the invention.

Claims

1. A method for identifying binary dot codes on a mold surface, characterized in that: The method comprises the following steps: Step S1: Data collection: A large number of binary dot matrix code images of the mold surface are collected by a camera. A positioning mark pattern is set on each of the four corners of the binary dot matrix code image. A target detection frame is marked on each positioning mark pattern to form a training set; Step S2: training the model by inputting the training set data into the YOLOv8 network model to train the model, obtaining the optimal weight data of the YOLOv8 network model, and loading the obtained optimal weight data into the YOLOv8 network model again to obtain the trained and upgraded YOLOv8 network model; Step S3: Positioning mark detection: The camera collects binary dot code images of the mold surface to be tested to form a test set. The test set images are input into the upgraded YOLOv8 network model. The model detects and outputs the corner points of the four target detection boxes corresponding to the test set data. Each target detection box has 4 corner points, for a total of 16 corner points. Step S4: Calculate the outer vertices: Filter the 16 corner points using a screening strategy to calculate the position coordinates of the outermost vertices of the four target detection frames; Step S5: perspective correction: a distorted quadrilateral is obtained according to the position coordinates of the outermost vertices of the four target detection frames, and then the distorted quadrilateral is converted into a standard L×L square pattern through perspective transformation; Step S6 calculates the counterclockwise rotation angle: the square pattern obtained in step S5 is input into the YOLOv8 network model upgraded in step S2 for detection, and the four corner points of the target detection frame corresponding to the square pattern positioning mark are output; Get the center point G coordinate of the target detection frame according to the four corner points of the target detection frame; Compare the center point G coordinate of the target detection frame with the center point of the square pattern obtained in step S5 The coordinate position of the square pattern is obtained by rotating the square pattern counterclockwise at an angle θ; Step S7: Rotation correction: The square pattern in step S5 is rotated counterclockwise by θ to the correct position through perspective transformation to obtain the standard pattern of the binary dot code image of the test set; Step S8: Code point recognition: The standard pattern is divided into image blocks of equal size according to the scale of the binary code points; the image blocks are then input into the YOLOv8 network model upgraded in step S2 for recognition in order from top to bottom and from left to right; If the code point exists in the image block, the output is 1, if the code point does not exist in the image block, the output is 0; Finally, the recognition results are connected to obtain a binary coded sequence data; Step S9: decoding: decoding the binary coded sequence data according to the binary coded decoding rules to obtain the corresponding binary coded character information.

2. A method for recognizing binary dot codes on a mold surface according to claim 1, characterized in that: There are two screening strategies, namely the first screening strategy and the second screening strategy, wherein: The screening method of the first screening strategy is as follows: Step S4-a1: Construct the 16 corner points of the four target detection boxes output by the YOLOv8 network model in step S3 into a set P, Let each corner point be a ij Its coordinates are represented by (x ij ,y ij ), where i represents the number of the target detection box, and its value range is i∈{1,2,3,4}; j represents the jth corner point among the four corner points of the box, and its value range is j∈{1,2,3,4}; Step S4-a2: The coordinate information of the four corner points of the first target detection frame is: a 11 The coordinates are: (x 11 ,y 11 ), a 12 The coordinates are: (x 12 ,y 12 ), a 13 The coordinates are: (x 13 ,y 13 ), a 14 The coordinates are: (x 14 ,y 14 ); Step S4-a3: Assume that the outermost vertices of the four target detection frames are Q1(x Q1 ,y Q1 ), Q2(x Q2 ,y Q2 ), Q3(x Q3 ,y Q3 ), Q4(x Q4 ,y Q4 ), and Q1 is located at the top of the binary dot code pattern, Q2 is located at the bottom of the binary dot code pattern, Q3 is located at the leftmost side of the binary dot code pattern, and Q4 is located at the rightmost side of the binary dot code pattern, then the coordinates of each vertex are calculated as follows: Q1 is at the top of the binary dot code pattern, so its vertical coordinate is the point with the smallest ordinate in the point set P, as shown in the following formulas (1) and (2): Q2 is at the bottom of the binary dot code pattern, so its vertical coordinate is the point with the largest ordinate in the point set P, as shown in the following formulas (3) and (4): Q3 is located at the leftmost side of the binary dot code pattern, so its horizontal coordinate is the point with the smallest horizontal coordinate in the point set P, as shown in the following formulas (5) and (6): Q4 is located at the rightmost side of the binary dot code pattern, so its horizontal coordinate is the point with the largest horizontal coordinate in the point set P, as shown in the following formulas (7) and (8):

3. A method for recognizing binary dot codes on a mold surface as claimed in claim 2, characterized in that: The screening method of the second screening strategy is as follows: The 16 corner points of the four target detection boxes output by the YOLOv8 network model in step S3 are constructed into a set W, where each point w m The coordinates are expressed as (x m ,y m ); For any corner point w m With the other 15 corner points w n The distance (m≠n) is defined as d(w m ,w n ), calculated using the Euclidean distance formula (9): Next, the corner point w m The sum of the distances to the other 15 corner points is calculated using the following formula (10): By comparing all , select the top 4 largest The corner point w corresponding to the value m These are the four outer vertices of the binary dot code, and the expression formula is as follows: Assume that all Arranged in descending order, the sorted sequence is as follows (11): Then select the first 4 largest The set of corresponding points P ' for: P′={w1,w2,w3,w4} (12).

4. A method for recognizing binary dot codes on a mold surface according to claim 1, characterized in that: The transformation formula of the perspective transformation is to transform the pixel coordinate (u, v) to a point on the three-dimensional world coordinate system, and then convert it to another pixel coordinate (x ' ,y ' ) transformation process, The transformation formula (13) of perspective transformation is as follows: Where: The coordinates of the original image in the two-dimensional plane are (u, v), w = 1, (x ' ,y ' ,z ' ) is the transformed three-dimensional space coordinate; Perspective transformation matrix Split into 3 parts, Used as a linear transformation, Used as perspective transformation, (b 31 ,b 32 ) for translation operations.

5. A method for recognizing binary dot codes on a mold surface as claimed in claim 4, characterized in that: In the perspective transformation, the pixel coordinates (u, v) are transformed to a point on the three-dimensional world coordinate system, and then transformed to a new two-dimensional plane, and the corrected coordinates are obtained as (x, y). The calculation formulas are shown in (14) and (15):

6. A method for recognizing binary dot codes on a mold surface according to claim 1, characterized in that: The steps of obtaining the counterclockwise rotation angle θ of the square pattern in step S6 are as follows: Step S6-1: Assume that the four corner points of the square positioning mark target detection box are represented as T r , the coordinates are expressed as (x r ,y r ), where r∈[1,4], the target detection box center point G(x G ,y G ), the coordinates of the center point G of the target detection frame can be calculated by formulas (16) and (17) as follows: Step S6-2: By comparing the target detection frame center point coordinates G(x G ,y G ) and the center point coordinates of the square pattern in step S5 Determine the angle θ of the counterclockwise rotation of the square pattern, and the corresponding relationship is as follows:

7. A method for recognizing binary dot codes on a mold surface according to claim 6, characterized in that: The steps for obtaining the standard pattern in step S7 are as follows: Assume that a certain point U(x u ,y u ) is rotated counterclockwise by an angle of θ. The steps of the rotation process are as follows: Calculate point U(x u ,y u ) relative to the center point The coordinates (x c ,y c ): Apply the rotation matrix R to rotate the coordinates (x c ,y c ) to get the coordinates (x h ,y h ): (x h ,y h ) translates back to the original position and obtains the final rotation point U'(x new ,y new ): Combining the above steps, we can get U(x u ,y u ) The coordinate U′(x) after rotating θ degrees around the center of the image new ,y new ):

8. The method for recognizing binary dot codes on a mold surface according to claim 1, wherein: The code point identification in step S8 includes the following steps: S8-1 Divide the binary dot code standard pattern into image blocks: Divide the binary dot code standard pattern rotated to the correct position in step S7 into image blocks of equal size according to the scale of the binary code points; S8-2 Image block code point recognition: Use the YOLOv8 network model upgraded in step S2 to identify the circular binary code points of the image block in order from top to bottom and from left to right. If the code point exists in the image block, it is recorded as 1; if the binary code point does not exist in the image block, it is recorded as 0. Finally, a binary 01 code sequence is recognized and read.

Citation Information

Patent Citations

  • A binary-based pattern encoding and recognition method, storage device, and smart terminal

    CN117375623B

  • Image perspective correction method, system and device

    CN108364259A

  • Dial pointer reading identification method based on target coding and decoding

    CN116612265A