CN107563476B - Two-dimensional code beautifying and anti-counterfeiting method - Google Patents

Two-dimensional code beautifying and anti-counterfeiting method Download PDF

Info

Publication number
CN107563476B
CN107563476B CN201710610122.6A CN201710610122A CN107563476B CN 107563476 B CN107563476 B CN 107563476B CN 201710610122 A CN201710610122 A CN 201710610122A CN 107563476 B CN107563476 B CN 107563476B
Authority
CN
China
Prior art keywords
dimensional code
value
black
white
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
Application number
CN201710610122.6A
Other languages
Chinese (zh)
Other versions
CN107563476A (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.)
Zhejiang Huima Technology Co ltd
Original Assignee
Zhejiang Huima Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Huima Technology Co ltd filed Critical Zhejiang Huima Technology Co ltd
Priority to CN201710610122.6A priority Critical patent/CN107563476B/en
Publication of CN107563476A publication Critical patent/CN107563476A/en
Application granted granted Critical
Publication of CN107563476B publication Critical patent/CN107563476B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Color Image Communication Systems (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The invention relates to the technical field of two-dimensional codes, in particular to a beautifying and anti-counterfeiting method for a two-dimensional code, which comprises the following steps: reducing the area of a black color block in the original two-dimensional code; reducing pixels of the two-dimensional code; adjusting the transparency of black and white blocks in the two-dimensional code; obtaining the minimum recognizable value of the area and the pixel of the black block and the transparency of the black and white blocks in the two-dimensional code; and combining the two-dimensional code and the high-definition background image, and adjusting the RGB value to the optimal value which is most easily recognized. The invention has the beneficial effects that: by using a high-definition background image, the covering proportion and the image transparency value of the foreground two-dimensional code are reduced, and the attractiveness is guaranteed to the greatest extent; the optimal parameter combination is selected, so that the recognition rate of the two-dimensional code is guaranteed; the image processing algorithm is difficult to copy, and the two-dimensional code is difficult to forge; the coverage rate and the pixels of the foreground two-dimensional code are reduced, the foreground two-dimensional code can not be identified basically after being photographed, and the fact that cheating cannot be conducted in a specific scene is guaranteed.

Description

Two-dimensional code beautifying and anti-counterfeiting method
Technical Field
The invention relates to the technical field of two-dimensional codes, in particular to a beautifying and anti-counterfeiting method for a two-dimensional code.
Background
The two-dimensional bar code/two-dimensional code (2-dimensional bar code) records data symbol information by using black and white alternate graphs which are distributed on a plane (two-dimensional direction) according to a certain rule by using a certain specific geometric figure; the concept of '0' and '1' bit stream which forms the internal logic base of computer is skillfully utilized in coding, a plurality of geometric shapes corresponding to binary system are used for representing literal numerical information, and the information is automatically read by an image input device or an optoelectronic scanning device so as to realize the automatic processing of the information: it has some commonality of barcode technology: each code system has its specific character set; each character occupies a certain width; has certain checking function and the like. Meanwhile, the method also has the function of automatically identifying information of different rows and processing the graph rotation change points. The two-dimensional code is a label mainly made of black and white, and in the using process, the visual experience is not good enough, and the two-dimensional code is easy to forge.
Disclosure of Invention
In order to solve the problems, the invention provides a method for beautifying and preventing counterfeiting of a two-dimensional code.
The technical scheme of the invention is as follows: a two-dimensional code beautifying and anti-counterfeiting method is characterized by comprising the following steps:
(1) reducing the area of a black color block in the original two-dimensional code;
(2) reducing pixels of the two-dimensional code;
(3) adjusting the transparency of black and white blocks in the two-dimensional code;
(4) obtaining the minimum recognizable value of the area and the pixel of the black block and the transparency of the black and white blocks in the two-dimensional code;
(5) and combining the two-dimensional code and the high-definition background image, and adjusting the RGB value to the optimal value which is most easily recognized.
Preferably, the method for reducing the area of the black block in the original two-dimensional code to the minimum value capable of identifying the original two-dimensional code comprises: and converting the original two-dimensional code into a pixel matrix, and modifying a full-size black block in the two-dimensional code into a non-full-size black block according to a template.
Preferably, the method for reducing the pixels of the two-dimensional code to the minimum value capable of identifying the two-dimensional code comprises: scaling the template to a required size through a scaling function (xt, yt) (wt/ws) × z × (xs, ys), and further performing reduction adjustment on each pixel, wherein (xt, yt) is a target pixel coordinate; (xs, ys) is the template pixel coordinate; wt is the target width; ws is the template width; wt/ws is the scaling factor; z is a regulation and control scaling weight, and dynamic change is carried out during subsequent regulation and control, wherein the default value is 1.
Preferably, the method for adjusting the transparency of the black and white blocks in the two-dimensional code to the lowest transparency for identifying the two-dimensional code comprises: and generating a two-dimensional code according to the zoom weight Z, the white ARGB value and the black ARGB value of the template and the dichotomy value of each defined interval, and reversely identifying the two-dimensional code, if the two-dimensional code can be identified, adjusting the zoom weight Z, the white ARGB value and the black ARGB value, and continuously generating the two-dimensional code for identification until the two-dimensional code cannot be identified, thereby obtaining the optimal parameter combination.
Preferably, the method for merging the two-dimensional code and the high-definition background map and adjusting the RGB values to the most easily recognized optimal values includes: carrying out binarization processing on the background picture to obtain a black and white dot matrix image; combining the two-dimensional code with the determined color block size and a background picture, setting the initial value of the RGB value of the 0 value of the two-dimensional code matrix with the black background picture as (200 ) to make the color be gray; the 1 value RGB initial value is set to (0,0,0), so that the black point can not be identified as a white point because the background is black; the initial value of RGB 0 value of the two-dimensional code matrix with white background is set to be (220,220,220), so that the color is white, the excessive visual effect is better, and the initial value of RGB 1 value is set to be (50,50,50), so that the black point is gray, and the purpose of softness is achieved; after the initial value is set, the value 0 of the two-dimensional code matrix is between (200 ) and (220,220,220), the value 1 is between (0,0,0) and (50,50,50), the two-dimensional code matrix is subjected to dichotomy value taking, the two-dimensional code is generated, reverse recognition is carried out, and the optimal RGB value combination is screened out according to the recognition speed.
The invention has the beneficial effects that:
(1) by using a high-definition background image, the covering proportion and the image transparency value of the foreground two-dimensional code are reduced, and the attractiveness is guaranteed to the greatest extent;
(2) the optimal parameter combination is selected, so that the recognition rate of the two-dimensional code is guaranteed;
(3) the image processing algorithm is difficult to copy, and the two-dimensional code is difficult to forge;
(4) the coverage rate and the pixels of the foreground two-dimensional code are reduced, the foreground two-dimensional code can not be identified basically after being photographed, and the fact that cheating cannot be conducted in a specific scene is guaranteed.
Drawings
The present invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
FIG. 1 is a schematic flow chart of an embodiment of the present invention;
fig. 2 is a merged diagram of a two-dimensional code and a high definition background diagram according to an embodiment of the present invention.
Detailed Description
The technical solutions of the present invention will be further described below with reference to the accompanying drawings, but the present invention is not limited to these embodiments.
With reference to the attached drawing 1, a two-dimensional code beautifying and anti-counterfeiting method is characterized by comprising the following steps:
(1) reducing the area of a black color block in the original two-dimensional code;
(2) reducing pixels of the two-dimensional code;
(3) adjusting the transparency of black and white blocks in the two-dimensional code;
(4) obtaining the minimum recognizable value of the area and the pixel of the black block and the transparency of the black and white blocks in the two-dimensional code;
(5) and combining the two-dimensional code and the high-definition background image, and adjusting the RGB value to the optimal value which is most easily recognized.
The method for reducing the area of the black block in the original two-dimensional code to the minimum value capable of identifying the original two-dimensional code comprises the following steps: and converting the original two-dimensional code into a pixel matrix, and modifying a full-size black block in the two-dimensional code into a non-full-size black block according to a template. The original patch, because it is full-size, is converted to a pixel matrix by the template:
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1。
the color patch is modified to a non-full size, and the template is defined as follows:
0 0 0 0 0 0
0 1 1 1 1 0
0 1 1 1 1 0
0 1 1 1 1 0
0 1 1 1 1 0
0 0 0 0 0 0。
when an image is generated, 0 represents colorless and 1 represents black.
The method for reducing the pixels of the two-dimensional code to the minimum value capable of identifying the two-dimensional code comprises the following steps: scaling the template to a required size through a scaling function (xt, yt) (wt/ws) × z × (xs, ys), and further performing reduction adjustment on each pixel, wherein (xt, yt) is a target pixel coordinate; (xs, ys) is the template pixel coordinate; wt is the target width; ws is the template width; wt/ws is the scaling factor; z is a regulation and control scaling weight, and dynamic change is carried out during subsequent regulation and control, wherein the default value is 1.
The method for adjusting the transparency of the black and white blocks in the two-dimensional code to the lowest transparency for identifying the two-dimensional code comprises the following steps: and generating a two-dimensional code according to the zoom weight Z, the white ARGB value and the black ARGB value of the template and the dichotomy value of each defined interval, and reversely identifying the two-dimensional code, if the two-dimensional code can be identified, adjusting the zoom weight Z, the white ARGB value and the black ARGB value, and continuously generating the two-dimensional code for identification until the two-dimensional code cannot be identified, thereby obtaining the optimal parameter combination.
With reference to fig. 2, the method for merging the two-dimensional code and the high-definition background map and adjusting the RGB values to the most easily recognized optimal values includes: carrying out binarization processing on the background picture to obtain a black and white dot matrix image; combining the two-dimensional code with the determined color block size and a background picture, setting the initial value of the RGB value of the 0 value of the two-dimensional code matrix with the black background picture as (200 ) to make the color be gray; the 1 value RGB initial value is set to (0,0,0), so that the black point can not be identified as a white point because the background is black; the initial value of RGB 0 value of the two-dimensional code matrix with white background is set to be (220,220,220), so that the color is white, the excessive visual effect is better, and the initial value of RGB 1 value is set to be (50,50,50), so that the black point is gray, and the purpose of softness is achieved; after the initial value is set, the value 0 of the two-dimensional code matrix is between (200 ) and (220,220,220), the value 1 is between (0,0,0) and (50,50,50), the two-dimensional code matrix is subjected to dichotomy value taking, the two-dimensional code is generated, reverse recognition is carried out, and the optimal RGB value combination is screened out according to the recognition speed.
The specific embodiments described herein are merely illustrative of the spirit of the invention. Various modifications or additions may be made to the described embodiments or alternatives may be employed by those skilled in the art without departing from the spirit or ambit of the invention as defined in the appended claims.

Claims (4)

1. A two-dimensional code beautifying and anti-counterfeiting method is characterized by comprising the following steps:
1) reducing the area of a black color block in the original two-dimensional code;
2) reducing pixels of the two-dimensional code;
3) adjusting the transparency of black and white blocks in the two-dimensional code;
4) obtaining the minimum recognizable value of the area and the pixel of the black block and the transparency of the black and white blocks in the two-dimensional code;
5) combining the two-dimensional code and the high-definition background image, and adjusting the RGB value to the optimal value which is most easily recognized;
the method for combining the two-dimensional code and the high-definition background image and adjusting the RGB value to the best value which is most easily recognized comprises the following steps: carrying out binarization processing on the background picture to obtain a black and white dot matrix image; combining the two-dimensional code with the determined color block size and a background picture, setting the initial value of the RGB value of the 0 value of the two-dimensional code matrix with the black background picture as (200 ) to make the color be gray; the 1 value RGB initial value is set to (0,0,0), so that the black point can not be identified as a white point because the background is black; the initial value of RGB 0 value of the two-dimensional code matrix with white background is set to be (220,220,220), so that the color is white, the excessive visual effect is better, and the initial value of RGB 1 value is set to be (50,50,50), so that the black point is gray, and the purpose of softness is achieved; after the initial value is set, the value 0 of the two-dimensional code matrix is between (200 ) and (220,220,220), the value 1 is between (0,0,0) and (50,50,50), the two-dimensional code matrix is subjected to dichotomy value taking, the two-dimensional code is generated, reverse recognition is carried out, and the optimal RGB value combination is screened out according to the recognition speed.
2. The method for beautifying and anti-counterfeiting of the two-dimensional code according to claim 1, wherein the method for reducing the area of the black block in the original two-dimensional code to the minimum value capable of identifying the original two-dimensional code comprises the following steps: and converting the original two-dimensional code into a pixel matrix, and modifying a full-size black block in the two-dimensional code into a non-full-size black block according to a template.
3. The method for beautifying and anti-counterfeiting of the two-dimensional code according to claim 1, wherein the method for reducing the pixels of the two-dimensional code to the minimum value capable of identifying the two-dimensional code comprises the following steps: scaling the template to a required size through a scaling function (xt, yt) = (wt/ws) × z (xs, ys), and further performing reduction adjustment on each pixel, wherein (xt, yt) is a target pixel coordinate; (xs, ys) is the template pixel coordinate; wt is the target width; ws is the template width; wt/ws is the scaling factor; z is a regulation and control scaling weight, and dynamic change is carried out during subsequent regulation and control, wherein the default value is 1.
4. The method for beautifying and anti-counterfeiting of the two-dimensional code according to claim 2, wherein the method for adjusting the transparency of the black and white blocks in the two-dimensional code to the lowest transparency for identifying the two-dimensional code comprises the following steps: and generating a two-dimensional code according to the zoom weight Z, the white ARGB value and the black ARGB value of the template and the dichotomy value of each defined interval, and reversely identifying the two-dimensional code, if the two-dimensional code can be identified, adjusting the zoom weight Z, the white ARGB value and the black ARGB value, and continuously generating the two-dimensional code for identification until the two-dimensional code cannot be identified, thereby obtaining the optimal parameter combination.
CN201710610122.6A 2017-07-25 2017-07-25 Two-dimensional code beautifying and anti-counterfeiting method Active CN107563476B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710610122.6A CN107563476B (en) 2017-07-25 2017-07-25 Two-dimensional code beautifying and anti-counterfeiting method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710610122.6A CN107563476B (en) 2017-07-25 2017-07-25 Two-dimensional code beautifying and anti-counterfeiting method

