CN116739022A - Decoding method and device for bar code image and electronic equipment - Google Patents

Decoding method and device for bar code image and electronic equipment Download PDF

Info

Publication number
CN116739022A
CN116739022A CN202311023040.3A CN202311023040A CN116739022A CN 116739022 A CN116739022 A CN 116739022A CN 202311023040 A CN202311023040 A CN 202311023040A CN 116739022 A CN116739022 A CN 116739022A
Authority
CN
China
Prior art keywords
test area
bar code
data block
image
errors
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.)
Granted
Application number
CN202311023040.3A
Other languages
Chinese (zh)
Other versions
CN116739022B (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.)
Beijing Unigroup Tsingteng Microsystems Co Ltd
Original Assignee
Beijing Unigroup Tsingteng Microsystems 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 Beijing Unigroup Tsingteng Microsystems Co Ltd filed Critical Beijing Unigroup Tsingteng Microsystems Co Ltd
Priority to CN202311023040.3A priority Critical patent/CN116739022B/en
Publication of CN116739022A publication Critical patent/CN116739022A/en
Application granted granted Critical
Publication of CN116739022B publication Critical patent/CN116739022B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/146Methods for optical code recognition the method including quality enhancement steps
    • G06K7/1473Methods for optical code recognition the method including quality enhancement steps error correction
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Toxicology (AREA)
  • Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Image Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The application relates to the technical field of two-dimensional bar code recognition, and discloses a decoding method, a decoding device and electronic equipment for bar code images. The bar code image comprises an interference image positioned in the center area of the bar code image; the decoding method comprises the following steps: marking errors in the data blocks of the bar code image as unknown errors; wherein the number of data blocks is 1 or more; determining an initial test area of the interference image; determining unknown errors of all data blocks contained in the test area in a mode of expanding the test area layer by layer based on the initial test area; converting unknown errors in each data block contained in the test area into known errors; and correcting the error of each converted data block in the bar code image to improve the recognition performance of the bar code image with the interference image in the central area.

Description

Decoding method and device for bar code image and electronic equipment
Technical Field
The application relates to the technical field of intelligent recognition, in particular to a decoding method and device for bar code images and electronic equipment.
Background
Two-dimensional bar codes are widely used in the consumer field. In this field, in order to increase artistic effects, better promote commercial popularization, etc., users tend to add custom images at the geometric center of a two-dimensional barcode, for example: a logo or the like, the customized image occupies the coding area of the two-dimensional bar code, so that the data error naturally exists in the two-dimensional bar code data area, and the reading capability of the conventional algorithm on the two-dimensional bar code is reduced. In order to improve the reading capability of the two-dimensional bar code with the image at the center position, the related technology corrects the error of the data block formed by the two-dimensional bar code through an error correction algorithm, thereby realizing the decoding of the two-dimensional bar code.
In the process of implementing the embodiments of the present disclosure, it is found that at least the following problems exist in the related art: although the related art can realize the reading of the two-dimensional bar code with the image at the center position to a certain extent, the error correction capability of each data block has an upper limit value, and the coverage area of the image of the center area is difficult to determine, so that the reading capability of the two-dimensional bar code with the image at the center position is still poor.
It should be noted that the information disclosed in the above background section is only for enhancing understanding of the background of the application and thus may include information that does not form the prior art that is already known to those of ordinary skill in the art.
Disclosure of Invention
The following presents a simplified summary in order to provide a basic understanding of some aspects of the disclosed embodiments. This summary is not an extensive overview, and is intended to neither identify key/critical elements nor delineate the scope of such embodiments, but is intended as a prelude to the more detailed description that follows.
The embodiment of the disclosure provides a decoding method, a decoding device and electronic equipment for bar code images, so as to improve the recognition performance of bar code images with interference images in central areas.
In some embodiments, the barcode image includes an interference image located in a central region of the barcode image; the decoding method for the bar code image comprises the following steps: marking errors in the data blocks of the bar code image as unknown errors; wherein the number of data blocks is 1 or more; determining an initial test area of the interference image; determining unknown errors of all data blocks contained in the test area in a mode of expanding the test area layer by layer based on the initial test area; converting unknown errors in each data block contained in the test area into known errors; and correcting the error of each converted data block in the bar code image.
Optionally, the data blocks of the barcode image are determined as follows: obtaining bit stream data and error correction block quantity of a bar code image; and converting bit stream data of the bar code image into 1 or more data blocks according to the number of error correction blocks.
Optionally, determining the unknown error of each data block contained in the test area in a manner that enlarges the test area layer by layer includes: determining unknown errors of all data blocks contained in the test area in a mode of expanding the test area layer by layer until the test area is the maximum test area; wherein the maximum test area and the version information of the barcode image are related to the error correction level.
Optionally, the maximum test area is determined as follows: obtaining version information and error correction level of the bar code image; collecting a complete pollution-free control bar code image with the same version information and error correction level as the bar code image; setting errors in the control test area as known errors in a manner of expanding the control test area layer by layer; decoding a control barcode image containing a control test area; and under the condition that the decoding of the comparison bar code image fails, determining the corresponding comparison test area as the maximum test area when the decoding of the comparison bar code image fails.
Optionally, setting the error in the control test area as a known error includes: setting an initial value of a comparison test area; and setting the error in the control test area as a known error based on the initial value of the control test area and the full black or full white control test area expanded layer by layer in the center of the control barcode image.
Optionally, error correction is performed on each data block of the barcode image, including: obtaining actual values of the number of unknown errors in each data block; determining an upper limit value of the number of unknown errors corresponding to each data block; under the condition that the actual value of the unknown error quantity is smaller than or equal to the upper limit value of the unknown error quantity, determining that the data block error correction is successful; and determining that the data block fails to correct the error when the actual value of the unknown error number is greater than the upper limit value of the unknown error number.
Optionally, determining the upper limit value of the number of unknown errors corresponding to each data block includes calculating the upper limit value of the number of unknown errors corresponding to each data block according to the following formula:
r=(k-p)/2
where r is an upper limit value of the number of unknown errors in each data block, k is an upper limit value of error correction capability of each data block, and p is the number of known errors in each data block.
Optionally, the decoding method further comprises: under the condition that all data blocks are successful in error correction, determining that the decoding of the bar code image is successful; and under the condition that the error correction of the data block fails, determining that the decoding of the bar code image fails.
In some embodiments, a decoding device for a barcode image comprises a processor and a memory storing program instructions, the processor being configured to perform a decoding method for a barcode image as described above when the program instructions are executed.
In some embodiments, an electronic device includes: an electronic device body; and the decoding device for bar code image is installed on the electronic equipment body.
The decoding method for the bar code image, the decoding device for the bar code image and the electronic equipment provided by the embodiment of the disclosure can realize the following technical effects:
for the bar code image with interference image in the central area, the unknown errors contained in the test area in each data block are sequentially determined through the test area expanded layer by layer, and the unknown errors contained in the test area are converted into known errors. Because the error correction capability of the error correction algorithm on the known errors is larger than that on the unknown errors, the error correction capability on each data block can be improved without determining the actual area of the interference image of the bar code image by converting the unknown errors contained in the test area into the known errors, so that the offset supporting capability of the two-dimensional bar code is enhanced, and the recognition performance of the two-dimensional bar code of the coverage image of the central area is greatly improved.
The foregoing general description and the following description are exemplary and explanatory only and are not restrictive of the application.
Drawings
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements, and in which like reference numerals refer to similar elements, and in which:
fig. 1 is a schematic diagram of a bar code image.
Fig. 2 is a schematic diagram of a barcode image with interference images in a central region provided by an embodiment of the present disclosure.
Fig. 3 is a decoding method for a barcode image according to an embodiment of the present disclosure.
Fig. 4 is another decoding method for barcode images provided by an embodiment of the present disclosure.
Fig. 5 is another decoding method for barcode images provided by an embodiment of the present disclosure.
Fig. 6 is another decoding method for barcode images provided by an embodiment of the present disclosure.
Fig. 7 is a decoding device for bar code images according to an embodiment of the present disclosure.
Detailed Description
So that the manner in which the features and techniques of the disclosed embodiments can be understood in more detail, a more particular description of the embodiments of the disclosure, briefly summarized below, may be had by reference to the appended drawings, which are not intended to be limiting of the embodiments of the disclosure. In the following description of the technology, for purposes of explanation, numerous details are set forth in order to provide a thorough understanding of the disclosed embodiments. However, one or more embodiments may still be practiced without these details. In other instances, well-known structures and devices may be shown simplified in order to simplify the drawing.
The terms first, second and the like in the description and in the claims of the embodiments of the disclosure and in the above-described figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe embodiments of the present disclosure. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion.
The term "plurality" means two or more, unless otherwise indicated.
In the embodiment of the present disclosure, the character "/" indicates that the front and rear objects are an or relationship. For example, A/B represents: a or B.
The term "and/or" is an associative relationship that describes an object, meaning that there may be three relationships. For example, a and/or B, represent: a or B, or, A and B.
The term "corresponding" may refer to an association or binding relationship, and the correspondence between a and B refers to an association or binding relationship between a and B.
The application provides a decoding method for a bar code image, which mainly comprises a two-dimensional bar code. The two-dimensional bar code is also called as a two-dimensional code, the common two-dimensional code is QRCode, and QR is called as Quick Response. The two-dimensional bar code is a graph which is distributed on a plane (in a two-dimensional direction) according to a certain rule by using a certain specific geometric figure, is black-white and records data symbol information; the concept of "0" and "1" bit stream forming the logic foundation in computer is skillfully utilized in code formation, several geometric shapes corresponding to binary system are used to represent literal value information, and the information is automatically read by image input equipment or photoelectric scanning equipment so as to implement automatic information processing.
As shown in connection with fig. 1, a two-dimensional bar code is typically disposed in a two-dimensional rectangular area, including a coded area. The coding area is mainly used for storing specification information and code words of the two-dimensional bar code. The specification information may include at least one of format information and version information. The types of the specification information mainly depend on the versions of the two-dimensional bar codes, and different types of the specification information can be configured by the two-dimensional bar codes of different versions. Taking the example that the specification information includes format information and version information, the format information and the version information are generally stored in a rectangular area as shown in fig. 1. Version information of the two-dimensional bar code may be used to indicate the size of the two-dimensional bar code (or the number of symbols of the two-dimensional bar code). The format information of the two-dimensional bar code is generally used to store some formatting data, such as error correction level and mask information of the two-dimensional bar code. The error correction level of the two-dimensional bar code generally comprises L, M, Q, H levels.
Version information may be directly acquired through a version information area of the two-dimensional bar code as shown in fig. 1, and format information may be directly acquired through an upper left-hand format information area as shown in fig. 1, or acquired through a combination of an upper right-hand and lower left-hand format information area.
Referring to fig. 2, the barcode image provided by the application includes an interference image located in a central area of the barcode image, wherein the interference image is covered in the central area of the barcode image, that is, the interference image and the barcode image are in an overlapping state, and a geometric center of the interference image coincides with a geometric center of the barcode image. The interference image may be logo, for example, and the present application is illustrated with an interference image of a square in fig. 2. Taking the QR code as an example, the interference image is covered on the QR code, so that partial data of the QR code is lost, and the identification capability of the QR code is reduced. Therefore, the embodiment of the disclosure provides a decoding method for a bar code image, which reduces the influence of the reduced decoding performance of the bar code image caused by the reduced error correction capability of the bar code image due to an interference image as much as possible, and improves the recognition performance of the bar code image with the interference image in the central area.
In connection with the barcode image shown in fig. 2, an embodiment of the present disclosure provides a decoding method for the barcode image. The execution subject of the decoding method provided by the application can be a processor. As shown in fig. 3, the decoding method includes:
s301, the processor marks all errors in the data blocks of the bar code image as unknown errors.
Wherein the number of the data blocks is 1 or more, and the number of the data blocks is related to the version information of the bar code image and the error correction level. The types of errors in each data block include known errors and unknown errors.
S302, the processor determines an initial test area of the interference image.
The initial test area is set to 0, so that each data block of the bar code image can be accurately corrected under the condition that the area of the interference image is smaller.
S303, the processor determines unknown errors of each data block contained in the test area in a mode of expanding the test area layer by layer based on the initial test area.
Wherein errors in the test area that is expanded layer by layer are set as known errors.
In expanding the test area layer by layer, each data block may coincide with the expanded test area layer by layer. In the case where the data block coincides with the test area, the unknown errors in the data block may fall into the test area, and these unknown errors located in the test area are the unknown errors of the respective data blocks included in the test area.
S304, the processor converts the unknown errors in each data block contained in the test area into known errors.
And S305, the processor corrects the error of each converted data block in the bar code image.
Wherein, each data block is error corrected by using Reed-Solomon (RS) code, thereby realizing decoding of the barcode image.
In this embodiment, for a barcode image having an interference image in a central area, unknown errors contained in the test area in each data block are sequentially determined by a test area expanded layer by layer, and the unknown errors contained in the test area are converted into known errors. Because the error correction capability of the error correction algorithm on the known errors is larger than that on the unknown errors, the error correction capability of each data block can be improved without determining the actual coverage area of the interference image by converting the unknown errors contained in the test area into the known errors, so that the offset supporting capability of the bar code image is enhanced, and the recognition performance of the bar code image with the interference image in the central area is greatly improved.
Optionally, the processor determines the data block of the barcode image as follows: the processor obtains the bit stream data and the number of error correction blocks of the barcode image. The processor converts the bit stream data of the barcode image into 1 or more data blocks according to the number of error correction blocks.
Wherein the number of error correction blocks and the version information of the barcode image are related to the error correction level. Illustratively, table 1 shows a correspondence relationship of version information, error correction level, and the number of error correction blocks.
TABLE 1
Optionally, the processor converting the bit stream data of the barcode image into 1 or more data blocks according to the number of error correction blocks includes: the processor converts the bit stream data of the bar code image into data blocks with the same number as the error correction blocks, so that the bar code image can be decoded conveniently.
Optionally, the processor determining the unknown error of each data block contained in the test area in a layer-by-layer expanding the test area includes: the processor determines the unknown errors of the data blocks contained in the test area in a layer-by-layer expansion manner until the test area is the largest test area.
Wherein the maximum test area and the version information of the barcode image are related to the error correction level.
In this embodiment, the decoding threshold for the barcode image with the interference image in this version is determined by setting the maximum test area. In the case where the area of the interference image is larger than the area of the maximum test area, it is determined that the decoding of the barcode image will fail. Therefore, the test area is expanded layer by layer in the range of the maximum test area for testing, and the decoding efficiency of the bar code image is further improved.
Optionally, the maximum test area is determined as follows: version information and error correction level of the bar code image are obtained. And collecting the complete pollution-free control bar code image with the same version information and error correction level as the bar code image. Errors in the control test area are set as known errors in a manner that enlarges the control test area layer by layer. Decoding the control bar code image containing the control test area. And under the condition that the decoding of the comparison bar code image fails, determining the corresponding comparison test area as the maximum test area when the decoding of the comparison bar code image fails.
Optionally, setting the error in the control test area to be a known error comprises: an initial value of the control test area is set. And setting the error in the control test area as a known error based on the initial value of the control test area and the full black or full white control test area expanded layer by layer in the center of the control barcode image.
Illustratively, the initial value of the control test area is set to 0.
Optionally, the control test area of full black or full white expanded layer by layer based on the initial value of the control test area and the center of the control barcode image comprises: setting the center coincidence of the control test area and the control bar code image, and expanding the control test area layer by layer on the basis of the initial value of the control test area.
Illustratively, as shown in fig. 4, the step of determining the maximum test area is specifically described:
s401, obtaining version information and error correction level of the bar code image.
S402, acquiring a complete non-stained bar code image with the same version information and error correction level as the bar code image, and taking the complete non-stained bar code image as a control bar code image.
S403, initializing the side length of the control test area so that q=0.
Where q is the side length of the control test area, q=0, 1, 2, … ….
S404, setting the data in the q multiplied by q area of the control bar code image to be full black or full white.
Wherein the control barcode image coincides with the center of the q×q region.
S405, setting the data in the q multiplied by q area as the known error, and obtaining a control bar code image with q multiplied by q control test area.
S406, decoding the control bar code image with q multiplied by q control test area.
S407, determine whether decoding of the control barcode image is successful? If yes, go to S408; if not, the process advances to S409.
S408, assigning the value of q+1 to q, and returning to the step S404.
S409, determining q corresponding to decoding failure as the side length of the maximum test area of the bar code image, and calculating the maximum test area of the bar code image according to q.
In this embodiment, the control barcode image can support the largest area of the interference image, i.e., the largest test area, because the barcode image is in a complete, non-stained state. In this way, the maximum test area is obtained in the mode, and a critical value is given to the test area in advance, so that the test area is expanded layer by layer in the maximum test area, and the decoding time of the bar code image is shortened.
Optionally, q corresponding to the decoding failure is marked as N. Where N is the side length of the largest test area. Obtaining a plurality of bar code images with different version information and different error correction levels, sequentially obtaining a plurality of version information and the side length N of the largest test area corresponding to the bar code images with the plurality of error correction levels according to the step of determining the largest test area, establishing a lookup table with the corresponding relation between the N and the version information and the error correction level of the bar code images, and obtaining the N in a query mode. The value of N can be directly obtained by pre-establishing a lookup table with a corresponding relation, the area of the maximum test area is directly obtained by the value of N, the work of determining the maximum test area by repeated operation is not needed, and the workload is reduced.
Optionally, the processor performing error correction on each data block of the barcode image includes: the processor obtains an actual value of the number of unknown errors in each data block. The processor determines an upper limit for the number of unknown errors corresponding to each data block. The processor determines that the data block error correction is successful if the actual value of the number of unknown errors is less than or equal to the upper limit value of the number of unknown errors. The processor determines that the data block fails to correct the error if the actual value of the number of unknown errors is greater than the upper limit value of the number of unknown errors.
In this embodiment, the number of unknown errors in each data block is reduced because the unknown errors contained in the test area in that data block are all translated into known errors. Since the error correction capability of the employed RS error correction algorithm for the known error is superior to that for the unknown error, in this case, if the number of unknown errors can be reduced to be less than or equal to the upper limit value of the number of unknown errors corresponding to the data block, it can be determined that the data block can be successfully corrected.
Illustratively, as shown in fig. 5, the steps of correcting the error of each converted data block in the barcode image are specifically described as follows:
s501, initializing i=0, n=0, and marking all errors in the data blocks as unknown errors.
Wherein i is the serial number of the data block, i=0, … …, M-1, M is the total number of the data blocks, N is the test side length of the interference image of the barcode image, n=0, … …, N-1, N is the maximum test side length of the interference image of the barcode image, and N is equal to q corresponding to the decoding failure in the step of determining the maximum test area.
S502, calculating the area n multiplied by n of the test area of the interference image of the bar code image, and marking the error in the test area of the interference image of the bar code image as a known error.
S503, error correction is carried out on the ith data block.
S504, determine whether the error correction of the i-th data block is successful? If yes, go to S505; if not, the process advances to S507.
S505, judging whether i < M? If yes, go to S506; if not, ending.
S506, setting n=0, assigning the value of i+1 to i, and returning to step S502.
S507, judging whether N < N? If yes, go to S508; if not, ending.
S508, assigning the value of n+1 to n, and returning to the step S502.
In this embodiment, error correction is performed for each data block in turn. For example: the test area is set to 0 first, and error correction is performed on the 1 st data block. Under the condition that the error correction of the 1 st data block is successful, if the number of the data blocks is 1, determining that the decoding of the bar code image is successful; if the number of data blocks is plural, error correction is continued for the 2 nd data block … …. In the case of failure in error correction of the 1 st data block, the area of the test area is enlarged to 1, and error correction of the 1 st data block is continued until the 1 st data block is successfully error-corrected … ….
Optionally, the processor determines an upper limit value of the number of unknown errors corresponding to each data block, including calculating the upper limit value of the number of unknown errors corresponding to each data block according to the following formula:
r=(k-p)/2
where r is an upper limit value of the number of unknown errors in each data block, k is an upper limit value of error correction capability of each data block, and p is the number of known errors in each data block.
The upper limit value of the error correction capability of each data block is related to the version information and the error correction level of the barcode image. Illustratively, table 2 shows a correspondence relationship of version information, error correction level, and error correction capability upper limit value.
TABLE 2
In this embodiment, in the case of determining the version information and the error correction level of the barcode image, the error correction capability upper limit value of each data block of the barcode image, which defines the unknown error number and the known error number that the data block can support error correction, can be obtained in the above-described manner. As known from the RS error correction algorithm, in the case of converting an unknown error in a data block into a known error, i.e., the number of unknown errors in the data block decreases, the number of known errors increases, so that the value of the error correction capability decreases. And determining that the data block can be successfully corrected under the condition that the value of the error correction capability is smaller than or equal to the upper limit value of the error correction capability. Thus, an upper limit value of the number of unknown errors is obtained from the known number of errors and the upper limit value of the error correction capability of the data block, thereby determining the result of the data block from the upper limit value of the unknown errors in the data block. The disclosed embodiments further enhance the fouling support capability of the barcode image by converting conditional unknown errors to known errors.
As shown in connection with fig. 6, another decoding method for barcode images is provided in an embodiment of the present disclosure. The decoding method comprises the following steps:
s601, the processor marks all errors in the data block of the bar code image as unknown errors.
Wherein the number of the data blocks is 1 or more, and the number of the data blocks is related to the version information of the bar code image and the error correction level. The types of errors in each data block include known errors and unknown errors.
S602, the processor determines an initial test area of the interference image.
The initial test area is set to 0, so that the barcode image can be accurately decoded under the condition that the area of the interference image in the central area of the barcode image is smaller.
S603, the processor determines an unknown error of each data block included in the test area in a layer-by-layer expansion manner of the test area based on the initial test area.
S604, the processor converts the unknown errors in each data block contained in the test area into known errors.
S605, the processor corrects the error of each converted data block in the bar code image.
S606, the processor determines that the decoding of the bar code image is successful under the condition that all the data blocks are successfully corrected.
S607, the processor determines that the decoding of the bar code image fails under the condition that the error correction of the data block fails.
In this embodiment, the decoding result of the barcode image is determined by the error correction results of all the data blocks to realize decoding of the barcode image.
As shown in connection with fig. 7, an embodiment of the present disclosure provides a decoding apparatus 200 for bar code images, including a processor (processor) 100 and a memory (memory) 101. Optionally, the apparatus may further comprise a communication interface (Communication Interface) 102 and a bus 103. The processor 100, the communication interface 102, and the memory 101 may communicate with each other via the bus 103. The communication interface 102 may be used for information transfer. The processor 100 may call logic instructions in the memory 101 to perform the decoding method for barcode images of the above-described embodiments.
The embodiment of the disclosure provides an electronic device, comprising: the electronic equipment body and the decoding device for the bar code image. A decoding device for a bar code image is mounted to an electronic device body. The mounting relationship described herein is not limited to being placed inside the electronic device, but also includes mounting connections with other components of the electronic device, including but not limited to physical connections, electrical connections, or signal transmission connections, etc. Those skilled in the art will appreciate that the decoding means for bar code images may be adapted to a viable electronic device body, thereby enabling other viable embodiments.
Embodiments of the present disclosure provide a computer-readable storage medium storing computer-executable instructions configured to perform the above-described method for decoding a barcode image.
The computer readable storage medium may be a transitory computer readable storage medium or a non-transitory computer readable storage medium.
Embodiments of the present disclosure may be embodied in a software product stored on a storage medium, including one or more instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of a method according to embodiments of the present disclosure. And the aforementioned storage medium may be a non-transitory storage medium including: a plurality of media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or a transitory storage medium.
The above description and the drawings illustrate embodiments of the disclosure sufficiently to enable those skilled in the art to practice them. Other embodiments may involve structural, logical, electrical, process, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the sequence of operations may vary. Portions and features of some embodiments may be included in, or substituted for, those of others. Moreover, the terminology used in the present application is for the purpose of describing embodiments only and is not intended to limit the claims. As used in the description of the embodiments and the claims, the singular forms "a," "an," and "the" (the) are intended to include the plural forms as well, unless the context clearly indicates otherwise. Similarly, the term "and/or" as used in this disclosure is meant to encompass any and all possible combinations of one or more of the associated listed. Furthermore, when used in the present disclosure, the terms "comprises," "comprising," and/or variations thereof, mean that the recited features, integers, steps, operations, elements, and/or components are present, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. Without further limitation, an element defined by the phrase "comprising one …" does not exclude the presence of other like elements in a process, method or apparatus comprising such elements. In this context, each embodiment may be described with emphasis on the differences from the other embodiments, and the same similar parts between the various embodiments may be referred to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method sections disclosed in the embodiments, the description of the method sections may be referred to for relevance.
Those of skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. The skilled artisan may use different methods for each particular application to achieve the described functionality, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the embodiments disclosed herein, the disclosed methods, articles of manufacture (including but not limited to devices, apparatuses, etc.) may be practiced in other ways. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the units may be merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. In addition, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form. The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to implement the present embodiment. In addition, each functional unit in the embodiments of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. In the description corresponding to the flowcharts and block diagrams in the figures, operations or steps corresponding to different blocks may also occur in different orders than that disclosed in the description, and sometimes no specific order exists between different operations or steps. For example, two consecutive operations or steps may actually be performed substantially in parallel, they may sometimes be performed in reverse order, which may be dependent on the functions involved. Each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

Claims (10)

1. A decoding method for a bar code image is characterized in that the bar code image comprises an interference image positioned in the center area of the bar code image; the decoding method comprises the following steps:
marking errors in the data blocks of the bar code image as unknown errors; wherein the number of data blocks is 1 or more;
determining an initial test area of the interference image;
determining unknown errors of all data blocks contained in the test area in a mode of expanding the test area layer by layer based on the initial test area;
converting unknown errors in each data block contained in the test area into known errors;
and correcting the error of each converted data block in the bar code image.
2. The decoding method of claim 1, wherein the data blocks of the barcode image are determined as follows:
obtaining bit stream data and error correction block quantity of a bar code image;
and converting bit stream data of the bar code image into 1 or more data blocks according to the number of error correction blocks.
3. The decoding method according to claim 1, wherein determining the unknown error of each data block included in the test area in a layer-by-layer expansion manner of the test area comprises:
determining unknown errors of all data blocks contained in the test area in a mode of expanding the test area layer by layer until the test area is the maximum test area;
wherein the maximum test area and the version information of the barcode image are related to the error correction level.
4. A decoding method according to claim 3, characterized in that the maximum test area is determined in the following way:
obtaining version information and error correction level of the bar code image;
collecting a complete pollution-free control bar code image with the same version information and error correction level as the bar code image;
setting errors in the control test area as known errors in a manner of expanding the control test area layer by layer;
decoding a control barcode image containing a control test area;
and under the condition that the decoding of the comparison bar code image fails, determining the corresponding comparison test area as the maximum test area when the decoding of the comparison bar code image fails.
5. The decoding method of claim 4, wherein setting the error in the control test area to be a known error comprises:
setting an initial value of a comparison test area;
and setting the error in the control test area as a known error based on the initial value of the control test area and the full black or full white control test area expanded layer by layer in the center of the control barcode image.
6. The decoding method according to any one of claims 1 to 5, wherein error correction is performed on each data block of the barcode image, comprising:
obtaining actual values of the number of unknown errors in each data block;
determining an upper limit value of the number of unknown errors corresponding to each data block;
under the condition that the actual value of the unknown error quantity is smaller than or equal to the upper limit value of the unknown error quantity, determining that the data block error correction is successful;
and determining that the data block fails to correct the error when the actual value of the unknown error number is greater than the upper limit value of the unknown error number.
7. The decoding method of claim 6, wherein determining an upper limit of the number of unknown errors for each data block comprises calculating the upper limit of the number of unknown errors for each data block according to the following formula:
r=(k-p)/2
where r is an upper limit value of the number of unknown errors in each data block, k is an upper limit value of error correction capability of each data block, and p is the number of known errors in each data block.
8. The decoding method according to any one of claims 1 to 5, further comprising:
under the condition that all data blocks are successful in error correction, determining that the decoding of the bar code image is successful;
and under the condition that the error correction of the data block fails, determining that the decoding of the bar code image fails.
9. A decoding device for a barcode image comprising a processor and a memory storing program instructions, characterized in that the processor is configured to perform the decoding method for a barcode image according to any of claims 1 to 8 when said program instructions are run.
10. An electronic device, comprising:
an electronic device body; and, a step of, in the first embodiment,
the decoding device for barcode image according to claim 9, mounted on the electronic apparatus body.
CN202311023040.3A 2023-08-15 2023-08-15 Decoding method and device for bar code image and electronic equipment Active CN116739022B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311023040.3A CN116739022B (en) 2023-08-15 2023-08-15 Decoding method and device for bar code image and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311023040.3A CN116739022B (en) 2023-08-15 2023-08-15 Decoding method and device for bar code image and electronic equipment

