CN115270839A - Industrial scene QR Code detection and identification method based on PPYOLOv2 model - Google Patents

Industrial scene QR Code detection and identification method based on PPYOLOv2 model Download PDF

Info

Publication number
CN115270839A
CN115270839A CN202210883094.6A CN202210883094A CN115270839A CN 115270839 A CN115270839 A CN 115270839A CN 202210883094 A CN202210883094 A CN 202210883094A CN 115270839 A CN115270839 A CN 115270839A
Authority
CN
China
Prior art keywords
image
code
dimensional code
transformation
detection
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.)
Pending
Application number
CN202210883094.6A
Other languages
Chinese (zh)
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.)
Henan Alson Intelligent Technology Co ltd
Original Assignee
Henan Alson Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Henan Alson Intelligent Technology Co ltd filed Critical Henan Alson Intelligent Technology Co ltd
Priority to CN202210883094.6A priority Critical patent/CN115270839A/en
Publication of CN115270839A publication Critical patent/CN115270839A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • 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/20081Training; Learning
    • 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/20084Artificial neural networks [ANN]

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Electromagnetism (AREA)
  • Data Mining & Analysis (AREA)
  • Toxicology (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to the technical field of intelligent manufacturing, in particular to a PPYOLOv2 model-based industrial scene QR Code detection and identification method, which aims at solving the problems that the current defects are various, irregular in shape, appearance position, area and the like, extremely fine, low in accuracy of the traditional algorithm and high in requirement on the detection speed of a single picture, and provides the following scheme, wherein the detection method comprises the following steps: s1: three rectangles positioned at the upper left, the lower left and the upper right are position detection graphs, the position of a first coded character on the right side of the rectangle at the upper left is accurately found, the position of the two-dimensional code is detected, the image is input, the minimum quadrangle surrounding the two-dimensional code is returned and detected, and the function calling state is realized; the invention aims to solve the problem that the two-dimensional Code identification is influenced by poor environments such as insufficient lighting, dust raising and light reflection in the industrial environment, improve the performance of terminal deployment hardware, reduce the cost and solve the identification problem of QR codes in an industrial scene.

Description

Industrial scene QR Code detection and identification method based on PPYOLOv2 model
Technical Field
The invention relates to the technical field of intelligent manufacturing, in particular to a PPYOLOv2 model-based industrial scene QR Code detection and identification method.
Background
In recent years, the two-dimensional bar Code technology is widely applied to the field of industrial control, and a plurality of industrial parts, electronic chips and product outer packages are identified by adopting the QR Code technology to complete the functions of quality management, product traceability and the like.
However, in the current industrial control environment, the bar code is often printed in other patterns, and therefore the position of the bar code must be detected in the background. The industrial environment is limited by certain limitations, such as insufficient lighting, dust raising, light reflection and the like, the types of defects are multiple, the shapes, the occurrence positions, the areas and the like are irregular, the defects are extremely fine, the accuracy of a traditional algorithm is low, the requirement on the detection speed of a single picture is high, the performance and the cost of terminal deployment hardware need to be balanced, each type of defect data sample is few, and model training basic materials are limited, so that the industrial scene QR Code detection and identification method based on the PPYOLOv2 model is provided and used for solving the problems.
Disclosure of Invention
The invention aims to solve the problems that the existing defects are various in types, irregular in shape, position, area and the like, extremely fine, low in accuracy of the traditional algorithm, high in requirement on detection speed of a single picture and the like, and provides a PPYOLOv2 model-based industrial scene QR Code detection and identification method.
In order to achieve the purpose, the invention adopts the following technical scheme:
a PPYOLOv2 model-based industrial scene QR Code detection and identification method comprises the following steps:
s1: three rectangles positioned at the upper left, the lower left and the upper right are position detection graphs, the position of a first coding character on the right side of the rectangle at the upper left corner is accurately found, the position of the two-dimensional code is detected, the image is input, the minimum quadrangle surrounding the two-dimensional code is returned, the function calling state is returned, the calling is successfully returned, and the two-dimensional code graph is obtained;
s2: correcting the two-dimension code graph, performing projection mapping on the irregular two-dimension code by utilizing computer perspective transformation, and obtaining a complete two-dimension code graph by two times of transformation;
s3: the camera scans black-white two-dimensional codes, the mobile phone converts the collected image into a binary image by using a threshold value theory of point operation, the binary image is subjected to binarization processing by using a gray value calculation formula to obtain a binary image, then expansion operation is performed on the binary image, and the expanded image is subjected to edge detection to obtain the outline of a bar code area;
s4: carrying out grid sampling, and sampling image pixels on each intersection point of the grid;
s5: the photoelectric converter receives and generates an analog electric signal, and the analog electric signal is amplified, filtered and shaped to form a square wave signal;
s6, the decoder determines whether the two-dimensional code is dark color 1 or light color 0 according to a threshold value so as to obtain an original binary sequence value of the two-dimensional code, corrects and decodes the data, and finally converts the original data into character data according to a logic coding rule of the bar code;
preferably, in S1, the detection of the two-dimensional code position utilizes a YOLOv2 algorithm, and the YOLOv2 predicts offsets of the bounding box relative to the prior box by using anchor boxes for referencing an RPN network, and a coordinate offset value (t) of an actual central position (x, y) of the bounding boxx,ty) Scale of the prior box (w)a,ha) And center coordinate (x)a,ya) To calculate:
x=(tx×wa)-xa
y=(ty×ha)-ya
however, the above formula is unconstrained, and the predicted bounding box is very largeEasily shifted in any direction, e.g. when txThe bounding box will shift right by one width size of the prior box when =1, and when txWhen the boundary box is shifted to the left by one width of the prior box when the boundary box is-1, therefore the boundary box predicted at each position can fall on any position of the picture, which causes instability of the model, a long time is needed to predict correct offsets during training, YOLOv2 follows the method of YOLOv1, the relative offset value of the center point of the boundary box relative to the position of the upper left corner of the corresponding cell is predicted, in order to constrain the center point of the boundary box in the current cell, the offset value is processed by using a sigmoid function, so that the predicted offset value is in the range of (0, 1), the scale of each cell is regarded as 1), and in summary, 4 offssts predicted according to the boundary box are consideredx,ty,tw,thThe actual position and size of the bounding box can be calculated according to the following formula:
bx=σ(tx)+cx
by=σ(ty)+cy
Figure RE-GDA0003874247150000041
Figure RE-GDA0003874247150000042
wherein (c)x,cy) For the coordinates of the upper left corner of the cell, the scale of each cell is 1 during calculation, so that the coordinates of the upper left corner of the current cell are (1, 1), and due to the processing of the sigmoid function, the central position of the bounding box can be restricted in the current cell to prevent excessive offset, and pwAnd phThe width and the length of the prior frame are the values of the prior frame and the values are relative to the size of the feature map, and the length and the width of each cell in the feature map are both 1; note here that the size of the feature map is (W, H), so we can calculate the position and size of the bounding box with respect to the whole picture (4 values are between 0 and 1):
bx=(σ(tx)+cx)/W
by=(σ(ty)+cy)/H
Figure RE-GDA0003874247150000043
Figure RE-GDA0003874247150000051
the final position and size of the bounding box can be obtained by multiplying the above 4 values by the width and length (pixel point values) of the picture, respectively.
Preferably, in S2, the original picture coordinates are mapped to obtain transformed picture coordinates x, y, where x = x '/w', y = y '/w'; w of the source coordinate is constantly 1, and the general transformation formula is as follows:
Figure RE-GDA0003874247150000052
transformation matrix
Figure RE-GDA0003874247150000053
Can be disassembled into 4 parts, and the two parts are combined,
Figure RE-GDA0003874247150000054
represents a linear transformation, [ a ]31 a32]For translation, [ a ]13 a23]TGenerating a perspective transformation; in the case where the mapped view plane is not parallel to the original plane, the image after perspective transformation is usually not a parallelogram;
in the code, we define several auxiliary variables in the perspective transformation, Δ x corresponds to dx1 in the code:
Δx1=x1-x2 Δx2=x3-x2 Δx3=x0-x1+x2-x3
Δy1=y1-y2 Δy2=y3-y2 Δy3=y0-y1+y2-y3
(1) when Δ x3,Δy3When all are 0, the transform plane is parallel to the original, and can obtain:
a11=x1-x0
a21=x2-x1
a31=x0
a12=y1-y0
a22=y2-y1
a32=y0
a13=0
a12=0
(2) when not 0, we obtain:
a11=x1-x0+a12x1
a21=x3-x0+a12x2
a31=x0
a12=y1-y0+a13y1
a22=y3-y0+a23y3
a32=y0
Figure RE-GDA0003874247150000061
Figure RE-GDA0003874247150000062
the solved transformation matrix can transform a square into a quadrangle, and the known target coordinates (x, y) are obtained by rewriting the transformation formula before, and the values of a11 to a33 are known, so that:
Figure RE-GDA0003874247150000063
Figure RE-GDA0003874247150000064
through two times of conversion; the transformation of a quadrangle to a square + the transformation of a square to a quadrangle makes it possible to transform any one quadrangle to another quadrangle.
Preferably, in S3, because the objects with different colors have different wavelengths of the reflected visible light, the white object can reflect the visible light with various wavelengths, and the black object absorbs the visible light with various wavelengths, when the camera scans the black and white two-dimensional code, the mobile phone uses the threshold theory of the point operation to change the acquired image into a binary image, that is, binarize the image to obtain a binarized image, and then perform an expansion operation on the binarized image, and perform edge detection on the expanded image to obtain the outline of the barcode region.
Preferably, in S3, the camera scans a black-and-white two-dimensional code, the mobile phone converts the acquired image into a binary image by using a threshold theory of point operation, performs binarization processing on the image through a gray value calculation formula, sets a global threshold T, and divides data of the image into two parts by using T: pixel groups larger than T and pixel groups smaller than T; setting the pixel value of the pixel group larger than T as white, setting the pixel value of the pixel group smaller than T as black, dividing the whole image into N windows according to a certain rule, dividing the pixels in the windows into two parts according to a uniform threshold value T for each window of the N windows, carrying out local binarization processing, and setting a parameter equation to carry out threshold value calculation to obtain the threshold value through various local characteristics such as the average value E of the pixels in the windows, the square difference P between the pixels, the root mean square value Q between the pixels and the like.
Preferably, in S3, the camera scans a black-and-white two-dimensional code, the mobile phone converts the acquired image into a binary image by using a threshold theory of point operation, performs binarization processing on the image through a gray value calculation formula to obtain a binarized image, performs expansion operation on the binarized image, performs edge detection on the expanded image to obtain an outline of a barcode region, performs or operation on each pixel of the scanned image by using a structural element of 3 × 3 and the binary image covered by the structural element, and if all the pixels are 0, the pixel of the resultant image is 0, otherwise, the pixel is 1.
Preferably, in S5, the photoelectric converter receives and generates an analog electrical signal, and the analog electrical signal is amplified, filtered and shaped to form a square-wave signal, and a median filtering technique is adopted.
Preferably, in S6, determining whether the code is dark color "1" or light color "0" according to a threshold value, so as to obtain an original binary sequence value of the two-dimensional code, performing error correction and decoding on the data, and finally converting the original data into text data according to a logic encoding rule of the barcode; finding a given term multiplied by a generator polynomial such that the result of the multiplication has the same first term as the message polynomial, xoring the result using the message polynomial in the first multiplication step or the remainder in all subsequent multiplication steps, performing these steps n times, where n is the coefficient in the message polynomial, and after division of the two polynomials there will be a remainder whose coefficient is an error correction codeword; and filling the obtained error correction code words into the grids of the two-dimensional code according to the standard to obtain data.
Compared with the prior art, the invention has the beneficial effects that:
1. the irregular graph is restored through a graph correction technology, the identification accuracy rate of the QR Code in the industrial scene is improved, the information quantity is large, the reliability is high, the use cost is low, and the method can be widely applied to the field of industrial control.
2. The PPYOLOv2 model realizes higher positioning precision, has high reliability, fuses SPP and improves the sample richness by using a data enhancement strategy.
The invention aims to solve the influence of poor environments such as insufficient lighting, dust raising, light reflection and the like on two-dimensional Code identification in an industrial environment, improve the performance of terminal deployment hardware, reduce the cost and solve the identification problem of QR codes in an industrial scene.
Drawings
Fig. 1 is a flowchart of an industrial scene QR Code detection and identification method based on a PPYOLOv2 model according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments.
Example one
Referring to fig. 1, a method for detecting and identifying an industrial scene QR Code based on a PPYOLOv2 model includes the following steps:
s1: three rectangles positioned at the upper left, the lower left and the upper right are position detection graphs, the position of a first coding character on the right side of the rectangle at the upper left corner is accurately found, the position of the two-dimensional code is detected, the image is input, the minimum quadrangle surrounding the two-dimensional code is returned, the function calling state is returned, the calling is successfully returned, and the two-dimensional code graph is obtained;
s2: correcting the two-dimension code graph, performing projection mapping on the irregular two-dimension code by utilizing computer perspective transformation, and obtaining a complete two-dimension code graph by twice transformation;
s3: the camera scans black-white two-dimensional codes, the mobile phone converts the collected image into a binary image by using a threshold value theory of point operation, the binary image is subjected to binarization processing by using a gray value calculation formula to obtain a binary image, then expansion operation is performed on the binary image, and the expanded image is subjected to edge detection to obtain the outline of a bar code area;
s4: carrying out grid sampling, and sampling image pixels on each intersection point of the grid;
s5: the photoelectric converter receives and generates an analog electric signal, and the analog electric signal is amplified, filtered and shaped to form a square wave signal;
s6: the decoder determines whether the color is dark color '1' or light color '0' according to the threshold value, so as to obtain the original binary sequence value of the two-dimensional code, corrects and decodes the data, and finally converts the original data into character data according to the logic coding rule of the bar code;
in this embodiment, the detection of the position of the two-dimensional code uses the YOLOv2 algorithm, and YOLOv2 predicts offsets of the bounding box relative to the prior box by using anchor boxes for reference of the RPN network, and a coordinate offset value (t, y) of the actual central position (x, y) of the bounding boxx,ty) The scale of the prior box (w)a,ha) And center coordinate (x)a,ya) To calculate:
x=(tx×wa)-xa
y=(ty×ha)-ya
however, the above formula is unconstrained, and the predicted bounding box is easily shifted in any direction, such as when txThe bounding box will shift right by one width size of the prior box when =1, and when txWhen the boundary box is shifted to the left by one width of the prior box when the value is = -1, therefore the boundary box predicted at each position can fall on any position of the picture, which causes instability of the model, a long time is needed to predict correct offsets during training, YOLOv2 follows the method of YOLOv1, the relative offset value of the center point of the boundary box relative to the position of the upper left corner of the corresponding cell is predicted, in order to constrain the center point of the boundary box in the current cell, the offset value is processed by using a sigmoid function, so that the predicted offset value is in the range of (0, 1), the scale of each cell is regarded as 1), and in summary, 4 offsets t predicted according to the boundary box are countedx,ty,tw,thThe actual position and size of the bounding box can be calculated according to the following formula:
bx=σ(tx)+cx
by=σ(ty)+cy
Figure RE-GDA0003874247150000111
Figure RE-GDA0003874247150000112
wherein (c)x,cy) For the coordinates of the top left corner of the cell, the scale of each cell is 1 during calculation, so that the coordinates of the top left corner of the current cell are (1, 1), and due to the processing of the sigmoid function, the central position of the bounding box can be restricted in the current cell to prevent excessive offset, and pwAnd phThe width and the length of the prior frame are the values of the prior frame and the values are relative to the size of the feature map, and the length and the width of each cell in the feature map are both 1; note here that the size of the feature map is (W, H), so we can calculate the position and size of the bounding box with respect to the whole picture (4 values are between 0 and 1):
bx=(σ(tx)+cx)/W
by=(σ(ty)+cy)/H
Figure RE-GDA0003874247150000121
Figure RE-GDA0003874247150000122
the final position and size of the bounding box can be obtained by multiplying the above 4 values by the width and length (pixel point values) of the picture, respectively.
In this embodiment, the original picture coordinates are used to obtain transformed picture coordinates x, y, where x = x '/w', and y = y '/w'; w for the source coordinate is constant at 1, and the general transformation formula is given below:
Figure RE-GDA0003874247150000123
transformation matrix
Figure RE-GDA0003874247150000124
Can be disassembled into 4 parts, and then the two parts are separated,
Figure RE-GDA0003874247150000125
representing a linear transformation, [ a ]31a32]For translation, [ a ]13 a23]TGenerating a perspective transformation; in the case where the mapped view plane is not parallel to the original plane, the image after perspective transformation is usually not a parallelogram;
in the code, we define several auxiliary variables in the perspective transformation, Δ x corresponds to dx1 in the code:
Δx1=x1-x2 Δx2=x3-x2 Δx3=x0-x1+x2-x3
Δy1=y1-y2 Δy2=y3-y2 Δy3=y0-y1+y2-y3
(1) when Δ x3,Δy3When the transform planes are all 0, the transform planes are parallel to the original transform planes, and can obtain:
a11=x1-x0
a21=x2-x1
a31=x0
a12=y1-y0
a22=y2-y1
a22=y2-y1
a32=y0
a13=0
a12=0
(2) when not 0, we obtain:
a11=x1-x0+a12x1
a21=x3-x0+a12x2
a31=x0
a12=y1-y0+a13y1
a22=y3-y0+a23y3
a32=y0
Figure RE-GDA0003874247150000141
Figure RE-GDA0003874247150000142
the solved transformation matrix can transform a square into a quadrangle, and the known target coordinates (x, y) are obtained by rewriting the transformation formula before, and the values of a11 to a33 are known, so that:
Figure RE-GDA0003874247150000143
Figure RE-GDA0003874247150000144
through two times of conversion; the transformation of a quadrangle to a square + the transformation of a square to a quadrangle makes it possible to transform any one quadrangle to another quadrangle.
In this embodiment, because objects of different colors have different wavelengths of reflected visible light, a white object can reflect visible light of various wavelengths, and a black object absorbs visible light of various wavelengths, when a camera scans a two-dimensional code between black and white, a mobile phone changes an acquired image into a binary image by using a threshold theory of point operation, that is, binarizes the image to obtain a binarized image, and then performs expansion operation on the binarized image, and performs edge detection on the expanded image to obtain an outline of a barcode region.
In this embodiment, the camera scans a black-and-white two-dimensional code, the mobile phone converts the acquired image into a binary image by using a threshold theory of point operation, performs binarization processing on the image through a gray value calculation formula, sets a global threshold T, and divides the data of the image into two parts by using T: pixel groups larger than T and pixel groups smaller than T; setting the pixel value of a pixel group larger than T as white, setting the pixel value of a pixel group smaller than T as black, dividing the whole image into N windows according to a certain rule, dividing the pixels in each window of the N windows into two parts according to a uniform threshold value T, carrying out local binarization processing, and setting a parameter equation to calculate the threshold value through various local characteristics such as the average value E of the pixels of the windows, the square difference P between the pixels, the root-mean-square value Q between the pixels and the like to obtain the threshold value.
In this embodiment, a camera scans a black-and-white two-dimensional code, a mobile phone converts an acquired image into a binary image by using a threshold theory of point operation, binarizes the image through a gray value calculation formula to obtain a binarized image, then performs expansion operation on the binarized image, performs edge detection on the expanded image to obtain an outline of a barcode region, performs or operation on each pixel of the scanned image by using a structural element of 3 × 3 and the binary image covered by the structural element, and if both the structural elements and the binary image are 0, the pixel of the resultant image is 0, otherwise, the pixel is 1.
In the embodiment, the deep color 1 or the light color 0 is determined according to the threshold value, so that the original binary sequence value of the two-dimensional code is obtained, the data is corrected and decoded, and finally the original data is converted into character data according to the logic coding rule of the bar code; finding a given term multiplied by a generator polynomial such that the result of the multiplication has the same first term as the message polynomial, xoring the result using the message polynomial in the first multiplication step or the remainder in all subsequent multiplication steps, performing these steps n times, where n is the coefficient in the message polynomial, and after division of the two polynomials there will be a remainder whose coefficient is an error correction codeword; and filling the obtained error correction code words into the grids of the two-dimensional code according to the standard to obtain data.
In this embodiment, the photoelectric converter receives and generates an analog electrical signal, and the analog electrical signal is amplified, filtered, and shaped to form a square wave signal, and a median filtering technique is used.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be considered as the technical solutions and the inventive concepts of the present invention within the technical scope of the present invention.