Publications (2)

Publication Number Publication Date
CN107563476A CN107563476A (en) 2018-01-09
CN107563476B true CN107563476B (en) 2020-05-15

Family

ID=60973729

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710610122.6A Active CN107563476B (en) 2017-07-25 2017-07-25 Two-dimensional code beautifying and anti-counterfeiting method

Country Status (1)

Country Link
CN (1) CN107563476B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108681767A (en) * 2018-05-29 2018-10-19 黄希敏 A kind of signed and stamped publicity method of tracing to the source
CN110033068A (en) * 2019-04-17 2019-07-19 尤尼泰克(嘉兴)信息技术有限公司 A kind of two-dimensional code generation method and equipment containing background image
CN110263894B (en) * 2019-06-21 2022-08-16 新疆三维智达网络科技有限公司 Image code generation method
CN111062455B (en) * 2019-12-18 2024-05-14 北京远度互联科技有限公司 Two-dimensional code simplification and display method and device, electronic equipment and storage medium
CN111539503A (en) * 2020-04-02 2020-08-14 北京环网瑞通软件有限责任公司 Method and device for generating color anti-counterfeiting two-dimensional code and anti-counterfeiting system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103306161A (en) * 2013-06-13 2013-09-18 山东泰宝防伪技术产品有限公司 Anti-falsification paper with intelligent scaling-down two-dimensional codes as well as preparation method and application thereof
CN103810514A (en) * 2013-12-02 2014-05-21 黑龙江华夏千博科技有限公司 Art two-dimension code encoding method
CN103854298A (en) * 2014-02-13 2014-06-11 腾讯科技(深圳)有限公司 Method for integrating pictures with two-dimension codes and terminal
CN104778732A (en) * 2015-01-30 2015-07-15 北大方正集团有限公司 Method and device for generating two-dimensional code of image
CN105117760A (en) * 2015-09-15 2015-12-02 牛建伟 Method for generating color image two-dimensional code through fusion of two-dimensional code with color image

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103306161A (en) * 2013-06-13 2013-09-18 山东泰宝防伪技术产品有限公司 Anti-falsification paper with intelligent scaling-down two-dimensional codes as well as preparation method and application thereof
CN103810514A (en) * 2013-12-02 2014-05-21 黑龙江华夏千博科技有限公司 Art two-dimension code encoding method
CN103854298A (en) * 2014-02-13 2014-06-11 腾讯科技(深圳)有限公司 Method for integrating pictures with two-dimension codes and terminal
CN104778732A (en) * 2015-01-30 2015-07-15 北大方正集团有限公司 Method and device for generating two-dimensional code of image
CN105117760A (en) * 2015-09-15 2015-12-02 牛建伟 Method for generating color image two-dimensional code through fusion of two-dimensional code with color image

