Movatterモバイル変換


[0]ホーム

URL:


CN112069852B - Low-quality two-dimensional code information extraction method and device based on run-length coding - Google Patents

Low-quality two-dimensional code information extraction method and device based on run-length coding
Download PDF

Info

Publication number
CN112069852B
CN112069852BCN202010930356.0ACN202010930356ACN112069852BCN 112069852 BCN112069852 BCN 112069852BCN 202010930356 ACN202010930356 ACN 202010930356ACN 112069852 BCN112069852 BCN 112069852B
Authority
CN
China
Prior art keywords
dimensional code
run
sampling points
length
image
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
CN202010930356.0A
Other languages
Chinese (zh)
Other versions
CN112069852A (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.)
Luster LightTech Co Ltd
Original Assignee
Luster LightTech 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 Luster LightTech Co LtdfiledCriticalLuster LightTech Co Ltd
Priority to CN202010930356.0ApriorityCriticalpatent/CN112069852B/en
Publication of CN112069852ApublicationCriticalpatent/CN112069852A/en
Application grantedgrantedCritical
Publication of CN112069852BpublicationCriticalpatent/CN112069852B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The invention provides a low-quality two-dimensional code information extraction method and device based on run-length coding, comprising the following steps: performing binarization processing on the acquired two-dimensional code image to acquire a binary image; carrying out connected domain marking on the binary image, and carrying out run-length coding on the binary image after the connected domain marking; determining two-dimensional code version specifications and module sizes according to run-length coding information based on connected domain marks; carrying out noise reduction treatment on the two-dimensional code image according to the run length coding information and the size of the two-dimensional code module; dividing two-dimensional code sampling points for the two-dimensional code image after noise reduction according to the run length coding information; and extracting a binary matrix stored in the two-dimensional code according to the run-length coding information and the sampling points, and finishing information extraction of the two-dimensional code. The method encodes the image by the run-length encoding technology, and obtains the accurate position coordinates of each module in the two-dimensional code area based on the encoded run-length information, so that the low-quality two-dimensional code can be accurately extracted, and the decoding success is ensured.

Description

