CN114386552B - Bar code generating and reading method and device and computer readable storage medium - Google Patents

Bar code generating and reading method and device and computer readable storage medium Download PDF

Info

Publication number
CN114386552B
CN114386552B CN202111628221.XA CN202111628221A CN114386552B CN 114386552 B CN114386552 B CN 114386552B CN 202111628221 A CN202111628221 A CN 202111628221A CN 114386552 B CN114386552 B CN 114386552B
Authority
CN
China
Prior art keywords
color
bar code
colors
data
printing primary
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
CN202111628221.XA
Other languages
Chinese (zh)
Other versions
CN114386552A (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.)
Alva Systems
Original Assignee
Alva Systems
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 Alva Systems filed Critical Alva Systems
Priority to CN202111628221.XA priority Critical patent/CN114386552B/en
Publication of CN114386552A publication Critical patent/CN114386552A/en
Application granted granted Critical
Publication of CN114386552B publication Critical patent/CN114386552B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06046Constructional details
    • G06K19/0614Constructional details the marking being selective to wavelength, e.g. color barcode or barcodes only visible under UV or IR
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

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

Abstract

Embodiments of the present disclosure provide barcode generation, reading methods, apparatuses, and computer-readable storage media. The method comprises the following steps: selecting a printing primary color; combining the printing primary colors to obtain a plurality of colors serving as preset bar code ribbon colors and recording the combination coefficients of the colors; selecting a corresponding number of available colors from the preset colors according to the number of colors required by the bar code color bands, and distributing the colors to the corresponding color bands; generating a bar code data area and a verification area; wherein the data area comprises a data ribbon with coded data identifying a bar code; the verification area includes a print primary color patch. In this way, the interference of environmental factors can be reduced, correction is not needed, the operation amount is reduced, and the accuracy of reading the bar code is improved.

Description

Bar code generating and reading method and device and computer readable storage medium
Technical Field
The present disclosure relates to the field of image generation and recognition technologies, and in particular, to the field of barcode generation and reading methods and apparatuses, and computer readable storage media.
Background
In the image generation and recognition process, the image of the bar code can be shot by the camera to recognize, and the information corresponding to the bar code is judged. However, the method needs to strictly control the illumination condition and reduce the interference of the camera so as to accurately restore the color of the bar code. When the gray bar code is identified, the obtained image is required to be corrected, the processing steps are complex, and the calculated amount is large.
Disclosure of Invention
The present disclosure provides a method, apparatus, device and storage medium for generating and reading bar codes and a computer readable storage medium.
According to a first aspect of the present disclosure, a barcode generation method is provided. The method comprises the following steps:
selecting a printing primary color;
combining the printing primary colors to obtain a plurality of colors serving as preset bar code ribbon colors and recording the combination coefficients of the colors;
selecting a corresponding number of available colors from the preset colors according to the number of colors required by the bar code color bands, and distributing the colors to the corresponding color bands;
generating a bar code data area and a verification area; wherein the data area comprises a data ribbon with coded data identifying a bar code; the verification area includes a print primary color patch.
According to a second aspect of the present disclosure, a barcode reading method is provided. Wherein, the bar code is generated by a bar code generating method, and the method comprises the following steps:
acquiring an image of a bar code, extracting the colors of each data color band and each printing primary color block of the bar code from the image, and judging the colors of each printing primary color block;
approximating the colors of the data color bands in the image by using the combination of the colors of the color blocks of each printing primary color to respectively obtain fitting coefficients of the data color bands;
and comparing the fitting coefficient of each data color band with a preset bar code color band combination coefficient, and taking the available color corresponding to the bar code color band combination coefficient closest to the fitting coefficient as a color reading result of the corresponding data color band.
According to a third aspect of the present disclosure, a bar code reading apparatus is provided. The device comprises:
the extraction module is used for acquiring an image of the bar code and extracting the colors of each data color band and each printing primary color block of the bar code from the image; judging the color of each printing primary color block;
the fitting module is used for approximating the colors of the data color bands in the image by using the combination of the colors of the color blocks of the printing primary colors to respectively obtain fitting coefficients of the data color bands;
and the judging module compares the fitting coefficient of each data color band with a preset bar code color band combination coefficient, and takes the available color corresponding to the bar code color band combination coefficient closest to the fitting coefficient as a color judging result of the corresponding data color band.
According to a fourth aspect of the present disclosure there is provided an electronic device comprising a memory and a processor, the memory having stored thereon a computer program, the processor implementing a method according to the first and/or second aspects of the present disclosure when executing the program.
According to a fifth aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor implements a method according to the first and/or second aspects of the present disclosure.
According to the embodiment of the disclosure, the accuracy and stability of bar code reading can be remarkably improved.
It should be understood that what is described in this summary is not intended to limit the critical or essential features of the embodiments of the disclosure nor to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The above and other features, advantages and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. For a better understanding of the present disclosure, and without limiting the disclosure thereto, the same or similar reference numerals denote the same or similar elements, wherein:
FIG. 1 illustrates a flow chart of an exemplary barcode generation method according to an embodiment of the present disclosure;
FIG. 2 illustrates a flow chart of an exemplary barcode reading method according to an embodiment of the present disclosure;
FIG. 3 illustrates a block diagram of an exemplary barcode reading device according to an embodiment of the present disclosure;
fig. 4 illustrates a block diagram of an exemplary electronic device capable of implementing embodiments of the present disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are some embodiments of the present disclosure, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments in this disclosure without inventive faculty, are intended to be within the scope of this disclosure.
In addition, the term "and/or" herein is merely an association relationship describing an association object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
According to the method and the device for generating the barcode color bar, the barcode data area and the calibration area are generated by combining the printing primary colors, so that the generated barcode data area and the calibration area are located in the same environment in the reading process, the problem of interpretation errors of the barcode color bar caused by the influence of ambient light or color cast of a camera is effectively solved, the accuracy is improved, correction of an obtained image is not needed, and the operation amount is reduced.
Fig. 1 shows a flowchart of an exemplary barcode generation method 100 according to an embodiment of the present disclosure. The barcode generation method 100 includes:
step S110: the primary printing colors are selected.
In some embodiments, the printing primary color patches are printing primary colors, printing secondary colors, or printing secondary color patches. More color combinations can be constructed by using a plurality of printing primary colors, so that the color types of the bar code color bands are enriched, and the degree of distinction between the color bands is increased.
In some embodiments, the three primary colors are printed magenta, yellow, and cyan, the four primary colors are printed magenta, yellow, cyan, and black, and the six primary colors are printed cyan, magenta, yellow, black, orange, and green.
Step S120: and combining the printing primary colors to obtain a plurality of colors serving as preset bar code ribbon colors, and recording the combination coefficients of the colors.
In some embodiments, the printing primaries are convex linearly combined to obtain a plurality of colors as the preset bar code ribbon colors.
Assuming that x1, x2,..xn is a set of color combinations, n represents the color category, a1, a2,., an is n constants, each constant is not less than 0, and a1+.+ an=1 is satisfied, a1x1+.+ anxn is referred to as x1,., a convex linear combination of xn.
The method for performing convex linear combination on the printing primary colors can set more colors as preset colors or optional colors of the bar code color bands, is convenient for identifying various colors possibly appearing in the bar code color bands, and improves reading accuracy.
Step S130: and selecting a corresponding number of available colors from the preset colors to be allocated to the corresponding color bands according to the number of colors required by the bar code color bands.
The main content of the bar code is the color band combination of various numbers and letters corresponding to various color values formulated according to the coding rule, and when the bar code is printed, whether the numbers or letter characters represented by the corresponding data color bands are displayed can be set according to the requirement. In practical applications, the bar code coding can be performed by using the combination of the numbers 0-9, and a designated color value is correspondingly set for each number. The coding rules are formulated according to the applied industry and article category and the user requirement. The corresponding data bands may also be labeled with letters or a combination of numbers and letters as desired.
For example, in library application, 9-digit combinations of 1-9 are selected for encoding, and books are classified, managed and ordered according to the following encoding rule:
corresponding to book scenes, the 1-3 bits on the bar code are used for corresponding to each sub-library, the 4 th and 5 th bits are used for corresponding to the classification of books, and the 6 th to 9 th bits are corresponding to the book storage bookshelf and the storage position sequence on the bookshelf.
In some embodiments, bar code color bands with different widths and different colors can be provided, bar code color band information is identified through the colors and the widths, and the bar code information amount is increased. In this case, in addition to the steps mentioned in step S130, at least the following steps are added:
setting the range of different bar code color band widths, distributing the width to the corresponding color band, and recording the preset color band color and width information.
At this time, the bar code color band includes two kinds of information, namely color and width, and the contents of the two kinds of information, such as one representative position information and the other representative kind information, can be set according to actual needs.
In step S130, at least two of the following cases may also occur:
(1) The colors of the bar code color bars are different from each other, and the number of the colors required by the bar code color bars is the number of the bar code color bars;
(2) At least 2 color bands with the same color exist in the bar code color bands, and at the moment, the color is selected from preset colors according to the color types of the color bands and is distributed to the corresponding color bands.
In order to further improve the differentiation of the colors of the bar code color bars and avoid the problems of similar colors and difficult differentiation of images acquired later, in some embodiments, N groups of convex linear combination coefficients with the largest distance in any convex linear combination are taken as the colors of the bar code color bars, wherein N is the number of the bar code color bars.
The maximum distance means that the distance of the convex linear combination coefficients in the space is larger, which means that the colors corresponding to different convex linear combination coefficients have larger difference, after being distributed to the corresponding color bands, the color difference among the color bands is obvious, the color of each color band in the obtained bar code color band image is also obviously different, and the identification accuracy is improved.
Step S140: generating a bar code data area and a verification area; wherein the data area comprises a data ribbon with coded data identifying a bar code; the verification area includes a print primary color patch.
In some embodiments, color and location information for each of the print primary color patches of the verification area is recorded, or a color difference, such as a luminance or pixel difference, for each of the print primary color patches of the verification area is recorded.
In some embodiments, the colors in the data bands correspond to corresponding characters, facilitating storage of image information.
The verification area is an independent area and is located on one side of the barcode data area, such as the upper side, the lower side, the left side or the right side of the barcode data area, or each printing primary color block in the verification area is located on a different corner of the barcode data area. The primary color blocks are printed in the check area in 3 numbers and distributed on 3 corners of the bar code data area, the primary color blocks are printed in the check area in 4 numbers and distributed on 4 corners of the bar code data area, and the primary color blocks are printed in the check area in 6 numbers and distributed on 4 corners of the bar code data area, at least one corner contains more than 2 color blocks.
Fig. 2 illustrates a flow chart of an exemplary barcode reading method 200 according to an embodiment of the present disclosure. The bar code reading method 200 includes:
step S210: acquiring an image of a bar code, extracting the colors of each data color band and each printing primary color block of the bar code from the image, and judging the colors of each printing primary color block;
in some embodiments, the method of determining the color of each of the printing primary color patches includes one of the following methods:
(1) The method can eliminate the color change caused by light or a camera according to the color of each printing primary color block in the acquired image and the position information of each printing primary color block recorded in the bar code generation method.
(2) The color of each printed primary color patch on the acquired image is directly identified. Although the color change may occur, since the bar code is not large in size, the changes generated by the environmental influences on the colors of the printing primary color blocks and the bar code color bars on the bar code are approximately the same, and even if the colors of the printing primary color blocks change greatly, the true colors of the bar code color bars can be directly read through subsequent processing.
(3) The color difference, such as brightness or pixel difference, of each printing primary color patch on the acquired image is judged, compared with the brightness or pixel difference of each printing primary color patch in the pre-recorded verification area, and the colors of each printing primary color patch on the acquired image are determined according to the order of brightness or pixels from large to small or from small to large.
In some embodiments, the printing primary color patches are printing primary colors, printing secondary colors, or printing secondary color patches. More color combinations can be constructed by using a plurality of printing primary colors, so that the color types of the bar code color bands are enriched, and the degree of distinction between the color bands is increased.
In some more specific embodiments, the printing three primary colors are magenta, yellow, and cyan, the four primary colors are magenta, yellow, cyan, and black, and the six primary colors are cyan, magenta, yellow, black, orange, and green.
Step S220: the combination of the colors of all the printing primary color blocks approximates the colors of all the data color bands in the image, and fitting coefficients of all the data color bands are obtained respectively.
In some embodiments, the printing primaries are convex linearly combined to obtain a plurality of colors as the preset bar code ribbon colors.
In some embodiments, the method for obtaining the fitting coefficient is to perform convex linear fitting on the color of each printing primary color block, so that the color obtained by the convex linear fitting approximates the color of each data color band in the image, and the convex linear fitting coefficient of each data color band is obtained.
In some embodiments, when the data bands include color and width information, the colors of the respective printing primary color patches are subjected to convex linear fitting, so that the colors obtained by the convex linear fitting approximate the colors of the respective data bands in the image, and convex linear fitting coefficients of the respective data bands are obtained. Width information of each data band on the acquired image is identified.
Step S230: and comparing the fitting coefficient of each data color band with a preset bar code color band combination coefficient, and taking the available color corresponding to the bar code color band combination coefficient closest to the fitting coefficient as a color reading result of the corresponding data color band.
Because the available color, the combination coefficient and the width data of the bar code color bands are pre-stored when the bar code is generated, the fitting coefficient of each data color band can be directly compared with the preset bar code color band combination coefficient, or the fitting coefficient and the width information of each data color band can be compared with the preset bar code color band combination coefficient and the width information to be used as the reading result of the corresponding data color band.
According to the method and the device for extracting the colors of the data color bands and the printing primary color blocks of the bar code on one image, the colors of all parts of the bar code are approximately the same due to the fact that the conditions of a photographing process are the same and the bar code is small, changes caused by the influence of the environment on all parts of the bar code can be eliminated through subsequent processing, so that interference of light and camera factors is reduced, real color information of the bar code color bands is directly read, additional correction balance steps are not needed, and the operation amount is reduced. In practice, the fitting coefficients and the combining coefficients may be the same or may be different. Therefore, in order to determine the color of the bar code, the fitting coefficient and the preset bar code color bar combination coefficient can be compared, and the available color corresponding to the bar code color bar combination coefficient closest to the fitting coefficient is taken as the color reading result of the corresponding data color bar, so that the reading accuracy can be further improved.
Some embodiments further include a barcode recognition step after step S230: and obtaining the recognition result of the bar code according to the color reading result of the corresponding data color band. And the information obtained by the comprehensive color reading result is used as bar code information to be stored or analyzed.
In some embodiments, the identification result of the bar code is obtained according to the obtained color and/or width information of each data color band and the bar code coding character.
In some embodiments, the identification result of the bar code is obtained according to the color and width reading result of the corresponding data color band. The recognition result comprises character data, wherein the character data can reflect bar code ribbon information, the bar code ribbon information corresponds to book scenes, 1-3 bits on the bar code are used for corresponding to each sub-library, the 4 th bit and the 5 th bit are used for corresponding to the classification of books, and the 6 th bit to the 9 th bit are corresponding to book storage shelves and storage position sequences on the shelves.
According to the embodiment of the disclosure, the following technical effects are achieved:
ambient light changes or camera color shift can be seen as additive shifts in the original color. The bar code is provided with the printing primary color blocks, and the size of the bar code is smaller, and the color offset on the printing primary color blocks and the color offset on the bar code color band can be considered to be approximately equal, so that the offset can be automatically eliminated in convex linear fitting, and the step of selecting the combination coefficient closest to the fitting coefficient as the bar code color band identification result by combining the comparison result of the combination coefficient is performed, thereby effectively solving the problem of bar code color band reading error caused by the influence of ambient light or camera color deviation.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present disclosure is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present disclosure. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all alternative embodiments, and that the acts and modules referred to are not necessarily required by the present disclosure.
The foregoing is a description of embodiments of the method, and the following further describes embodiments of the present disclosure through examples of apparatus.
Fig. 3 illustrates a block diagram of an exemplary barcode reading device 300 according to an embodiment of the present disclosure.
As shown in fig. 3, the apparatus 300 includes:
the extraction module 310 is configured to obtain an image of a barcode, extract colors of each data color band and each printing primary color block of the barcode from the image, and determine the color of each printing primary color block;
a fitting module 320, configured to approximate the colors of the data color bands in the image with the combination of the colors of the color blocks of each printing primary color, and obtain fitting coefficients of the data color bands respectively;
the judging module 330 compares the fitting coefficient of each data color band with a preset barcode color band combination coefficient, and takes the available color corresponding to the barcode color band combination coefficient closest to the fitting coefficient as a color interpretation result of the corresponding data color band.
The bar code reading device disclosed by the embodiment can reduce the operation amount, reduce the environmental interference and accurately read bar code information.
In the extraction module 310 of some embodiments, the method of determining the color of each print primary color patch includes one of the following methods:
(1) The method can eliminate the color change caused by light or a camera according to the color of each printing primary color block in the acquired image and the position information of each printing primary color block recorded in the bar code generation method.
(2) The color of each printed primary color patch on the acquired image is directly identified. Although a color change may occur, the color of each of the printing primary color patches is not completely changed due to the small change, and thus each color can be distinguished from the image.
(3) The color difference, such as brightness or pixel difference, of each printing primary color patch on the acquired image is judged, compared with the brightness or pixel difference of each printing primary color patch in the pre-recorded verification area, and the colors of each printing primary color patch on the acquired image are determined according to the order of brightness or pixels from large to small or from small to large.
In some embodiments, the extraction module 310, the printing primary color patches are printing primary colors, printing secondary colors, or printing secondary color patches. More color combinations can be constructed by using a plurality of printing primary colors, so that the color types of the bar code color bands are enriched, and the degree of distinction between the color bands is increased.
In the fitting module 320 of some embodiments, the printing primaries are convex linearly combined to obtain a plurality of colors as the preset bar code ribbon colors.
In some embodiments, the method for obtaining the fitting coefficient is to perform convex linear fitting on the color of each printing primary color block, so that the color obtained by the convex linear fitting approximates the color of each data color band in the image, and the convex linear fitting coefficient of each data color band is obtained.
In some embodiments, when the data bands include color and width information, the colors of the respective printing primary color patches are subjected to convex linear fitting, so that the colors obtained by the convex linear fitting approximate the colors of the respective data bands in the image, and convex linear fitting coefficients of the respective data bands are obtained. Width information of each data band on the acquired image is identified.
In the judging module 330 of some embodiments, the available color, the combination coefficient and the width data of the barcode ribbon are pre-stored when the barcode is generated, so that the fitting coefficient of each data ribbon can be directly compared with the preset barcode ribbon combination coefficient, or the fitting coefficient and the width information of each data ribbon can be compared with the preset barcode ribbon combination coefficient and the width information, so as to obtain the color reading result of the corresponding data ribbon.
According to the method and the device for extracting the colors of the data color bands and the printing primary color blocks of the bar code on one image, the colors of all parts of the bar code are approximately the same due to the fact that the conditions of a photographing process are the same and the bar code is small, changes caused by the influence of the environment on all parts of the bar code can be eliminated through subsequent processing, so that interference of light and camera factors is reduced, real color information of the bar code color bands is directly read, additional correction balance steps are not needed, and the operation amount is reduced. In practice, the fitting coefficients and the combining coefficients may be the same or may be different. Therefore, in order to determine the color of the bar code, the fitting coefficient and the preset bar code color bar combination coefficient can be compared, and the available color corresponding to the bar code color bar combination coefficient closest to the fitting coefficient is taken as the color reading result of the corresponding data color bar, so that the reading accuracy can be further improved.
In some embodiments, the determining module 330 may obtain the identification result of the barcode according to the color reading result of the corresponding data patch data ribbon. And the information obtained by the comprehensive color reading result is used as bar code information to be stored or analyzed.
In some embodiments, the determining module 330 may obtain the recognition result of the barcode according to the obtained color and/or width information of each data ribbon and the barcode coding character.
In some embodiments, the judging module 330 obtains the identification result of the bar code according to the color and width reading result of the corresponding data color band. The recognition result comprises character data, wherein the character data can reflect bar code ribbon information, the bar code ribbon information corresponds to book scenes, 1-3 bits on the bar code are used for corresponding to each sub-library, the 4 th bit and the 5 th bit are used for corresponding to the classification of books, and the 6 th bit to the 9 th bit are corresponding to book storage shelves and storage position sequences on the shelves.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the described modules may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device and a computer-readable storage medium.
Embodiments of the present disclosure provide an electronic device comprising a memory and a processor, the memory having stored thereon a computer program, which when executed by the processor implements the barcode generation method 100 and/or the barcode reading method 200 as according to the present disclosure.
Embodiments of the present disclosure provide a computer readable storage medium having stored thereon a computer program which when executed by a processor implements the barcode generation method 100 and/or barcode reading method 200 as in accordance with the present disclosure.
Fig. 4 shows a schematic block diagram of an electronic device 400 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
The device 400 comprises a computing unit 401 that may perform various suitable actions and processes in accordance with a computer program stored in a Read Only Memory (ROM) 402 or loaded from a storage unit 408 into a Random Access Memory (RAM) 403. In RAM 403, various programs and data required for the operation of device 400 may also be stored. The computing unit 401, ROM 402, and RAM 403 are connected to each other by a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Various components in device 400 are connected to I/O interface 405, including: an input unit 406 such as a keyboard, a mouse, etc.; an output unit 407 such as various types of displays, speakers, and the like; a storage unit 408, such as a magnetic disk, optical disk, etc.; and a communication unit 409 such as a network card, modem, wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The computing unit 401 may be a variety of general purpose and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 401 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above, such as the barcode generation method 100 and/or the barcode reading method 200. For example, in some embodiments, the barcode generation method 100 and/or the barcode reading method 200 may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 408. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 400 via the ROM 402 and/or the communication unit 409. When the computer program is loaded into RAM 403 and executed by computing unit 401, one or more steps of barcode generation method 100 and/or barcode reading method 200 described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the barcode generation method 100 and/or the barcode reading method 200 by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel or sequentially or in a different order, provided that the desired results of the technical solutions of the present disclosure are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (10)

1. A bar code generation method, comprising the steps of:
selecting a printing primary color;
combining the printing primary colors to obtain a plurality of colors serving as preset bar code ribbon colors and recording the combination coefficients of the colors;
selecting a corresponding number of available colors from the preset colors according to the number of colors required by the bar code color bands, and distributing the colors to the corresponding color bands;
generating a bar code data area and a verification area; wherein the data area comprises a data ribbon with coded data identifying a bar code; the verification area comprises a printing primary color block;
and recording the color and position information of each printing primary color block of the verification area or recording the color difference of each printing primary color block of the verification area.
2. The barcode generation method of claim 1, wherein the colors in the data bands correspond to respective characters.
3. The barcode generation method of claim 1, wherein the printing primary color patch is a printing primary color, a printing secondary color, or a printing secondary color patch.
4. The bar code generating method of claim 1, wherein the printing primary colors are convexly and linearly combined to obtain a plurality of colors as preset bar code ribbon colors.
5. The bar code generating method as claimed in claim 4, wherein N sets of convex linear combination coefficients with the largest distance among any convex linear combinations are taken as bar code color bands, and N is the number of bar code color bands.
6. A barcode reading method, wherein the barcode is generated by the barcode generating method according to any one of claims 1 to 5, comprising the steps of:
acquiring an image of a bar code, extracting the colors of each data color band and each printing primary color block of the bar code from the image, and judging the colors of each printing primary color block; the method for judging the color of each printing primary color block comprises one of the following methods: determining the color of each printing primary color block in the acquired image according to the color and the position information of each printing primary color block recorded in the bar code generation method; directly identifying the color of each printing primary color block on the acquired image; judging the color difference of each printing primary color block on the acquired image, comparing the color difference with the brightness or pixel difference of each printing primary color block in a pre-recorded verification area, and determining the color of each printing primary color block on the acquired image according to the sequence of the brightness or the pixel from large to small or from small to large;
approximating the colors of the data color bands in the image by using the combination of the colors of the color blocks of each printing primary color to respectively obtain fitting coefficients of the data color bands;
and comparing the fitting coefficient of each data color band with a preset bar code color band combination coefficient, and taking the available color corresponding to the bar code color band combination coefficient closest to the fitting coefficient as a color reading result of the corresponding data color band.
7. The bar code reading method as claimed in claim 6, further comprising a bar code recognition step after the step S220: and obtaining the recognition result of the bar code according to the color reading result of the corresponding data color band.
8. A bar code reading apparatus, comprising:
the extraction module is used for acquiring an image of the bar code, extracting the colors of each data color band and each printing primary color block of the bar code from the image, and judging the colors of each printing primary color block; the method of breaking the color of each printed primary color patch comprises one of the following: determining the color of each printing primary color block in the acquired image according to the color and the position information of each printing primary color block recorded in the bar code generation method; directly identifying the color of each printing primary color block on the acquired image; judging the color difference of each printing primary color block on the acquired image, comparing the color difference with the brightness or pixel difference of each printing primary color block in a pre-recorded verification area, and determining the color of each printing primary color block on the acquired image according to the sequence of the brightness or the pixel from large to small or from small to large;
the fitting module is used for approximating the colors of the data color bands in the image by using the combination of the colors of the color blocks of the printing primary colors to respectively obtain fitting coefficients of the data color bands;
and the judging module compares the fitting coefficient of each data color band with a preset bar code color band combination coefficient, and takes the available color corresponding to the bar code color band combination coefficient closest to the fitting coefficient as a color judging result of the corresponding data color band.
9. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program, characterized in that the processor implements the method according to any of claims 1 to 7 when executing the program.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the method according to any of claims 1 to 7.
CN202111628221.XA 2021-12-28 2021-12-28 Bar code generating and reading method and device and computer readable storage medium Active CN114386552B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111628221.XA CN114386552B (en) 2021-12-28 2021-12-28 Bar code generating and reading method and device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111628221.XA CN114386552B (en) 2021-12-28 2021-12-28 Bar code generating and reading method and device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN114386552A CN114386552A (en) 2022-04-22
CN114386552B true CN114386552B (en) 2024-03-15

Family

ID=81197913

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111628221.XA Active CN114386552B (en) 2021-12-28 2021-12-28 Bar code generating and reading method and device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114386552B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008058480A1 (en) * 2006-11-16 2008-05-22 Shenzhen Mpr Technology Co., Ltd Two-dimension code, decoding method thereof and printing publication for applying two-dimension code
CN102087698A (en) * 2011-03-03 2011-06-08 北京天地融科技有限公司 Method and system for transmitting information and device for displaying and reading bar code
CN102971744A (en) * 2010-06-29 2013-03-13 锡克拜控股有限公司 Method and device for measuring optical properties of an optically variable marking applied to an object
CN105320979A (en) * 2014-05-29 2016-02-10 柯尼卡美能达美国研究所有限公司 High capacity 2d color barcode and method for decoding the same
CN107862234A (en) * 2017-10-23 2018-03-30 广东数相智能科技有限公司 A kind of recognition methods of color bar code, electronic equipment and storage medium
CN107871151A (en) * 2017-10-23 2018-04-03 广东数相智能科技有限公司 A kind of color bar code and its production method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008058480A1 (en) * 2006-11-16 2008-05-22 Shenzhen Mpr Technology Co., Ltd Two-dimension code, decoding method thereof and printing publication for applying two-dimension code
CN102971744A (en) * 2010-06-29 2013-03-13 锡克拜控股有限公司 Method and device for measuring optical properties of an optically variable marking applied to an object
CN102087698A (en) * 2011-03-03 2011-06-08 北京天地融科技有限公司 Method and system for transmitting information and device for displaying and reading bar code
CN105320979A (en) * 2014-05-29 2016-02-10 柯尼卡美能达美国研究所有限公司 High capacity 2d color barcode and method for decoding the same
CN107862234A (en) * 2017-10-23 2018-03-30 广东数相智能科技有限公司 A kind of recognition methods of color bar code, electronic equipment and storage medium
CN107871151A (en) * 2017-10-23 2018-04-03 广东数相智能科技有限公司 A kind of color bar code and its production method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
唐远林等.《新编大学物理实验 下 综合提高应用性实验》.重庆大学出版社,2010,第148页. *

Also Published As

Publication number Publication date
CN114386552A (en) 2022-04-22

Similar Documents

Publication Publication Date Title
CN111724396B (en) Image segmentation method and device, computer readable storage medium and electronic equipment
CN110675940A (en) Pathological image labeling method and device, computer equipment and storage medium
CN106663329B (en) Graphics primitives and color channels
US10009507B2 (en) Image processing device
CN113378958A (en) Automatic labeling method, device, equipment, storage medium and computer program product
US20210004699A1 (en) Learning apparatus, inferring apparatus, learning method, program, and inferring method
US20220004857A1 (en) Neural network processing apparatus, neural network processing method, and neural network processing program
US20100158393A1 (en) Image comparison system and method
CN113888560A (en) Method, apparatus, device and storage medium for processing image
CN114386552B (en) Bar code generating and reading method and device and computer readable storage medium
US6339432B1 (en) Using alpha values to control pixel blending
CN110210467B (en) Formula positioning method of text image, image processing device and storage medium
US10163004B2 (en) Inferring stroke information from an image
CN113269841A (en) Gray scale testing method and device, electronic equipment and storage medium
CN117669750B (en) Quantum circuit simulation method, device, electronic device and storage medium
US20230351781A1 (en) Line removal from an image
US10521686B2 (en) Image processing apparatus, information processing method and storage medium for generating an image file by extracting character pixels of a target image
EP3360321B1 (en) Projection apparatus, projection system, program, and non-transitory computer-readable recording medium
US20120303620A1 (en) Method of calculating connectivity of n-dimensional space
CN117635550A (en) Detection method, detection device, detection equipment and storage medium
CN112580638B (en) Text detection method and device, storage medium and electronic equipment
CN113343965B (en) Image tilt correction method, device and storage medium
CN113643266A (en) Image detection method and device and electronic equipment
CN118469896A (en) Detection method, detection device, electronic equipment and storage medium
US12380716B2 (en) Character recognition device, method, and non-transitory computer readable storage medium

Legal Events

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