CN114819022A - Bar code encoding method, decoding method and equipment - Google Patents

Bar code encoding method, decoding method and equipment Download PDF

Info

Publication number
CN114819022A
CN114819022A CN202210385694.XA CN202210385694A CN114819022A CN 114819022 A CN114819022 A CN 114819022A CN 202210385694 A CN202210385694 A CN 202210385694A CN 114819022 A CN114819022 A CN 114819022A
Authority
CN
China
Prior art keywords
bar code
image
secret
preset
code image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210385694.XA
Other languages
Chinese (zh)
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.)
Fudan University
Zhuhai Fudan Innovation Research Institute
Original Assignee
Fudan University
Zhuhai Fudan Innovation Research Institute
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 Fudan University, Zhuhai Fudan Innovation Research Institute filed Critical Fudan University
Priority to CN202210385694.XA priority Critical patent/CN114819022A/en
Publication of CN114819022A publication Critical patent/CN114819022A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/06018Record 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 one-dimensional coding
    • G06K19/06028Record 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 one-dimensional coding using bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models

Abstract

The application relates to a bar code encoding method, a bar code decoding method and bar code decoding equipment. The method comprises the following steps: acquiring an original bar code image and preset secret information; inputting the original bar code image and the preset secret information into a first neural network which is constructed in advance, so that the preset secret information and the original bar code image are combined in the up-sampling process of the first neural network; after the merging operation is finished, outputting a secret-carrying bar code image through the first neural network; and the secret-carrying bar code image is a bar code image containing the preset secret information. The scheme provided by the application can embed the preset secret information in the original barcode image, and realizes the expansion of the barcode capacity information.

Description

Bar code encoding method, decoding method and equipment
Technical Field
The present application relates to the field of barcode technologies, and in particular, to a barcode encoding method, a barcode decoding method, and a barcode decoding device.
Background
Bar codes (also known as bar codes) are world-wide identification cards unique to goods and provide machine-readable, printable language as compared to machine-readable language loaded on magnetic disks, magnetic tapes and optical disks. Barcode technology, one of the automatic identification technologies, has been developed for nearly thirty years, and barcode labels basically cover all products. Barcodes can be printed on packaging and articles, scanned by a digital camera or camera-equipped cell phone, digitized, and then information (e.g., product lot, date of manufacture, etc.) can be extracted. The bar code has the characteristic of easy realization of informatization management, and is widely applied to the product traceability field.
However, the current barcodes have limited capacity and are difficult to embed with some other traceability information. In the barcode technology, there is no reliable solution for the problems of small information amount and poor encryption.
Disclosure of Invention
In order to solve or partially solve the problems in the related art, the application provides a method for encoding a barcode, a method for decoding the barcode and equipment, which can embed preset secret information in an original barcode image to realize the expansion of barcode capacity information.
The first aspect of the present application provides a method for encoding a barcode, including:
acquiring an original bar code image and preset secret information;
inputting the original bar code image and the preset secret information into a first neural network which is constructed in advance, so that the preset secret information and the original bar code image are combined in the up-sampling process of the first neural network;
after the merging operation is finished, outputting a secret-carrying bar code image through the first neural network; and the secret-carrying bar code image is a bar code image containing the preset secret information.
In one embodiment, the merging the preset covert information with the original barcode image includes:
converting the preset secret information into a target two-dimensional matrix;
and merging the target two-dimensional matrix and the characteristic graph corresponding to the original bar code image.
In one embodiment, the converting the preset covert information into a target two-dimensional matrix includes:
converting the preset secret information into binary data;
converting the binary data into an initial two-dimensional matrix;
and upsampling the initial two-dimensional matrix into a target two-dimensional matrix corresponding to the pixel size of the characteristic diagram.
In one embodiment, the first neural network is pre-constructed according to a first preset semantic segmentation network; the first preset semantic segmentation network comprises a U-Net network.
In one embodiment, the secret barcode image corresponds to the original barcode image pixels; and/or the presence of a gas in the gas,
the secret-carrying bar code image and the original bar code image are both one-dimensional bar code images.
A second aspect of the present application provides a method for decoding a barcode, including:
acquiring a secret-carrying bar code image; the secret-carrying bar code image is a bar code image containing preset secret information;
inputting the secret bar code image into a pre-constructed second neural network so that the second neural network identifies the image to obtain a first identification result;
and outputting the preset secret information according to the first identification result.
In one embodiment, the second neural network identifies the image to obtain a first identification result, including:
and the second neural network identifies the image to obtain a pre-identification result, and then performs spatial transformation on the pre-identification result to obtain a first identification result.
In one embodiment, the second neural network is pre-constructed according to a second preset semantic segmentation network and a preset spatial transformation network; and the second preset semantic segmentation network comprises a U-Net network.
A third aspect of the present application provides an electronic device comprising:
a processor; and
a memory having executable code stored thereon, which when executed by the processor, causes the processor to perform the method as described above.
A fourth aspect of the present application provides a computer-readable storage medium having stored thereon executable code, which, when executed by a processor of an electronic device, causes the processor to perform the method as described above.
The technical scheme provided by the application can comprise the following beneficial effects:
according to the method, the original bar code image and the preset secret information are input into the first neural network which is constructed in advance by acquiring the original bar code image and the preset secret information, so that the preset secret information and the original bar code image are combined in the up-sampling process of the first neural network, and the secret-carrying bar code image is output. Therefore, the preset secret information can be embedded in the original barcode image, and the expansion of the barcode capacity information is realized.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The foregoing and other objects, features and advantages of the application will be apparent from the following more particular descriptions of exemplary embodiments of the application as illustrated in the accompanying drawings wherein like reference numbers generally represent like parts throughout the exemplary embodiments of the application.
Fig. 1 is a schematic flowchart of a method for encoding a barcode according to an embodiment of the present application;
FIG. 2 is another schematic flow chart of a method for encoding a barcode according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a network structure of a U-Net network according to an embodiment of the present application;
FIG. 4 is an original barcode image shown in an embodiment of the present application;
FIG. 5 is an image of a secret barcode shown in an embodiment of the present application;
FIG. 6 is a flowchart illustrating a method for decoding a barcode according to an embodiment of the present application;
FIG. 7 is another schematic flow chart diagram illustrating a method for decoding a barcode according to an embodiment of the present application;
FIG. 8 is a schematic view of an application scenario of a secret barcode image according to an embodiment of the present application;
FIG. 9 is a schematic view of another application scenario of a secret barcode image according to an embodiment of the present application;
FIG. 10 is a schematic diagram of a reading result of an image of a secret-loaded barcode according to an embodiment of the present application;
FIG. 11 is a schematic structural diagram of an encoding apparatus for a barcode according to an embodiment of the present application;
FIG. 12 is a schematic structural diagram of a decoding apparatus for bar codes according to an embodiment of the present application;
FIG. 13 is a schematic structural diagram of a barcode encoding and decoding system according to an embodiment of the present application;
FIG. 14 is a schematic view of an application scenario of a barcode encoding and decoding system according to an embodiment of the present application;
FIG. 15 is a schematic view of another structure of a system for encoding and decoding barcodes according to an embodiment of the present application;
fig. 16 is a schematic structural diagram of an electronic device shown in an embodiment of the present application.
Detailed Description
Embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While embodiments of the present application are illustrated in the accompanying drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms "first," "second," "third," etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
In the related art, the capacity of the bar code is limited, and other tracing information is difficult to embed. In the barcode technology, there is no reliable solution for the problems of small information amount and poor encryption.
In view of the above problems, embodiments of the present application provide a method for encoding a barcode, which can embed preset secret information in an original barcode image, so as to expand barcode capacity information.
The technical solutions of the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a method for encoding a barcode according to an embodiment of the present application. The method of the embodiment of fig. 1 may be applied to an electronic device, which may be an encoding device (or encoder).
Referring to fig. 1, the method includes:
and S101, acquiring an original bar code image and preset secret information.
Wherein, the original barcode image can be a one-dimensional barcode image. The original barcode image may be a barcode of a commodity (e.g., code EAN-13, code EAN-128, etc.), and the barcode presented by the original barcode image complies with the national standard GB 12904-2008. The original barcode image carries basic information of the commodity (such as a commodity producing country, a manufacturer, a commodity name and the like), and the basic information of the commodity can be obtained after the original barcode image is scanned and read by a general scanning type reader (such as a code scanning gun, a smart phone and the like) on the market.
The preset secret information may be commodity characteristic information such as production batch, production date and the like of the commodity. The predetermined secret information may be a text format data.
Step S102, inputting the original bar code image and the preset secret information into a first neural network which is constructed in advance, so that the preset secret information and the original bar code image are combined in the up-sampling process of the first neural network.
The first neural network can be obtained by pre-constructing according to a first preset semantic segmentation network. The first preset semantic segmentation network can be a U-Net network.
In this step, in the up-sampling process of the first neural network, the preset covert information may be converted into a target two-dimensional matrix, and the target two-dimensional matrix and the feature map corresponding to the original barcode image are merged. It can be understood that, in this step, the preset secret information is fused with the original barcode image.
Step S103, outputting a secret bar code image through a first neural network after the merging operation is finished; the secret-carrying bar code image is a bar code image containing preset secret information.
The secret bar code image and the original bar code image are both one-dimensional bar code images, and the secret bar code image corresponds to the original bar code image in pixel. That is to say, the secret-carrying barcode image also carries the same basic information of the commodity as the original barcode image, and after a general scanning type reader in the market scans and reads the secret-carrying barcode image, the basic information of the commodity carried in the original barcode image can also be obtained. The preset secret information carried in the secret bar code image can be read and obtained only by a special scanning type reader.
It can be seen from this embodiment that, in the method provided in this embodiment of the present application, the original barcode image and the preset secret information are input to the first neural network that is constructed in advance by acquiring the original barcode image and the preset secret information, so that the preset secret information and the original barcode image are combined in the upsampling process of the first neural network, and the secret-loaded barcode image is output. Therefore, the preset secret information can be embedded in the original barcode image, and the expansion of the barcode capacity information is realized.
Fig. 2 is another schematic flow chart of a barcode encoding method according to an embodiment of the present application. Fig. 2 depicts the solution of the present application in more detail with respect to fig. 1.
Referring to fig. 2, the method includes:
step S201, obtaining an original bar code image and preset secret information.
The step can refer to the description in step S101, and is not described herein again.
Step S202, inputting the original bar code image and the preset secret information into a first neural network which is constructed in advance, so that the preset secret information is converted into a target two-dimensional matrix in the up-sampling process of the first neural network, and the target two-dimensional matrix and the feature map corresponding to the original bar code image are combined.
The first neural network can be obtained by pre-constructing according to a first preset semantic segmentation network. The first preset semantic segmentation network can be a U-Net network. In the embodiment of the application, the first neural network is constructed in advance according to the U-Net network. In one embodiment, the first neural network is obtained by adjusting and modifying the convolutional layer in the U-Net network.
The U-Net network is one of algorithms for performing semantic segmentation by using a full convolution network, and the U-Net network can perform pixel-level classification tasks, outputs the classes of each pixel point, and displays different colors for different classes of pixels, and is commonly used in the situations of heavy tasks and less picture data. It can be seen that the barcode picture meets the condition, and the first neural network is pre-constructed according to the U-Net network, which can obtain two advantages including, but not limited to: one is that the output results can locate the target class. And secondly, data enhancement can be carried out, the problem of less image data can be solved, and the U-shaped structure of the U-Net network can ensure that the segmentation accuracy is higher while less training pictures are used.
Referring to fig. 3, fig. 3 shows a network structure of a U-Net network, and the overall flow of the U-Net network is encoding (as shown in the left part of fig. 3) and decoding (as shown in the right part of fig. 3). Carrying out feature extraction through down sampling in the encoding process; that is, the network on the left side of the U-Net network is a feature extraction network, which uses conv and pooling. In the decoding process, the abstract features are restored to the size of the original image through up-sampling, and finally a segmentation result is obtained; that is, the network on the right side of the U-Net network is a feature-adding fusion network, which uses up-sampling to generate a feature map and perform cascade operation with a concatenate, and then convolves the feature map for a set number of times (for example, two times) to generate the feature map, and classifies the feature map by using a set number of preset convolution kernels (for example, two convolution kernels with a convolution kernel size of 1 × 1).
The first neural network is constructed in advance according to the U-Net network, belongs to a semantic segmentation network, and can identify the original bar code in the original bar code image. In this application, the processing procedure of the first neural network may be understood as: firstly, extracting the characteristics of an original bar code in an original bar code image, then reducing the extracted characteristics into a characteristic diagram corresponding to the original bar code image in an up-sampling process, at the moment, combining the characteristic diagram with a target two-dimensional matrix converted by preset secret information, and outputting the result after convolution operation for set times (for example, twice) so as to obtain a finally required secret-carrying bar code image.
It can be understood that there may be a plurality of upsampling operations in the upsampling process of the first neural network, and in the embodiment of the present application, the target two-dimensional matrix converted from the preset covert information may be merged with the feature map corresponding to the original barcode image in any one upsampling operation.
In one embodiment, the preset covert information may be converted into a target two-dimensional matrix through preprocessing, which includes:
step A: and converting the preset secret information into binary data.
In this step, the preset secret information in the text format may be converted into binary data.
And B: the binary data is converted into an initial two-dimensional matrix.
Wherein the length and width of the initial two-dimensional matrix may be equal.
And C: the initial two-dimensional matrix is up-sampled to a target two-dimensional matrix corresponding to the pixel size of the feature map.
In this step, the initial two-dimensional matrix may be up-sampled by interpolation to a target two-dimensional matrix corresponding to the pixel size of the feature map.
To facilitate understanding of the processing procedure of the first neural network, an example is given as follows, for example, the pixels of the original barcode image are 400 × 400, and the feature map of the corresponding original barcode image generated by restoration in the upsampling procedure of the first neural network is 400 × 400; meanwhile, the preset covert information of the binary data can be converted into an initial two-dimensional matrix with pixels of 40 × 40, and then the initial two-dimensional matrix of 40 × 40 is up-sampled to a target two-dimensional matrix of 400 × 400 by an interpolation method; it can be seen that the 400 × 400 target two-dimensional matrix corresponds to the 400 × 400 feature map pixel size, and the 400 × 400 target two-dimensional matrix and the 400 × 400 feature map are merged and then the packed barcode image is output after the convolution operation.
For another example, the pixels of the original barcode image are 400 × 400, and the feature map generated by restoration in the up-sampling process of the first neural network is 200 × 200; meanwhile, the preset covert information of the binary data can be converted into an initial two-dimensional matrix with pixels of 40 × 40, and then the initial two-dimensional matrix of 40 × 40 is up-sampled to a target two-dimensional matrix of 200 × 200 by an interpolation method; it can be seen that the 200 × 200 target two-dimensional matrix corresponds to the pixel size of the 200 × 200 feature map, and the 200 × 200 target two-dimensional matrix and the 200 × 200 feature map are merged, then the upsampling operation is performed again to reach the 400 × 400 feature map, and then the convolution operation is performed to output the secret barcode image.
Step S203, outputting the secret bar code image through a first neural network after the merging operation is finished; the secret-carrying bar code image is a bar code image containing preset secret information.
It will be appreciated that by performing the merge operation (e.g., performing the matrix addition), the first neural network convolution operation will output the encrypted barcode image. In the embodiment of the present application, the secret barcode image corresponds to the original barcode image in pixels, for example, a secret barcode image with 400 × 400 pixels corresponds to an original barcode image with 400 × 400 pixels.
In the embodiment of the application, the preset secret information of the preset capacity can be acquired, and then the secret-carrying bar code image is generated according to the preset secret information of the preset capacity and the original bar code image so as to expand the capacity of the bar code. For example, the secret-carrying barcode image may be generated according to the preset secret information with a capacity of 200bit and the pre-acquired original barcode image, so that the preset secret information with 200bit is embedded in the generated secret-carrying barcode image.
Referring to fig. 4 and 5 together, fig. 4 is an original barcode image shown in the embodiment of the present application, and fig. 5 is an encrypted barcode image shown in the embodiment of the present application. It can be found that the difference between the original barcode image and the secret barcode image is slight, and human eyes cannot easily detect the difference, in other words, the difference between the original barcode image and the secret barcode image cannot be clearly distinguished visually by human eyes. The secret-carrying bar code image utilizes the first neural network which is constructed in advance in the generation process to realize the modulation and fusion of pixels in the original bar code image, and the preset secret information is fused into the original bar code image, so that the preset secret information is not easy to be found and obtained, and the encryption attribute of the preset secret information in the secret-carrying bar code image is ensured.
It should be noted that, in the embodiment of the present application, the secret barcode image and the original barcode image are both one-dimensional barcode images, and the secret barcode image corresponds to pixels of the original barcode image. That is to say, the secret-carrying barcode image also carries the same basic information of the commodity as the original barcode image, and after a general scanning type reader in the market scans and reads the secret-carrying barcode image, the basic information of the commodity carried in the original barcode image can also be obtained. The preset secret information carried in the secret bar code image can be read and obtained only by a special scanning type reader.
It can be seen from this embodiment that, the method provided by the embodiment of the present application can embed the preset secret information in the original barcode image, thereby implementing the expansion of the barcode capacity information. Therefore, the coding method of the barcode provided by the application, as a steganography (steganography is a skill and science related to information hiding, and the information hiding refers to not making anyone except an expected receiver know a transfer event of information or the content of the information), can realize high-security hiding of additional data information by an original barcode image, increase the existing capacity of the barcode, and can realize the expansion of additional information on the basis of not influencing a general scanning type reader (such as a code scanning gun) on the market to recognize the GS1 general-specification barcode. Secondly, especially in the logistics industry, a feasible solution is provided for realizing that one code replaces multiple codes, and through executing the method, preset secret information can be embedded into an original bar code image on a commodity or an article package, so that an additional bar code does not need to be pasted on the commodity or the article package again, the attractiveness of package printing is guaranteed, and the spatial layout of the package surface is not damaged. In addition, when images and videos are accessed in a local area network, privacy disclosure and even content malicious tampering can be caused.
Fig. 6 is a flowchart illustrating a method for decoding a barcode according to an embodiment of the present application. The method of the embodiment of fig. 1 may be applied to an electronic device, which may be a decoding device (or decoder), such as a scanning reader, a smart phone, etc.
Referring to fig. 6, the method includes:
s601, acquiring a secret-carrying bar code image; the secret-carrying bar code image is a bar code image containing preset secret information.
For specific description of the encrypted barcode image, reference may be made to the embodiment in fig. 1 or fig. 2, which is not described herein again.
Step S602, inputting the secret-carrying bar code image into a pre-constructed second neural network so that the second neural network identifies the image to obtain a first identification result.
In one embodiment, the second neural network is constructed in advance according to a second preset semantic segmentation network; and the second preset semantic segmentation network comprises a U-Net network. That is to say, the second neural network is used as a semantic segmentation network, the second neural network identifies image data corresponding to the preset secret information according to the secret bar code image, and the image data is the obtained first identification result.
In another embodiment, the second neural network is obtained by pre-constructing according to a second preset semantic segmentation network and a preset spatial transformation network; and the second preset semantic segmentation network comprises a U-Net network. In this embodiment, the second neural network identifies the image and obtains the first identification result, including: and the second neural network identifies the image to obtain a pre-identification result, and then performs spatial transformation on the pre-identification result to obtain a first identification result. The second neural network is used as a semantic segmentation network, the second neural network identifies image data corresponding to preset secret information according to the secret bar code image, the image data is a pre-identification result, then the image data used as the pre-identification result is subjected to space transformation, and the image data after the space transformation is the obtained first identification result.
And step S603, outputting preset secret information according to the first identification result.
In this step, according to the first recognition result, the information expressed by the first recognition result can be obtained according to a preset algorithm, so that the preset secret information is obtained.
It can be seen from this embodiment that the method provided in the embodiment of the present application can decode the secret-carrying barcode image, and obtain the preset secret information in the secret-carrying barcode image.
Fig. 7 is another flowchart illustrating a method for decoding a barcode according to an embodiment of the present application. Fig. 7 describes the solution of the present application in more detail with respect to fig. 6.
Referring to fig. 7, the method includes:
s701, acquiring a secret-carrying bar code image; the secret-carrying bar code image is a bar code image containing preset secret information.
For specific description of the encrypted barcode image, reference may be made to the embodiment in fig. 1 or fig. 2, which is not described herein again.
It should be noted that the secret barcode image may be an electronic image, that is, the secret barcode image is displayed in an electronic display device (e.g., a computer screen). The secret barcode image may be a printed image, that is, the secret barcode image may be a printed paper image, for example, a printed image printed by the secret barcode image existing in a computer in an electronic image form, or a printed image printed by a photographing apparatus after photographing the secret barcode image.
In the embodiment of the application, the image of the secret-carrying barcode can be acquired in a scanning mode. For example, a scanning reader is used to scan to obtain an image of the secret barcode.
Step S702, inputting the secret-carrying bar code image into a pre-constructed second neural network so that the second neural network identifies the image to obtain a pre-identification result, and then performing spatial transformation on the pre-identification result to obtain a first identification result.
In this embodiment, the second neural network is pre-constructed according to a second preset semantic segmentation network and a preset spatial transformation network; and the second preset semantic segmentation network comprises a U-Net network. In the step, the second neural network is used as a semantic segmentation network, the second neural network identifies image data corresponding to preset secret information according to the secret-carrying bar code image, the image data is a pre-identification result, then the image data used as the pre-identification result is subjected to space transformation, and the image data after the space transformation is the obtained first identification result.
It can be understood that the image data (namely, feature map) as the pre-recognition result is subjected to spatial transformation, and the purpose is to correct the image data, adjust the posture of the image data, and take the image data after the spatial transformation as the first recognition result, so that the preset secret information can be conveniently obtained from the first recognition result, and the correctness of obtaining the preset secret information can be improved.
It should be noted that the second neural network is a trained network, and is used for recovering the hidden preset secret information from the secret-carrying bar code image. Compared with the first neural network in the embodiment of fig. 1 or fig. 2, the second neural network can be pre-constructed according to the U-Net network, and can be regarded as the inverse transform of the first neural network. In the second neural Network, in order to enhance robustness, a preset Spatial transformation Network (e.g. Spatial Transformer Network, abbreviated as STN Network) is introduced, which provides corresponding Spatial transformation modes for the input in the Network structure, and the transformation modes include but are not limited to scaling, shearing and rotating, so that the second neural Network can learn the characteristics of Spatial invariance. The secret-carrying bar code image is processed through a series of convolution, dense layers and S-shaped functions to generate final output with the same length as the embedded preset secret information so as to recover the preset secret information. In the embodiment of the application, the cross entropy loss function can be used for supervising the second neural network.
The second neural network can be pre-constructed according to the U-Net network and the preset space transformation network, the second neural network also belongs to a semantic segmentation network, the network structure of the second neural network comprises the network structure of the U-Net network and the space transformation network, the output of the U-Net network in the second neural network is the input of the preset space transformation network, and the output of the preset space transformation network is used as the first identification result. The convolution layer of the U-Net network in the second neural network can be adjusted and modified according to requirements.
The secret-carrying bar code image is a bar code image containing preset secret information, in other words, the original bar code image becomes the secret-carrying bar code image after the preset secret information is embedded into the original bar code image. In the embodiment of the application, the second neural network is used as a semantic segmentation network, and the second neural network can identify the image data corresponding to the preset secret information from the secret-carrying bar code image and can also identify the image data corresponding to the original bar code image from the secret-carrying bar code image. In the embodiment of the application, the second neural network only selects the image data (i.e. the first recognition result) corresponding to the preset covert information for output.
And step S703, outputting preset secret information according to the first identification result.
In this step, according to the first recognition result, the information expressed by the first recognition result can be obtained according to a preset algorithm, so that the preset secret information is obtained. In one embodiment, the first recognition result may correspond to a matrix data, and the matrix data is converted into the predetermined secret information in the text format.
It should be noted that the secret barcode image and the original barcode image are both one-dimensional barcode images, and the secret barcode image corresponds to pixels of the original barcode image. That is to say, the secret-carrying barcode image also carries the same basic information of the commodity as the original barcode image, and after a general scanning type reader in the market scans and reads the secret-carrying barcode image, the basic information of the commodity carried in the original barcode image can also be obtained. The preset secret information carried in the secret bar code image can be read and obtained only by a special scanning type reader. In the embodiment of the present application, the predetermined secret information carried in the secret barcode image can be obtained by reading the preset secret information by a decoding device executing the method in the embodiment shown in fig. 6 or fig. 7, where the decoding device may be a scanning type reader (i.e., a code scanning gun).
It is to be understood that the image of the secret barcode may be an electronic image or a printed image. Referring to fig. 8, the embodiment of fig. 8 shows a scene of the secret barcode image scanned and read by a commercially available scanning type reader. In the embodiment of fig. 8, the secret barcode image is presented in an electronic image form in an electronic display device (i.e., a computer screen), and a commercially available scanning reader can successfully scan and read the secret barcode image presented in the electronic image form, so as to obtain basic information (e.g., data shown in the left area in fig. 8) of the commodity carried in the original barcode image.
Referring to fig. 9, the embodiment of fig. 9 shows another scenario in which the secret barcode image is scanned and read by a commercially available scanning type reader. In the embodiment of fig. 9, the secret barcode image is presented in the form of a printed image, and a commercially available scanning reader can successfully scan and read the secret barcode image presented in the form of the printed image, so as to obtain basic information of the commodity (such as data shown in the left area in fig. 9) carried in the original barcode image.
Referring to fig. 10, fig. 10 is a schematic diagram illustrating a result of scanning and reading a secret barcode image by a decoding device according to an embodiment of the present invention. After the image of the secret-carrying bar code is scanned and read by the decoding device, preset secret information (such as data at the upper left of the bar code shown in fig. 10) can be obtained. The decoding device, which may be a scanning reader (i.e., a code scanning gun), performs the method of the embodiments shown in fig. 6 or fig. 7.
It can be seen from this embodiment that, with the method provided in the embodiment of the present application, the secret-carrying barcode image can be decoded by using the pre-constructed second neural network, so as to obtain the preset secret information in the secret-carrying barcode image.
Corresponding to the embodiment of the application function implementation method, the application also provides an embodiment of a barcode encoding device.
Fig. 11 is a schematic structural diagram of an encoding device for a barcode according to an embodiment of the present application.
Referring to fig. 11, an encoding apparatus 1100 of a barcode includes: a first obtaining module 1110, an encoding module 1120, and a first output module 1130.
The first obtaining module 1110 is configured to obtain an original barcode image and preset secret information.
The encoding module 1120 is configured to input the original barcode image and the preset secret information into a first neural network that is constructed in advance, so that the preset secret information and the original barcode image are merged during an upsampling process of the first neural network.
A first output module 1130, configured to output the secret barcode image through the first neural network after the merging operation is completed; the secret-carrying bar code image is a bar code image containing preset secret information.
As can be seen from this embodiment, the encoding apparatus 1100 for barcode provided in the present application can embed the preset secret information in the original barcode image, thereby implementing the expansion of the barcode capacity information.
Fig. 12 is a schematic structural diagram of a barcode decoding apparatus according to an embodiment of the present application.
Referring to fig. 12, a decoding apparatus 1200 for a barcode includes: a second obtaining module 1210, a decoding module 1220, and a second output module 1230.
A second obtaining module 1210, configured to obtain a secret-carrying barcode image; the secret-carrying bar code image is a bar code image containing preset secret information.
The decoding module 1220 is configured to input the secret-carrying barcode image into a pre-constructed second neural network, so that the second neural network identifies the image to obtain a first identification result.
The second output module 1230 is configured to output the preset secret information according to the first recognition result.
As can be seen from this embodiment, the decoding apparatus 1200 for barcode provided in this application can decode the secret-carrying barcode image, and acquire the preset secret information in the secret-carrying barcode image.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 13 is a schematic structural diagram of a barcode encoding and decoding system according to an embodiment of the present application.
Referring to fig. 13, a system 1300 for encoding and decoding a barcode includes: an encoding device 1310 and a decoding device 1320.
The encoding device is used for acquiring an original bar code image and preset secret information; inputting the original bar code image and the preset secret information into a first neural network which is constructed in advance, so that the preset secret information and the original bar code image are combined in the up-sampling process of the first neural network; after the merging operation is finished, outputting a secret-carrying bar code image through a first neural network; the secret-carrying bar code image is a bar code image containing preset secret information.
The decoding equipment is used for acquiring the secret-carrying bar code image; the secret-carrying bar code image is a bar code image containing preset secret information; inputting the secret-carrying bar code image into a pre-constructed second neural network so that the second neural network identifies the image to obtain a first identification result; and outputting preset secret information according to the first identification result.
It can be seen from this embodiment that the encoding and decoding system 1300 for barcode provided in the present application can embed the preset secret information into the original barcode image to obtain the secret-carrying barcode image, thereby implementing the expansion of the barcode capacity information, and can decode the secret-carrying barcode image to obtain the preset secret information in the secret-carrying barcode image.
Referring to fig. 14, fig. 14 is a schematic view of an application scenario of a barcode encoding and decoding system according to an embodiment of the present application. The original barcode image at the lower left corner of fig. 14 and the preset confidential information (e.g., the steganographic information shown at the upper left corner of fig. 14, i.e., the website information) may be encoded by an encoding device, so as to obtain a secret-carrying barcode image, and after the secret-carrying barcode image is encoded by an encoding device (e.g., the smartphone in fig. 14), the preset confidential information (e.g., the website information shown at the upper right corner of fig. 14) in the secret-carrying barcode image may be obtained.
Further, please refer to fig. 15, fig. 15 is another structural schematic diagram of the barcode encoding and decoding system according to the embodiment of the present application. The system for encoding and decoding the bar code further comprises: the prediction device 1330. The prediction device 1330 is configured to detect a location area of the secret barcode image from the electronic image or the printed image, so that the decoding device 1320 decodes the secret barcode image to identify the predetermined secret information in the secret barcode image.
As shown in fig. 15, in one embodiment, after the encoding device 1310 encodes the original barcode image and the predetermined secret information into the secret-carrying barcode image, the decoding device 1320 may decode the secret-carrying barcode image to obtain the predetermined secret information. In another embodiment, since the secret-carrying barcode image can be presented in the form of an electronic image or a printed image, in order to facilitate the decoding device 1320 to decode and identify the preset secret information from the electronic image or the printed image, the electronic image or the printed image is processed by the prediction device 1330, and after the prediction device 1330 detects the position area occupied by the secret-carrying barcode image in the electronic image or the printed image, the decoding device 1320 is used for decoding, so as to improve the decoding success rate and reduce the decoding difficulty.
Fig. 16 is a schematic structural diagram of an electronic device shown in an embodiment of the present application. The electronic device may be an encoding device or a decoding device, in other words an encoding device when performing the method of the embodiment shown in fig. 1 or fig. 2; when the method of the embodiment shown in fig. 6 or fig. 7 is performed, the electronic device is a decoding device.
Referring to fig. 16, the electronic device 1600 includes a memory 1610 and a processor 1620.
The Processor 1620 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 1610 may include various types of storage units, such as system memory, Read Only Memory (ROM), and permanent storage. Wherein the ROM may store static data or instructions that are needed by the processor 1620 or other modules of the computer. The persistent storage device may be a read-write storage device. The persistent storage may be a non-volatile storage device that does not lose stored instructions and data even after the computer is powered off. In some embodiments, the persistent storage device employs a mass storage device (e.g., magnetic or optical disk, flash memory) as the persistent storage device. In other embodiments, the permanent storage may be a removable storage device (e.g., floppy disk, optical drive). The system memory may be a read-write memory device or a volatile read-write memory device, such as a dynamic random access memory. The system memory may store instructions and data that some or all of the processors require at runtime. In addition, memory 1610 may comprise any combination of computer-readable storage media, including various types of semiconductor memory chips (e.g., DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), magnetic and/or optical disks, as well. In some embodiments, memory 1610 may include a removable storage device that is readable and/or writable, such as a Compact Disc (CD), a digital versatile disc read only (e.g., DVD-ROM, dual layer DVD-ROM), a Blu-ray disc read only, an ultra-dense disc, a flash memory card (e.g., SD card, min SD card, Micro-SD card, etc.), a magnetic floppy disk, or the like. Computer-readable storage media do not contain carrier waves or transitory electronic signals transmitted by wireless or wired means.
The memory 1610 has stored thereon executable code, which, when processed by the processor 1620, may cause the processor 1620 to perform some or all of the methods described above.
Furthermore, the method according to the present application may also be implemented as a computer program or computer program product comprising computer program code instructions for performing some or all of the steps of the above-described method of the present application.
Alternatively, the present application may also be embodied as a computer-readable storage medium (or non-transitory machine-readable storage medium or machine-readable storage medium) having executable code (or a computer program or computer instruction code) stored thereon, which, when executed by a processor of an electronic device (or server, etc.), causes the processor to perform part or all of the various steps of the above-described method according to the present application.
Having described embodiments of the present application, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen in order to best explain the principles of the embodiments, the practical application, or improvements to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (10)

1. A method of encoding a barcode, comprising:
acquiring an original bar code image and preset secret information;
inputting the original bar code image and the preset secret information into a first neural network which is constructed in advance, so that the preset secret information and the original bar code image are combined in the up-sampling process of the first neural network;
after the merging operation is finished, outputting a secret-carrying bar code image through the first neural network; and the secret-carrying bar code image is a bar code image containing the preset secret information.
2. The method of claim 1, wherein the merging the predetermined covert information with the original barcode image comprises:
converting the preset secret information into a target two-dimensional matrix;
and merging the target two-dimensional matrix and the characteristic graph corresponding to the original bar code image.
3. The method according to claim 2, wherein the converting the predetermined stego information into a target two-dimensional matrix comprises:
converting the preset secret information into binary data;
converting the binary data into an initial two-dimensional matrix;
and upsampling the initial two-dimensional matrix into a target two-dimensional matrix corresponding to the pixel size of the characteristic diagram.
4. The method of claim 1, wherein:
the first neural network is obtained by pre-constructing according to a first preset semantic segmentation network; the first preset semantic segmentation network comprises a U-Net network.
5. The method of claim 1, wherein:
the secret-carrying bar code image corresponds to the original bar code image in pixel; and/or the presence of a gas in the gas,
the secret-carrying bar code image and the original bar code image are both one-dimensional bar code images.
6. A method of decoding a barcode, comprising:
acquiring a secret-carrying bar code image; the secret-carrying bar code image is a bar code image containing preset secret information;
inputting the secret bar code image into a pre-constructed second neural network so that the second neural network identifies the image to obtain a first identification result;
and outputting the preset secret information according to the first identification result.
7. The method of claim 6, wherein the second neural network identifies the image, resulting in a first identification result, comprising:
and the second neural network identifies the image to obtain a pre-identification result, and then performs spatial transformation on the pre-identification result to obtain a first identification result.
8. The method of claim 6, wherein:
the second neural network is obtained by pre-constructing according to a second preset semantic segmentation network and a preset spatial transformation network; and the second preset semantic segmentation network comprises a U-Net network.
9. An electronic device, comprising:
a processor; and
a memory having executable code stored thereon, which when executed by the processor, causes the processor to perform the method of any one of claims 1-8.
10. A computer-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to perform the method of any one of claims 1-8.
CN202210385694.XA 2022-04-13 2022-04-13 Bar code encoding method, decoding method and equipment Pending CN114819022A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210385694.XA CN114819022A (en) 2022-04-13 2022-04-13 Bar code encoding method, decoding method and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210385694.XA CN114819022A (en) 2022-04-13 2022-04-13 Bar code encoding method, decoding method and equipment

Publications (1)

Publication Number Publication Date
CN114819022A true CN114819022A (en) 2022-07-29

Family

ID=82536644

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210385694.XA Pending CN114819022A (en) 2022-04-13 2022-04-13 Bar code encoding method, decoding method and equipment

Country Status (1)

Country Link
CN (1) CN114819022A (en)

Similar Documents

Publication Publication Date Title
US11675985B2 (en) Systems and methods for generating and reading intrinsic matrixed bar codes
US20200410186A1 (en) Localization of machine-readable indicia in digital capture systems
US10963657B2 (en) Methods and arrangements for identifying objects
US11625551B2 (en) Methods and arrangements for identifying objects
US11763113B2 (en) Methods and arrangements for identifying objects
US9406010B2 (en) Producing, capturing and using visual identification tags for moving objects
US8750618B2 (en) Method for coding images with shape and detail information
KR102235215B1 (en) Augmenting barcodes with secondary encoding for anti-counterfeiting
CN106056183B (en) The printed medium of printing press readable image and the system and method for scanning the image
CN115035533B (en) Data authentication processing method and device, computer equipment and storage medium
EP3465570A1 (en) An authentication method for product packaging
CN114819022A (en) Bar code encoding method, decoding method and equipment
Bunma et al. Using augment reality to increase capacity in QR code
CN115700590A (en) Commodity information representation method and system based on dot matrix image and application thereof
Novozámský et al. Extended IMD2020: a large‐scale annotated dataset tailored for detecting manipulated images
US11875259B1 (en) Generative system and method for enhancing readability of barcodes using frequency guided computer vision
WO2019023864A1 (en) Two-dimensional code identification method and system based on intelligent terminal camera
EP4016374A1 (en) Method for extracting data from a food package, food package and system for producing a food package
Patil et al. A Survey on PiCode: Picture-Embedding 2D Barcode
Nguyen Enhanced Color QR Codes with Resilient Error Correction for Dirt-Prone Surfaces
CN114742088A (en) Bar code image processing method, device and equipment
CN116978030A (en) Text information recognition method and training method of text information recognition model
Mishra Region Identification and Decoding Of Security Markers Using Image Processing Tools
Bernstein et al. Subliminal: A System for Augmenting Images with Steganography
WO2020190312A1 (en) Content verification system for opaque sealed containers

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