Low-quality two-dimensional code information extraction method and device based on run-length coding
Technical Field
The invention relates to the technical field of two-dimensional code information extraction, in particular to a low-quality two-dimensional code information extraction method and device based on run-length coding.
Background
The two-dimensional code has the advantages of large information capacity, strong error correction capability, good confidentiality and anti-counterfeiting performance, low printing cost and the like, and is widely applied to the industrial field. The two-dimensional code reading flow can be divided into three steps of bar code positioning, two-dimensional code binary information extraction and decoding, wherein the two-dimensional code binary information extraction refers to carrying out '0', '1' bit stream extraction, bar code version and module size calculation on the two-dimensional code obtained by positioning. In the two-dimensional code area, each module represents 0 or 1, wherein the background of the module gray value close to the silence area represents 0, and the gray value of the module represents 1 close to the polarity of the two-dimensional code.
As shown in fig. 1, a Data Matrix two-dimensional code (abbreviated as DM code) with polarity of dark on light is shown in fig. 2, a mode side of the DM code is shown, the mode side includes an L side formed by two lower left sides and a clock side formed by two upper right sides, as shown in fig. 3, a Data area of the DM code is shown, wherein a black module represents "1", a white module represents "0", and an area between two rectangular frames is a mute area of the DM code as shown in fig. 4. For the two-dimensional code with better printing and imaging quality, the version specification can be directly determined according to the clock edge of the DM code, the sampling point coordinate of each module in the data area of the DM code is jointly determined by the centroid x coordinate of the horizontal clock edge module and the centroid y coordinate of the vertical clock edge module, and the sampling value of the sampling point is determined by the gray value of the sampling point position.
However, for low quality DM codes, for example: the module position has the conditions of offset, noise, damage and the like in the code area, the accurate sampling point of each module in the data area of the DM code cannot be determined simply through the clock side information of the DM code, so that the bit stream information extracted from the data area of the DM code is inaccurate, and finally decoding failure is caused.
Disclosure of Invention
The invention provides a low-quality two-dimensional code information extraction method and device based on run-length coding, which are used for solving the problem that the bit stream information of the extracted two-dimensional code is inaccurate because the accurate sampling point position of each module in the data area of the two-dimensional code cannot be determined simply through clock side information of the two-dimensional code due to the fact that the module position of the low-quality two-dimensional code is offset, the code area is noisy, damaged and the like.
In one aspect, the invention provides a low-quality two-dimensional code information extraction method based on run-length coding, which comprises the following steps:
performing binarization processing on the acquired two-dimensional code image to obtain a binary image;
carrying out connected domain marking on the binary image, and carrying out run length coding on the binary image marked by the connected domain to obtain run length coding information data based on the connected domain;
determining two-dimensional code version specifications and module sizes according to the run-length coding information data;
according to the run-length coding information data and the module size, carrying out noise reduction treatment on the two-dimensional code image;
dividing two-dimensional code sampling points for the two-dimensional code image after noise reduction processing according to the run-length coding information data, the two-dimensional code version specification and the module size;
and obtaining a binary matrix stored in the two-dimensional code image according to the run-length coding information data and the two-dimensional code sampling points, and finishing information extraction of the two-dimensional code.
In a preferred embodiment of the present invention, performing binarization processing on an acquired two-dimensional code image to obtain a binary image, including: and carrying out binary gray segmentation on the two-dimensional code image by using an Ojin method to obtain the binary image.
In a preferred embodiment of the present invention, the binary image is marked by a connected domain marking method for performing boundary tracking based on a run, so as to obtain the binary image after connected domain marking.
In a preferred embodiment of the present invention, the run-length encoded information data includes a run length, a row or column where the same gray value is located, a run start point, a run end point, and a run Duan Suoshu connected domain.
In a preferred embodiment of the present invention, the specific operation of determining the two-dimensional code version specification and the module size according to the run-length encoding information is as follows:
counting each row of runs Duan Shu starting from run data line 0;
if the maximum value of the continuous N rows of the run Cheng Duanshu is D1, D1 is the number of modules in the horizontal direction of the two-dimensional code, wherein N is a number close to the size of the two-dimensional code module;
repeating the steps to obtain the number D2 of modules in the vertical direction of the two-dimensional code;
and if the two-dimensional code is not present, the information extraction area is a non-two-dimensional code area, and the operation is terminated.
In a preferred embodiment of the present invention, the method for calculating the module size of the two-dimensional code is as follows:
counting Cheng Duanchang degrees of all odd numbered walks in the N/2 rows, and calculating the average value Size1;
counting Cheng Duanchang degrees of all odd numbered walks in the N/2 columns, and calculating the average Size2;
the module Size ModSize of the two-dimensional code is one half of the sum of Size1 and Size 2.
In the above technical solution, the N/2 th row or column is taken to ensure that each counted run length is located in the middle of the clock side module, and the counted run length can represent the width of each module.
In a preferred embodiment of the present invention, the noise reduction processing of the two-dimensional code image includes noise reduction processing of an unoccupied two-dimensional code image and noise reduction processing of an interspaced two-dimensional code image.
In a preferred embodiment of the present invention, the noise reduction processing for the non-interval two-dimensional code image comprises the following specific processes:
acquiring run-length coding information data of a two-dimensional code image;
finding out a run section with the current row length smaller than one half of the two-dimensional code module size in the row direction of the two-dimensional code image;
judging whether the communication domains of two adjacent run sections are the same as each other, if so, the current run section is a noise section, combining the current run section with the two adjacent run sections to reduce noise, traversing all rows, and finishing the upstream Cheng Jiangzao of the two-dimensional code image in the row direction;
the above steps are repeated in the column direction of the two-dimensional code image, and the upstream Cheng Jiangzao in the column direction of the two-dimensional code image is completed.
In a preferred embodiment of the present invention, the noise reduction processing for the spaced two-dimensional code image comprises the following specific processes:
acquiring run-length coding information data of a two-dimensional code image;
finding out a run section with the current row length smaller than one half of the two-dimensional code module size in the row direction of the two-dimensional code image;
judging whether the communication domains of two adjacent run sections are the same as the current run section, if so, the current run section is a noise section;
judging whether the connected domain of the noise section is consistent with the background connected domain, if so, the noise section is the interval between two-dimensional code modules, can not be combined, all rows are traversed, and the upstream Cheng Jiangzao of the two-dimensional code in the row direction is completed;
the above steps are repeated in the column direction of the two-dimensional code image, and the upstream Cheng Jiangzao in the column direction of the two-dimensional code image is completed.
By adopting the technical scheme, the arrangement characteristics of the two-dimensional code module can be accurately reflected by the noise-reduced run information data.
In a preferred embodiment of the present invention, the dividing the two-dimensional code sampling points according to the run-length coding information comprises the following specific processes:
judging the number of modules in each run section according to the two-dimensional code module size;
dividing two-dimensional code sampling points according to the number of the modules, wherein the dividing criteria of the two-dimensional code sampling points are specifically as follows:
NUM=R(L/Size),
wherein NUM represents the number of sampling points contained in each run, R () represents rounding operation, i.e. if the excess length exceeds 0.5 module Size, then a complete module is considered to exist, L represents the run length, and Size represents the module Size of the two-dimensional code;
in the calculation of the current run section, the calculation formula of each sampling point accounting for Cheng Duanchang degrees of the run is as follows:
SL=L/NUM,
wherein SL represents that each sampling point occupies a run length;
and calculating the position coordinates of each sampling point, wherein the formula is as follows:
Xi =START_COL+SL*(0.5+i),i=(0,1,2,......,NUM-1),
wherein X isi Representing the coordinates of the ith sampling point, and START_COL represents the starting point of the run length;
calculating the position coordinates of each sampling point according to the length of each sampling point occupying the current run section, the starting point of the current run section and the number of the sampling points;
judging whether the position coordinates of the sampling points and the total number of the sampling points are consistent with the two-dimensional code version specification information, and deleting the excessive sampling points if the calculated number of the sampling points is more than the number of modules in the two-dimensional code version specification; if the number of the calculated sampling points is smaller than the number of the modules in the two-dimensional code version specification, the missing sampling points are increased.
In a preferred embodiment of the present invention, the specific process of deleting multiple sampling points or adding missing sampling points is as follows:
when the number of the calculated sampling points is more than the number of the modules in the two-dimensional code version specification, selecting a run section with the sampling points occupying the minimum length of the current run section, deleting one sampling point, updating the number information of the sampling points, and continuing deleting until the number of the calculated sampling points is consistent with the number of the modules in the two-dimensional code version specification;
when the number of the calculated sampling points is smaller than the number of the modules in the two-dimensional code version specification, a run section with the sampling points occupying the length of the current run section to the maximum is selected, one sampling point is added, the information of the number of the sampling points is updated, and the addition is continued until the number of the calculated sampling points is consistent with the number of the modules in the two-dimensional code version specification.
On the other hand, the invention provides a low-quality two-dimensional code information extraction device based on run-length coding, which comprises:
the preprocessing unit is used for carrying out binarization processing on the input two-dimensional code image to obtain a binary image;
the connected domain marking unit is used for carrying out connected domain marking division on the binary image;
the run length coding unit is used for performing run length coding on the binary image marked by the connected domain;
and the two-dimensional code information extraction unit is used for determining the version specification and the module size of the two-dimensional code based on the run coding information data of the run coding module, reducing noise of the two-dimensional code image, dividing sampling points, extracting a binary matrix and finishing information extraction of the two-dimensional code image.
Compared with the prior art, the low-quality two-dimensional code information extraction method and device based on run length coding have the following beneficial effects:
according to the method, the two-dimensional code image marked by the connected domain is encoded by a run-length encoding technology, the accurate position coordinates of each module in the data area are obtained based on the encoded run-length information and the connected relation, information extraction is carried out, and particularly, for a low-quality two-dimensional code image, even if the position of the module is offset, the code area is noisy and damaged, the accurate position coordinates of each module can be obtained according to the run-length encoding data information of the binary image marked by the connected domain, and the two-dimensional code information extraction is carried out.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings that are needed in the embodiments will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a Data Matrix two-dimensional code image with polarity of DarkOnLight;
FIG. 2 is a schematic diagram of a Data Matrix two-dimensional code pattern edge of DarkOnLight;
FIG. 3 is a schematic diagram of a Data Matrix two-dimensional code Data region of DarkOnLight;
FIG. 4 is a schematic diagram of a DarkOnLight Data Matrix two-dimensional code mute region;
FIG. 5 is a flow chart of a low-quality two-dimensional code information extraction method based on run-length encoding;
FIG. 6 is a schematic view of partial run length encoding of a binary image, wherein FIG. 6 (a) is a schematic view of partial binary image data, and FIG. 6 (b) is a schematic view of run length encoding of FIG. 6 (a);
fig. 7 is a schematic view of partial run length encoding of a binary image after connected domain labeling, in which fig. 7 (a) is a schematic view of connected domain labeling of a binary image, fig. 7 (b) is an image after connected domain labeling of a binary image, and fig. 7 (c) is a schematic view of run length information of run length encoding based on a split image;
FIG. 8 is a schematic diagram of ten consecutive rows of runs Cheng Duanshu counted in the calculation module size;
fig. 9 is a schematic diagram of noise reduction processing of a two-dimensional code image, in which fig. 9 (a) is a two-dimensional code module diagram with pixel noise points, and fig. 9 (b) is a data comparison diagram before and after noise reduction of the pixel noise points in fig. 9 (a);
fig. 10 is a schematic diagram of sampling point extraction according to clock edge binary information of a two-dimensional code image with serious offset, wherein fig. 10 (a) is a two-dimensional code image with serious offset, and fig. 10 (b) is a sampling point position diagram obtained by directly extracting according to clock edge binary information;
FIG. 11 is a schematic view of run information obtained by performing partial run coding on the two-dimensional code image with serious offset in FIG. 10 (a);
fig. 12 is a sample point position diagram obtained by sampling and extracting fig. 10 (a) by the low-quality two-dimensional code information extraction method of the present invention.
Detailed Description
For the purposes of making the objects, embodiments and advantages of the present invention more apparent, an exemplary embodiment of the present invention will be described more fully hereinafter with reference to the accompanying drawings in which exemplary embodiments of the invention are shown, it being understood that the exemplary embodiments described are merely some, but not all, of the examples of the invention.
Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the description of the embodiments of the present invention, it should be noted that, directions or positional relationships indicated by terms such as "upper", "lower", "left", "right", etc., are based on directions or positional relationships shown in the drawings, or directions or positional relationships in which the inventive product is conventionally put in use, are merely for convenience of describing the present invention and simplifying the description, and are not indicative or implying that the apparatus or element to be referred to must have a specific direction, be configured and operated in a specific direction, and thus should not be construed as limiting the present invention.
Based on the exemplary embodiments described herein, all other embodiments that may be obtained by one of ordinary skill in the art without making any inventive effort are within the scope of the appended claims. Furthermore, while the present disclosure has been described in terms of an exemplary embodiment or embodiments, it should be understood that each aspect of the disclosure can be practiced separately from the other aspects.
It should be noted that the brief description of the terminology in the present invention is for the purpose of facilitating understanding of the embodiments described below only and is not intended to limit the embodiments of the present invention. Unless otherwise indicated, these terms should be construed in their ordinary and customary meaning.
The term "unit" as used in this disclosure refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and/or software code that is capable of performing the function associated with that element.
In the run length encoding method, a segment having the same gray scale value, i.e., a row or a column, is called a run length.
The two-dimensional code specification refers to the number of modules in the horizontal direction and the vertical direction of the bar code, and the total number of the square bar codes and the 6 rectangular bar code types in the international standard is 24. The module size refers to the length of the minimum circumscribed rectangle of the minimum unit of the code area, namely the pixel number. The two-dimensional code shown in fig. 1 has a specification of 14×14, the module size is the width of a single module, and the average value of all the module sizes of the clock edge (e.g., the upper right two sides in fig. 2) is generally used to represent the module size of the whole code, for no space code, the clock edge is the row with the largest number of gray level transitions, and for space code, the clock edge is the row with the largest number of gray level transitions except for the L edge. The gray level jump times of each line of the two-dimensional code image are mapped to the run data and represent the number of run segments of a single line, so that the clock edge is the line with the largest number of coded run segments.
The module size refers to the height or width of a single module, ideally the width and height of a module are equal and the width and height of all modules of the entire code area are equal, but for imaging reasons this size tends to deviate, but not by more than 20%.
Example 1
Fig. 5 is a flowchart of a low-quality two-dimensional code information extraction method based on run-length encoding, which specifically includes the following steps:
as shown in fig. 5, S100, performing binarization processing on the acquired two-dimensional code image to obtain a binary image; in this embodiment, binary gray segmentation is performed on the two-dimensional code image by using an oxford method to obtain the binary image;
as shown in fig. 5, S200, performing connected domain labeling on the binary image, and performing run length encoding on the binary image after the connected domain labeling to obtain run length encoding information data based on the connected domain;
in this embodiment, the run-length encoded information data includes a run length, a row or column where the same gray value is located, a run start point, a run end point, and a run Duan Suoshu connected domain.
As shown in fig. 6, a schematic diagram of partial RUN coding of a binary image in this embodiment is shown, where fig. 6 (a) is a schematic diagram of partial binary image data, fig. 6 (b) is a schematic diagram of RUN coding of fig. 6 (a), and as shown in fig. 6 (b), a RUN includes three variables, and as shown in fig. 6 (a), a gray shaded portion is shown, where a ROW corresponds to a second ROW in fig. 6 (a), a column START point start_col corresponds to a first column in fig. 6 (a), a column END point end_col corresponds to a second column in fig. 6 (a), and RUN in fig. 6 (b) represents a RUN, so that after RUN coding, the RUN of the gray shaded portion in fig. 6 (a) is 5.
As shown in fig. 7, a schematic view of run-length encoding is performed on the binary image after the connected domain is marked in this embodiment, and as shown in fig. 7 (a), a schematic view of performing connected domain marking on the binary image is performed, where each connected domain is marked with an ID. Common algorithms for labeling the connected domain of the binary image include Two-Pass algorithm, seed-Fi rolling algorithm, etc., in this embodiment, a connected domain labeling method for performing boundary tracking based on a run is adopted to label the binary image, so as to obtain the binary image after the connected domain is labeled, as shown in fig. 7 (a); the split binary image is run-coded, the current line position of each run Duan Qidian and the connected domain ID of the run Duan Suoshu are recorded, and run coding is performed based on the binary image marked by the connected domain, as shown in fig. 7 (b), in which the gray shaded portions are different connected domains for the image marked by the connected domain, as shown in fig. 7 (c), compared with fig. 6 (b), run information for run coding based on the split image is added, the run Cheng Duanchang degrees Length, the connected domain ID and the pixel value Vaule of each line are added, and the dependency relationship between each run segment and the connected domain can be obtained from fig. 7 (c), so that it can be known which run segments are connected, and the connected information is also critical for judging the subsequent noise point.
As shown in fig. 5, S300, determining a two-dimensional code version specification and a module size according to the run-length encoding information data;
in this embodiment, the specific operation of determining the two-dimensional code version specification and the module size according to the run-length encoding information is as follows:
counting each row of runs Duan Shu starting from run data line 0;
if the maximum value of the continuous N rows of the tour Cheng Duanshu is D1, D1 is the number of modules in the horizontal direction of the two-dimensional code, wherein N is a number close to the size of the two-dimensional code module, and due to imaging reasons, deviation exists between N and the size of the two-dimensional code module, but the maximum deviation is not more than 20%;
repeating the steps to obtain the number D2 of modules in the vertical direction of the two-dimensional code;
and if the two-dimensional code is not present, the information extraction area is a non-two-dimensional code area, and the operation is terminated.
As shown in fig. 8, the number of run segments of 10 consecutive lines counted in this embodiment is shown as 14 for all of the runs Cheng Duanshu from the 0 th line to the 8 th line, and the run Cheng Duanshu of the 9 th line is suddenly changed to 7, which indicates that the 9 th line is not the clock edge of the two-dimensional code image, so that the number of modules in the horizontal direction of the two-dimensional code is 14 according to the fact that the runs Cheng Duanshu of the 9 consecutive lines are 14, and the number of modules in the vertical direction is also 14 according to the same method, and the version specification of the two-dimensional code in this embodiment is 14×14.
In this embodiment, N represents the number of rows with the same number of consecutive transitions at the scanning clock edge, that is, N is 9 in fig. 8.
After the two-dimension code specification is determined, calculating the module size; due to the influence of factors such as printing and imaging, the sizes of the modules of the two-dimensional code may have slight deviation, in this embodiment, the average value of the sizes of all the modules at the clock edge is adopted to approximately represent the sizes of all the modules in the two-dimensional code area, and the specific calculation method is as follows:
counting Cheng Duanchang degrees of all odd numbered walks in the N/2 rows, and calculating the average value Size1;
counting Cheng Duanchang degrees of all odd numbered walks in the N/2 columns, and calculating the average Size2;
the module Size ModSize of the two-dimensional code is one half of the sum of Size1 and Size 2.
In the above technical solution, the N/2 th row or column is taken to ensure that each counted run length is located in the middle of the clock side module, and the counted run length can represent the width of each module.
Due to the influence of factors such as imaging and printing technology, noise may exist in the two-dimensional code area, and decoding failure is caused by error judgment on each module value of the two-dimensional code. Therefore, necessary noise reduction processing is required, and conventional noise reduction methods include median filtering, gaussian filtering and the like, but due to the characteristics of a DM code, excessive pixels at the edges of a module may be caused by filtering operation, resulting in differences between a segmented two-dimensional code image and an original boundary, and finally resulting in extraction errors of a binary matrix. The noise reduction process is performed in the present embodiment by the following method.
As shown in fig. 5, S400 performs noise reduction processing on the two-dimensional code image according to the run-length encoded information data and the module size, where the noise reduction processing includes noise reduction processing on the non-interval two-dimensional code image and noise reduction processing on the interval two-dimensional code image.
In this embodiment, the noise reduction process for the non-interval two-dimensional code image is as follows:
acquiring run coding information data of a two-dimensional code image, namely the length of a run section in fig. 7 (c), the connected domain ID and the module size, and identifying the run section as noise or interference;
the identification rule is as follows: finding out a run section with the current row length smaller than one half of the two-dimensional code module size in the row direction of the two-dimensional code image;
judging whether the communication domains of two adjacent run sections are the same as each other, if so, the current run section is a noise section, combining the current run section with the two adjacent run sections to reduce noise, traversing all rows, and finishing the upstream Cheng Jiangzao of the two-dimensional code image in the row direction;
the above steps are repeated in the column direction of the two-dimensional code image, and the upstream Cheng Jiangzao in the column direction of the two-dimensional code image is completed.
As shown in fig. 9 (a), the two-dimensional code module with one pixel noise point is provided, and the specific noise reduction process is as follows: taking the noise reduction of the pixels in the second row in fig. 9 (a) as an example, firstly, the noise pixels in the second row are identified according to the identification rule, then the run information is modified according to the rule, as shown in fig. 9 (b), a comparison graph of Cheng Duanchang degrees of the second row before and after the noise reduction in fig. 9 (a), three run sections are arranged in the second row in fig. 9 (a) before the noise reduction, only one run section with the length of 5 in the second row in fig. 9 (a) after the noise reduction, the noise reduction processing of the second row with the noise pixels is completed, and other noise pixel processing processes are similar.
In this embodiment, the specific process of the noise reduction processing of the two-dimensional code image with the interval is as follows:
acquiring run-length coding information data of a two-dimensional code image;
finding out a run section with the current row length smaller than one half of the two-dimensional code module size in the row direction of the two-dimensional code image;
judging whether the communication domains of two adjacent run sections are the same as the current run section, if so, the current run section is a noise section;
judging whether the connected domain of the noise section is consistent with the background connected domain, if so, the noise section is the interval between two-dimensional code modules, can not be combined, all rows are traversed, and the upstream Cheng Jiangzao of the two-dimensional code in the row direction is completed;
the above steps are repeated in the column direction of the two-dimensional code image, and the upstream Cheng Jiangzao in the column direction of the two-dimensional code image is completed.
By adopting the technical scheme, because each module of the DM two-dimensional code is provided with the interval, if whether the module is a noise point is judged only according to the run information data, the interval between the adjacent modules is regarded as the noise point, but the interval between the adjacent modules is communicated with the background, so that the intervals can be reserved according to the connected domain information and cannot be identified as the noise point. And when the DM two-dimensional code module is internally provided with the noise points, the front and rear modules of the noise points are certainly communicated, and the noise points are not communicated with the background, so that the noise points can be accurately identified, and noise reduction treatment is carried out.
Generally, two-dimensional code sampling points can be determined according to clock side information, but due to the influence of factors such as technology or imaging, whole-row or whole-column module offset may be generated, a binary matrix obtained by directly sampling clock information has larger deviation from actual information stored in the two-dimensional code, as shown in fig. 10 (a), and is a two-dimensional code image with serious offset, and the clock side binary information of the image is extracted to determine sampling points, as shown in fig. 10 (b), because of the deviation of the whole row, more sampling point positions have larger deviation from actual sampling points, and decoding fails. In this embodiment, the accurate position of each module is determined to sample through the code region run information data, so that the accurate sampling point position can be ensured to be obtained, and the accurate values of 0 and 1 of each module of the two-dimensional code are obtained, thereby ensuring that decoding is successful.
As shown in fig. 5, S500, dividing a two-dimensional code sampling point for the two-dimensional code image after the noise reduction processing according to the run-length encoding information data, the two-dimensional code version specification and the module size;
as shown in fig. 10 (a), in order to determine the accurate position of each module for sampling by using the run information data of the code region for the two-dimensional code image with serious offset, it is ensured that the accurate sampling point position is obtained.
Judging the number of modules in each run section according to the two-dimensional code module size;
dividing two-dimensional code sampling points according to the number of the modules, wherein the dividing criteria of the two-dimensional code sampling points are specifically as follows:
NUM=R(L/Size),
the Number represents the Number of sampling points contained in each run segment, the Number in the corresponding drawing, R () represents rounding and rounding operation, that is, if the length of the extra module exceeds 0.5 module Size, a complete module is considered to exist, L represents the length of the run segment, and Size represents the module Size of the two-dimensional code; in this embodiment, taking the run information of the second row of modules in fig. 10 (a) as an example, as shown in fig. 11, the module size is 4.56, and the version specification is 18×18.
In the calculation of the current run section, the calculation formula of each sampling point accounting for Cheng Duanchang degrees of the run is as follows:
SL=L/NUM,
wherein SL represents that each sampling point occupies a run length;
calculating the position coordinates of each sampling point according to the length of each sampling point occupying the current run section, the starting point of the current run section and the number of the sampling points, wherein the formula is as follows:
Xi =START_COL+SL*(0.5+i),i=(0,1,2,......,NUM-1),
wherein X isi Representing the coordinates of the ith sampling point, and START_COL represents the starting point of the run length;
judging whether the position coordinates of the sampling points and the total number of the sampling points are consistent with the two-dimensional code version specification information, and deleting the excessive sampling points if the calculated number of the sampling points is more than the number of modules in the two-dimensional code version specification; if the number of the calculated sampling points is smaller than the number of the modules in the two-dimensional code version specification, the missing sampling points are increased.
In this embodiment, the specific procedure of deleting multiple sampling points or adding missing sampling points is as follows:
when the number of the calculated sampling points is more than the number of the modules in the two-dimensional code version specification, selecting a run section with the sampling points occupying the minimum length of the current run section, deleting one sampling point, updating the number information of the sampling points, and continuing deleting until the number of the calculated sampling points is consistent with the number of the modules in the two-dimensional code version specification;
when the number of the calculated sampling points is smaller than the number of the modules in the two-dimensional code version specification, a run section with the sampling points occupying the length of the current run section to the maximum is selected, one sampling point is added, the information of the number of the sampling points is updated, and the addition is continued until the number of the calculated sampling points is consistent with the number of the modules in the two-dimensional code version specification.
As shown in fig. 5, S600, after obtaining the sampling points of each module according to the run-length encoded information data and the two-dimensional code sampling points, referring to fig. 12, it can be seen that although the module offset is very serious, accurate sampling points can be obtained, for the sampling point positions obtained by sampling and extracting fig. 10 (a) by using the extraction method of the embodiment; and then, directly according to the value of the run length, obtaining that the bit value of each sampling point is 0 or 1, namely obtaining a binary matrix stored in the two-dimensional code image, and finishing information extraction of the two-dimensional code.
Example 2
The invention provides a low-quality two-dimensional code information extraction device based on run-length coding, which comprises:
the preprocessing unit is used for carrying out binarization processing on the input two-dimensional code image to obtain a binary image;
the connected domain marking unit is used for carrying out connected domain marking division on the binary image;
the run length coding unit is used for performing run length coding on the binary image marked by the connected domain;
and the two-dimensional code information extraction unit is used for determining the version specification and the module size of the two-dimensional code based on the run coding information data of the run coding module, reducing noise of the two-dimensional code image, dividing sampling points, extracting a binary matrix and finishing information extraction of the two-dimensional code image.
It should be noted that, specific data such as two-dimensional code version specification, module size, sampling point number and the like adopted by the present invention and corresponding drawings are all for better illustrating the technical scheme of the present invention, so that those skilled in the art can understand the present invention conveniently, and the scope of the present invention is not limited.
The above-provided detailed description is merely a few examples under the general inventive concept and does not limit the scope of the present invention. Any other embodiments which are extended according to the solution of the invention without inventive effort fall within the scope of protection of the invention for a person skilled in the art.

Claims (11)

CN202010930356.0A2020-09-072020-09-07Low-quality two-dimensional code information extraction method and device based on run-length codingActiveCN112069852B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202010930356.0ACN112069852B (en)2020-09-072020-09-07Low-quality two-dimensional code information extraction method and device based on run-length coding

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202010930356.0ACN112069852B (en)2020-09-072020-09-07Low-quality two-dimensional code information extraction method and device based on run-length coding

Publications (2)

Publication NumberPublication Date
CN112069852A CN112069852A (en)2020-12-11
CN112069852Btrue CN112069852B (en)2023-12-12

Family

ID=73663950

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202010930356.0AActiveCN112069852B (en)2020-09-072020-09-07Low-quality two-dimensional code information extraction method and device based on run-length coding

Country Status (1)

CountryLink
CN (1)CN112069852B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN112651260B (en)*2020-12-302024-01-30凌云光技术股份有限公司Method and system for converting self-adaptive discrete codes into continuous codes
CN115100608B (en)*2022-08-252022-11-11南通佰瑞利电动工具有限公司Electric drill shell glass fiber exposure identification method and system
CN117218370B (en)*2023-09-052025-05-09上海交通大学Straight line segment identification and fitting method and system for random orthogonal structure point cloud
CN119670782B (en)*2024-11-292025-09-12中国烟草总公司河南省公司 Order precision identification and abnormality repair system and method based on cigarette QR code
CN119785277B (en)*2025-03-132025-08-01杭州华目科技有限公司Two-dimensional code identification method and device
CN120387466A (en)*2025-06-272025-07-29杭州汇萃智能科技有限公司 Two-dimensional code positioning method, system and readable storage medium based on grid jump degree

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106156684A (en)*2016-06-302016-11-23南京理工大学 A two-dimensional code recognition method and device
CN106529550A (en)*2016-10-252017-03-22凌云光技术集团有限责任公司Multidimensional characteristic extraction method and device based on connected domain analysis
CN111145191A (en)*2019-12-282020-05-12武汉瑞纳捷电子技术有限公司Run-length coding-based connected domain searching method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JP4301775B2 (en)*2002-07-182009-07-22シャープ株式会社 Two-dimensional code reading device, two-dimensional code reading method, two-dimensional code reading program, and recording medium for the program
US20100158376A1 (en)*2008-10-172010-06-24Klosterman Peter SSystems and methods for labeling and characterization of connected regions in a binary mask
KR20150092585A (en)*2014-02-052015-08-13한국전자통신연구원DNA data compression Method and Apparatus based on binary image

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106156684A (en)*2016-06-302016-11-23南京理工大学 A two-dimensional code recognition method and device
CN106529550A (en)*2016-10-252017-03-22凌云光技术集团有限责任公司Multidimensional characteristic extraction method and device based on connected domain analysis
CN111145191A (en)*2019-12-282020-05-12武汉瑞纳捷电子技术有限公司Run-length coding-based connected domain searching method and device