Claims (8)

1. A QR Code detection and identification method based on a PPYOLOv2 model in an industrial scene is characterized by comprising the following steps:
s1: three rectangles positioned at the upper left, the lower left and the upper right are position detection graphs, the position of a first coding character on the right side of the rectangle at the upper left corner is accurately found, the position of the two-dimensional code is detected, the image is input, the minimum quadrangle surrounding the two-dimensional code is returned, the function calling state is returned, the calling is successfully returned, and the two-dimensional code graph is obtained;
s2: correcting the two-dimension code graph, performing projection mapping on the irregular two-dimension code by utilizing computer perspective transformation, and obtaining a complete two-dimension code graph by two times of transformation;
s3: the camera scans black-white two-dimensional codes, the mobile phone converts the collected image into a binary image by using a threshold value theory of point operation, the binary image is subjected to binarization processing by using a gray value calculation formula to obtain a binary image, then expansion operation is performed on the binary image, and the expanded image is subjected to edge detection to obtain the outline of a bar code area;
s4: carrying out grid sampling, and sampling image pixels on each intersection point of the grid;
s5: the photoelectric converter receives and generates an analog electric signal, and the analog electric signal is amplified, filtered and shaped to form a square wave signal;
s6: the decoder determines whether the color is dark color '1' or light color '0' according to the threshold value, so as to obtain the original binary sequence value of the two-dimensional code, corrects and decodes the data, and finally converts the original data into character data according to the logic coding rule of the bar code.
2. The method for QR Code detection and identification of industrial scenes based on PPYOLOv2 model according to claim 1, wherein in S1, the detection of the position of the two-dimensional Code utilizes the YOLOv2 algorithm, the YOLOv2 predicts the offsets of the bounding box relative to the prior box by using anchor boxes for reference of RPN network, and the coordinate offset value (t) of the actual central position (x, y) of the bounding boxx,ty) Scale of the prior box (w)a,ha) And center coordinate (x)a,ya) To calculate:
x=(tx×wa)-xa
y=(ty×ha)-ya
YOLOv2 adopts the method of YOLOv1, predicts the relative offset value of the center point of the bounding box relative to the position of the upper left corner of the corresponding cell, and predicts 4 offset samples according to the bounding boxx,ty,tw,thAnd calculating the actual position and size of the bounding box according to the following formula:
bx=σ(tx)+cx
by=σ(ty)+cy
Figure FDA0003758381210000021
Figure FDA0003758381210000022
wherein (c)x,cy) For the coordinates of the top left corner of the cell, the scale of each cell is 1 during calculation, so that the coordinates of the top left corner of the current cell are (1, 1), due to the processing of the sigmoid function, the center position of the bounding box is constrained in the current cell, and p iswAnd phThe width and length of the prior frame are recorded, the size of the feature map is recorded as (W, H), and the boundary frame is relative to the whole frameThe position and size of the picture are calculated:
bx=(σ(tx)+cx)/W
by=(σ(ty)+cy)/H
Figure FDA0003758381210000031
Figure FDA0003758381210000032
multiplying the above 4 values by the width and length of the picture, respectively, yields the final position and size of the bounding box.
3. The method for detecting and identifying the QR Code of the industrial scene based on the PPYOLOv2 model according to claim 1, wherein in S2, the original picture coordinates are mapped to transformed picture coordinates x, y, where x = x '/w', y = y '/w'; w of the source coordinate is constantly 1, and the general transformation formula is as follows:
Figure FDA0003758381210000033
transformation matrix
Figure FDA0003758381210000034
Can be disassembled into 4 parts, and the two parts are combined,
Figure FDA0003758381210000035
representing a linear transformation, [ a ]31 a32]For translation, [ a ]13 a23]TGenerating a perspective transformation; in the case where the mapped view plane is not parallel to the original plane, the image after perspective transformation is usually not a parallelogram; in code, we define several auxiliary variables in the perspective transformation, Δ x corresponds to dx1 in code:
Δx1=x1-x2 Δx2=x3-x2 Δx3=x0-x1+x2-x3
Δy1=y1-y2 Δy2=y3-y2 Δy3=y0-y1+y2-y3
when Δ x3,Δy3When the transform planes are all 0, the transform planes are parallel to the original transform planes, and can obtain:
a11=x1-x0
a21=x2-x1
a31=x0
a12=y1-y0
a22=y2-y1
a32=y0
a13=0
a12=0
when not 0, we get:
a11=x1-x0+a12x1
a21=x3-x0+a12x2
a31=x0
a12=y1-y0+a13y1
a22=y3-y0+a23y3
a32=y0
Figure FDA0003758381210000041
Figure FDA0003758381210000042
the solved transformation matrix can transform a square into a quadrangle, and the known target coordinates (x, y) are obtained by rewriting the transformation formula before, and the values of a11 to a33 are known, so that:
Figure FDA0003758381210000051
Figure FDA0003758381210000052
through two transformations; the transformation of a quadrangle to a square + the transformation of a square to a quadrangle makes it possible to transform any one quadrangle to another quadrangle.
4. The method as claimed in claim 1, wherein in S3, objects of different colors reflect visible light of different wavelengths, white objects reflect visible light of various wavelengths, black objects absorb visible light of various wavelengths, and when a camera scans a two-dimensional Code between black and white, a mobile phone converts an acquired image into a binary image by using a threshold theory of point operation, i.e., binarizes the image to obtain a binarized image, and then performs dilation operation on the binarized image, and performs edge detection on the dilated image to obtain an outline of a barcode region.
5. The method as claimed in claim 4, wherein in S3, the camera scans two-dimensional codes between black and white, the mobile phone uses a threshold theory of point operation to change the collected image into a binary image, the image is binarized by a gray value calculation formula, a global threshold T is set, and the data of the image is divided into two parts by T: pixel groups larger than T and pixel groups smaller than T; setting the pixel value of the pixel group larger than T as white, setting the pixel value of the pixel group smaller than T as black, dividing the whole image into N windows according to a certain rule, dividing the pixels in the windows into two parts according to a uniform threshold value T for each window of the N windows, carrying out local binarization processing, and setting a parameter equation to carry out threshold value calculation to obtain the threshold value through various local characteristics such as the average value E of the pixels in the windows, the square difference P between the pixels, the root mean square value Q between the pixels and the like.
6. The method as claimed in claim 5, wherein in S3, the camera scans a two-dimensional Code between black and white, the mobile phone converts the collected image into a binary image by using a threshold theory of point operation, binarizes the image through a gray value calculation formula to obtain a binarized image, performs dilation operation on the binarized image, performs edge detection on the dilated image to obtain an outline of a barcode region, performs or operation on each pixel of the scanned image by using a binary image covered by a structural element and the structural element by using a 3x3 structural element, and if the pixel of the scanned image is 0, the pixel of the resultant image is 0, otherwise the pixel is 1.
7. The QR Code detection and identification method based on the PPYOLOv2 model for industrial scenes as claimed in claim 6, wherein in S6, the dark color "1" or the light color "0" is determined according to the threshold value, so as to obtain the original binary sequence value of the two-dimensional Code, the data is corrected and decoded, and finally the original data is converted into the text data according to the logical coding rule of the bar Code; finding a given term multiplied by a generator polynomial such that the result of the multiplication has the same first term as the message polynomial, xoring the result using the message polynomial in the first multiplication step or the remainder in all subsequent multiplication steps, performing these steps n times, where n is the coefficient in the message polynomial, and after division of the two polynomials there will be a remainder whose coefficient is an error correction codeword; and filling the obtained error correction code words into the grids of the two-dimensional code according to the standard to obtain data.
8. The QR Code detection and identification method based on PPYOLOv2 model for industrial scenes as claimed in claim 1, wherein in S5, the photoelectric converter receives and generates analog electrical signals, the analog electrical signals are amplified, filtered and shaped to form square wave signals, and a median filtering technique is adopted.
CN202210883094.6A 2022-07-21 2022-07-21 Industrial scene QR Code detection and identification method based on PPYOLOv2 model Pending CN115270839A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210883094.6A CN115270839A (en) 2022-07-21 2022-07-21 Industrial scene QR Code detection and identification method based on PPYOLOv2 model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210883094.6A CN115270839A (en) 2022-07-21 2022-07-21 Industrial scene QR Code detection and identification method based on PPYOLOv2 model

