CN107451640B - Anti-counterfeiting method based on two-dimensional code - Google Patents

Anti-counterfeiting method based on two-dimensional code Download PDF

Info

Publication number
CN107451640B
CN107451640B CN201710596434.6A CN201710596434A CN107451640B CN 107451640 B CN107451640 B CN 107451640B CN 201710596434 A CN201710596434 A CN 201710596434A CN 107451640 B CN107451640 B CN 107451640B
Authority
CN
China
Prior art keywords
area
code
dimensional code
value
particles
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
CN201710596434.6A
Other languages
Chinese (zh)
Other versions
CN107451640A (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.)
Fuzhou Dragonfly Vision Technology Co ltd
Original Assignee
Fuzhou Dragonfly Vision 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 Fuzhou Dragonfly Vision Technology Co ltd filed Critical Fuzhou Dragonfly Vision Technology Co ltd
Priority to CN201710596434.6A priority Critical patent/CN107451640B/en
Publication of CN107451640A publication Critical patent/CN107451640A/en
Application granted granted Critical
Publication of CN107451640B publication Critical patent/CN107451640B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/06037Record 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
    • 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/06046Constructional details
    • G06K19/06103Constructional details the marking being embedded in a human recognizable image, e.g. a company logo with an embedded two-dimensional code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1447Methods for optical code recognition including a method step for retrieval of the optical code extracting optical codes from image or text carrying said optical code

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Credit Cards Or The Like (AREA)

Abstract

The invention provides an anti-counterfeiting method based on a two-dimensional code, which realizes double anti-counterfeiting by encryption of a public key and a private key and fusion and drawing of the two-dimensional code and a logo icon.

Description

Anti-counterfeiting method based on two-dimensional code
Technical Field
The invention relates to an anti-counterfeiting technology, in particular to an anti-counterfeiting method based on a two-dimensional code.
Background
The market has wide demand for the anti-counterfeiting of commodities, and the anti-counterfeiting effect on the physical layer is good but the cost is higher. Along with the popularization of two-dimension code recognizing and reading equipment, the two-dimension code has special advantages in anti-counterfeiting, the cost is low, the product can be traced, and the mobile network can be connected with a database to acquire more product information. The traditional two-dimensional code such as a QR code needs a clean area for placing, the QR code and the like can be forged at will as an open technology, the identification of a code scanner carried by a mobile phone is easy to be connected to an unsafe website, and not only the anti-counterfeiting function is lost, but also the unexpected loss is brought.
Disclosure of Invention
The technical problem to be solved by the invention is to provide an anti-counterfeiting method based on a two-dimensional code, multiple anti-counterfeiting is realized, the two-dimensional code is fused with a logo icon, certain difficulty is brought to copying and tampering of counterfeiting, and carried information cannot be changed.
The technical problem to be solved by the invention is realized as follows:
an anti-counterfeiting method based on two-dimensional codes comprises the following steps:
step 11: each product corresponds to an independent number S, and an index I is generated for the independent number;
step 12: encrypting the index I through a private key to obtain an encryption number E, wherein the encryption number E corresponds to the index I one by one;
step 13: encoding the encryption number E and generating a two-dimensional code;
step 14: fusing the two-dimension code and a logo icon to form an anti-counterfeiting image, wherein the two-dimension code is arranged on an upper layer, the logo icon is arranged on a lower layer, the black module is displayed in the overlapping area of the black module of the two-dimension code and the logo icon, and the logo icon is displayed in the overlapping area of the white module of the two-dimension code and the logo icon;
step 15: after a product is obtained, firstly, picking an anti-counterfeiting image carried by the product, and extracting a two-dimensional code from the anti-counterfeiting image;
step 16: decoding the two-dimensional code and acquiring a number to be checked E1;
and step 17: decrypting the serial number E1 to be detected through a public key to obtain an index I1, wherein the public key corresponds to the private key;
step 18: and searching the encryption number E corresponding to the index I1 by using the index I1, and comparing the number E1 to be detected with the encryption number E, wherein if the number E is the same as the encryption number E, the product is a genuine product.
Further, in step 11, the independent number S is used to generate a hash value as an index I.
Further, the public key and the private key are based on an asymmetric encryption algorithm.
Further, the two-dimensional code is a stacked two-dimensional code, and the stacked two-dimensional code comprises a plurality of code areas arranged in an equidistant matrix manner and a positioning area for separating the code areas; each code area comprises a plurality of rows and a plurality of columns of identification units which are arranged in a matrix manner, a row of blank units is arranged between every two adjacent rows of identification units in the same code area, and a column of blank units is arranged between every two adjacent columns of identification units; each blank unit is a 3 x 3 module consisting of white modules; each identification unit is a 3 x 3 module consisting of a black module and a white module, the 3 x 3 module of the identification unit comprises two black modules and 7 white modules, the distance between the two black modules in the same identification unit is at least one white module, each identification unit correspondingly stores a four-bit binary string, the positioning area is formed by alternately arranging the identification units and blank units, a row of blank unit grids are arranged between the positioning area and the code area, and the positioning area is obtained by arranging one or more specific identification units selected in advance according to a certain rule so as to be rapidly distinguished and positioned; each code area carries a complete encryption number E.
Further, the black module and the white module are both square color blocks or circular color blocks.
Further, the logo icon is divided into a graphic part and a blank part, in step 14, the graphic part of the logo icon is set to be a dark gray value, the blank part of the logo icon is set to be a light gray value, a black module of the two-dimensional code is set to be a middle gray value, the middle gray value is in the middle range of the dark gray value and the light gray value, and the size of a pixel point of the black module is obviously smaller than that of the logo icon and not larger than the width of a stroke in a character in the logo icon.
Further, in step 15, performing gray histogram statistics on the acquired anti-counterfeiting image, finding a deeper gray value as a typical depth and finding a lighter gray value as a typical lightness, wherein the typical darkness represents a logo icon graphic part, and the typical lightness represents a logo icon blank part, the gray value of the black module in the identification unit is located in the middle of the typical depth and the typical lightness, and pixels located in a certain range between the typical depth and the typical lightness in the gray histogram are used as an area to be decoded for decoding.
Further, the decoding process comprises the steps of:
step 81, converting the image of the region to be decoded into a binary image;
82, obtaining the central coordinates of all the particles and the area values of the particles in the binary image, and filtering out the particles with the area values not meeting the requirements;
step 83, traversing the particles, and pairing two particles with the minimum distance by calculating the distance between the center coordinate of each particle and the center coordinates of other particles, wherein each two paired particles form an identification unit;
step 84, obtaining a plurality of identification units required by an independent code area;
and 85, sequentially traversing the identification unit to decode according to the four-bit binary string corresponding to the identification unit to obtain the binary string of the two-dimensional code.
Further, the step 82 further includes: counting the angles of the two particles with the maximum quantity and the minimum distance, and rotating the to-be-decoded area according to the angles to ensure that the to-be-decoded area is a positive image.
Further, the specific manner of filtering the particles with the unsatisfactory area value in step 82 is as follows: and obtaining the area value with the largest occurrence frequency as a standard value by adopting a particle counting method, setting an upper limit value and a lower limit value according to the standard value, and filtering out particles of which the area value is greater than the upper limit value and the area value is smaller than the upper limit value.
The invention has the following advantages:
1. the anti-counterfeiting method realizes double anti-counterfeiting through encryption of the public key and the private key and fusion of the two-dimensional code and the logo icon.
2. The anti-counterfeiting position and the logo icon have the obvious characteristic and can be identified at a glance, a counterfeiter can be identified at a glance by bypassing the pattern, and the falsification and batch copying of the coded content by the counterfeiter can be prevented.
3. Because enough gaps are reserved in the two-dimensional code, the two-dimensional code can be well integrated into other non-coding graphics (such as logo icons), a large coding area and a large logo icon can be generated, the logo icons are displayed by taking a uniform code area as a background, and the two-dimensional code is clearer and clearer than the logo icons in the existing two-dimensional code and does not influence the aesthetic feeling.
4. A plurality of code areas through piling up form a district, convenience of customers selects an area at will and sweeps a yard operation, realize conveniently sweeping the sign indicating number, and this kind of evenly distributed's heap two-dimensional code interference immunity in the discernment of decoding is strong, the module that belongs to the two-dimensional code and the figure of non-code are distinguished to the method of accessible statistics, after rejecting the non-code figure, utilize the two-dimensional code of repeated piling up to verify each other, further improve two-dimensional code robustness, and when some two-dimensional codes damaged appearing, the user can also use other positions to sweep the sign indicating number, do not influence normally and sweep the sign indicating number, improve the user greatly and sweep a sign indicating number and experience.
Drawings
The invention will be further described with reference to the following examples with reference to the accompanying drawings.
FIG. 1 is a flow chart of the anti-counterfeiting method of the invention.
Fig. 2 is a schematic diagram illustrating the fusion of stacked two-dimensional codes and logo icons according to the present invention.
FIG. 3 is a diagram of a single code region according to the present invention.
Fig. 4 is an enlarged view of a portion a of fig. 3.
FIG. 5 is a diagram illustrating a correspondence relationship between an identification unit and a four-bit binary string according to an embodiment of the present invention.
Fig. 6 is a decoding flow chart of stacked two-dimensional codes according to the present invention.
Detailed Description
As shown in fig. 1, the anti-counterfeiting method based on the two-dimensional code of the invention comprises the following steps:
step 11: each product corresponds to an independent number S, and an index I is generated for the independent number;
step 12: encrypting the index I through a private key to obtain an encryption number E, wherein the encryption number E corresponds to the index I one by one;
step 13: encoding the encryption number E and generating a two-dimensional code;
step 14: fusing the two-dimension code and a logo icon to form an anti-counterfeiting image, wherein the two-dimension code is arranged on an upper layer, the logo icon is arranged on a lower layer, the black module is displayed in the overlapping area of the black module of the two-dimension code and the logo icon, and the logo icon is displayed in the overlapping area of the white module of the two-dimension code and the logo icon;
step 15: after a product is obtained, firstly, picking an anti-counterfeiting image carried by the product, and extracting a two-dimensional code from the anti-counterfeiting image;
step 16: decoding the two-dimensional code and acquiring a number to be checked E1;
and step 17: decrypting the serial number E1 to be detected through a public key to obtain an index I1, wherein the public key corresponds to the private key;
step 18: and searching the encryption number E corresponding to the index I1 by using the index I1, and comparing the number E1 to be detected with the encryption number E, wherein if the number E is the same as the encryption number E, the product is a genuine product.
More specifically, in step 11, the manufacturer assigns an independent number S to each product to be produced, and generates a hash value of the independent number S as an index I of the product information in the database.
In step 12, the index I, which is the hash value of the product number, is encrypted by using a private key in an asymmetric encryption algorithm (which may be RSA, Elgamal, knapsack algorithm, Rabin, D-H, EC, etc.) to generate a new number, which is the encryption number E, and the encryption number E is stored in the data indexed by the index I, where the private key is held by the manufacturer.
In step 17, after decoding, the inspector holds the public key issued by the manufacturer, and decrypts the content to-be-checked number E1 obtained by decoding by using the public key to obtain the index I1.
In step 18, the inspector generates a link according to the index I1 and sends the content of the inspection number E1, the database indexes according to the index I1 and compares the received inspection number E1 with the encryption number E stored under the index I1, if the comparison result shows that the product is genuine, and relevant product information is sent to the inspector.
The anti-counterfeiting method realizes double anti-counterfeiting by encryption of the public key and the private key, fusion of the two-dimensional code and the logo icon and image acquisition, and greatly improves the anti-counterfeiting strength.
As shown in fig. 2 to 5, the two-dimensional code in the present invention is a stacked two-dimensional code, and the stacked two-dimensional code includes a plurality of code regions arranged in an equidistant matrix and a positioning region for separating the code regions; each code area comprises a plurality of rows and a plurality of columns of identification units which are arranged in a matrix manner, a row of blank units is arranged between every two adjacent rows of identification units in the same code area, and a column of blank units is arranged between every two adjacent columns of identification units; each of the blank cells is a 3 × 3 module (see a in fig. 4) composed of white modules; each of the identification units is a 3 × 3 module (see b in the figure) composed of a black module and a white module, the 3 × 3 module of the identification unit includes two black modules and 7 white modules, a distance of at least one white module is spaced between the two black modules in the same identification unit, each of the identification units correspondingly stores a four-bit binary string, as shown in fig. 5, 16 identification units combined according to different positions of the black modules are exactly matched with 16 values of the four-bit binary, and a four-bit binary string is bound to each of the identification units in advance, so that one identification unit corresponds to one four-bit binary.
Specifically, the encoding method of the stacked two-dimensional code is described, an existing matrix two-dimensional code is generated according to an encryption code E according to an encoding mode of the existing two-dimensional code, a positioning part is removed, and a data part is obtained, wherein the existing matrix two-dimensional code is a QR code or a DM code;
then, sequentially extracting 2 x 2 modules in the data part, and converting the 2 x 2 modules into corresponding identification units according to the four-bit binary string stored by the 2 x 2 modules;
then, all the converted identification units are sequentially arranged into a plurality of rows and a plurality of columns corresponding to the existing matrix two-dimensional code, a row of blank units is inserted between every two adjacent rows of identification units, and a column of blank units is inserted between every two adjacent columns of identification units, so that a code area of the stacked two-dimensional code is obtained.
Or, the encryption code E may be converted into a binary code string, and then the binary code string is divided into a plurality of sets of four-bit binary strings, each four-bit binary string corresponds to an identification unit, and the identification units are sorted into a code region.
While specific embodiments of the invention have been described, it will be understood by those skilled in the art that the specific embodiments described are illustrative only and are not limiting upon the scope of the invention, and that various equivalent modifications and changes in light of the spirit of the invention will be suggested to those skilled in the art and are to be included within the spirit and purview of this application as defined in the appended claims.
Each code area carries a complete encryption number E, all code areas in the same stacked two-dimensional code are the same, the code areas can be stacked in a matrix mode without limitation, and the density of black modules in the code areas is low, so that the stacked two-dimensional code can be set to be in any shape and any size as long as the logo icon area is larger than one code area, and the stacked two-dimensional code can be better fused with a logo icon.
The code area and the code area can be quickly positioned by arranging the positioning area, so that the identification efficiency is improved, the positioning area is formed by alternately arranging identification units and blank units, a row of blank unit grids (namely a row or a column of blank units) is arranged between the positioning area and the code area at intervals, the identification units in the positioning area can assign one or more identification units to be arranged according to a certain rule according to needs so as to be quickly distinguished and positioned, for example, the identification units in the positioning area can assign the identification units which are horizontally arranged by using the position relation of two black modules, also can select several identification units to be arranged according to a certain rule according to needs, and can assign the identification units at the cross position of the positioning area to be the identification units in which the position relation of the two black modules is horizontally arranged or vertically arranged so as to be distinguished from the arrangement relation of the identification units in the code area, therefore, the quick positioning is realized, the image direction is convenient to adjust, and the code area position is quick to obtain. For another example, the random combinations of 0 °, 90 °, 45 °, and 135 ° are selected from several identification units to form the positioning region.
The black module and the white module may be color blocks with the same size and shape, for example, both are square color blocks or circular color blocks.
The fusion process and the picture-taking process of the two-dimensional code and the logo icon are specifically that the logo icon is divided into a graph part and a blank part, in step 14, the graphic part of the logo icon is set as a dark gray value, the blank part of the logo icon is set as a light gray value, the black module of the two-dimensional code is set as a middle gray value, the intermediate gray value magnitude should be in the intermediate range of the dark gray value and the light gray value, the dark gray scale value may be set to H, the light gray scale value may be set to L, G is set to 1/2(H + L), the middle gray scale value may be set to a value at or near G, the dark gray value, the light gray value and the middle gray value are obviously distinguished, the future image acquisition and decoding are facilitated, the size of the black module pixel point is obviously smaller than that of the logo icon and not larger than the width of the stroke in the characters in the logo icon. Therefore, the finally formed pixel points of the black module in the overlapped pattern are smaller than the trademark graph, the display of the trademark cannot be influenced on the whole, and the marked features can be recognized at a glance.
In step 15, gray histogram statistics is performed on the acquired anti-counterfeiting image, a deeper gray value is found in the gray histogram as a typical depth, a shallower gray value is found in the gray histogram as a typical light, wherein the typical depth represents a logo icon graphic part, and the typical light represents a logo icon blank part, the gray value of the black module in the identification unit is located in the middle of the typical depth and the typical light gray values, and pixels located in a certain range between the typical depth and the typical light in the gray histogram are used as an area to be decoded.
The more specific embodiment is as follows:
during fusion: logo icons are in both dark and light colors, similar to binary images, with the difference between light and dark being as great as possible, e.g., black and white. And the gray value of the two-dimensional code black module is taken as the middle, such as gray. Expressed as:
logo icon blank section: white colour (Bai)
Black module of two-dimensional code: ash of
Logo icon graphic part: black colour
When the drawing is collected: the method includes the steps of acquiring an area with a proper size in an image, taking the area as a subdivided area, wherein the subdivided area needs to simultaneously comprise two-dimensional code units and logo icons, ensuring that gray values in the subdivided area comprise three types of black, white and gray, making a histogram, taking pixels in a front section of the histogram (for example, at the front 1/4 gray, the 1/5 gray or the 1/6 gray) as typical dark, taking pixels in a rear section of the histogram (for example, at the rear 1/4 gray, the 1/5 gray or the 1/6 gray) as typical light, cutting off the typical dark and the typical light pixels, taking two reasonable thresholds (for example, selecting the middle 1/3 in the range of the typical dark and the typical light, in order to set a wide range and ensure that all black modules can be found, although the set black modules are actually intermediate values of the gray values of the dark gray values and the light gray values, but the scope is used for inclusion when the drawing is adopted so as to ensure the completeness of the drawing. ) Pixels of gradation values within the threshold range are taken as standard cells. Then looking for other cells outwards according to the gray value of the standard cell.
As shown in fig. 6, the decoding process in the present invention includes the following steps:
step 81, converting the image of the region to be decoded into a binary image;
82, obtaining the central coordinates of all the particles and the area values of the particles in the binary image, and filtering out the particles with the area values not meeting the requirements;
step 83, traversing the particles, and pairing two particles with the minimum distance by calculating the distance between the center coordinate of each particle and the center coordinates of other particles, wherein each two paired particles form an identification unit;
step 84, obtaining a plurality of identification units required by an independent code area;
and 85, sequentially traversing the identification unit to decode according to the four-bit binary string corresponding to the identification unit to obtain the binary string of the two-dimensional code.
More specifically, the step 82 further includes: counting the angles of the two particles with the maximum quantity and the minimum distance, and rotating the to-be-decoded area according to the angles to ensure that the to-be-decoded area is a positive image.
More specifically, the specific manner of filtering the particles with the unsatisfactory area value in step 82 is as follows: and obtaining the area value with the largest occurrence frequency as a standard value by adopting a particle counting method, setting an upper limit value and a lower limit value according to the standard value, and filtering out particles of which the area value is greater than the upper limit value and the area value is smaller than the upper limit value.
When the stacked two-dimensional code with the positioning area is scanned, only one part of the two-dimensional code needs to be scanned at will, and decoding can be performed only by identifying one code area, and the method comprises the following specific steps:
acquiring an image of the stacked two-dimensional code with the positioning area, and filtering (such as gaussian filtering or mean filtering) the image of the stacked two-dimensional code with the positioning area;
obtaining the central coordinates of all particles and the area values of the particles in the image, and filtering out the particles with the logo icons (namely, the image acquisition process) and the area values not meeting the requirements, wherein the particles with the filtering area values not meeting the requirements specifically comprise: and screening out the particles with the area value larger than an upper limit value and the area value smaller than the upper limit value to obtain the particles meeting the conditions, wherein the specific upper limit value and the specific lower limit value can be set by taking the area value with the largest occurrence frequency as a standard value and increasing or decreasing the standard value by a certain value according to the area values of all the particles counted.
Counting the angles of the two particles with the largest number and the smallest distance, rotating and righting the image according to the angles to obtain a positive image, wherein the positive image is convenient to identify, the specific rotating mode can be that the angles of the two particles (corresponding to the black modules) with the largest number and the smallest distance are counted, and the image is rotated and righted according to the angles, and because the distance between the two black modules is the mode with the smallest distance in various modes when the two black modules in the identification unit are positioned on the same horizontal line or the same vertical line, the identification units with 0 degrees or 90 degrees can be searched through a statistical method, and the identification units are used for adjusting the position of image information;
traversing the particles, and pairing two particles with the minimum distance by calculating the distance between the center coordinate of each particle and the center coordinates of other particles, wherein each two paired particles form an identification unit;
searching a positioning area according to a preset protocol, and finding a plurality of identification units required by an independent code area according to the positioning area, namely, finding a code area according to the position of the positioning area by finding the positioning area, wherein the code area can be a complete code area or a code area formed by splicing identification units around the positioning area, so that the required minimum decoding area is greatly reduced; in the case where there is no location area, the identification unit of one code area can be judged by the repetition part.
Sequentially traversing the identification units corresponding to the code areas, obtaining the binary string corresponding to one code area according to the four-bit binary string corresponding to the identification unit, then selecting the existing two-dimensional code (such as QR algorithm, DM decoding and the like) decoding algorithm or a self-defined decoding method for further decoding operation according to needs, then obtaining the encrypted number E corresponding to the code area, and carrying out subsequent steps.
The anti-counterfeiting position combined with the logo icon has the obvious characteristic and can be recognized at a glance, a counterfeiter can be recognized at a glance by bypassing the pattern, and the falsification and batch copying of the coded content by the counterfeiter can be prevented. Enough gaps are reserved inside the stacked two-dimensional code, and the stacked two-dimensional code can be well integrated into other non-coding graphics (such as logo icons), so that a large piece of coding area and a large piece of logo icons can be generated, the size of each logo icon is obviously larger than that of one identification unit, and the logo icons are displayed by taking uniform code areas as backgrounds, so that the stacked two-dimensional code is more obvious than the logo icons in the existing two-dimensional code, and the aesthetic feeling is not influenced. A plurality of code areas are stacked to form a chip area, a user can conveniently and freely select one area to scan codes, convenient code scanning is realized, the uniformly distributed stacked two-dimensional codes have strong anti-interference performance in decoding and identification, modules and non-coded graphs belonging to the two-dimensional codes can be distinguished by a statistical method, after non-coded graphs are eliminated, the two-dimensional codes which are repeatedly stacked can be mutually verified, the robustness of the two-dimensional codes is further improved, when a part of the two-dimensional codes are damaged, the user can also use other parts to scan the codes, normal code scanning is guaranteed, and the code scanning experience of the user is greatly improved. The decoding efficiency is greatly improved, and when different code areas are stacked, the specific code area of the scanned code area can be judged through the positioning area.
Although specific embodiments of the invention have been described above, it will be understood by those skilled in the art that the specific embodiments described are illustrative only and are not limiting upon the scope of the invention, and that equivalent modifications and variations can be made by those skilled in the art without departing from the spirit of the invention, which is to be limited only by the appended claims.

Claims (6)

1. An anti-counterfeiting method based on two-dimensional codes is characterized in that: the method comprises the following steps:
step 11: each product corresponds to an independent number S, and an index I is generated for the independent number;
step 12: encrypting the index I through a private key to obtain an encryption number E, wherein the encryption number E corresponds to the index I one by one;
step 13: encoding the encryption number E and generating a two-dimensional code;
step 14: fusing the two-dimension code and a logo icon to form an anti-counterfeiting image, wherein the two-dimension code is arranged on an upper layer, the logo icon is arranged on a lower layer, the black module is displayed in the overlapping area of the black module of the two-dimension code and the logo icon, and the logo icon is displayed in the overlapping area of the white module of the two-dimension code and the logo icon;
step 15: after a product is obtained, firstly, picking an anti-counterfeiting image carried by the product, and extracting a two-dimensional code from the anti-counterfeiting image;
step 16: decoding the two-dimensional code and acquiring a number to be checked E1;
and step 17: decrypting the serial number E1 to be detected through a public key to obtain an index I1, wherein the public key corresponds to the private key;
step 18: searching an encryption number E corresponding to the index I1 by using the index I1, and comparing the number E1 to be detected with the encryption number E, wherein if the number E is the same as the encryption number E, the product is a genuine product;
the two-dimensional code is a stacked two-dimensional code, and the stacked two-dimensional code comprises a plurality of code areas arranged in an equidistant matrix manner and a positioning area for separating the code areas; each code area comprises a plurality of rows and a plurality of columns of identification units which are arranged in a matrix manner, a row of blank units is arranged between every two adjacent rows of identification units in the same code area, and a column of blank units is arranged between every two adjacent columns of identification units; each blank unit is a 3 x 3 module consisting of white modules; each identification unit is a 3 x 3 module consisting of a black module and a white module, the 3 x 3 module of the identification unit comprises two black modules and 7 white modules, the distance between the two black modules in the same identification unit is at least one white module, each identification unit correspondingly stores a four-bit binary string, the positioning area is formed by alternately arranging the identification units and blank units, a row of blank unit grids are arranged between the positioning area and the code area, and the positioning area is obtained by arranging one or more specific identification units selected in advance according to a certain rule so as to be rapidly distinguished and positioned; each code area carries a complete encryption number E;
in step 14, setting the graph part of the logo icon as a dark-color gray value, setting the blank part of the logo icon as a light-color gray value, setting a black module of the two-dimensional code as an intermediate gray value, wherein the intermediate gray value is in the intermediate range of the dark-color gray value and the light-color gray value, and the size of a pixel point of the black module is obviously smaller than that of the logo icon and not larger than the width of a stroke in a character in the logo icon;
in step 15, performing gray histogram statistics on the acquired anti-counterfeiting image, finding a deeper gray value as a typical depth and finding a shallower gray value as a typical shallow, wherein the typical deep represents a logo icon graphic part, and the typical shallow represents a logo icon blank part, the gray value of a black module in the identification unit is in the middle of the typical deep and typical shallow gray values, and pixels in a certain range between the typical deep and typical shallow in the gray histogram are used as an area to be decoded for decoding;
the decoding process comprises the steps of:
step 81, converting the image of the region to be decoded into a binary image;
82, obtaining the central coordinates of all the particles and the area values of the particles in the binary image, and filtering out the particles with the area values not meeting the requirements;
step 83, traversing the particles, and pairing two particles with the minimum distance by calculating the distance between the center coordinate of each particle and the center coordinates of other particles, wherein each two paired particles form an identification unit;
step 84, obtaining a plurality of identification units required by an independent code area;
and 85, sequentially traversing the identification unit to decode according to the four-bit binary string corresponding to the identification unit to obtain the binary string of the two-dimensional code.
2. The anti-counterfeiting method based on the two-dimensional code as claimed in claim 1, characterized in that: in step 11, the independent number S is used to generate a hash value as an index I.
3. The anti-counterfeiting method based on the two-dimensional code as claimed in claim 1, characterized in that: the public key and the private key are based on an asymmetric encryption algorithm.
4. The anti-counterfeiting method based on the two-dimensional code as claimed in claim 1, characterized in that: the black module and the white module are both square color blocks or circular color blocks.
5. The anti-counterfeiting method based on the two-dimensional code according to claim 1, characterized in that: the step 82 further comprises: counting the angles of the two particles with the maximum quantity and the minimum distance, and rotating the to-be-decoded area according to the angles to ensure that the to-be-decoded area is a positive image.
6. The anti-counterfeiting method based on the two-dimensional code according to claim 1, characterized in that: the specific way of filtering the particles with the unsatisfactory area value in the step 82 is as follows: and obtaining the area value with the largest occurrence frequency as a standard value by adopting a particle counting method, setting an upper limit value and a lower limit value according to the standard value, and filtering out particles of which the area value is greater than the upper limit value and the area value is smaller than the upper limit value.
CN201710596434.6A 2017-07-20 2017-07-20 Anti-counterfeiting method based on two-dimensional code Active CN107451640B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710596434.6A CN107451640B (en) 2017-07-20 2017-07-20 Anti-counterfeiting method based on two-dimensional code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710596434.6A CN107451640B (en) 2017-07-20 2017-07-20 Anti-counterfeiting method based on two-dimensional code

Publications (2)

Publication Number Publication Date
CN107451640A CN107451640A (en) 2017-12-08
CN107451640B true CN107451640B (en) 2020-04-24

Family

ID=60488822

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710596434.6A Active CN107451640B (en) 2017-07-20 2017-07-20 Anti-counterfeiting method based on two-dimensional code

Country Status (1)

Country Link
CN (1) CN107451640B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109379351B (en) * 2018-09-30 2021-04-27 武汉斗鱼网络科技有限公司 Two-dimensional code encryption method, storage medium, equipment and system
CN111597856B (en) * 2020-05-26 2023-04-07 成都鹏业软件股份有限公司 Concrete mark extraction method based on photochromic material
CN112182143B (en) * 2020-09-29 2023-08-25 平安科技(深圳)有限公司 Intelligent product recommendation method and device, computer equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102932148A (en) * 2012-10-25 2013-02-13 成都市易恒信科技有限公司 System and method for preventing safety two-dimensional code counterfeiting on basis of combination of public key (CPK) authentication
CN104077624A (en) * 2013-03-26 2014-10-01 中国银联股份有限公司 Methods and systems for generating and checking electronic note with anti-counterfeiting two-dimension code
CN104320440A (en) * 2014-09-30 2015-01-28 珠海市君天电子科技有限公司 Picture remote storage method and picture remote storage processing device
CN104850999A (en) * 2015-04-20 2015-08-19 中国农业大学 Commodity authenticity identifying method and system based on cloud technology and million-level encrypted two-dimension code
CN105447546A (en) * 2015-11-25 2016-03-30 林蔚 Two-dimensional code capable of being embedded with large-ratio graph as well as coding and decoding method and device therefor

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8608074B2 (en) * 2011-12-20 2013-12-17 Seiko Epson Corporation Method and apparatus for locating and decoding machine-readable symbols

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102932148A (en) * 2012-10-25 2013-02-13 成都市易恒信科技有限公司 System and method for preventing safety two-dimensional code counterfeiting on basis of combination of public key (CPK) authentication
CN104077624A (en) * 2013-03-26 2014-10-01 中国银联股份有限公司 Methods and systems for generating and checking electronic note with anti-counterfeiting two-dimension code
CN104320440A (en) * 2014-09-30 2015-01-28 珠海市君天电子科技有限公司 Picture remote storage method and picture remote storage processing device
CN104850999A (en) * 2015-04-20 2015-08-19 中国农业大学 Commodity authenticity identifying method and system based on cloud technology and million-level encrypted two-dimension code
CN105447546A (en) * 2015-11-25 2016-03-30 林蔚 Two-dimensional code capable of being embedded with large-ratio graph as well as coding and decoding method and device therefor

Also Published As

Publication number Publication date
CN107451640A (en) 2017-12-08

Similar Documents

Publication Publication Date Title
CN107451640B (en) Anti-counterfeiting method based on two-dimensional code
CA2586274C (en) Mixed code, and method and apparatus for generating the same, and method and apparatus for decoding the same
CN103489026B (en) Colorful two-dimension code, generating method and generating system thereof and printed article
EP1507232B1 (en) Method for classifying a digital image
CN101944187B (en) Two-dimensional micro code and processing method and device thereof
CN104657698B (en) A kind of color 2 D code decoding method for carrying several black and white Quick Response Codes
CN102236810A (en) QR (Quick Response) code with hidden codes, and formation and identification methods of hidden codes
CN105550730B (en) Safe two-dimensional code manufacture method and decoding method, and safe two-dimensional code identifier
CN101739720B (en) Method and device for generating three-dimensional dynamic verification code
CN105447546A (en) Two-dimensional code capable of being embedded with large-ratio graph as well as coding and decoding method and device therefor
KR20070122129A (en) Color classification method for color based image code recognition
CN102136064A (en) System for recognizing characters from image
CN106446885A (en) Paper-based Braille recognition method and system
CN103632179A (en) Three-dimensional bar code encoding and decoding method and device
CN111783608B (en) Face-changing video detection method
CN113313225A (en) Anti-counterfeiting method based on sparse dot matrix code
CN109831309A (en) A kind of safety code principle and method with multiple-authentication
CN108960387A (en) A kind of anti-counterfeiting two dimensional code and its generation and recognition methods
CN111160331A (en) Anti-counterfeit label authentication method, device, medium and template graph generation method
CN102163336B (en) Method for coding and decoding image identification codes
CN104933386B (en) The recognition methods of many GTG invisible two-dimensional codes
CN116822548B (en) Method for generating high recognition rate AI two-dimensional code and computer readable storage medium
CN109934322A (en) Generation method, generating means, recognition methods and the identification device of dynamic 3 D code
CN109543803B (en) Coding system and decoding system capable of editing primary-secondary color two-dimensional codes
CN107153804B (en) Method for generating and identifying stacked two-dimensional code with positioning area

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