Also Published As

Publication numberPublication date
CN112069852A (en)2020-12-11

Similar Documents

PublicationPublication DateTitle
CN112069852B (en)Low-quality two-dimensional code information extraction method and device based on run-length coding
EP3309704B1 (en)Two-dimensional code partitioning and decoding method and system
CN107633192B (en) A method of barcode segmentation and reading in complex background based on machine vision
JP4232800B2 (en) Line noise elimination device, line noise elimination method, line noise elimination program
US7172124B2 (en)Camera-based barcode recognition
CN110324617B (en)Image processing method and device
EP0999519A1 (en)Distortion correction method in optical code reading
CN109948393B (en)Method and device for positioning one-dimensional bar code
CN105975894B (en)A kind of one-dimension code recognizer based on auto-adaptable image edge detection and mapping model
CN115330628B (en)Video frame-by-frame denoising method based on image processing
CN111339797A (en)Decoding method and terminal capable of accurately identifying damaged one-dimensional bar code
CN116704209B (en)Quick flange contour extraction method and system
CN110348266B (en)Method and device for recognizing and reading dot matrix code image
CN114417904A (en)Bar code identification method based on deep learning and book retrieval system
CN112508913A (en)Cable section edge detection method based on image detection
CN109740403B (en)Method and device for reading one-dimensional bar code
US7273177B2 (en)Camera-based barcode recognition
WO2011011051A2 (en)Image-based barcode reader
CN116842976A (en)DataMatrix two-dimensional code identification method and system based on coarse positioning of images
CN111523341B (en)Binarization method and device for two-dimensional code image
CN117115701A (en)Platform truck operation behavior identification method for customs auxiliary management
JP3099771B2 (en) Character recognition method and apparatus, and recording medium storing character recognition program
CN114140620B (en) A method for detecting straight line contour of an object
JP5379626B2 (en) Stack bar code information reading method and stack bar code information reading device
CN109766889B (en)Rail image recognition post-processing method based on curve fitting

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp