Verification method and device of novel three-dimensional code combined with picture

文档序号:1953484 发布日期:2021-12-10 浏览:15次 中文

阅读说明:本技术 一种结合图片的新型三维码的验证方法及设备 (Verification method and device of novel three-dimensional code combined with picture ) 是由 陈绳旭 王秋婉 马吉良 何荣茂 张梦达 于 2021-09-08 设计创作,主要内容包括:本发明涉及一种结合图片的新型三维码的验证方法,包括如下步骤:获取三维码,所述三维码包括第一图片、数据码组和定位码组;提取所述三维码中的定位码组;通过定位码组对第一图片和数据码组进行畸变校正;对三维码进行验证,步骤如下:获取第二图片;通过图像识别算法判断第二图片与校正后的第一图片是否一致,若一致,则该三维码通过验证;否则,该三维码不通过验证。本发明通过所述第一图片向用户提供视觉信息,用户可通过图片辨识三维码,提高用户体验;并利用第一图片验证三维码,增强三维码的防伪能力。(The invention relates to a verification method of a novel three-dimensional code combined with a picture, which comprises the following steps: acquiring a three-dimensional code, wherein the three-dimensional code comprises a first picture, a data code group and a positioning code group; extracting a positioning code group in the three-dimensional code; carrying out distortion correction on the first picture and the data code group through a positioning code group; the three-dimensional code is verified, and the steps are as follows: acquiring a second picture; judging whether the second picture is consistent with the corrected first picture or not through an image recognition algorithm, and if so, verifying the three-dimensional code; otherwise, the three-dimensional code does not pass verification. According to the invention, visual information is provided for the user through the first picture, and the user can recognize the three-dimensional code through the picture, so that the user experience is improved; and the three-dimensional code is verified by utilizing the first picture, so that the anti-counterfeiting capability of the three-dimensional code is enhanced.)

1. A verification method of a novel three-dimensional code combined with a picture is characterized by comprising the following steps:

acquiring a three-dimensional code, wherein the three-dimensional code comprises a first picture, a data code group and a positioning code group;

extracting a positioning code group in the three-dimensional code;

carrying out distortion correction on the first picture and the data code group through a positioning code group;

the three-dimensional code is verified, and the steps are as follows: acquiring a second picture; judging whether the second picture is consistent with the corrected first picture or not through an image recognition algorithm, and if so, verifying the three-dimensional code; otherwise, the three-dimensional code does not pass verification.

2. The method for verifying the novel three-dimensional code combined with the picture according to claim 1, wherein the method for generating the three-dimensional code comprises:

acquiring a first picture; generating coded data and converting the coded data into a data module; generating a positioning module; and arranging the data module, the positioning module and the first picture to obtain the three-dimensional code.

3. The method for verifying the novel three-dimensional code combined with the picture according to claim 1, wherein the determining whether the second picture is consistent with the corrected first picture specifically comprises: respectively obtaining a first hash value of the corrected first picture and a second hash value of the second picture through a perceptual hash algorithm, and if the Hamming distance between the first hash value and the second hash value is greater than a first threshold value, determining that the second picture is inconsistent with the corrected first picture; and if the Hamming distance between the first Hash value and the second Hash value is smaller than a second threshold value, the second picture is considered to be consistent with the corrected first picture.

4. The method as claimed in claim 1, wherein the data code group and the positioning code group are arranged around the first picture.

5. The method for verifying the novel three-dimensional code combined with the picture according to claim 1, further comprising: decoding the corrected data code group to obtain coded data, wherein the coded data comprises a picture identifier; and inquiring to obtain the second picture through the picture identification index.

6. The method for verifying the novel three-dimensional code combined with the picture according to claim 1, further comprising: decoding the corrected data code group to obtain coded data, wherein the coded data comprises a function identifier; the function identifier is used for judging whether to verify the three-dimensional code or whether to store the corrected first picture or whether to store the coded data.

7. The utility model provides a verification equipment of novel three-dimensional code that combines picture which characterized in that, includes memory, camera and treater:

the camera is used for acquiring a three-dimensional code, and the three-dimensional code comprises a first picture, a data code group and a positioning code group;

the memory stores instructions adapted to be loaded by the processor and to perform the steps of:

extracting a positioning code group in the three-dimensional code;

carrying out distortion correction on the first picture and the data code group according to the positioning code group;

the three-dimensional code is verified, and the steps are as follows: acquiring a second picture; judging whether the second picture is consistent with the corrected first picture or not through an image recognition algorithm, and if so, verifying the three-dimensional code; otherwise, the three-dimensional code does not pass verification.

8. The apparatus for verifying a novel three-dimensional code according to claim 7, wherein the determining whether the second picture is consistent with the corrected first picture specifically comprises: respectively obtaining a first hash value of the corrected first picture and a second hash value of the second picture through a perceptual hash algorithm, and if the Hamming distance between the first hash value and the second hash value is greater than a first threshold value, determining that the second picture is inconsistent with the corrected first picture; and if the Hamming distance between the first Hash value and the second Hash value is smaller than a second threshold value, the second picture is considered to be consistent with the corrected first picture.

9. The apparatus for authenticating a new three-dimensional code combined with a picture according to claim 7, wherein said set of data codes and said set of positioning codes are disposed around said first picture.

10. The verification device of the novel three-dimensional code combined with the picture according to claim 7, further comprising: decoding the corrected data code group to obtain coded data, wherein the coded data comprises a picture identifier; and inquiring to obtain the second picture through the picture identification index.

11. The verification device of the novel three-dimensional code combined with the picture according to claim 7, further comprising: decoding the corrected data code group to obtain coded data, wherein the coded data comprises a function identifier; the function identifier is used for judging whether to verify the three-dimensional code or whether to store the corrected first picture or whether to store the coded data.

Technical Field

The invention relates to a verification method and equipment of a novel three-dimensional code combined with a picture, and belongs to the field of two-dimensional code/three-dimensional code anti-counterfeiting authentication.

Background

The two-dimensional code has weak anti-counterfeiting capability due to the characteristics of open source, easy copying, only consisting of black and white code points and the like. The prior art is as follows: 1. the picture (such as a WeChat payment two-dimensional code) is directly superposed on the two-dimensional code by utilizing an error correction mechanism of the two-dimensional code, and the picture is used as an identification symbol, so that the anti-counterfeiting effect of the two-dimensional code is enhanced, but the size of the picture is limited by the error correction capability; 2. a three-dimensional code combining code points and pictures (see patent publication No. CN106991462A, "three-dimensional code generation method"), in which, although the size of a picture in the three-dimensional code is not limited, the picture is hidden under the code points, and the code point matrix can block the picture, thereby affecting the visual information conveyed by the picture.

Therefore, a method for better combining the picture and the code point matrix is needed, so that the picture can better enhance the anti-counterfeiting effect of the two-dimensional code/three-dimensional code.

Patent publication No. CN108510274A, a method and an apparatus for visual identification of a combination of a picture and a two-dimensional code, discloses: before scanning the code, the user checks and compares whether the first picture is consistent with the real scene; after the confirmation, starting the camera function of the mobile intelligent equipment; scanning and identifying the first two-dimensional code through a software APP, and meanwhile; carrying out automatic focusing photographing on the first picture; the first picture is bound with at least one first two-dimensional code; sending the first two-dimensional code and the first picture which are scanned, identified and photographed to a website server; the website server receives the first two-dimensional code and the first picture, and compares and verifies the first two-dimensional code and the first picture with a second two-dimensional code and a two-dimensional code picture stored in the website server; and checking the binding relationship between the first two-dimensional code and the first picture. The method can greatly improve the safety of payment by using the static two-dimensional code. However, the first picture obtained by shooting has distortion to a certain degree, which affects the accuracy of comparison of subsequent pictures, and the situation that the two-dimensional code passing the verification is judged as not passing the verification by error easily occurs.

Disclosure of Invention

In order to solve the problems in the prior art, the invention provides a verification method of a novel three-dimensional code combined with pictures, visual information is provided for a user through a first picture, the user can recognize the three-dimensional code through the picture, and user experience is improved; the picture is also used for verifying the three-dimensional code, and the anti-counterfeiting performance of the three-dimensional code is improved. In addition, the first picture, the data code group and the positioning code group are taken as a whole, the positioning code group is used for carrying out distortion correction on the first picture, the accuracy of picture comparison in the follow-up verification of the three-dimensional code is improved, and therefore the accuracy of three-dimensional code verification is improved.

The technical scheme of the invention is as follows:

the first technical scheme is as follows:

acquiring a three-dimensional code, wherein the three-dimensional code comprises a first picture, a data code group and a positioning code group;

extracting a positioning code group in the three-dimensional code;

carrying out distortion correction on the first picture and the data code group through a positioning code group;

the three-dimensional code is verified, and the steps are as follows: acquiring a second picture; judging whether the second picture is consistent with the corrected first picture or not through an image recognition algorithm, and if so, verifying the three-dimensional code; otherwise, the three-dimensional code does not pass verification.

Further, the determining whether the second picture is consistent with the corrected first picture specifically includes: respectively obtaining a first hash value of the corrected first picture and a second hash value of the second picture through a perceptual hash algorithm, and if the Hamming distance between the first hash value and the second hash value is greater than a first threshold value, determining that the second picture is inconsistent with the corrected first picture; and if the Hamming distance between the first Hash value and the second Hash value is smaller than a second threshold value, the second picture is considered to be consistent with the corrected first picture.

Further, the data code group and the positioning code group are arranged around the first picture.

Further, the method also comprises the following steps: decoding the corrected data code group to obtain coded data, wherein the coded data comprises a picture identifier; and inquiring to obtain the second picture through the picture identification index.

Further, the method also comprises the following steps: decoding the corrected data code group to obtain coded data, wherein the coded data comprises a function identifier; the function identifier is used for judging whether to verify the three-dimensional code or whether to store the corrected first picture or whether to store the coded data.

The second technical scheme is as follows:

the utility model provides a verification equipment of novel three-dimensional code of combination picture, includes memory and treater, includes memory, camera and treater:

the camera is used for acquiring a three-dimensional code, and the three-dimensional code comprises a first picture, a data code group and a positioning code group;

the memory stores instructions adapted to be loaded by the processor and to perform the steps of:

extracting a positioning code group in the three-dimensional code;

carrying out distortion correction on the first picture and the data code group according to the positioning code group;

the three-dimensional code is verified, and the steps are as follows: acquiring a second picture; judging whether the second picture is consistent with the corrected first picture or not through an image recognition algorithm, and if so, verifying the three-dimensional code; otherwise, the three-dimensional code does not pass verification.

Further, the determining whether the second picture is consistent with the corrected first picture specifically includes: respectively obtaining a first hash value of the corrected first picture and a second hash value of the second picture through a perceptual hash algorithm, and if the Hamming distance between the first hash value and the second hash value is greater than a first threshold value, determining that the second picture is inconsistent with the corrected first picture; and if the Hamming distance between the first Hash value and the second Hash value is smaller than a second threshold value, the second picture is considered to be consistent with the corrected first picture.

Further, the data code group and the positioning code group are arranged around the first picture.

Further, the method also comprises the following steps: decoding the corrected data code group to obtain coded data, wherein the coded data comprises a picture identifier; and inquiring to obtain the second picture through the picture identification index.

Further, the method also comprises the following steps: decoding the corrected data code group to obtain coded data, wherein the coded data comprises a function identifier; the function identifier is used for judging whether to verify the three-dimensional code or whether to store the corrected first picture or whether to store the coded data.

The invention has the following beneficial effects:

1. in the three-dimensional code generated by the method, the first picture provides visual information for a user, and the user can identify the three-dimensional code through the picture, so that the user experience is improved; data code group and location code group encircle first picture sets up, and the size of first picture is unrestricted, and the picture can not sheltered from to the code point, avoids influencing the visual information that the picture conveyed

2. The three-dimensional code is verified by using the first picture in the decoding process, so that the anti-counterfeiting capability of the three-dimensional code is effectively enhanced.

3. The invention takes the first picture, the data code group and the positioning code group as a whole, and utilizes the positioning code group to carry out distortion correction on the first picture, thereby improving the accuracy of picture comparison when the three-dimensional code is verified, further improving the accuracy of three-dimensional code verification and further enhancing the anti-counterfeiting capability of the three-dimensional code.

4. The picture identification is set in the coded data, the second picture is inquired through the picture identification index during code verification, and the first picture and the second picture are compared, so that the risk of replacing the picture or the data code group is effectively prevented.

5. According to the invention, the function identifier is arranged in the coded data, the function of the three-dimensional code can be flexibly selected according to actual requirements, the first picture is transmitted or the three-dimensional code is verified or the data is transmitted, the information transmission capacity (large picture data volume) of the three-dimensional code is increased, and the user experience is good.

6. According to the invention, whether the first picture and the second picture are consistent or not is compared through the perceptual hash algorithm, the identification precision is higher than that of human eyes, and the accuracy of picture comparison is high, so that the accuracy of three-dimensional code verification is improved.

Drawings

FIG. 1 is a flow chart of three-dimensional code verification;

FIG. 2 is a schematic diagram of a code generation flow of three-dimensional code;

FIG. 3 is a flow chart of a three-dimensional code decoding process;

FIG. 4 is a schematic diagram of a three-dimensional code according to the present invention;

FIG. 5 is a schematic diagram of a corrector.

Detailed Description

The invention is described in detail below with reference to the figures and the specific embodiments.

Example one

Referring to fig. 2, the three-dimensional code is generated as follows:

a first picture is obtained. The first picture can be a face picture, a space picture, a commodity picture or a device picture, and the like.

And generating a picture identifier for identifying the first picture. In this embodiment, the picture identifier is a character string composed of 36-bit characters. The first picture and the picture identification of the first picture are stored in the server, and the picture identification in the server is associated with the storage address of the first picture in the server, as shown in table 1.

TABLE 1

Encoded data is generated, the encoded data including a function identification and a data field. When the function identifier is 00, the three-dimensional code is used for transmitting a first image, and the data field does not contain the picture identifier and does not verify the three-dimensional code; when the function identifier is 01, the three-dimensional code is used for transmitting a data field, and the data field does not contain a picture identifier or verify the three-dimensional code; when the function identifier is 10, the data field contains a picture identifier, and the three-dimensional code needs to be verified; when the function identifier is 11, the three-dimensional code is used for transmitting a data field, and the data field contains a picture identifier, the three-dimensional code needs to be verified.

The encoded data is converted into a binary stream, data 0 being a white code dot and data 1 being a black code dot. And arranging the code points around the first picture according to a preset rule to obtain a data code group. In this embodiment, the code points are sequentially arranged in four rectangular areas outlined in fig. 4 in the counterclockwise direction. And generating a positioning module, wherein the positioning module comprises three locators and a corrector. In this embodiment, the locator is a black rectangular frame embedded with a black square, and the corrector includes a quarter of the black rectangular frame and the black square (for example, the specific size ratio is shown in fig. 5). The black square blocks in the corrector have larger occupied area proportion in the corrector, have higher anti-pollution capacity, are easier to identify and are beneficial to improving the success rate of distortion correction. And adding positioning modules at the four outer corners of the first picture to obtain the three-dimensional code, as shown in fig. 4. In the embodiment, the mask is also superposed on the three-dimensional code, so that the black and white code points are more uniformly distributed, and the cracking difficulty of the three-dimensional code is increased.

The beneficial effect of this embodiment lies in:

1. the first picture in the three-dimensional code provides visual information for a user, and the user can recognize the three-dimensional code through the picture, so that the user experience is improved; encircle data code group and location code group first picture setting, then the picture size is unrestricted, and the code point can not shelter from the picture, does not influence the visual information that the picture conveyed.

2. And a picture identifier is set in the coded data, and the second picture is inquired through the picture identifier index and the first picture and the second picture are compared during code verification, so that the risk of replacing the picture or the data code group is effectively prevented.

