CN111598198B - Image two-dimensional code generation method and reading method based on LSB information hiding - Google Patents
Image two-dimensional code generation method and reading method based on LSB information hiding Download PDFInfo
- Publication number
- CN111598198B CN111598198B CN202010422569.2A CN202010422569A CN111598198B CN 111598198 B CN111598198 B CN 111598198B CN 202010422569 A CN202010422569 A CN 202010422569A CN 111598198 B CN111598198 B CN 111598198B
- Authority
- CN
- China
- Prior art keywords
- information
- dimensional code
- image
- gray
- rgb
- 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
Links
- 238000000034 method Methods 0.000 title claims description 18
- 239000011159 matrix material Substances 0.000 claims abstract description 4
- 230000000007 visual effect Effects 0.000 abstract description 3
- 230000006978 adaptation Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K19/00—Record carriers for use with machines and with at least a part designed to carry digital markings
- G06K19/06—Record 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/06009—Record 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/06037—Record 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 multi-dimensional coding
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
- Color Image Communication Systems (AREA)
Abstract
When the two-dimensional code is generated, two-dimensional code information is converted into binary information, a color digital bitmap is selected as a carrier, RGB values of each pixel point are converted into YUV format, the binary information replaces the lowest bit of gray information Y in the YUV format, a new gray image is obtained, Y' UV is restored to RGB information through inverse change, and the new RGB information is restored to a bitmap with the two-dimensional code information. And when the bitmap with the two-dimensional code information is read into a computer, converted into a YUV format, and the lowest bit of the first n values of the Y matrix is read. The binary bits of the two-dimensional code information are substituted for the lowest bits of the gray information of the image, and the visual effect of the original image is not affected because the lowest bits of the gray information are substituted, and the two-dimensional code information is carried. When the two-dimensional code information is read, the two-dimensional code can be recovered only by taking out the lowest bit of the gray level image.
Description
Technical Field
The invention belongs to the technical field of two-dimension codes, and particularly relates to an image two-dimension code generation method and a reading method based on LSB information hiding.
Background
The two-dimension code is a graph which is distributed on a plane (two-dimension direction) according to a certain rule by using a certain specific geometric figure and is used for recording data symbol information, the concept of 0 and 1 bit streams which form the internal logic foundation of a computer is skillfully utilized in code programming, a plurality of geometric shapes corresponding to binary are used for representing literal numerical information, and the literal numerical information is automatically read through an image input device or a photoelectric scanning device so as to realize automatic information processing. The traditional two-dimensional code adopts black and white square to represent information, and the two-dimensional code information is blended into an image and is generally simply overlapped, so that the visual effect of the image is affected. Therefore, it is necessary to design an image two-dimensional code that can be hidden.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides an image two-dimensional code generation method and a reading method based on LSB information hiding.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
The image two-dimensional code generation method based on LSB information hiding is characterized by comprising the following steps of:
step one: converting the two-dimensional code information into binary information;
Step two: selecting a color digital bitmap as a carrier, and converting RGB values of each pixel point in the carrier into YUV format;
step three: replacing the lowest bit of gray information Y in YUV format with binary information to obtain new gray image;
Step four: the Y' UV is restored into RGB information through inverse change;
step five: and recovering the new RGB information into a bitmap with the two-dimensional code information.
In order to optimize the technical scheme, the specific measures adopted further comprise:
Further, in the second step, YUV and RGB are both 8 bits, and three values of RGB of each pixel point in the carrier are converted into YUV format representation according to the following formula:
Y=0.299R+0.587G+0.114B
U=-0.1687R-0.3313G+0.5B+128
V=0.5R-0.4187G-0.0813B+128
Wherein R, G, B represents three primary color components of the color digital bitmap, Y represents gray information of a pixel point, and U, V represents two color difference information, respectively.
Further, the third step is specifically as follows:
let the carrier pixel be mxn, the gray information of each pixel point be represented by an 8-bit binary number, forming set C:
C={xij|0≤i<M,0≤j<N,xij∈{0,1,...,255}}
wherein x ij represents the gray information of the pixel points in the ith row and the j columns;
Let S be n bits of binary information to be hidden:
s={si|0≤i<n,si∈{0,1}}
Wherein s i represents the i-th bit information, N < M×N;
selecting the first n data from C according to the principle of row priority to form a set C':
C′={xk|0≤k<n,xk∈{0,1,...,255}}
where x k represents the selected kth data, x k is represented by an 8-bit binary representation, each bit number is represented in turn as x k0,xk1,xk2,xk3,xk4,xk5,xk6,xk7,
And (3) replacing the lowest bit x k0 of x k with s i to obtain each bit number of x k′,xk ', sequentially obtaining s i,xk1,xk2,xk3,xk4,xk5,xk6,xk7, and obtaining new gray information Y ' according to x k ', thereby obtaining a new gray image.
Further, in the fourth step, Y' UV is restored to RGB information by inverse-changing as follows:
R=Y′+1.402(V-128)
G=Y′-0.34414(U-128)-0.71414(V-128)
B=Y′+1.772(U-128)。
In addition, a method for reading the two-dimensional code generated by the image two-dimensional code generation method is also provided, and the method is characterized by comprising the following steps: and reading the bitmap with the two-dimensional code information into a computer, converting the bitmap into a YUV format, reading the lowest bits of the first n values of the Y matrix, and recovering the two-dimensional code information.
The beneficial effects of the invention are as follows: the binary bits of the two-dimensional code information are substituted for the lowest bits of the gray information of the image, and the visual effect of the original image is not affected because the lowest bits of the gray information are substituted, and the two-dimensional code information is carried. When the two-dimensional code information is read, the two-dimensional code can be recovered simply and quickly by taking out the lowest bit of the gray level image.
Drawings
Fig. 1 is a flowchart of image two-dimensional code generation.
Fig. 2 is an image two-dimensional code reading flow chart.
Detailed Description
The invention will now be described in further detail with reference to the accompanying drawings.
The image two-dimensional code generation method shown in fig. 1 specifically comprises the following steps:
1. The information which needs to be changed into the two-dimensional code is converted into binary by a computer.
2. Any color digital bitmap is searched for as a carrier. Converting the RGB three values of each pixel point into YUV format representation, wherein YUM and RGB are 8 bits:
Y=0.299R+0.587G+0.114B
U=-0.1687R-0.3313G+0.5B+128
v=0.5R-0.4187G-0.0813b+128
Wherein R, G, B represents three primary color components of the color digital bitmap, Y represents gray information of a pixel point, and U, V represents two color difference information, respectively.
3. The binary information replaces the least significant bit of Y8 bit information, and the specific process is as follows:
1) Let the image pixels be mxn, the gray information of each pixel point be represented by an 8-bit binary number, forming set C:
C={xij|0≤i<M,0≤j<N,xij∈{0,1,...,255}}
S is a message to be hidden by n-bit:
S={si|0≤i<n,si∈{0,1})
the requirements are: n < m×n.
2) The first n data are chosen from C by row-first principle, C' = { x k|0≤k<n,xk e {0, 1..once., 255 }.
X k can be represented in an 8-bit binary representation:
xk0 | xk1 | xk2 | xk3 | xk4 | xk5 | xk6 | xk7 |
s i is a one-bit binary. Replace x k0, the Least Significant Bit (LSB) of x k.
X k is changed to x k':
xk0 | xk1 | xk2 | xk3 | xk4 | xk5 | xk6 | xk7 |
a new gray image Y' is obtained.
4. Y' UV was restored to RGB bitmap by inverse change:
R=Y′+1.402(V-128)
G=Y′-0.34414(U-128)-0.71414(V-128)
B=Y′+1.772(U-128)。
5. And recovering the new RGB information into a bitmap with the two-dimensional code information.
As shown in fig. 2, when the two-dimensional code is read, a bitmap with the two-dimensional code information is read into a computer and converted into a YUV format, and the lowest bits of the first n values of the Y matrix are read to recover the two-dimensional code information.
It should be noted that the terms like "upper", "lower", "left", "right", "front", "rear", and the like are also used for descriptive purposes only and are not intended to limit the scope of the invention in which the invention may be practiced, but rather the relative relationship of the terms may be altered or modified without materially altering the teachings of the invention.
The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above examples, and all technical solutions belonging to the concept of the present invention belong to the protection scope of the present invention. It should be noted that modifications and adaptations to the invention without departing from the principles thereof are intended to be within the scope of the invention as set forth in the following claims.
Claims (3)
1. The image two-dimensional code generation method based on LSB information hiding is characterized by comprising the following steps of:
step one: converting the two-dimensional code information into binary information;
Step two: selecting a color digital bitmap as a carrier, and converting RGB values of each pixel point in the carrier into YUV format; in the second step, YUV and RGB are 8 bits, and three values of RGB of each pixel point in the carrier are converted into YUV format representation according to the following formula:
Y=0.299R+0.587G+0.114B
U=-0.1687R-0.3313G+0.5B+128
V=0.5R-0.4187G-0.0813B+128
wherein R, G, B represents three primary color components of the color digital bitmap, Y represents gray information of pixel points, and U, V represents two color difference information;
Step three: replacing the lowest bit of gray information Y in YUV format with binary information to obtain new gray image Y' UV; the third step is as follows:
let the carrier pixel be mxn, the gray information of each pixel point be represented by an 8-bit binary number, forming set C:
C={xij|0≤i<M,0≤j<N,xij∈{0,1,…,255}}
wherein x ij represents the gray information of the pixel points in the ith row and the j columns;
Let S be n bits of binary information to be hidden:
S={si|0≤i<n,si∈{0,1}}
Wherein s i represents the i-th bit information, N < M×N;
Selecting the first n data from C according to the principle of row priority to form a set C':
C'={xk|0≤k<n,xk∈{0,1,...,255}}
where x k represents the selected kth data, x k is represented by an 8-bit binary representation, each bit number is represented in turn as x k0,xk1,xk2,xk3,xk4,xk5,xk6,xk7,
S i is substituted for the lowest bit x k0 of x k to obtain each bit number of x k',xk ' which is s i,xk1,xk2,xk3,xk4,xk5,xk6,xk7 in sequence, and new gray information Y ' is obtained according to x k ';
step four: the Y' UV is restored into RGB information through inverse change;
step five: and recovering the new RGB information into a bitmap with the two-dimensional code information.
2. The LSB information hiding-based image two-dimensional code generating method according to claim 1, wherein: in the fourth step, Y' UV is restored to RGB information by inverse change as follows:
R=Y'+1.402(V-128)
G=Y'-0.34414(U-128)-0.71414(V-128)
B=Y'+1.772(U-128)。
3. The method for reading a two-dimensional code generated by the image two-dimensional code generation method according to claim 1, comprising the steps of: and reading the bitmap with the two-dimensional code information into a computer, converting the bitmap into a YUV format, reading the lowest bits of the first n values of the Y matrix, and recovering the two-dimensional code information.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010422569.2A CN111598198B (en) | 2020-05-18 | 2020-05-18 | Image two-dimensional code generation method and reading method based on LSB information hiding |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010422569.2A CN111598198B (en) | 2020-05-18 | 2020-05-18 | Image two-dimensional code generation method and reading method based on LSB information hiding |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111598198A CN111598198A (en) | 2020-08-28 |
CN111598198B true CN111598198B (en) | 2024-04-26 |
Family
ID=72189864
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010422569.2A Active CN111598198B (en) | 2020-05-18 | 2020-05-18 | Image two-dimensional code generation method and reading method based on LSB information hiding |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111598198B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115230359A (en) * | 2022-09-22 | 2022-10-25 | 江苏铨通印数字印刷有限公司 | Intelligent digital printing anti-counterfeiting mark generation and use method |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103646264A (en) * | 2013-11-06 | 2014-03-19 | 杭州电子科技大学 | Multiple information encrypted two-dimensional code anti-counterfeiting method |
CN104850883A (en) * | 2015-06-12 | 2015-08-19 | 矽照光电(厦门)有限公司 | Method for generating multi-gray-scale invisible two-dimensional code |
CN106097239A (en) * | 2016-06-15 | 2016-11-09 | 常熟理工学院 | A kind of Quick Response Code watermark encrypting parallelization quickly embeds and extracting method |
CN107493405A (en) * | 2017-09-27 | 2017-12-19 | 广西师范大学 | Encrypted image reversible information hidden method based on coding compression |
CN107545390A (en) * | 2017-09-06 | 2018-01-05 | 中国科学技术大学 | Information concealing method, device and logistics implementation method, apparatus and system |
CN109948766A (en) * | 2019-03-29 | 2019-06-28 | 北京印刷学院 | The composite coloured anti-fake two-dimension code of multi-code and its generation and reading method |
-
2020
- 2020-05-18 CN CN202010422569.2A patent/CN111598198B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103646264A (en) * | 2013-11-06 | 2014-03-19 | 杭州电子科技大学 | Multiple information encrypted two-dimensional code anti-counterfeiting method |
CN104850883A (en) * | 2015-06-12 | 2015-08-19 | 矽照光电(厦门)有限公司 | Method for generating multi-gray-scale invisible two-dimensional code |
CN106097239A (en) * | 2016-06-15 | 2016-11-09 | 常熟理工学院 | A kind of Quick Response Code watermark encrypting parallelization quickly embeds and extracting method |
CN107545390A (en) * | 2017-09-06 | 2018-01-05 | 中国科学技术大学 | Information concealing method, device and logistics implementation method, apparatus and system |
CN107493405A (en) * | 2017-09-27 | 2017-12-19 | 广西师范大学 | Encrypted image reversible information hidden method based on coding compression |
CN109948766A (en) * | 2019-03-29 | 2019-06-28 | 北京印刷学院 | The composite coloured anti-fake two-dimension code of multi-code and its generation and reading method |
Non-Patent Citations (2)
Title |
---|
Daniela Stanescu等.Steganography in YUV color space.2007 International Workshop on Robotic and Sensors Environments.2007,第1-4页. * |
殷颢玻.二维码与图像信息隐藏相结合的研究.《中国优秀硕士学位论文全文数据库信息科技辑》.2017,(第2期),第1-69页. * |
Also Published As
Publication number | Publication date |
---|---|
CN111598198A (en) | 2020-08-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9544467B2 (en) | Halftone data-bearing encoding system and halftone data-bearing decoding system | |
CN111340047B (en) | Image semantic segmentation method and system based on multi-scale feature and foreground and background contrast | |
CN111898606B (en) | Night imaging identification method for superimposing transparent time characters in video image | |
CN113096017A (en) | Image super-resolution reconstruction method based on depth coordinate attention network model | |
CN113379833B (en) | Image visible watermark positioning and segmenting method based on neural network | |
CN109815948B (en) | Test paper segmentation algorithm under complex scene | |
CN104268615A (en) | Encoding method and decoding method for color two-dimensional code | |
CN113392828B (en) | Encoding and decoding method based on high-resolution dot matrix | |
CN109582926B (en) | Digital watermarking method for resisting printing and scanning attacks based on fusion fonts | |
CN111598198B (en) | Image two-dimensional code generation method and reading method based on LSB information hiding | |
CN110475038A (en) | A kind of character of combination minimum closure coding is drawn production and is hidden and restoration methods | |
CN113962839A (en) | Multi-color mode quantum image blind watermarking method based on TMQIR | |
CN116009749A (en) | Handwritten character erasing method and system based on attention mechanism | |
CN116822548B (en) | Method for generating high recognition rate AI two-dimensional code and computer readable storage medium | |
Kuribayashi et al. | Aesthetic QR code based on modified systematic encoding function | |
CN114519788A (en) | Image processing method, image processing device, electronic equipment and computer readable storage medium | |
CN110086955B (en) | Large-capacity image steganography method | |
CN107808382A (en) | A kind of PCB bar code dividing methods based on color saturation information | |
CN111738255A (en) | Guideboard text detection and recognition algorithm based on deep learning | |
CN113160028B (en) | Information hiding and recovering method and equipment based on colorful character picture and storage medium | |
CN113065407B (en) | Financial bill seal erasing method based on attention mechanism and generation countermeasure network | |
CN114627344A (en) | Labeling method capable of realizing interactive labeling | |
CN108388948B (en) | Design method for type conversion from quantum image to quantum real signal | |
CN113901913A (en) | Convolution network for ancient book document image binaryzation | |
CN112686794A (en) | Watermark removing method based on generating type countermeasure network |
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 |