Publications (2)

Publication Number Publication Date
CN116739022A true CN116739022A (en) 2023-09-12
CN116739022B CN116739022B (en) 2023-11-07

Family

ID=87919045

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311023040.3A Active CN116739022B (en) 2023-08-15 2023-08-15 Decoding method and device for bar code image and electronic equipment

Country Status (1)

Country Link
CN (1) CN116739022B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117350317A (en) * 2023-12-05 2024-01-05 北京紫光青藤微系统有限公司 Decoding method and device for bar code image and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100155464A1 (en) * 2008-12-22 2010-06-24 Canon Kabushiki Kaisha Code detection and decoding system
JP2013030185A (en) * 2008-03-27 2013-02-07 Denso Wave Inc Two-dimensional code, two-dimensional code generating method, computer readable program for displaying two-dimensional code, authentication method using two-dimensional code, and information providing method using two-dimensional code
CN103377390A (en) * 2012-04-26 2013-10-30 阿里巴巴集团控股有限公司 Method and device for generating and recognizing two-dimension code
CN106127276A (en) * 2016-06-27 2016-11-16 福建联迪商用设备有限公司 A kind of quantization is stained the method and system of QRCode
CN113822091A (en) * 2021-11-23 2021-12-21 北京紫光青藤微系统有限公司 Method and device for correcting errors of two-dimensional code pattern, electronic equipment and storage medium
CN116562318A (en) * 2023-01-29 2023-08-08 西安富立叶微电子有限责任公司 Encoding format detection method and device based on PDA terminal and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013030185A (en) * 2008-03-27 2013-02-07 Denso Wave Inc Two-dimensional code, two-dimensional code generating method, computer readable program for displaying two-dimensional code, authentication method using two-dimensional code, and information providing method using two-dimensional code
US20100155464A1 (en) * 2008-12-22 2010-06-24 Canon Kabushiki Kaisha Code detection and decoding system
CN103377390A (en) * 2012-04-26 2013-10-30 阿里巴巴集团控股有限公司 Method and device for generating and recognizing two-dimension code
CN106127276A (en) * 2016-06-27 2016-11-16 福建联迪商用设备有限公司 A kind of quantization is stained the method and system of QRCode
CN113822091A (en) * 2021-11-23 2021-12-21 北京紫光青藤微系统有限公司 Method and device for correcting errors of two-dimensional code pattern, electronic equipment and storage medium
CN116562318A (en) * 2023-01-29 2023-08-08 西安富立叶微电子有限责任公司 Encoding format detection method and device based on PDA terminal and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LADISLAV KARRACH等: "Identification of QR Code Perspective Distortion Based on Edge Directions and Edge Projections Analysis", 《JOURNAL OF IMAGING》 *
王员云;曾凤生;: "基于图像处理的手机二维码识别的研究", 乐山师范学院学报, no. 08 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117350317A (en) * 2023-12-05 2024-01-05 北京紫光青藤微系统有限公司 Decoding method and device for bar code image and electronic equipment
CN117350317B (en) * 2023-12-05 2024-03-26 北京紫光青藤微系统有限公司 Decoding method and device for bar code image and electronic equipment