Publications (1)

Publication Number Publication Date
CN115270839A true CN115270839A (en) 2022-11-01

Family

ID=83769188

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210883094.6A Pending CN115270839A (en) 2022-07-21 2022-07-21 Industrial scene QR Code detection and identification method based on PPYOLOv2 model

Country Status (1)

Country Link
CN (1) CN115270839A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116167394A (en) * 2023-02-21 2023-05-26 深圳牛图科技有限公司 Bar code recognition method and system
CN116882433A (en) * 2023-09-07 2023-10-13 无锡维凯科技有限公司 Machine vision-based code scanning identification method and system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116167394A (en) * 2023-02-21 2023-05-26 深圳牛图科技有限公司 Bar code recognition method and system
CN116882433A (en) * 2023-09-07 2023-10-13 无锡维凯科技有限公司 Machine vision-based code scanning identification method and system
CN116882433B (en) * 2023-09-07 2023-12-08 无锡维凯科技有限公司 Machine vision-based code scanning identification method and system

Similar Documents

Publication Publication Date Title
CN115270839A (en) Industrial scene QR Code detection and identification method based on PPYOLOv2 model
JP2832646B2 (en) Method and apparatus for determining a fine azimuth of a barcode symbol in a two-dimensional CDD image
US7764835B2 (en) Method and apparatus for recognizing code
US7780084B2 (en) 2-D barcode recognition
EP3309703A1 (en) Method and system for decoding qr code based on weighted average grey method
US20070272755A1 (en) Two-directional bar code symbol and its encoding & decoding method
CN105989317B (en) Two-dimensional code identification method and device
CN110647795B (en) Form identification method
CN110175997B (en) Display screen dead pixel detection method and device, computer equipment and storage medium
CN110569683B (en) Bar code detection method and bar code detection system
US9769454B2 (en) Method for generating a depth map, related system and computer program product
US8538191B2 (en) Image correction apparatus and method for eliminating lighting component
CN105844277B (en) Label identification method and device
US9396422B1 (en) Methods and systems for localizing aztec codes
CN113392669B (en) Image information detection method, detection device and storage medium
US20060210164A1 (en) Image processing device
CN111222355A (en) Method and system for positioning bar code on PCB
CN116976372A (en) Picture identification method, device, equipment and medium based on square reference code
CN111428534B (en) Decryption identification method based on dot matrix hidden writing information coding
CN113222895A (en) Electrode defect detection method and system based on artificial intelligence
CN110598697A (en) Container number positioning method based on thickness character positioning
Nguyen et al. Symmetrical-symbol pattern based structured light for accurate decoding
Sakharov et al. Research and Development of Information Technology for Determining Shoe Size by Image
Wu et al. A Distortion Rectification Method for Distorted QR Code Images Based on Self-Adapting Structural Element
CN109584287B (en) Spatial coding structured light decoding method based on deep learning target detection

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination