CN112307786B - Batch positioning and identifying method for multiple irregular two-dimensional codes - Google Patents

Batch positioning and identifying method for multiple irregular two-dimensional codes Download PDF

Info

Publication number
CN112307786B
CN112307786B CN202011089645.9A CN202011089645A CN112307786B CN 112307786 B CN112307786 B CN 112307786B CN 202011089645 A CN202011089645 A CN 202011089645A CN 112307786 B CN112307786 B CN 112307786B
Authority
CN
China
Prior art keywords
camera
dimensional code
dimensional
positioning
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011089645.9A
Other languages
Chinese (zh)
Other versions
CN112307786A (en
Inventor
田洪志
张贺
田芳如
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Cmb Electronic Technology Co ltd
Original Assignee
Shanghai Cmb Electronic 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 Shanghai Cmb Electronic Technology Co ltd filed Critical Shanghai Cmb Electronic Technology Co ltd
Priority to CN202011089645.9A priority Critical patent/CN112307786B/en
Publication of CN112307786A publication Critical patent/CN112307786A/en
Application granted granted Critical
Publication of CN112307786B publication Critical patent/CN112307786B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/10544Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum
    • G06K7/10821Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum further details of bar or optical code scanning devices
    • G06K7/1092Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum further details of bar or optical code scanning devices sensing by means of TV-scanning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2411Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1443Methods for optical code recognition including a method step for retrieval of the optical code locating of the code in an image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • 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/40Extraction of image or video features
    • G06V10/50Extraction of image or video features by performing operations within image blocks; by using histograms, e.g. histogram of oriented gradients [HoG]; by summing image-intensity values; Projection analysis
    • G06V10/507Summing image-intensity values; Histogram projection analysis

Abstract

The invention relates to a batch positioning and identifying method for a plurality of irregular two-dimensional codes, which comprises the following steps: s1, calibrating a camera for shooting a plurality of two-dimensional code images to obtain an internal reference matrix and a lens distortion parameter of the camera for correcting the distortion of the picture images; s2, shooting a plurality of sample photos including a plurality of two-dimensional codes by using a camera calibrated by the camera, and using the sample photos subjected to distortion correction for computer machine learning to obtain a two-dimensional code positioning detection model; s3, shooting a video image comprising a plurality of two-dimensional codes by using a camera calibrated by the camera, and positioning the plurality of two-dimensional code images on the video image frame subjected to distortion correction by using a two-dimensional code positioning detection model; s4, carrying out two-dimensional code image decoding and identification on the positioned two-dimensional code images to obtain a plurality of two-dimensional code strings. The method has the advantages of automatically identifying the position of the two-dimensional code and the code word string and having high identification efficiency.

Description

Batch positioning and identifying method for multiple irregular two-dimensional codes
[ technical field ] A method for producing a semiconductor device
The invention relates to the field of two-dimensional code image identification, in particular to a batch positioning identification method for a plurality of irregular two-dimensional codes.
[ background of the invention ]
QR codes are a type of two-dimensional bar code, and QR comes from the acronym of "Quick Response," meaning that Quick Response, results from the inventor's desire that QR codes allow their contents to be decoded quickly. The QR code can store more data than the common bar code, and does not need to be aligned with a scanner in a straight line during scanning like the common bar code. The QR code is square and only has black and white. In 3 of the 4 corners, a smaller square pattern like a "hui" is printed. The square pattern of these 3 "Hui" words is a pattern that helps the decoding software to locate, and the user does not need to align, and the data can still be correctly read regardless of the angle of scanning. The QR code is composed of two parts: a. a QR code located in the interior region; b. and the auxiliary positioning frame is positioned at the outer part. There are two sizes of QR codes: two dimensions are defined according to the distance of the Camera mounting position from the target QR code: the side length of the outer frame is 24mm (smaller QR code) and the side length of the outer frame is 28mm (larger QR code). The QR code word defines a sample: XB050N3941042513, XB082N 3157920410. The specific codeword may be self-defining.
In image measurement processes and machine vision applications, in order to determine the correlation between the three-dimensional geometric position of a certain point on the surface of an object in space and the corresponding point in the image, a geometric model of camera imaging must be established, and the parameters of the geometric model are the parameters of the camera. Under most conditions, the parameters must be obtained through experiments and calculation, and the process of solving the parameters is called camera calibration (or video camera calibration). The camera calibration method comprises the following steps: the method comprises a traditional camera calibration method, an active vision camera calibration method, a camera self-calibration method and a zero-distortion camera calibration method. Calibration template (Calibration Target): in the applications of machine vision, image measurement, photogrammetry, three-dimensional reconstruction and the like, the lens distortion is corrected; determining a conversion relation between the physical size and the pixel; and determining the mutual relation between the three-dimensional geometric position of a certain point on the surface of the space object and the corresponding point in the image, wherein a geometric model imaged by a camera needs to be established. The camera shoots the array flat plate with the fixed-spacing pattern, and a geometric model of the camera can be obtained through calculation of a calibration algorithm, so that high-precision measurement and reconstruction results are obtained. And the plate with the fixed pitch pattern array is a Calibration template (Calibration Target). Calibrating the type of the template: firstly, forming an equidistant solid circular array pattern Ti-timesCG-100-D; ② a chessboard pattern Ti-times CG-076-T; and phase shift grating (3 longitudinal, 3 transverse, 120 degree phase shift). The Camera Calibration tool GML Camera Calibration, "Camera 2.0" development kit SDK, C + + API function library, C + + source program, and the like.
Rtsp (real Time Streaming protocol), RFC2326, real-Time Streaming protocol, is an application layer protocol in the TCP/IP protocol system that defines how one-to-many applications can efficiently transmit multimedia data over an IP network. Undistort transform: and (4) transformation without distortion. The Dlib is written by C + +, and provides a series of functions related to the fields of machine learning, numerical calculation, graph model algorithm, image processing and the like. imglab is a tool for labeling rectangles on images. HOG characteristics: histogram of Oriented Gradient (HOG) feature is a feature descriptor used for object detection in computer vision and image processing; it forms the characteristic by calculating and counting the histogram of gradient direction in the local area of the image; the Hog feature combined with the SVM classifier has been widely applied to image recognition. A Support Vector Machine (SVM) is a generalized linear classifier (generalized linear classifier) that binary classifies data according to a supervised learning (supervised learning) mode, and a decision boundary of the SVM is a maximum-margin hyperplane (maximum-margin hyperplane) that solves learning samples. Histogram stretching is to expand the image to fill the entire gray scale when the gray scale distribution of the image is not uniform and is concentrated only in certain areas. The homography transformation can be simply understood as the transformation matrix used for describing the position mapping relation of an object between a world coordinate system and a pixel coordinate system, the corresponding transformation matrix is called as a homography matrix, and the homography plays an important role in the fields of image correction, image stitching, camera pose estimation, vision SLAM and the like. Zxing is an open source code, 1D/2D bar code image processing library with various formats realized by Java, comprises ports connected with other languages, and can realize that a built-in camera of a mobile phone is used for scanning and decoding bar codes. OpenCV is a cross-platform computer vision and machine learning software library issued based on BSD licensing (open source), which can run on Linux, Windows, Android, and Mac OS operating systems; the method is light in weight and efficient, is composed of a series of C functions and a small number of C + + classes, provides interfaces of languages such as Python, Ruby, MATLAB and the like, and realizes a plurality of general algorithms in the aspects of image processing and computer vision. Roi (region of interest), region of interest; in machine vision and image processing, a region needing to be processed is outlined from a processed image in a mode of a square frame, a circle, an ellipse, an irregular polygon and the like, and the region is called as a region of interest (ROI); various operators (operators) and functions are commonly used on machine vision software such as Halcon, OpenCV, Matlab and the like to obtain the ROI, and the ROI is subjected to the next processing of the image. The OpencvRect template class is an important class, and can be used for setting an image ROI (region of interest), intercepting an image and the like; the member variables of the Rect class are x, y, width and height, which are respectively a coordinate at the upper left corner and the width and the height of a rectangle.
The invention improves the batch positioning and identifying method of a plurality of two-dimensional codes by utilizing the prior image identifying technology.
[ summary of the invention ]
The invention aims to provide a method for positioning and identifying a plurality of irregular two-dimensional codes, which can automatically identify the positions of the two-dimensional codes and code strings and has high identification efficiency.
In order to achieve the purpose, the invention adopts the technical scheme that the method for batch positioning and identifying the plurality of irregular two-dimensional codes comprises the following steps:
s1, calibrating the camera for shooting a plurality of two-dimensional code images to obtain the inner part of the camera
The parameter matrix and the lens distortion parameter are used for correcting the distortion of the photo image;
s2, shooting a plurality of sample photos including a plurality of two-dimensional codes by using a camera calibrated by the camera, and using the sample photos subjected to distortion correction for computer machine learning to obtain a two-dimensional code positioning detection model;
s3, shooting a video image comprising a plurality of two-dimensional codes by using a camera calibrated by the camera, and positioning the plurality of two-dimensional code images on the video image frame subjected to distortion correction by using a two-dimensional code positioning detection model;
and S4, performing two-dimensional code image decoding and identification on the positioned two-dimensional code images to obtain a plurality of two-dimensional code strings.
Preferably, in the method for batch location and identification of multiple irregular two-dimensional codes, the step S1 includes the following steps:
s11, the camera uses a chessboard calibration plate to collect a plurality of calibration specimen photos;
s12, storing the collected photos of the calibration sample in a folder;
s13, calibrating the camera by using the calibration script;
and S14, generating a camera internal reference matrix and a lens distortion parameter for the distortion correction of the photo image acquired by the camera.
Preferably, the camera adopts an ultra-wide-angle, fisheye lens; the size of the chessboard calibration plate is larger than 60cm x40cm, and each grid is a square with the side length of 3 cm.
Preferably, in the above method for batch positioning and identifying a plurality of irregular two-dimensional codes, the step S2 includes the following steps:
s21, shooting a plurality of sample photos comprising a plurality of two-dimensional codes by using a camera calibrated by the camera;
s22, marking the sample picture subjected to distortion correction by using a sample marking tool;
and S23, applying the marked sample photo to a computer machine learning training two-dimensional code positioning detection model.
Preferably, in step S22, the sample photograph is down-sampled by 1/4, and the length and width are reduced by 0.5 times and then labeled.
Preferably, in step S23, the Hog feature + SVM classifier is used to train the two-dimensional code location detection model.
Preferably, in the above method for batch positioning and identifying a plurality of irregular two-dimensional codes, the step S3 includes the following steps:
s31, shooting a video image comprising a plurality of two-dimensional codes by using a camera calibrated by the camera;
s32, graying the video image frame;
s33, distortion correction is carried out on the video image frame according to the requirement;
s34, down-sampling the video image frame after distortion correction to 1/4;
and S35, carrying out two-dimensional code positioning detection on the video image frame by using the two-dimensional code positioning detection model to obtain a plurality of two-dimensional code position lists.
Preferably, in the method for batch location and identification of multiple irregular two-dimensional codes, the step S4 includes the following steps:
s41, obtaining all two-dimension code position rectangles according to the two-dimension code position list;
s42, selecting a two-dimensional code position rectangle, and obtaining image subblocks according to the selected two-dimensional code position rectangle;
s43, calling a two-dimensional code decoder to perform first two-dimensional code recognition on the image subblocks, if the first two-dimensional code recognition is performed on the image subblocks
The step S42 is executed after the two-dimension code identification is successful;
s44, if the first two-dimension code identification is unsuccessful, detecting a two-dimension code positioning outer frame in the image sub-block, and if the two-dimension code positioning outer frame is not detected, skipping to execute S42;
s45, if the two-dimension code positioning outer frame is detected, homography transformation is carried out on the image subblocks according to the two-dimension code positioning outer frame, a two-dimension code decoder is called to carry out secondary two-dimension code identification, and the step S42 is executed if the secondary two-dimension code identification is successful/unsuccessful.
Preferably, in the above method for batch location and identification of a plurality of irregular two-dimensional codes, the two-dimensional code decoder performs the following steps:
s51, traversing each scaling factor, and circularly executing the steps S52 and S53 until the two-dimensional code is identified
A code string is formed;
s52, performing histogram stretching on the image sub-blocks;
and S53, performing two-dimensional code identification to obtain a two-dimensional code word string.
Preferably, in the method for batch location and identification of multiple irregular two-dimensional codes, the scale factor sequence is {1.0, 1.2, 1.5, 2.0 }.
The invention has the following beneficial effects: 1. in a cabinet of an IDC machine room, two-dimensional code labels for asset management are pasted on the front faces of a plurality of devices at different or same positions, the efficiency is very low when the traditional handheld device is used for manual identification, the efficiency is greatly improved if the video identification technology is used for batch identification, and automatic identification can be realized; and 2, the identification accuracy (identification number/detected number) of the QR codes reaches over 96 percent (almost unidentified QR codes have large edge deformation).
[ description of the drawings ]
Fig. 1 is a flowchart of a batch positioning and identifying method for a plurality of irregular two-dimensional codes.
Fig. 2 is a camera calibration flow chart of a batch positioning and identification method for a plurality of irregular two-dimensional codes.
FIG. 3 is a flow chart of a training process of a detection model of a batch positioning and recognition method of a plurality of irregular two-dimensional codes.
Fig. 4 is a two-dimension code positioning flow chart of a batch positioning and identifying method for a plurality of irregular two-dimension codes.
Fig. 5 is a flow chart of two-dimension code identification by a batch positioning identification method for a plurality of irregular two-dimension codes.
Fig. 6 is a flowchart of a two-dimensional code decoder for a batch positioning and identification method of a plurality of irregular two-dimensional codes.
[ detailed description ] embodiments
The invention is further described with reference to the following examples and with reference to the accompanying drawings.
Example 1
The embodiment realizes a batch positioning and identifying method for a plurality of irregular two-dimensional codes.
Fig. 1 is a flow chart of a batch positioning and identifying method for a plurality of irregular two-dimensional codes. As shown in fig. 1, a method for batch positioning and identifying a plurality of irregular two-dimensional codes includes the following steps:
s1, calibrating the camera for shooting a plurality of two-dimensional code images to obtain the inner part of the camera
The parameter matrix and the lens distortion parameter are used for correcting the distortion of the photo image;
s2, shooting a plurality of sample photos including a plurality of two-dimensional codes by using a camera calibrated by the camera, and using the sample photos subjected to distortion correction for computer machine learning to obtain a two-dimensional code positioning detection model;
s3, shooting a video image comprising a plurality of two-dimensional codes by using a camera calibrated by the camera, and positioning the plurality of two-dimensional code images on the video image frame subjected to distortion correction by using a two-dimensional code positioning detection model;
s4, carrying out two-dimensional code image decoding and identification on the positioned two-dimensional code images to obtain a plurality of two-dimensional code strings.
Fig. 2 is a camera calibration flow chart of a batch positioning and identification method for a plurality of irregular two-dimensional codes. As shown in fig. 2, preferably, in the above method for batch location and identification of a plurality of irregular two-dimensional codes, the step S1 includes the following steps:
s11, the camera collects a plurality of calibration sample photos by using a chessboard calibration plate;
s12, storing the collected calibration sample photos in a folder;
s13, calibrating the camera by using the calibration script;
and S14, generating a camera internal reference matrix and a lens distortion parameter for correcting the distortion of the photo image acquired by the camera.
Preferably, the camera adopts an ultra-wide-angle, fisheye lens; the size of the checkerboard calibration plate is larger than 60cm x40cm, and each grid is a square with the side length of 3 cm.
FIG. 3 shows a training flow chart of a detection model of a batch positioning and recognition method of a plurality of irregular two-dimensional codes. As shown in fig. 3, preferably, in the above method for batch location and identification of a plurality of irregular two-dimensional codes, the step S2 includes the following steps:
s21, shooting a plurality of sample photos comprising a plurality of two-dimensional codes by using a camera calibrated by the camera;
s22, marking the sample picture subjected to distortion correction by using a sample marking tool;
and S23, using the marked sample photo for computer machine learning training of the two-dimensional code positioning detection model.
Preferably, in step S22, the specimen photograph is down-sampled by 1/4 times, and then the length and width are reduced by 0.5 times and marked.
Preferably, in step S23, the Hog feature + SVM classifier is used to train the two-dimensional code location detection model.
Fig. 4 is a two-dimension code positioning flow chart of a batch positioning and identifying method for a plurality of irregular two-dimension codes. As shown in fig. 4, preferably, in the above method for batch location and identification of a plurality of irregular two-dimensional codes, the step S3 includes the following steps:
s31, shooting a video image comprising a plurality of two-dimensional codes by using a camera calibrated by the camera;
s32, graying the video image frame;
s33, distortion correction is carried out on the video image frame according to the requirement;
s34, down-sampling the video image frame after distortion correction to 1/4;
and S35, carrying out two-dimensional code positioning detection on the video image frame by using the two-dimensional code positioning detection model to obtain a plurality of two-dimensional code position lists.
Fig. 5 is a flow chart of two-dimension code identification by a batch positioning identification method for a plurality of irregular two-dimension codes. As shown in fig. 5, preferably, in the above method for batch location and identification of a plurality of irregular two-dimensional codes, the step S4 includes the following steps:
s41, obtaining all two-dimension code position rectangles according to the two-dimension code position list;
s42, selecting a two-dimensional code position rectangle, and obtaining an image sub-block according to the selected two-dimensional code position rectangle;
s43, calling a two-dimensional code decoder to perform first two-dimensional code recognition on the image subblocks, if the first two-dimensional code recognition is performed on the image subblocks
The step S42 is executed after the two-dimension code identification is successful;
s44, if the first two-dimension code identification is unsuccessful, detecting a two-dimension code positioning outer frame in the image sub-block, and if the two-dimension code positioning outer frame is not detected, skipping to execute S42;
s45, if the two-dimension code positioning outer frame is detected, homography transformation is carried out on the image subblocks according to the two-dimension code positioning outer frame, a two-dimension code decoder is called to carry out secondary two-dimension code identification, and the step S42 is executed if the secondary two-dimension code identification is successful/unsuccessful.
Fig. 6 is a flow chart of a two-dimensional code decoder for a batch location identification method of a plurality of irregular two-dimensional codes. As shown in fig. 6, preferably, in the method for batch location and identification of a plurality of irregular two-dimensional codes, the two-dimensional code decoder performs the following steps:
s51, traversing each scaling factor, and circularly executing the steps S52 and S53 until the two-dimensional code encoding is identified
A code string is formed;
s52, performing histogram stretching on the image sub-blocks;
and S53, performing two-dimensional code identification to obtain a two-dimensional code word string.
Preferably, in the method for batch location and identification of multiple irregular two-dimensional codes, the scale factor sequence is {1.0, 1.2, 1.5, 2.0 }.
Example 2
The embodiment realizes a batch positioning and identifying method for a plurality of irregular two-dimensional codes. The embodiment is implemented based on embodiment 1.
The embodiment relates to positioning and identification of a plurality of QR two-dimensional codes (QR codes for short in the following) under an ultra-wide-angle Camera (based on visible light): inputting a frame of image (about 1080P size) captured by Camera, and requesting to locate the identification module through the QR code to obtain the position of the QR code and the code string contained therein.
Manufacturing of one-dimensional and QR (quick response) codes
Appearance and size of QR code
(1) The QR code is composed of two parts: a. a QR code located in the interior region; b. and the auxiliary positioning frame is positioned on the outer part.
(2) Two sizes: two dimensions are defined according to the distance of the Camera mounting position from the target QR code: outer frame side length 24mm (smaller QR code), outer frame side length 28mm (larger QR code)
QR code type selection (related to Version, error correction level, encodable word length): version1 was used; the character string to be encoded contains only letters and numbers (alphanumerics), and the letters are all capital letters. Error correction level: in case of 15% error correction, the letter length is 23 when the letter is not case-specific (20 when case-specific); in the case of 25% error correction, the letter length is 18 when the letter is case insensitive (16 when case insensitive).
Definition of QR code words
(1) The QR code word defines a sample: XB050N3941042513, XB082N 3157920410. The specific code word may be self-defined.
Two, Camera calibration
Necessity of Camera calibration
(1) Camera calibration can provide support for accurate positioning of a QR code, a U bit or other markers in physical space;
(2) after the Camera is calibrated, the lens distortion correction can be carried out on the picture, and the detection rate and the recognition rate of the QR code can be improved.
Camera calibration procedure
(1) Calibrating a plate: the chessboard calibration plate is adopted, and the size of the calibration plate is preferably more than 60cmx40cm because the calibration plate is used for calibrating super-wide-angle and fisheye lenses; the side length of each grid (square) is about 3 cm;
(2) camera: one or more cameras (a plurality of cameras are distinguished by IP addresses) are fixed, and the cameras start RTSP service and send the captured images to the PC host.
(3) A calibration process:
firstly, collecting a calibration sample: the checkerboard calibration plate is arranged in front of the Camera to form various poses (positions and postures), so that the checkerboard appears at each position in the Camera vision as much as possible, and the poses of the checkerboard are diversified. The number of the sample sheets is about 10;
secondly, storing the collected calibration samples in one folder, and if a plurality of cameras are arranged, storing the calibration samples in a plurality of folders;
calibrating one or more cameras by using the calibration script;
and fourthly, storing the generated internal reference matrix of the single or a plurality of cameras and the lens distortion parameters.
Camera distortion correction
(1) Loading an internal reference matrix and a lens distortion parameter corresponding to the Camera;
(2) initializing distortion correction map of Camrea;
(3) undistort conversion is carried out on the image frame sequence newly acquired by Camera, and the picture is cut to obtain the image frame picture after distortion correction.
Three, QR code detection and positioning
1.QR code positioning based on machine learning
(1) And (5) collecting learning samples. Pasting the manufactured QR code on the surface of equipment, wherein the pose of the QR code should be enriched as much as possible, or the pose condition of the system after deployment in an actual application environment is included as much as possible; then shooting by Camera to obtain learning samples, and storing the learning samples in a specified file directory according to the ratio of 4: 1.
(2) And (5) learning the labeling of the sample sheets. In order to increase the speed, 1/4 downsampling (reducing the length and the width by 0.5 times respectively) is carried out on the sample; and then, carrying out annotation by using an imglab provided by the Dlib.
(3) And (5) training a model. And training a detection model by the Dlib by using the Hog characteristic + SVM classifier. After the training is finished, the training result can be seen:
Test detector(precision,recall,AP):0.962963 0.899209 0.894933
Parameters used:
Threads:20
C:3
Eps:0.01
target-size:2100
detection window width:46
detection window height:46
upsample this many times:1
trained using left/right flips。
svm model is obtained after training.
2. Positioning process: the input image frame is processed as follows:
(1) graying the image frame;
(2) distortion correction is carried out according to the requirement;
(3) down-sampling the image to 1/4;
(4) and (5) loading a detection model by using the Dlib to detect the QR code to obtain a position list of the QR code.
Four, QR code identification
QR code identification: in this embodiment, ZXing and OpenCV are comprehensively adopted to identify all located QR code image subblocks, and a qrDecode method is defined as follows:
(1) defining a scaling factor sequence {1.0, 1.2, 1.5, 2.0}, traversing each factor, and executing the following steps until the QR code is identified;
(2) performing histogram stretching on the image subblocks roi;
(3) and calling a QR code recognition function.
2. And (3) overall identification flow, wherein each rect is processed as follows:
(1) obtaining an image subblock roi according to the rect, calling qrDecode to try first identification, and jumping to the next rect to continue identification if the identification is successful; otherwise, the following process is continued.
(2) Detecting a positioning outer frame in the roi, if the positioning outer frame cannot be detected, the QR code corresponding to the rect cannot be identified, and jumping to the next rect for continuous identification; otherwise the following process continues.
(3) Performing homography transformation on the roi according to the positioning outer frame, and calling qrdeoce for secondary identification; whether or not, jumping to the next rect continues the identification.
3. In this embodiment, the QR code recognition accuracy (number of recognized QR codes/number of detected QR codes) is up to 96% or more (almost unrecognized QR codes have large edge deformation).
In this embodiment, the distance of Camera is 25cm, and in the case of recognition that distortion correction has been performed, it can be seen that the QR code located in the central region of Camera can be basically detected and recognized.
Fifthly, the embodiment is applied to asset management of IDC machine room
In the rack of IDC computer lab, a lot of equipment openly can paste the two-dimensional code label that is used for asset management in different or the same position, and traditional manual discernment is carried out through handheld device, and efficiency can be very low, if discernment in batches is carried out through this embodiment video identification technology, and efficiency can improve a lot, can accomplish automatic identification moreover.
It will be understood by those skilled in the art that all or part of the steps of implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing associated hardware, and the program may be stored in a computer-readable storage medium, where the storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and additions can be made without departing from the principle of the present invention, and these should also be considered as the protection scope of the present invention.

Claims (10)

1. A method for batch positioning and identifying a plurality of irregular two-dimensional codes is characterized by comprising the following steps:
s1, calibrating a camera for shooting a plurality of two-dimensional code images to obtain an internal reference matrix and a lens distortion parameter of the camera for correcting the distortion of the picture images;
s2, shooting a plurality of sample photos including a plurality of two-dimensional codes by using a camera calibrated by the camera, and using the sample photos subjected to distortion correction for computer machine learning to obtain a two-dimensional code positioning detection model;
s3, shooting a video image comprising a plurality of two-dimensional codes by using a camera calibrated by a camera, and positioning the plurality of two-dimensional code images of the video image frame subjected to distortion correction by using a two-dimensional code positioning detection model;
s4, carrying out two-dimensional code image decoding and identification on the positioned two-dimensional code images to obtain a plurality of two-dimensional code strings.
2. The method for batch location and identification of a plurality of irregular two-dimensional codes according to claim 1, wherein the step S1 comprises the steps of:
s11, the camera collects a plurality of calibration sample photos by using a chessboard calibration plate;
s12, storing the collected calibration sample photos in a folder;
s13, calibrating the camera by using the calibration script;
and S14, generating a camera internal reference matrix and a lens distortion parameter for correcting the distortion of the photo image acquired by the camera.
3. The method for batch positioning and identifying of the irregular two-dimensional codes according to claim 2, wherein the method comprises the following steps: the camera adopts an ultra-wide-angle and fish-eye lens; the size of the chessboard calibration plate is larger than 60cm x40cm, and each grid is a square with the side length of 3 cm.
4. The method for batch location and identification of a plurality of irregular two-dimensional codes according to claim 1, wherein the step S2 comprises the steps of:
s21, shooting a plurality of sample photos comprising a plurality of two-dimensional codes by using a camera calibrated by the camera;
s22, marking the sample picture subjected to distortion correction by using a sample marking tool;
and S23, using the marked sample photo for computer machine learning training of the two-dimensional code positioning detection model.
5. The method for batch positioning and identifying of the irregular two-dimensional codes according to claim 4, wherein the method comprises the following steps: in step S22, the specimen photograph is down-sampled 1/4, and the length and width are reduced by 0.5 times and then labeled.
6. The method for batch positioning and identifying of the irregular two-dimensional codes according to claim 4, wherein the method comprises the following steps: and S23, training a two-dimensional code positioning detection model by using the Hog characteristics and the SVM classifier.
7. The method for batch location and identification of a plurality of irregular two-dimensional codes according to claim 1, wherein the step S3 comprises the steps of:
s31, shooting a video image comprising a plurality of two-dimensional codes by using a camera calibrated by the camera;
s32, graying the video image frame;
s33, distortion correction is carried out on the video image frame according to the requirement;
s34, down-sampling the video image frame after distortion correction to 1/4;
and S35, carrying out two-dimensional code positioning detection on the video image frame by using the two-dimensional code positioning detection model to obtain a plurality of two-dimensional code position lists.
8. The method for batch location and identification of a plurality of irregular two-dimensional codes according to claim 1, wherein the step S4 comprises the steps of:
s41, obtaining all two-dimension code position rectangles according to the two-dimension code position list;
s42, selecting a two-dimensional code position rectangle, and obtaining an image sub-block according to the selected two-dimensional code position rectangle;
s43, calling a two-dimensional code decoder to perform first two-dimensional code recognition on the image subblock, and executing the step S42 if the first two-dimensional code recognition is successful;
s44, if the first two-dimension code identification is unsuccessful, detecting the two-dimension code positioning outline frame in the image sub-block,
if the two-dimensional code positioning outer frame jump is not detected, S42 is executed;
s45, if the two-dimension code positioning outer frame is detected, homography transformation is carried out on the image subblocks according to the two-dimension code positioning outer frame, a two-dimension code decoder is called to carry out secondary two-dimension code identification, and the step S42 is executed if the secondary two-dimension code identification is successful/unsuccessful.
9. The method as claimed in claim 8, wherein the two-dimensional code decoder performs the following steps:
s51, traversing each scaling factor, and circularly executing the steps S52 and S53 until the two-dimensional code string is identified;
s52, performing histogram stretching on the image sub-blocks;
and S53, performing two-dimensional code recognition to obtain a two-dimensional code string.
10. The method for batch positioning and identifying of the irregular two-dimensional codes according to claim 9, wherein the method comprises the following steps: the scale factor sequence is {1.0, 1.2, 1.5, 2.0 }.
CN202011089645.9A 2020-10-13 2020-10-13 Batch positioning and identifying method for multiple irregular two-dimensional codes Active CN112307786B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011089645.9A CN112307786B (en) 2020-10-13 2020-10-13 Batch positioning and identifying method for multiple irregular two-dimensional codes

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011089645.9A CN112307786B (en) 2020-10-13 2020-10-13 Batch positioning and identifying method for multiple irregular two-dimensional codes

Publications (2)

Publication Number Publication Date
CN112307786A CN112307786A (en) 2021-02-02
CN112307786B true CN112307786B (en) 2022-07-08

Family

ID=74489873

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011089645.9A Active CN112307786B (en) 2020-10-13 2020-10-13 Batch positioning and identifying method for multiple irregular two-dimensional codes

Country Status (1)

Country Link
CN (1) CN112307786B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115600953A (en) * 2021-07-07 2023-01-13 未来机器人(深圳)有限公司(Cn) Monitoring method and device for warehouse positions, computer equipment and storage medium
CN114663517A (en) * 2022-02-07 2022-06-24 哈尔滨工业大学 Simulated target pose acquisition method, target capture method and device based on MBDyn simulation, and aerospace on-orbit target capture method
CN115471769B (en) * 2022-08-16 2023-04-07 上海航翼高新技术发展研究院有限公司 Visual identification method for existing state of tool in tool cabinet

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN202632311U (en) * 2012-02-21 2012-12-26 华南农业大学 Two-dimension code reading device based on video stream
CN107463976A (en) * 2016-06-02 2017-12-12 国家计算机网络与信息安全管理中心 A kind of QR codes figure adjustment method
CN108121931B (en) * 2017-12-18 2021-06-25 阿里巴巴(中国)有限公司 Two-dimensional code data processing method and device and mobile terminal
CN110008771B (en) * 2019-03-15 2022-05-27 创新先进技术有限公司 Code scanning system and code scanning method
CN110175660A (en) * 2019-04-16 2019-08-27 广州云上区块链技术有限公司 Logistics based on block chain is traced to the source implementation method
CN110400278B (en) * 2019-07-30 2021-10-01 广东工业大学 Full-automatic correction method, device and equipment for image color and geometric distortion

Also Published As

Publication number Publication date
CN112307786A (en) 2021-02-02

Similar Documents

Publication Publication Date Title
CN112307786B (en) Batch positioning and identifying method for multiple irregular two-dimensional codes
CN110046529B (en) Two-dimensional code identification method, device and equipment
US20180032777A1 (en) Imaging terminal, imaging sensor to determine document orientation based on bar code orientation and methods for operating the same
CN110827247B (en) Label identification method and device
CN109344820B (en) Digital ammeter reading identification method based on computer vision and deep learning
Dubská et al. Real-time precise detection of regular grids and matrix codes
US7305131B2 (en) Extracting graphical bar codes from an input image
AU2017380263B2 (en) Method for detecting and recognising long-range high-density visual markers
Tribak et al. QR code recognition based on principal components analysis method
CN113903024A (en) Handwritten bill numerical value information identification method, system, medium and device
US20200302135A1 (en) Method and apparatus for localization of one-dimensional barcodes
CN110765795A (en) Two-dimensional code identification method and device and electronic equipment
CN113435557B (en) Two-dimensional code generation, decoding and identification method, device and equipment
CN114998347B (en) Semiconductor panel corner positioning method and device
CN111260574A (en) Seal photo correction method, terminal and computer readable storage medium
KR20210088436A (en) Image processing methods, devices and electronic devices
CN113312937A (en) Bar code identification method and device, storage medium and computer equipment
CN113850100A (en) Method and device for correcting two-dimensional code
CN112749664A (en) Gesture recognition method, device, equipment, system and storage medium
CN112883973A (en) License plate recognition method and device, electronic equipment and computer storage medium
CN117576617B (en) Decoding system based on automatic adjustment of different environments
Ahmed Signage recognition based wayfinding system for the visually impaired
CN112149442B (en) Distorted two-dimensional code recognition method and device, storage medium and electronic device
CN111178143B (en) Container temperature information acquisition method, device and system
CN112183650B (en) Digital detection and identification method under camera defocus condition

Legal Events

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