Also Published As

Publication number Publication date
CN116739022B (en) 2023-11-07

Similar Documents

Publication Publication Date Title
CN116739022B (en) Decoding method and device for bar code image and electronic equipment
US6031938A (en) Image encoding apparatus with selective Markov and predictive coding
US5412196A (en) Method and apparatus for decoding bar code images using multi-order feature vectors
EP2393038A1 (en) Matrix-type two-dimensional barcode decoding chip and decoding method thereof
CN111539502B (en) Anti-counterfeiting two-dimensional code generation method and device, server and storage medium
CN113313226B (en) Method and device for determining DM code version information, equipment and storage medium
CN113673655B (en) Method and device for determining decoding direction of two-dimensional code, electronic equipment and medium
CN104579360A (en) Method and equipment for data processing
CN112733568B (en) One-dimensional bar code recognition method, device, equipment and storage medium
JP4460903B2 (en) ID mark recognition method for semiconductor wafer
CN114492706B (en) Method and device for estimating module size of DM (direct memory access) code, decoding equipment and storage medium
CN104217189A (en) Self-learning identification method of barcode used for test strip
CN109977715B (en) Two-dimensional code identification method based on contour identification and two-dimensional code
JP4978879B2 (en) Two-dimensional code generation system and two-dimensional code generation program
CN112783971B (en) Transaction recording method, transaction query method, electronic device and storage medium
CN114970464A (en) Method, device, terminal equipment and storage medium for generating identification
CN111818141A (en) Method, system, device, terminal and storage medium for transmitting file
CN114168871A (en) Method and device for page jump, electronic equipment and storage medium
CN103200312A (en) Method for writing international mobile equipment identity (IMEI) codes quickly for multiple-card mobile phone
CN117350317B (en) Decoding method and device for bar code image and electronic equipment
CN115345131A (en) Method and device for constructing hierarchical relationship tree and electronic equipment
CN112530522A (en) Sequence error correction method, device, equipment and storage medium
CN116451721B (en) Method and device for decoding, electronic equipment and storage medium
JP4905767B2 (en) Two-dimensional code detection system and two-dimensional code detection program
CN107391583B (en) Method and system for converting website login log information into vectorized data

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