3. The function identification is arranged in the coded data, the function of the three-dimensional code can be flexibly selected according to actual requirements, the first picture is transmitted or the three-dimensional code is verified or the data is transmitted, the information transmission capacity of the three-dimensional code is increased (the data volume of the first picture is large), and the user experience is good.

Example two

The process of converting the encoded data into a binary stream is illustrated:

the encoded data includes: a start field, a count field, a function identification, and a data field. The encoded data is converted into a binary stream.

The data fields are: 002/0002937c-62a9-4934-9ee0-6a1b703ebb35 has a start field of 10, a count field of 00101000, and a function identifier of 10.

The binary stream obtained after encoding is:

00110000001100000011001000101111001100000011000000110000001100100011100100110011001101110110001100101101001101100011001001100001001110010010110100110100001110010011001100110100001011010011100101100101011001010011000000101101001101100110000100110001011000100011011100110000001100110110010101100010011000100011001100110101

EXAMPLE III

As described in the first embodiment, the server stores the first picture, and the corresponding relationship between the picture identifier and the storage address of the first picture in the server in advance.

As shown in fig. 1 and 3, the code scanning device obtains a three-dimensional code picture through a camera, and executes the following steps through a processor:

extracting a positioning module in the three-dimensional code picture;

distortion correction is carried out on the three-dimensional code picture through a positioning module;

extracting a first picture and a data code group in the corrected three-dimensional code picture;

converting the data code group into coded data;

judging the three-dimensional code function according to the function identification in the coded data:

if the function identifier is 00, the three-dimensional code is not verified, and the code scanning device stores a first picture; if the function identifier is 01, the three-dimensional code is not verified, and the code scanning device stores data fields in the coded data; if the function identifier is 10, the three-dimensional code is verified, specifically:

the code scanning equipment sends the picture identification in the data field to the server (if the data field has no picture identification, the three-dimensional code is directly considered not to pass verification); the server inquires a storage address of the first picture according to the picture identification so as to obtain the first picture, and then returns the stored first picture serving as a second picture to the code scanning device;

respectively processing the first picture and the second picture as follows: 1. and (3) reducing the size: reducing the picture to 8 × 8 (64 pixels in total) to remove the details of the image, only retaining the basic information of structure/brightness and the like, and abandoning the image difference caused by different sizes/proportions;

2. simplifying the color: converting the reduced picture into 64-level gray, namely that all pixel points have 64 colors in total;

3. calculating the average value: calculating the gray level average value of all 64 pixels;

4. comparing the gray levels of the pixels: comparing the gray scale of each pixel with the average value, and recording the average value greater than or equal to 1 and the average value smaller than 0;

5. calculating a hash value: combining the comparison results of the previous step in sequence to form a 64-bit integer, namely a hash value;

6. if the hamming distance between the first hash value and the second hash value is greater than the first threshold (10 in this embodiment), it is determined that the second picture is inconsistent with the corrected first picture, and the three-dimensional code does not pass the verification; if the hamming distance between the first hash value and the second hash value is smaller than the second threshold (5 in this embodiment), the first picture and the second picture are considered to be consistent, and the three-dimensional code passes verification. And judging whether the first picture and the second picture are consistent or not by a manual or other image recognition algorithm when the Hamming distance between the first hash value and the second hash value is between 5 and 10.

The improvement of the embodiment is that:

1. the three-dimensional code is verified by using the first picture in the decoding process, so that the anti-counterfeiting capability of the three-dimensional code is effectively enhanced;

2. the first picture, the data code group and the positioning code group are taken as a whole, the positioning code group is used for carrying out distortion correction on the first picture, the accuracy of picture comparison in the follow-up verification of the three-dimensional code is improved, and therefore the accuracy of three-dimensional code verification is improved.

3. Whether the first picture and the second picture are consistent or not is compared through a perceptual hash algorithm, the recognition precision is higher than that of human eyes, and the authenticity of the three-dimensional code is effectively verified.

The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes performed by the present specification and drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

12页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种结合人像的新型三维码的验证方法及设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!