[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN115600619B - Dot matrix two-dimensional code identification method and device, electronic equipment and storage medium - Google Patents

Dot matrix two-dimensional code identification method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115600619B
CN115600619B CN202211593196.0A CN202211593196A CN115600619B CN 115600619 B CN115600619 B CN 115600619B CN 202211593196 A CN202211593196 A CN 202211593196A CN 115600619 B CN115600619 B CN 115600619B
Authority
CN
China
Prior art keywords
dimensional code
dot matrix
code image
layer
current
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
CN202211593196.0A
Other languages
Chinese (zh)
Other versions
CN115600619A (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.)
Shenzhen Smartmore Technology Co Ltd
Original Assignee
Shenzhen Smartmore 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 Shenzhen Smartmore Technology Co Ltd filed Critical Shenzhen Smartmore Technology Co Ltd
Priority to CN202211593196.0A priority Critical patent/CN115600619B/en
Publication of CN115600619A publication Critical patent/CN115600619A/en
Application granted granted Critical
Publication of CN115600619B publication Critical patent/CN115600619B/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/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
    • 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/1452Methods for optical code recognition including a method step for retrieval of the optical code detecting bar code edges
    • 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/146Methods for optical code recognition the method including quality enhancement steps

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The application relates to a dot matrix two-dimensional code identification method and device, electronic equipment and a storage medium. The method comprises the following steps: starting from the obtained original dot matrix two-dimensional code image, selecting local extreme values based on pixel values to perform layer-by-layer downsampling, and generating a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image; the local extremum pyramid is obtained by arranging the dot matrix two-dimensional code images of all layers obtained by down-sampling layer by layer from top to bottom according to the sequence of less to more pixel points; traversing downwards layer by layer from the uppermost layer of the local extremum pyramid, and detecting positioning graphs of the dot matrix two-dimensional code image of the current layer traversed each time until positioning graphs meeting the preset number are detected from the dot matrix two-dimensional code image of one layer; and determining the recognition result of the original dot matrix two-dimensional code image according to the detected positioning patterns which accord with the preset number. By adopting the method, the accuracy of dot matrix two-dimensional code identification can be improved.

Description

Dot matrix two-dimensional code identification method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies and image processing technologies, and in particular, to a method and an apparatus for identifying a dot matrix two-dimensional code, an electronic device, and a storage medium.
Background
With the development of science and technology, the amount of information used in life and work is larger and larger, and the two-dimensional code becomes an information carrier with high utilization rate. Common two-dimensional codes in life are generally continuous, and different from common two-dimensional codes in life, dot matrix two-dimensional codes are generally printed on industrial devices in industrial scenes and other scenes, the dot matrix two-dimensional codes are two-dimensional codes formed by arrays formed by a plurality of points, and code points are discontinuous.
The traditional two-dimensional code identification method generally determines a positioning graph in a two-dimensional code image according to edge points in the two-dimensional code image, and then further corrects and decodes the two-dimensional code image according to the positioning graph so as to realize two-dimensional code identification. The method has a good identification effect on continuous two-dimensional codes which are common in life, however, for the industrial dot matrix two-dimensional codes, redundant edge points may exist inside a positioning graph because the code points are discontinuous, the positioning graph is difficult to accurately detect according to the edge points, and the accuracy of dot matrix two-dimensional code identification is influenced.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product for identifying a dot matrix two-dimensional code, which can improve the accuracy of identifying the dot matrix two-dimensional code.
In a first aspect, the present application provides a dot matrix two-dimensional code identification method, including:
starting from the obtained original dot matrix two-dimensional code image, selecting local extreme values based on pixel values to perform layer-by-layer downsampling, and generating a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image; the local extremum pyramid is obtained by arranging the dot matrix two-dimensional code images of all layers obtained by down-sampling layer by layer from top to bottom according to the sequence of pixel points from few to many;
traversing downwards layer by layer from the uppermost layer of the local extreme value pyramid, and detecting positioning graphs of the dot matrix two-dimensional code image of the current layer traversed each time until the positioning graphs meeting the preset number are detected from the dot matrix two-dimensional code image of one layer;
and determining the recognition result of the original dot matrix two-dimensional code image according to the detected positioning patterns which accord with the preset number.
In a second aspect, the present application further provides a dot matrix two-dimensional code recognition apparatus, including:
the generating module is used for selecting local extrema from the acquired original dot matrix two-dimensional code image based on the pixel value to perform layer-by-layer downsampling, and generating a local extrema pyramid corresponding to the original dot matrix two-dimensional code image; the local extremum pyramid is obtained by arranging the dot matrix two-dimensional code images of all layers obtained by down-sampling layer by layer from top to bottom according to the sequence of less to more pixel points;
the detection module is used for traversing downwards layer by layer from the uppermost layer of the local extreme value pyramid, and detecting positioning graphs of the dot matrix two-dimensional code images of the current layer traversed each time until the positioning graphs meeting the preset number are detected from the dot matrix two-dimensional code images of one layer;
and the identification module is used for determining the identification result of the original dot matrix two-dimensional code image according to the detected positioning patterns which accord with the preset number.
In a third aspect, the present application further provides an electronic device, where the electronic device includes a memory and a processor, where the memory stores a computer program, and the processor implements the steps in the dot matrix two-dimensional code identification method when executing the computer program.
In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps in the above dot matrix two-dimensional code identification method.
In a fifth aspect, the present application further provides a computer program product, where the computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements the steps in the dot matrix two-dimensional code identification method.
According to the dot matrix two-dimensional code identification method, the dot matrix two-dimensional code identification device, the electronic equipment, the computer readable storage medium and the computer program product, local extrema are selected from the obtained original dot matrix two-dimensional code image to perform layer-by-layer downsampling based on the pixel values, the local extremum pyramid corresponding to the original dot matrix two-dimensional code image is generated, the dot matrix two-dimensional code in the dot matrix two-dimensional code image in the level close to the top layer of the local extremum pyramid is converted into a continuous code, edge points inside the positioning graph can be removed, the outer edge of the positioning graph is reserved as far as possible, therefore, in the process of detecting the positioning graph by traversing downwards layer by layer from the uppermost layer of the local extremum pyramid, the positioning graph can be accurately detected based on the dot matrix two-dimensional code image with the inner edge points removed and the outer edge reserved, the identification result of the original dot matrix two-dimensional code image can be determined according to the detected accurate positioning graph which is in accordance with the preset number, and the accuracy of the dot matrix two-dimensional code identification is improved.
Drawings
Fig. 1 is an application environment diagram of a dot matrix two-dimensional code identification method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a dot matrix two-dimensional code identification method provided in the embodiment of the present application;
fig. 3 is a schematic diagram of an original dot matrix two-dimensional code image according to an embodiment of the present application;
fig. 4 is a schematic diagram of selecting a local extremum for down-sampling according to an embodiment of the present disclosure;
fig. 5 is a schematic overall flow chart of a dot matrix two-dimensional code identification method according to an embodiment of the present application;
fig. 6 is a block diagram of a structure of a dot matrix two-dimensional code recognition apparatus according to an embodiment of the present application;
fig. 7 is an internal structural diagram of an electronic device according to an embodiment of the present application;
fig. 8 is an internal structural diagram of a computer-readable storage medium according to an embodiment of the present application.
Detailed description of the preferred embodiments
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The dot matrix two-dimensional code identification method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. The shooting device 102 may perform image acquisition on the dot matrix two-dimensional code on the device 106 to obtain an original dot matrix two-dimensional code image. The shooting device 102 may send the original dot matrix two-dimensional code image to the electronic device 104 through a communication method such as a network or bluetooth, or may copy the original dot matrix two-dimensional code image acquired by the shooting device 102 to the electronic device 104 through a copying method. The electronic device 104 may execute the dot matrix two-dimensional code recognition method in the embodiments of the present application to recognize the dot matrix two-dimensional code in the original dot matrix two-dimensional code image. The photographing device 102 may be a camera or a first terminal having a photographing function, and the like. The camera may be, but is not limited to, an industrial camera or a civil camera, etc. The first terminal having the photographing function may be, but is not limited to, various notebook computers, smart phones, tablet computers, and portable wearable devices. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, and the like. The electronic device 104 may be a second terminal, a server, an embedded device, or the like. The second terminal can be but not limited to various personal computers, notebook computers, smart phones, tablet computers, internet of things equipment and portable wearable equipment, and the internet of things equipment can be smart sound boxes, smart televisions, smart air conditioners, smart vehicle-mounted equipment and the like. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, and the like. The server may be implemented as a stand-alone server or as a server cluster consisting of a plurality of servers.
In some embodiments, as shown in fig. 2, a dot matrix two-dimensional code recognition method is provided, which is described by taking the method as an example applied to the electronic device 104 in fig. 1, and includes the following steps:
step 202, starting from the obtained original dot matrix two-dimensional code image, selecting a local extreme value based on a pixel value to perform layer-by-layer downsampling, and generating a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image; the local extremum pyramid is obtained by arranging the dot matrix two-dimensional code images of all layers obtained by down-sampling layer by layer from top to bottom according to the sequence of less to more pixel points.
The dot matrix two-dimensional code is a two-dimensional code formed by an array consisting of a plurality of discontinuous code points. The local extremum is the maximum value in the local region. Selecting a local extremum based on the pixel value refers to selecting a local extremum of the pixel value. As shown in fig. 3, which is a schematic diagram of an original dot matrix two-dimensional code image, it can be seen that the code points in the dot matrix two-dimensional code are discontinuous. And (3) performing down-sampling layer by layer, namely performing down-sampling treatment on the dot matrix two-dimensional code image obtained by each down-sampling in an iterative manner. The original dot matrix two-dimensional code image is an image collected aiming at the dot matrix two-dimensional code.
It can be understood that fewer and fewer pixel points of the dot matrix two-dimensional code image are obtained in the layer-by-layer down-sampling process each time.
Specifically, the electronic device may select a local extremum based on a pixel value from the obtained original dot matrix two-dimensional code image for downsampling, and iteratively select a local extremum based on a pixel value for downsampling for the dot matrix two-dimensional code image obtained by each downsampling, so as to generate a local extremum pyramid corresponding to the original dot matrix two-dimensional code image.
In some embodiments, the original dot matrix two-dimensional code image is a grayscale image. The pixel value refers to a gray value in a gray image.
In some embodiments, the local extremum may be the most significant value selected from the plurality of sub-regions into which the image is divided.
In some embodiments, the electronic device may determine the type of the local extremum according to a magnitude relationship between pixel values of code points in the acquired original dot matrix two-dimensional code image and pixel values of the background. The type of the local extremum is whether the local extremum is a local maximum or a local minimum. The local maximum value is a maximum value in a local area. Local minima refer to the minimum in a local region.
In some embodiments, the dot matrix two-dimensional code may be disposed on an industrial device, and the shooting device may perform image acquisition on the dot matrix two-dimensional code on the industrial device to obtain an original dot matrix two-dimensional code image. The shooting device can send the original dot matrix two-dimensional code image to the electronic device through a network or a Bluetooth communication mode or copy the original dot matrix two-dimensional code image acquired by the shooting device to the electronic device through a copying mode. The electronic device can select local extrema based on pixel values from the original dot matrix two-dimensional code image to perform layer-by-layer downsampling, and generate a local extrema pyramid corresponding to the original dot matrix two-dimensional code image.
In some embodiments, the lattice two-dimensional Code may be any one type of lattice two-dimensional Code of a QR Code (i.e., quick Response Code), a DM two-dimensional Code (Data Matrix Code), a MaxiCode two-dimensional Code, or a hansencode, etc.
In some embodiments, the electronic device may perform smoothing filtering on the obtained original dot matrix two-dimensional code image, and then select a local extremum based on the pixel values from the smoothed image to perform down-sampling layer by layer, so as to generate a local extremum pyramid corresponding to the original dot matrix two-dimensional code image. In this embodiment, noise caused by image acquisition performed by the shooting device can be eliminated by smoothing filtering.
And 204, traversing downwards layer by layer from the uppermost layer of the local extremum pyramid, and detecting positioning graphs of the dot matrix two-dimensional code image of the current layer traversed each time until the positioning graphs conforming to the preset number are detected from the dot matrix two-dimensional code image of one layer.
The positioning graph is a graph used for positioning the dot matrix two-dimensional code in the dot matrix two-dimensional code. The positioning pattern detection is a process of detecting a positioning pattern from a dot matrix two-dimensional code image.
In some embodiments, in the case that the dot matrix two-dimensional code is a QR two-dimensional code type dot matrix two-dimensional code, the positioning pattern refers to a "return" font in the QR two-dimensional code type dot matrix two-dimensional code.
In some embodiments, the preset number is the number of positioning patterns in the dot matrix two-dimensional code. Such as: the number of the 'return' font positioning graphs in the QR two-dimensional code type dot matrix two-dimensional code is 3, and the preset number is 3. Such as 302, 304 and 306 in fig. 3, are the positioning graphics of the 3 "back" glyphs in the dot matrix two-dimensional code.
Specifically, the electronic device may traverse downward layer by layer from the uppermost layer of the local extremum pyramid, perform positioning graph detection on the dot matrix two-dimensional code image of the current layer traversed each time, and continue traversing downward if positioning graphs conforming to a preset number are not detected from the dot matrix two-dimensional code image of the current layer; if the positioning patterns meeting the preset number are detected from the dot matrix two-dimensional code image of the current layer, step 206 is executed.
In some embodiments, the electronic device may perform edge detection on the dot matrix two-dimensional code image of the current layer, and then detect the positioning graph from the dot matrix two-dimensional code image of the current layer according to an edge detection result.
And step 206, determining the recognition result of the original dot matrix two-dimensional code image according to the detected positioning patterns which accord with the preset number.
In some embodiments, the electronic device may determine, according to the detected positioning graphics conforming to the preset number, an identification result of the original dot matrix two-dimensional code image based on the dot matrix two-dimensional code image of the corresponding hierarchy. The dot matrix two-dimensional code images of the corresponding levels are dot matrix two-dimensional code images of the levels which are detected to be in accordance with the preset number of positioning graphs. Such as: and if the positioning patterns meeting the preset number are detected from the dot matrix two-dimensional code image of the third layer of the local extremum pyramid, the electronic equipment can determine the identification result of the original dot matrix two-dimensional code image based on the dot matrix two-dimensional code image of the third layer.
In other embodiments, the electronic device may map the detected positioning graphics conforming to the preset number into the original dot matrix two-dimensional code image, and then determine the recognition result of the original dot matrix two-dimensional code image based on the original dot matrix two-dimensional code image according to the mapped positioning graphics.
In some embodiments, the electronic device may locate the position of the dot matrix two-dimensional code according to the detected positions that conform to the preset number of location patterns, and then decode the dot matrix two-dimensional code according to the located dot matrix two-dimensional code to obtain the recognition result of the original dot matrix two-dimensional code image.
In some embodiments, the electronic device may locate the positions of the dot-matrix two-dimensional codes according to the detected positions that conform to the preset number of location patterns, correct the target dot-matrix two-dimensional code image according to the positions of the location patterns, and then decode based on the corrected image. The correction refers to adjusting the target dot matrix two-dimensional code image into an image under a vertical shooting visual angle. The target dot matrix two-dimensional code image can be a dot matrix two-dimensional code image of a corresponding hierarchy or an original dot matrix two-dimensional code image.
In some embodiments, the electronic device may perform down-sampling on the corrected image, then perform binarization on the down-sampled image, and then perform decoding on the binarized image. The binarization processing may be implemented by any of global threshold binarization, local threshold binarization, and the like.
In some embodiments, in a case that the dot matrix two-dimensional code is a QR two-dimensional code type dot matrix two-dimensional code, and the positioning patterns are 3 "hui" shaped positioning patterns, the electronic device may determine a position of the fourth pattern, then calculate a perspective transformation matrix according to the position of each positioning pattern and the position of the fourth pattern, and correct the target dot matrix two-dimensional code image according to the perspective transformation matrix.
In some embodiments, in the case that the dot matrix two-dimensional code is a QR two-dimensional code type dot matrix two-dimensional code, the positioning pattern is 3 "return" shaped positioning patterns, and there is no correction pattern in the dot matrix two-dimensional code, the fourth pattern may be a fourth vertex except for 3 positioning patterns in a parallelogram composed of 3 positioning patterns as vertices. The electronic device can determine a parallelogram according to the position of each positioning graph to obtain the position of the fourth graph.
In other embodiments, in the case that the dot matrix two-dimensional code is a QR two-dimensional code type dot matrix two-dimensional code, the positioning graph is 3 "return" font positioning graphs, and there is a correction graph in the dot matrix two-dimensional code, the fourth graph may be a correction graph in the dot matrix two-dimensional code. The electronic device can detect the correction pattern from the dot matrix two-dimensional code image of the corresponding hierarchy, and obtain the position of the correction pattern (i.e. the position of the fourth pattern). The correction graph is a graph used for correcting the two-dimensional code in the dot matrix two-dimensional code. The corrected graph in the dot matrix two-dimensional code is shown as 308 in fig. 3.
According to the dot matrix two-dimensional code identification method, local extrema are selected from an original dot matrix two-dimensional code image to perform layer-by-layer downsampling based on pixel values to generate a local extremum pyramid corresponding to the original dot matrix two-dimensional code image, so that dot matrix two-dimensional codes in the dot matrix two-dimensional code image in the hierarchy close to the top layer of the local extremum pyramid are converted into continuous codes, edge points inside a positioning graph can be removed, and the outer edge of the positioning graph is reserved as far as possible. And the positioning graph is detected based on the continuous codes, so that the detection difficulty of the positioning graph is reduced, and the recognition rate of the dot matrix two-dimensional code is improved. In addition, compared with the traditional Gaussian pyramid, the method avoids the problem that gradient in the image disappears layer by layer due to Gaussian filtering in the process of establishing the Gaussian pyramid, so that the edge of the positioning graph in the image on the upper layer of the Gaussian pyramid possibly disappears, further reduces the detection difficulty of the positioning graph, improves the accuracy and the recognition rate of the dot matrix two-dimensional code recognition, also avoids the problems of large calculation amount and low calculation speed of establishing the Gaussian pyramid in a Gaussian filtering mode, and improves the recognition efficiency of the dot matrix two-dimensional code.
In some embodiments, starting from the obtained original dot matrix two-dimensional code image, selecting a local extremum based on pixel values to perform layer-by-layer downsampling, and generating a local extremum pyramid corresponding to the original dot matrix two-dimensional code image, including:
taking the obtained original dot matrix two-dimensional code image as a current dot matrix two-dimensional code image;
dividing a current dot matrix two-dimensional code image into a plurality of sub-areas;
respectively selecting a maximum value or a minimum value from each sub-area based on the pixel value so as to perform down-sampling on the current dot matrix two-dimensional code image to obtain a dot matrix two-dimensional code image of the previous layer;
and taking the previous layer of dot matrix two-dimensional code image as the current dot matrix two-dimensional code image, returning to execute the steps of dividing the current dot matrix two-dimensional code image into a plurality of sub-areas and the subsequent steps until the down-sampling stop condition is met, and obtaining a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image.
It can be understood that the maximum value or the minimum value in the sub-region of the dot matrix two-dimensional code image is the local extreme value of the dot matrix two-dimensional code image.
In some embodiments, the size of each sub-region may be the same, and each sub-region may be a square region of the same size.
In some embodiments, the size of the sub-region may be 2 × 2 (unit: pixel × pixel). In other embodiments, the size of the sub-region may be 3 × 3 (unit: pixel × pixel) or 4 × 4 (unit: pixel × pixel), and the like, without limitation.
As shown schematically in fig. 4 (a), the pixel value of each pixel point in the dot matrix two-dimensional code image is shown, each square represents a pixel point, and the number in each square represents the pixel value of the pixel point. The region framed by the white frame 402 in (a) in fig. 4 is one of the sub-regions obtained by dividing the dot matrix two-dimensional code image according to the size of the sub-region of 2 × 2.
In some embodiments, the electronic device may select a maximum value or a minimum value of the pixel values from each sub-region, respectively, and generate the dot matrix two-dimensional code image of the previous layer according to the maximum value or the minimum value in each sub-region.
In some embodiments, the downsampling stop condition may be that the size of the current dot matrix two-dimensional code image is smaller than the size of the sub-region, that is, the current dot matrix two-dimensional code image cannot be continuously divided into the sub-regions. In other embodiments, the down-sampling stop condition may be that the number of layers of the dot matrix two-dimensional code image of each layer obtained by down-sampling reaches a preset number of layers.
In the above embodiment, the current dot matrix two-dimensional code image is iteratively divided into a plurality of sub-regions, a maximum value or a minimum value is respectively selected from each sub-region based on a pixel value, so as to perform downsampling on the current dot matrix two-dimensional code image to obtain a dot matrix two-dimensional code image of a previous layer, and a local extremum pyramid corresponding to the original dot matrix two-dimensional code image is obtained, so that the dot matrix two-dimensional code in the dot matrix two-dimensional code image in the hierarchy close to the top layer of the local extremum pyramid can be converted into a continuous code, edge points inside the positioning graph can be removed, the outer edge of the positioning graph can be reserved as far as possible, the positioning graph can be accurately detected based on the dot matrix two-dimensional code image in which the inner edge points of the positioning graph are removed and the outer edge is reserved, and then the identification result of the original dot matrix two-dimensional code image can be determined according to the detected accurate positioning graph, and the accuracy of the dot matrix two-dimensional code identification is improved. And the positioning graph is detected based on the continuous codes, so that the detection difficulty of the positioning graph is reduced, and the recognition rate of the dot matrix two-dimensional code is improved.
In some embodiments, the pixel values of the code points in the original dot matrix two-dimensional code image are greater than the pixel values of the background; starting from the obtained original dot matrix two-dimensional code image, local extreme values are selected based on pixel values to perform layer-by-layer downsampling, and a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image is generated, and the method comprises the following steps of:
and starting from the obtained original dot matrix two-dimensional code image, selecting local maximum values based on pixel values to perform down sampling layer by layer, and generating a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image.
The code points refer to points in a dot matrix two-dimensional code region in an original dot matrix two-dimensional code image. The background refers to the image content except for the points in the dot matrix two-dimensional code area in the original dot matrix two-dimensional code image.
It can be understood that the pixel value of the code point in the original dot matrix two-dimensional code image is greater than the pixel value of the background, which indicates that the code point in the original dot matrix two-dimensional code image is brighter than the background.
Such as: in the case where the dot matrix two-dimensional code in the original dot matrix two-dimensional code image is a black-matrix white code (i.e., the background is approximately black, and the code dots are approximately white), the pixel value of the code dot in the original dot matrix two-dimensional code image is greater than the pixel value of the background.
In some embodiments, in the case that the pixel value of the code point in the original dot matrix two-dimensional code image is greater than the pixel value of the background, the user may configure the local extremum value as a local maximum value. The electronic equipment can select local maximum values to perform layer-by-layer downsampling on the basis of pixel values from the acquired original dot matrix two-dimensional code image to generate a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image.
In some embodiments, when a pixel value of a code point in an original dot-matrix two-dimensional code image is greater than a pixel value of a background, the electronic device may use the obtained original dot-matrix two-dimensional code image as a current dot-matrix two-dimensional code image, divide the current dot-matrix two-dimensional code image into a plurality of sub-regions, select a maximum value from each sub-region based on the pixel value, perform down-sampling on the current dot-matrix two-dimensional code image to obtain a dot-matrix two-dimensional code image of a previous layer, use the dot-matrix two-dimensional code image of the previous layer as the current dot-matrix two-dimensional code image, and return to perform the steps of dividing the current dot-matrix two-dimensional code image into the plurality of sub-regions and performing the subsequent steps until a down-sampling stop condition is met, thereby obtaining a local extremum pyramid corresponding to the original dot-matrix two-dimensional code image.
Fig. 4 (b) is a dot matrix two-dimensional code image obtained by performing one-layer down-sampling on the dot matrix two-dimensional code image (a) in fig. 4 by selecting local maximum values based on pixel values. Such as: the maximum value 196 is selected from the sub-regions 402 in (a) in fig. 4 as a pixel value in the dot matrix two-dimensional code image (b).
In the above embodiment, when the pixel value of a code point in the original dot matrix two-dimensional code image is greater than the pixel value of the background, starting from the obtained original dot matrix two-dimensional code image, the local maximum value is selected based on the pixel value to perform layer-by-layer downsampling, and the local extreme value pyramid corresponding to the original dot matrix two-dimensional code image is generated, so that a pixel point inside the positioning graph can be converted into a larger pixel value, thereby converting the dot matrix two-dimensional code in the dot matrix two-dimensional code image in the hierarchy close to the top layer of the local extreme value pyramid into a continuous code, removing the edge point inside the positioning graph, and reserving the outer edge of the positioning graph as much as possible, thereby accurately detecting the positioning graph based on the dot matrix two-dimensional code image with the inner edge point removed and the outer edge reserved, further determining the identification result of the original dot matrix two-dimensional code image according to the detected accurate positioning graph, and improving the accuracy of the dot matrix two-dimensional code identification. And the positioning graph is detected based on the continuous codes, so that the detection difficulty of the positioning graph is reduced, and the recognition rate of the dot matrix two-dimensional code is improved.
In some embodiments, the pixel values of the code points in the original dot matrix two-dimensional code image are smaller than the pixel values of the background; starting from the obtained original dot matrix two-dimensional code image, local extreme values are selected based on pixel values to perform layer-by-layer down-sampling, and a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image is generated, and the method comprises the following steps:
and starting from the obtained original dot matrix two-dimensional code image, selecting local minimum values based on pixel values to perform layer-by-layer downsampling, and generating a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image.
It can be understood that the pixel value of the code point in the original dot matrix two-dimensional code image is smaller than the pixel value of the background, which indicates that the code point in the original dot matrix two-dimensional code image is darker than the background.
Such as: in the case where the dot matrix two-dimensional code in the original dot matrix two-dimensional code image is a white-backed black code (i.e., the background is approximately white, and the code dots are approximately black), the pixel value of the code dot in the original dot matrix two-dimensional code image is smaller than the pixel value of the background.
In some embodiments, in the case that the pixel value of the code point in the original dot matrix two-dimensional code image is smaller than the pixel value of the background, the user may configure the local extreme value as the local minimum value. The electronic device can select local minimum values to perform layer-by-layer downsampling on the basis of pixel values from the acquired original dot matrix two-dimensional code image to generate a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image.
In some embodiments, when the pixel value of a code point in the original dot matrix two-dimensional code image is smaller than the pixel value of the background, the electronic device may use the obtained original dot matrix two-dimensional code image as a current dot matrix two-dimensional code image, divide the current dot matrix two-dimensional code image into a plurality of sub-regions, select a minimum value from each sub-region based on the pixel value, perform down-sampling on the current dot matrix two-dimensional code image to obtain a dot matrix two-dimensional code image of a previous layer, use the dot matrix two-dimensional code image of the previous layer as the current dot matrix two-dimensional code image, return to perform the steps of dividing the current dot matrix two-dimensional code image into the plurality of sub-regions and performing the subsequent steps until a down-sampling stop condition is satisfied, and obtain a local extremum pyramid corresponding to the original dot matrix two-dimensional code image.
As shown in fig. 4 (c), the dot matrix two-dimensional code image is obtained by performing one-layer down-sampling on the dot matrix two-dimensional code image (a) in fig. 4 by selecting a local minimum value based on a pixel value. Such as: the minimum value 10 is selected from the sub-regions 402 in (a) in fig. 4 as a pixel value in the dot matrix two-dimensional code image (c).
In the above embodiment, when the pixel value of a code point in the original dot matrix two-dimensional code image is smaller than the pixel value of the background, starting from the obtained original dot matrix two-dimensional code image, the local minimum value is selected based on the pixel value to perform layer-by-layer downsampling, and the local extremum pyramid corresponding to the original dot matrix two-dimensional code image is generated, so that a pixel point inside the positioning graph can be converted into a smaller pixel value, and thus the dot matrix two-dimensional code in the dot matrix two-dimensional code image in the hierarchy close to the top layer of the local extremum pyramid is converted into a continuous code, the edge point inside the positioning graph can be removed, and the outer edge of the positioning graph itself can be reserved as much as possible, so that the positioning graph can be accurately detected based on the dot matrix two-dimensional code image from which the inner edge point of the positioning graph is removed and the outer edge is reserved, and the identification result of the original dot matrix two-dimensional code image can be determined according to the detected accurate positioning graph, and the accuracy of the dot matrix two-dimensional code identification is improved. And the positioning graph is detected based on the continuous codes, so that the detection difficulty of the positioning graph is reduced, and the identification rate of the dot matrix two-dimensional code is improved.
In some embodiments, the positioning graph detection is performed on the dot matrix two-dimensional code image of the current layer traversed each time, and includes:
performing line type scanning on the dot matrix two-dimensional code image of the current layer traversed each time, and determining edge points through which scanning lines pass;
and determining a positioning graph meeting a preset distance proportional relation from the dot matrix two-dimensional code image of the current layer according to the proportional relation of the distances between adjacent edge points on the same scanning line.
The line scan is a process of scanning the dot matrix two-dimensional code image of the current layer in a translation manner by using a linear scan line. The scanning line is a linear line. The same scanning line refers to a scanning line at the same position.
In some embodiments, the scan lines may be maintained horizontal with the dot matrix two-dimensional code image of the current layer. In other embodiments, the scan line may also be perpendicular to the dot matrix two-dimensional code image of the current layer, and the direction of the scan line is not limited.
In some embodiments, the electronic device may perform line type scanning on the dot matrix two-dimensional code image of the current layer traversed each time, determine edge points through which a scanning line passes, and determine a positioning graph satisfying a preset distance proportional relationship from the dot matrix two-dimensional code image of the current layer according to a proportional relationship of distances between adjacent edge points on the scanning line when the scanning line is at the same position.
In some embodiments, the electronic device may compare a proportional relationship between distances between adjacent edge points on the scanning line when the scanning line is located at the same position with a preset distance proportional relationship of the positioning graph, so as to determine, from the dot matrix two-dimensional code image of the current layer, a position of the positioning graph that meets the preset distance proportional relationship. The preset distance proportional relationship is a proportional relationship of distances between adjacent external edge points of the positioning graph on the same straight line. The preset distance proportionality is a known and determined value. The external edge points of the positioning graph refer to edge points of the positioning graph in the continuous code after the dot matrix two-dimensional code is converted into the continuous code.
In some embodiments, the electronic device may determine, from the dot matrix two-dimensional code image of the current layer, a positioning pattern that satisfies a preset distance proportional relationship according to the edge point that is consistent with the preset distance proportional relationship of the positioning pattern.
In the above embodiment, the dot matrix two-dimensional code in the high-rise dot matrix two-dimensional code image can be converted into the continuous code through the local extremum pyramid, line type scanning is performed on the image based on the continuous code, the edge point through which the scanning line passes is determined, the positioning graph is determined according to the proportional relation of the distance between the adjacent edge points on the same scanning line, the positioning graph meeting the preset distance proportional relation can be accurately detected, the influence of the edge point inside the positioning graph of the dot matrix two-dimensional code is avoided, the detection difficulty of the positioning graph is reduced, and therefore the identification rate of the dot matrix two-dimensional code and the accuracy of dot matrix two-dimensional code identification are improved.
In some embodiments, the positioning graph detection is performed on the dot matrix two-dimensional code image of the current layer traversed each time, and includes:
performing edge detection on the dot matrix two-dimensional code image of the current layer traversed each time to obtain an edge detection result;
determining a positioning graph meeting a preset area proportional relation from a dot matrix two-dimensional code image of a current layer according to the proportional relation among the areas of all sub-graphs included in a target graph in an edge detection result; the shape of the target pattern conforms to the shape of the positioning pattern.
In some embodiments, in the case that the positioning graph is in a shape of a "back" font, the target graph may include 3 rectangles (i.e., sub-graphs), and the electronic device may determine, from the dot matrix two-dimensional code image of the current layer, the positioning graph satisfying a preset area proportional relationship according to a proportional relationship between areas of the rectangles included in the target graph.
In some embodiments, the electronic device may compare a proportional relationship between areas of the sub-patterns included in the target pattern with a preset area proportional relationship between areas of the sub-patterns in the positioning pattern, so as to determine the positioning pattern satisfying the preset area proportional relationship from the dot matrix two-dimensional code image of the current layer. The preset area proportional relationship is a proportional relationship among the areas of all the sub-graphs of the positioning graph. The preset area ratio relationship is known and determined.
In the above embodiment, the dot matrix two-dimensional code in the dot matrix two-dimensional code image of the high layer can be converted into the continuous code through the local extremum pyramid, the edge detection is performed on the image based on the continuous code, an edge detection result is obtained, according to the proportional relation among the areas of the sub-patterns included in the target pattern in the edge detection result, the positioning pattern meeting the preset area proportional relation is determined from the dot matrix two-dimensional code image of the current layer, the positioning pattern can be accurately detected, the influence of the edge points inside the positioning pattern of the dot matrix two-dimensional code is avoided, the detection difficulty of the positioning pattern is reduced, and therefore the identification rate of the dot matrix two-dimensional code and the accuracy of dot matrix two-dimensional code identification are improved.
In some embodiments, after determining the recognition result of the original dot matrix two-dimensional code image according to the detected positioning patterns conforming to the preset number, the method further includes:
and if the identification result of the original dot matrix two-dimensional code image is identification failure, continuously traversing downwards layer by layer from the next layer of the dot matrix two-dimensional code image traversed last time, and performing positioning graph detection on the dot matrix two-dimensional code image of the current layer traversed each time until positioning graphs meeting the preset number are detected from the dot matrix two-dimensional code image of one layer and the subsequent steps are performed.
Specifically, if the identification result of the original dot matrix two-dimensional code image is successful, the electronic device may output the identification result of the original dot matrix two-dimensional code image. If the identification result of the original dot matrix two-dimensional code image is identification failure, the electronic equipment can continue to traverse downwards layer by layer from the next layer of the dot matrix two-dimensional code image traversed last time, and iteratively perform positioning graph detection on the dot matrix two-dimensional code image of the current layer traversed each time until positioning graphs meeting the preset number are detected from the dot matrix two-dimensional code image of one layer, and determine the identification result of the original dot matrix two-dimensional code image according to the detected positioning graphs meeting the preset number until the identification result of the original dot matrix two-dimensional code image is identification success.
In some embodiments, if the local extremum pyramid is traversed to the lowest layer, and the identification result of the original dot matrix two-dimensional code image is identification failure, the electronic device may output prompt information of the identification failure.
In the above embodiment, if the identification result of the original dot matrix two-dimensional code image is identification failure, the dot matrix two-dimensional code image continues to traverse downward layer by layer from the next layer of the dot matrix two-dimensional code image traversed last time, the positioning patterns continue to be detected, the identification result of the original dot matrix two-dimensional code image is determined according to the detected positioning patterns conforming to the preset number, and the identification rate of the dot matrix two-dimensional code can be improved.
Fig. 5 is a schematic overall flow chart of a dot matrix two-dimensional code identification method in each embodiment of the present application. Firstly, obtaining an original dot matrix two-dimensional code image through image acquisition, establishing a local extremum pyramid according to the original dot matrix two-dimensional code image, then taking the dot matrix two-dimensional code image on the uppermost layer of the local extremum pyramid as an image to be detected, detecting a bit pattern from the image to be detected, if the bit pattern conforming to the preset number is not detected, taking the dot matrix two-dimensional code image on the lower layer of the local extremum pyramid as a new image to be detected, returning to the step of detecting the bit pattern from the image to be detected, correcting and decoding the dot matrix two-dimensional code image according to the position of the bit pattern until the bit pattern conforming to the preset number is detected from the dot matrix two-dimensional code image on one layer, returning to a decoding result if the decoding is successful, and continuing to take the dot matrix two-dimensional code image on the lower layer of the local extremum pyramid as a new image to be detected and returning to the step of detecting the bit pattern from the image to be detected if the decoding is failed. And if the lowest layer of the local extreme value pyramid is reached and the positioning patterns meeting the preset number are not detected in the downward layer by layer process, returning an empty result.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially shown as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts according to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the application also provides a dot matrix two-dimensional code identification device. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the method, so the specific limitations in the following embodiments of the dot matrix two-dimensional code recognition device can be referred to the limitations of the dot matrix two-dimensional code recognition method in the above, and are not described herein again.
In some embodiments, as shown in fig. 6, there is provided a dot matrix two-dimensional code recognition apparatus 600, including:
the generating module 602 is configured to select a local extremum from the obtained original dot matrix two-dimensional code image based on the pixel values to perform down-sampling layer by layer, and generate a local extremum pyramid corresponding to the original dot matrix two-dimensional code image; the local extremum pyramid is obtained by arranging the dot matrix two-dimensional code images of all layers obtained by down-sampling layer by layer from top to bottom according to the sequence of less to more pixel points;
the detection module 604 is configured to traverse downward layer by layer from the uppermost layer of the local extremum pyramid, and perform positioning pattern detection on the dot matrix two-dimensional code image of the current layer traversed each time until positioning patterns conforming to a preset number are detected from the dot matrix two-dimensional code image of one of the layers;
the identification module 606 is configured to determine an identification result of the original dot matrix two-dimensional code image according to the detected positioning patterns meeting the preset number.
In some embodiments, in terms of selecting a local extremum based on a pixel value from an obtained original lattice two-dimensional code image to perform layer-by-layer downsampling, and generating a local extremum pyramid corresponding to the original lattice two-dimensional code image, the generating module 602 is specifically configured to:
taking the obtained original dot matrix two-dimensional code image as a current dot matrix two-dimensional code image;
dividing a current dot matrix two-dimensional code image into a plurality of sub-areas;
respectively selecting a maximum value or a minimum value from each sub-region based on the pixel value to perform down-sampling on the current dot matrix two-dimensional code image to obtain a dot matrix two-dimensional code image of the previous layer;
and taking the previous layer of dot matrix two-dimensional code image as the current dot matrix two-dimensional code image, returning to execute the steps of dividing the current dot matrix two-dimensional code image into a plurality of subregions and the subsequent steps until the down-sampling stop condition is met, and obtaining a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image.
In some embodiments, the pixel values of the code points in the original dot matrix two-dimensional code image are larger than the pixel values of the background; in terms of selecting local extrema based on pixel values from an obtained original lattice two-dimensional code image to perform down-sampling layer by layer, and generating a local extrema pyramid corresponding to the original lattice two-dimensional code image, the generating module 602 is specifically configured to:
and starting from the obtained original dot matrix two-dimensional code image, selecting local maximum values based on pixel values to perform down sampling layer by layer, and generating a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image.
In some embodiments, the pixel values of the code points in the original dot matrix two-dimensional code image are smaller than the pixel values of the background; in terms of selecting a local extremum based on a pixel value from an obtained original dot matrix two-dimensional code image to perform layer-by-layer downsampling and generating a local extremum pyramid corresponding to the original dot matrix two-dimensional code image, the generating module 602 is specifically configured to:
and starting from the obtained original dot matrix two-dimensional code image, selecting local minimum values based on pixel values to perform layer-by-layer downsampling, and generating a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image.
In some embodiments, in terms of performing positioning graph detection on the dot matrix two-dimensional code image of the current layer traversed each time, the detection module 604 is specifically configured to:
performing line type scanning on the dot matrix two-dimensional code image of the current layer traversed each time, and determining edge points through which scanning lines pass;
and determining a positioning graph meeting a preset distance proportional relation from the dot matrix two-dimensional code image of the current layer according to the proportional relation of the distances between adjacent edge points on the same scanning line.
In some embodiments, in the aspect of detecting a location graph of the dot matrix two-dimensional code image of the current layer traversed each time, the detecting module 604 is specifically configured to:
performing edge detection on the dot matrix two-dimensional code image of the current layer traversed each time to obtain an edge detection result;
determining a positioning graph meeting a preset area proportional relation from a dot matrix two-dimensional code image of a current layer according to the proportional relation among the areas of all sub-graphs included in a target graph in an edge detection result; the shape of the target pattern conforms to the shape of the positioning pattern.
In some embodiments, the detection module 604 is further configured to: and if the identification result of the original dot matrix two-dimensional code image is identification failure, continuously traversing downwards layer by layer from the next layer of the dot matrix two-dimensional code image traversed last time, and performing positioning graph detection on the dot matrix two-dimensional code image of the current layer traversed each time until positioning graphs meeting the preset number are detected from the dot matrix two-dimensional code image of one layer and the subsequent steps are performed.
All or part of each module in the dot matrix two-dimensional code identification device can be realized through software, hardware and combination thereof. The modules may be embedded in hardware or independent of a processor in the computer device, or may be stored in a memory in the computer device in software, so that the processor calls and executes operations corresponding to the modules.
In one embodiment, an electronic device is provided, which may be a terminal, and the internal structure thereof may be as shown in fig. 7. The electronic device includes a processor, a memory, an Input/Output (I/O) interface, a communication interface, a display unit, and an Input apparatus. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic equipment comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the electronic device is used for communicating with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to realize the steps of the dot matrix two-dimensional code identification method. The display unit of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covered on the display unit, a key, a track ball or a touch pad arranged on the shell of the electronic device, an external keyboard, a touch pad or a mouse, and the like.
It will be appreciated by those skilled in the art that the configuration shown in fig. 7 is a block diagram of only a portion of the configuration associated with the present application, and is not intended to limit the computing device to which the present application may be applied, and that a particular computing device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In some embodiments, a computer-readable storage medium 800 is provided, on which a computer program 802 is stored, the computer program 802 implementing the steps of the above-described method embodiments when executed by a processor, and the internal structure of the computer program 802 is shown in fig. 8.
In some embodiments, an electronic device is provided, the computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the above-described method embodiments when executing the computer program.
In some embodiments, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps in the above-described method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, the computer program can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include a Read-Only Memory (ROM), a magnetic tape, a floppy disk, a flash Memory, an optical Memory, a high-density embedded nonvolatile Memory, a resistive Random Access Memory (ReRAM), a Magnetic Random Access Memory (MRAM), a Ferroelectric Random Access Memory (FRAM), a Phase Change Memory (PCM), a graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the various embodiments provided herein may be, without limitation, general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, or the like.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (14)

1. A dot matrix two-dimensional code recognition method is characterized by comprising the following steps:
taking the obtained original dot matrix two-dimensional code image as a current dot matrix two-dimensional code image;
dividing the current dot matrix two-dimensional code image into a plurality of sub-areas;
respectively selecting a maximum value or a minimum value from each sub-region based on the pixel value so as to perform down-sampling on the current dot matrix two-dimensional code image to obtain a dot matrix two-dimensional code image of a previous layer;
taking the dot matrix two-dimensional code image of the previous layer as the current dot matrix two-dimensional code image, returning to execute the steps of dividing the current dot matrix two-dimensional code image into a plurality of subregions and the subsequent steps until a down-sampling stop condition is met, and obtaining a local extremum pyramid corresponding to the original dot matrix two-dimensional code image; the local extremum pyramid is obtained by arranging the dot matrix two-dimensional code images of all layers obtained by down-sampling layer by layer from top to bottom according to the sequence of less to more pixel points;
traversing downwards layer by layer from the uppermost layer of the local extremum pyramid, and detecting positioning graphs of the dot matrix two-dimensional code image of the current layer traversed each time until positioning graphs conforming to the preset number are detected from the dot matrix two-dimensional code image of one layer;
and determining the recognition result of the original dot matrix two-dimensional code image according to the detected positioning patterns which accord with the preset number.
2. The method of claim 1, wherein the pixel values of the code points in the original dot matrix two-dimensional code image are greater than the pixel values of the background; the pixel value-based method for respectively selecting the maximum value or the minimum value from each sub-region to perform downsampling on the current dot matrix two-dimensional code image to obtain the dot matrix two-dimensional code image of the previous layer comprises the following steps:
and respectively selecting a maximum value from each sub-region based on the pixel value so as to perform down-sampling on the current dot matrix two-dimensional code image to obtain a dot matrix two-dimensional code image of the previous layer.
3. The method of claim 1, wherein the pixel values of the code points in the original dot matrix two-dimensional code image are smaller than the pixel values of the background; the pixel value-based method for respectively selecting the maximum value or the minimum value from each sub-region to perform downsampling on the current dot matrix two-dimensional code image to obtain the dot matrix two-dimensional code image of the previous layer comprises the following steps:
and respectively selecting a minimum value from each sub-area based on the pixel value so as to perform down-sampling on the current dot matrix two-dimensional code image and obtain the dot matrix two-dimensional code image of the previous layer.
4. The method according to any one of claims 1 to 3, wherein the performing positioning graph detection on the lattice two-dimensional code image of the current layer traversed to each time comprises:
performing linear scanning on the dot matrix two-dimensional code image of the current layer traversed each time, and determining edge points through which scanning lines pass;
and determining a positioning graph meeting a preset distance proportional relation from the dot matrix two-dimensional code image of the current layer according to the proportional relation of the distances between adjacent edge points on the same scanning line.
5. The method according to any one of claims 1 to 3, wherein the performing positioning graph detection on the lattice two-dimensional code image of the current layer traversed to each time comprises:
performing edge detection on the dot matrix two-dimensional code image of the current layer traversed each time to obtain an edge detection result;
determining a positioning graph meeting a preset area proportional relation from the dot matrix two-dimensional code image of the current layer according to the proportional relation among the areas of all sub-graphs included in the target graph in the edge detection result; the shape of the target graph conforms to the shape of the positioning graph.
6. The method according to any one of claims 1 to 3, wherein after the determining the recognition result of the original dot matrix two-dimensional code image according to the detected positioning patterns conforming to the preset number, the method further comprises:
and if the identification result of the original dot matrix two-dimensional code image is identification failure, continuously traversing downwards layer by layer from the next layer of the dot matrix two-dimensional code image traversed last time, and executing positioning graph detection on the dot matrix two-dimensional code image traversed to the current layer each time until the positioning graphs meeting the preset number are detected from the dot matrix two-dimensional code image of one layer and the subsequent steps are carried out.
7. A dot matrix two-dimensional code recognition device, characterized by, includes:
the generating module is used for taking the obtained original dot matrix two-dimensional code image as a current dot matrix two-dimensional code image; dividing the current dot matrix two-dimensional code image into a plurality of sub-areas; respectively selecting a maximum value or a minimum value from each sub-region based on the pixel value so as to perform down-sampling on the current dot matrix two-dimensional code image to obtain a dot matrix two-dimensional code image of a previous layer; taking the previous layer of dot matrix two-dimensional code image as the current dot matrix two-dimensional code image, returning to execute the steps of dividing the current dot matrix two-dimensional code image into a plurality of sub-regions and the subsequent steps until a down-sampling stop condition is met, and obtaining a local extreme value pyramid corresponding to the original dot matrix two-dimensional code image; the local extremum pyramid is obtained by arranging the dot matrix two-dimensional code images of all layers obtained by down-sampling layer by layer from top to bottom according to the sequence of less to more pixel points;
the detection module is used for traversing downwards layer by layer from the uppermost layer of the local extreme value pyramid, and carrying out positioning graph detection on the dot matrix two-dimensional code image of the current layer traversed each time until positioning graphs meeting the preset number are detected from the dot matrix two-dimensional code image of one layer;
and the identification module is used for determining the identification result of the original dot matrix two-dimensional code image according to the detected positioning patterns which accord with the preset number.
8. The apparatus of claim 7, wherein pixel values of code points in the original dot matrix two-dimensional code image are greater than pixel values of a background; in the aspect that the maximum value or the minimum value is respectively selected from each sub-region based on the pixel value to perform downsampling on the current dot matrix two-dimensional code image to obtain a dot matrix two-dimensional code image of a previous layer, the generation module is specifically configured to:
and respectively selecting a maximum value from each sub-region based on the pixel value so as to perform down-sampling on the current dot matrix two-dimensional code image to obtain a dot matrix two-dimensional code image of the previous layer.
9. The device of claim 7, wherein the pixel value of the code point in the original dot matrix two-dimensional code image is smaller than the pixel value of the background; in the aspect that the maximum value or the minimum value is respectively selected from each sub-region based on the pixel value to perform downsampling on the current dot matrix two-dimensional code image to obtain a dot matrix two-dimensional code image of a previous layer, the generation module is specifically configured to:
and respectively selecting a minimum value from each sub-region based on the pixel value so as to perform down-sampling on the current dot matrix two-dimensional code image and obtain a dot matrix two-dimensional code image of the previous layer.
10. The apparatus according to any one of claims 7 to 9, wherein in the aspect of detecting the positioning graph of the lattice two-dimensional code image of the current layer traversed each time, the detection module is specifically configured to:
performing linear scanning on the dot matrix two-dimensional code image of the current layer traversed each time, and determining edge points through which scanning lines pass;
and determining a positioning graph meeting a preset distance proportional relation from the dot matrix two-dimensional code image of the current layer according to the proportional relation of the distances between adjacent edge points on the same scanning line.
11. The apparatus according to any one of claims 7 to 9, wherein in the aspect of detecting the positioning graph of the lattice two-dimensional code image of the current layer traversed each time, the detection module is specifically configured to:
performing edge detection on the dot matrix two-dimensional code image of the current layer traversed each time to obtain an edge detection result;
determining a positioning graph meeting a preset area proportional relation from the dot matrix two-dimensional code image of the current layer according to the proportional relation among the areas of all sub-graphs included in the target graph in the edge detection result; the shape of the target graph conforms to the shape of the positioning graph.
12. The apparatus of any of claims 7-9, wherein the detection module is further configured to: and if the identification result of the original dot matrix two-dimensional code image is identification failure, continuously traversing downwards layer by layer from the next layer of the dot matrix two-dimensional code image traversed last time, and executing positioning graph detection on the dot matrix two-dimensional code image traversed to the current layer each time until the positioning graphs meeting the preset number are detected from the dot matrix two-dimensional code image of one layer and the subsequent steps are carried out.
13. An electronic device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any of claims 1 to 6 when executing the computer program.
14. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
CN202211593196.0A 2022-12-13 2022-12-13 Dot matrix two-dimensional code identification method and device, electronic equipment and storage medium Active CN115600619B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211593196.0A CN115600619B (en) 2022-12-13 2022-12-13 Dot matrix two-dimensional code identification method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211593196.0A CN115600619B (en) 2022-12-13 2022-12-13 Dot matrix two-dimensional code identification method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115600619A CN115600619A (en) 2023-01-13
CN115600619B true CN115600619B (en) 2023-04-07

Family

ID=84853918

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211593196.0A Active CN115600619B (en) 2022-12-13 2022-12-13 Dot matrix two-dimensional code identification method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115600619B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0825547A2 (en) * 1996-08-23 1998-02-25 Matsushita Electric Industrial Co., Ltd. Two-dimensional code reader
WO2013166995A1 (en) * 2012-05-11 2013-11-14 深圳市天朗时代科技有限公司 Method for decoding matrix-type two-dimensional code

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW201113815A (en) * 2009-10-09 2011-04-16 Primax Electronics Ltd QR code processing method and apparatus thereof
WO2014191028A1 (en) * 2013-05-28 2014-12-04 Sicpa Holding Sa Bar code reading device and detection method
CN109508571B (en) * 2017-09-14 2021-08-27 杭州海康威视数字技术股份有限公司 Strip-space positioning method and device, electronic equipment and storage medium
CN109086644B (en) * 2018-07-27 2021-05-25 广东奥普特科技股份有限公司 Positioning method of sub-pixel-precision DataMatrix two-dimensional code
CN113033233B (en) * 2019-12-27 2023-09-01 深圳大学 Positioning method, device and storage medium for geometric deformation QR code
CN112419215B (en) * 2020-11-11 2024-04-09 广东拓斯达科技股份有限公司 Image processing method, device, electronic equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0825547A2 (en) * 1996-08-23 1998-02-25 Matsushita Electric Industrial Co., Ltd. Two-dimensional code reader
WO2013166995A1 (en) * 2012-05-11 2013-11-14 深圳市天朗时代科技有限公司 Method for decoding matrix-type two-dimensional code

Also Published As

Publication number Publication date
CN115600619A (en) 2023-01-13

Similar Documents

Publication Publication Date Title
CN110956171A (en) Automatic nameplate identification method and device, computer equipment and storage medium
CN111079632A (en) Training method and device of text detection model, computer equipment and storage medium
JP4727614B2 (en) Image processing apparatus, control program, computer-readable recording medium, electronic apparatus, and control method for image processing apparatus
CN110674804A (en) Text image detection method and device, computer equipment and storage medium
JP4727615B2 (en) Image processing apparatus, control program, computer-readable recording medium, electronic apparatus, and control method for image processing apparatus
JP2008250950A5 (en)
CN107886082B (en) Method and device for detecting mathematical formulas in images, computer equipment and storage medium
CN111626295B (en) Training method and device for license plate detection model
CN112800955A (en) Remote sensing image rotating target detection method and system based on weighted bidirectional feature pyramid
CN109711419A (en) Image processing method, device, computer equipment and storage medium
CN112464798A (en) Text recognition method and device, electronic equipment and storage medium
CN111160288A (en) Gesture key point detection method and device, computer equipment and storage medium
CN104504387A (en) Correcting method and device for text image
US9176606B2 (en) Handwriting input system
CN114022558A (en) Image positioning method and device, computer equipment and storage medium
CN115063473A (en) Object height detection method and device, computer equipment and storage medium
CN113538291B (en) Card image inclination correction method, device, computer equipment and storage medium
CN115600619B (en) Dot matrix two-dimensional code identification method and device, electronic equipment and storage medium
CN110807342B (en) Bar code positioning method, bar code positioning device, computer equipment and storage medium
CN116402842B (en) Edge defect detection method, device, computer equipment and storage medium
CN115880362B (en) Code region positioning method, device, computer equipment and computer readable storage medium
CN111598100A (en) Vehicle frame number identification method and device, computer equipment and storage medium
CN115965799A (en) Image recognition method and device, computer equipment and storage medium
CN116168377A (en) License plate recognition method, license plate recognition device, computer equipment and storage medium
CN113971738B (en) Image detection method, device, electronic equipment and storage medium

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