Also Published As

Publication number Publication date
CN107563476A (en) 2018-01-09

Similar Documents

Publication Publication Date Title
CN107563476B (en) Two-dimensional code beautifying and anti-counterfeiting method
US10614574B2 (en) Generating image segmentation data using a multi-branch neural network
US10158840B2 (en) Steganographic depth images
CN106447721B (en) Image shadow detection method and device
US8121408B2 (en) Image processing method and apparatus for face image
Du et al. Saliency-guided color-to-gray conversion using region-based optimization
JP4232804B2 (en) Image density conversion method, image enhancement processing apparatus, and program thereof
Yeung et al. Secure binary image steganography with distortion measurement based on prediction
CN110866529A (en) Character recognition method, character recognition device, electronic equipment and storage medium
CN108171157A (en) The human eye detection algorithm being combined based on multiple dimensioned localized mass LBP histogram features with Co-HOG features
CN111027545A (en) Card picture mark detection method and device, computer equipment and storage medium
CN110399760A (en) A kind of batch two dimensional code localization method, device, electronic equipment and storage medium
CN113228101A (en) System and method for image segmentation
CN111899202A (en) Method for enhancing superimposed time characters in video image
CN115482142A (en) Dark watermark adding method, extracting method, system, storage medium and terminal
CN116822548B (en) Method for generating high recognition rate AI two-dimensional code and computer readable storage medium
CN114519788A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN107808382A (en) A kind of PCB bar code dividing methods based on color saturation information
CN110070017B (en) Method and device for generating human face artificial eye image
Prasad et al. Grayscale to color map transformation for efficient image analysis on low processing devices
CN106682717B (en) Method and system for generating halftone two-dimensional code
CN110659343A (en) Extraction method, device and equipment of geo-fence data
CN116420176A (en) Method and apparatus for distinguishing between different configuration states of an object based on an image representation of the object
CN116542835A (en) Character watermark generation and extraction method and system
JP6276504B2 (en) Image detection apparatus, control program, and image detection method

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