A method for generating color anti-counterfeiting code
By drawing colored anti-counterfeiting lines and segment numbers on the QR code image to generate a colored anti-counterfeiting code, the problem of poor anti-counterfeiting effect of existing QR codes is solved, and higher anti-counterfeiting effect and practicality are achieved.
Patent Information
- Application Number
- CN202210510790.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-11
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-05-11
AI Technical Summary
The existing QR code anti-counterfeiting effect needs to be improved and it is difficult to meet higher anti-counterfeiting requirements.
By generating a color anti-counterfeiting code, the anti-counterfeiting lines and segment numbers are drawn at specific positions of the QR code image, and a color two-dimensional barcode is generated using specific bit data to improve the anti-counterfeiting effect.
It greatly improves the anti-counterfeiting effect, has good practicality, and the color security code is easy to identify and distinguish.
Smart Images

Figure CN114819023B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of anti-counterfeiting codes, and in particular to a method for generating a color anti-counterfeiting code. Background Art
[0002] A QR code, also known as a two-dimensional barcode, is most commonly known as a QR Code. QR stands for Quick Response. A QR code is a black and white graphic that records data symbols, arranged in a pattern across a two-dimensional plane. The code cleverly leverages the concept of "0" and "1" bit streams, fundamental to computer logic, using geometric shapes corresponding to binary numbers to represent textual and numerical information. This information is automatically processed through image input devices or photoelectric scanning equipment. It shares some common characteristics with barcode technology: each code system has its own unique character set; each character occupies a specific width; and it has certain checksums. It also features automatic recognition of different lines of information and handles rotational variations. A QR code has become extremely popular on mobile devices in recent years, storing more information and representing a wider range of data types than traditional barcodes.
[0003] Existing QR codes generally adopt a two-dimensional directional distribution and black and white structure, and the anti-counterfeiting effect needs to be further improved. Summary of the Invention
[0004] (1) Technical problems to be solved
[0005] An embodiment of the present invention provides a method for generating a color anti-counterfeiting code, comprising: loading data for generating the anti-counterfeiting code into a program memory; running the program to generate a QR code image, extracting the color of the anti-counterfeiting line and the number of line segments; and drawing the anti-counterfeiting line and the number of segments at corresponding positions in the QR code image. This embodiment of the present invention significantly improves the anti-counterfeiting effect and has excellent practicality.
[0006] (2) Technical solution
[0007] The embodiment of the present invention provides a method for generating a color anti-counterfeiting code, comprising the following steps:
[0008] Step 1: Start the program and load the data for generating the anti-counterfeiting code into the program memory;
[0009] Step 2: Run the program and read string A in sequence according to the data content loaded in the memory;
[0010] Step 3: Generate a QR code image based on the string A and draw it on a temporary canvas;
[0011] Step 4: extracting a specific number of digits from the character string A, sequentially reading each bit of anti-counterfeiting data P in the specific number of digits, and obtaining the color of the anti-counterfeiting line and the number of line segments according to the value of the anti-counterfeiting data P;
[0012] Step 5: sequentially draw the anti-counterfeiting lines and the segment numbers at corresponding positions of the QR code image on the temporary canvas to obtain the color anti-counterfeiting code.
[0013] Furthermore, the data for generating the anti-counterfeiting code in step 1 is QR Code data in txt format.
[0014] Furthermore, the specific bit number data is 16-bit data.
[0015] Furthermore, the anti-counterfeiting lines are respectively arranged on the left and right sides of the QR code image.
[0016] Furthermore, the number of segments is set at the bottom side of the QR code image.
[0017] Furthermore, the color security code generation method further comprises: in step 1, after the program is started, determining whether the data for generating the security code is loaded into the program memory; if not, prompting the user to perform a loading operation.
[0018] Furthermore, the specific number of digits of data is set at the end of the character string A.
[0019] Furthermore, the color security code generation method further includes performing flipping, rotating, and picture height setting operations on the generated color security code.
[0020] Furthermore, the number of the anti-counterfeiting lines corresponds to the number of the segments.
[0021] (3) Beneficial effects
[0022] The embodiment of the present invention generates a QR code image through a character string A, then inserts a specific number of digits of data into the character string A, uses the specific number of digits of data to generate a color two-dimensional barcode and a corresponding number of segments, and then obtains a color anti-counterfeiting code in the form of a combination of the QR code image, the color two-dimensional barcode and the corresponding number of segments, which greatly improves the anti-counterfeiting effect and has good practicality.
[0023] Additional aspects and advantages of the present invention will be set forth in part in the description which follows and, in part, will be obvious from the description which follows, or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0025] Figure 1 This is a flow chart of a method for generating a color anti-counterfeiting code according to an embodiment of the present invention.
[0026] Figure 2 FIG. 1 is a schematic diagram of a color anti-counterfeiting code according to an embodiment of the present invention.
[0027] Figure 3 2 is a schematic diagram comparing the anti-counterfeiting lines and the number of their segments according to an embodiment of the present invention.
[0028] Figure 4 This is a flow chart of a method for generating a color anti-counterfeiting code according to another embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following detailed description of the embodiments of the present invention is provided in conjunction with the accompanying drawings and examples. The detailed description of the following embodiments and the accompanying drawings are intended to illustrate the principles of the present invention and are not intended to limit the scope of the present invention. That is, the present invention is not limited to the described embodiments and covers any modifications, replacements, and improvements to the parts, components, and connection methods without departing from the spirit of the present invention.
[0030] It should be noted that, unless there is any conflict, the embodiments and features in the embodiments of this application can be combined with each other.
[0031] The following will refer to the attached Figure 1 -Attached Figure 4 The present application is described in detail with reference to embodiments.
[0032] See attached Figure 1 As shown, a method for generating a color anti-counterfeiting code according to an embodiment of the present invention includes the following steps:
[0033] Step 1: Start the program and load the data for generating the anti-counterfeiting code into the program memory;
[0034] Step 2: Run the program and read string A in sequence according to the data content loaded in the memory;
[0035] Step 3: Generate a QR code image based on the string A and draw it on a temporary canvas;
[0036] Step 4: extracting a specific number of digits from the character string A, sequentially reading each bit of anti-counterfeiting data P in the specific number of digits, and obtaining the color of the anti-counterfeiting line and the number of line segments according to the value of the anti-counterfeiting data P;
[0037] Step 5: sequentially draw the anti-counterfeiting lines and the segment numbers at corresponding positions of the QR code image on the temporary canvas to obtain the color anti-counterfeiting code.
[0038] Attachment Figure 1 This is a flow chart of a method for generating a color anti-counterfeit code according to an embodiment of the present invention. Figure 1 In order to generate a color anti-counterfeiting code, first, start the program and load the data for generating the anti-counterfeiting code into the program memory. In this way, after the program is run, the data for generating the anti-counterfeiting code can be directly called to complete the generation of the anti-counterfeiting code. Then, run the program, read the character string A in sequence according to the data content loaded in the memory, generate a QR code image according to the character string A and draw it to a temporary canvas. In the embodiment of the present invention, the data for generating the anti-counterfeiting code generally includes the character string A, and the character string A is used to generate the QR code image, that is, the QR code (as shown in the attached figure). Figure 2 As shown in the middle), the data for generating the anti-counterfeiting code may include other information such as a checksum in addition to the character string A, which can improve the security of the data. Specifically, the data for generating the anti-counterfeiting code is not limited to other information other than the character string A, and can be set as needed. After generating the QR code image based on the character string A and drawing it to the temporary canvas, it is still a common QR code black and white anti-counterfeiting code, which cannot further improve the anti-counterfeiting effect. Therefore, the color anti-counterfeiting code generation method of the embodiment of the present invention then extracts the specific digit data from the character string A, reads each anti-counterfeiting data P in the specific digit data in turn, and takes out the color of the anti-counterfeiting line and the number of line segments according to the value of the anti-counterfeiting data P; that is, the embodiment of the present invention has inserted specific digit data (for example, it can be 8 digits, 16 digits, etc.) into the character string A, and by reading each anti-counterfeiting data P in the specific digit data, the color of the anti-counterfeiting line and the number of line segments are taken out according to the value of the anti-counterfeiting data P, thereby obtaining a color two-dimensional bar code and the corresponding number of segments (as shown in the attached figure). Figure 2 and attached Figure 3 Finally, the anti-counterfeiting lines and the number of segments are drawn in sequence on the corresponding positions of the QR code image on the temporary canvas (as shown in the attached figure). Figure 2 The 16-digit barcode shown is set on the left and right sides of the QR code image respectively, and the number of segments is set on the bottom side of the QR code image) to obtain the final color anti-counterfeiting code.
[0039] To sum up, the embodiment of the present invention generates a QR code image through a character string A, then inserts a specific number of digits of data into the character string A, uses the specific number of digits of data to generate a color two-dimensional barcode and a corresponding number of segments, and then obtains a color anti-counterfeiting code in the form of a combination of the QR code image, the color two-dimensional barcode and the corresponding number of segments, which greatly improves the anti-counterfeiting effect and has good practicality.
[0040] Furthermore, according to another embodiment of the present invention, the data used to generate the anti-counterfeiting code in step 1 is QR Code data in a txt format. A QR Code is a matrix two-dimensional code symbol that has the advantages of a one-dimensional barcode and other two-dimensional barcodes, such as large information capacity, high reliability, the ability to represent Chinese characters and images, and strong confidentiality and anti-counterfeiting properties. Furthermore, the txt format data is easy to read, load, and run.
[0041] Furthermore, according to another embodiment of the present invention, the specific bit data is 16-bit data. Figure 2 and attached Figure 3 As shown in the figure, the obtained 16-bit color two-dimensional barcode and the corresponding number of segments and the color anti-counterfeiting code formed with the two-dimensional code image. Figure 2 and attached Figure 3 The specific color is not shown in the figure, and the specific color can be determined according to actual needs, such as the attached Figure 3 Data 0 represents red, data 1 represents green, data 2 represents blue, and so on. To avoid tediousness, we will not go into details one by one.
[0042] Furthermore, according to an embodiment of the present invention, the anti-counterfeiting lines are respectively arranged on the left and right sides of the QR code image. Figure 2 As shown, this can be more beautiful and easier to identify the direction.
[0043] Furthermore, according to another embodiment of the present invention, the number of segments is set at the bottom of the QR code image. Figure 2 As shown, this can be more beautiful and easier to identify the direction.
[0044] Furthermore, according to another embodiment of the present invention, the color security code generation method further includes: in step 1, after the program is started, determining whether the data for generating the security code has been loaded into the program memory, and if not, prompting the user to load the data. This can improve the user-friendliness and recognizability of the operation and enhance the efficiency of program operation.
[0045] Furthermore, according to another embodiment of the present invention, the specific digit data is set at the end of the string A. The specific digit data is used to store data for generating a color two-dimensional barcode and the corresponding number of segments. Therefore, its position needs to be fixed at a specific position in the string A to facilitate program recognition. When the specific digit data is set at the end of the string A, the QR code image is generated first, and then the color two-dimensional barcode and the corresponding number of segments are generated at the end of the string A. This has the advantage of being performed in sequence, which helps reduce the complexity of the operation, improves efficiency, and facilitates data acquisition and recognition.
[0046] Furthermore, according to one embodiment of the present invention, the color security code generation method further includes flipping, rotating, and setting the image height of the generated color security code. In this way, the generated color security code can be flipped, rotated, and set to the image height to ensure that the generated color security code faces the user in the correct direction.
[0047] Furthermore, according to an embodiment of the present invention, the number of the anti-counterfeiting lines corresponds to the number of the segments, as shown in the attached figure. Figure 2 As shown, there are 16 items in total.
[0048] The following is combined with Figure 4 Another embodiment of the present invention will be described.
[0049] As attached Figure 4 As shown, according to a method for generating a color anti-counterfeiting code according to an embodiment of the present invention, first open the file, start the program, and load the QRCode data for generating the anti-counterfeiting code into the program memory; then run the program and start the process of generating the color anti-counterfeiting code. After the program is started, it is determined whether the data for generating the anti-counterfeiting code is loaded into the program memory. If it is not loaded, the user is prompted to perform the loading operation. After the loading is completed, the data is read, and a QRCode image is generated based on the QRCode data and drawn to a temporary canvas; then, the color anti-counterfeiting lines corresponding to each number are generated based on the 16-digit number, and the 16-digit color digital information below the QRCode image is generated based on the 16-digit number. Then it is determined whether there is data that needs to be processed. If so, the above process is performed again. If there is no data that needs to be processed, the color anti-counterfeiting code is obtained.
[0050] To sum up, the embodiment of the present invention generates a QR Code image through QR Code data, and then uses specific bit data to generate a 16-bit color two-dimensional barcode and the corresponding number of segments, thereby obtaining a color anti-counterfeiting code in the form of a combination of the QR code image, the color two-dimensional barcode and the corresponding number of segments, which greatly improves the anti-counterfeiting effect and has good practicality.
[0051] It should be noted that the various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences from other embodiments. For the method embodiments, the relevant parts can be referred to the partial description of the device embodiments. The present invention is not limited to the specific steps and structures described above and shown in the figures. Moreover, for the sake of brevity, detailed descriptions of known methods and technologies are omitted here.
[0052] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art without departing from the scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included within the scope of the claims of the present application.
Claims
1. A method for generating a color anti-counterfeiting code, characterized in that: The steps include: Step 1: Start the program and load the data for generating the anti-counterfeiting code into the program memory; Step 2: Run the program and read string A in sequence according to the data content loaded in the memory; Step 3: Generate a QR code image based on the string A and draw it on a temporary canvas; Step 4: Extracting a specific number of digits from the string A, wherein the specific number of digits is 16 digits and is set at the end of the string A, sequentially reading each bit of the anti-counterfeiting data P in the specific number of digits, and determining the color of the anti-counterfeiting line and the number of line segments according to the value of the anti-counterfeiting data P; Step 5: sequentially draw the anti-counterfeiting lines and the segment numbers at corresponding positions of the QR code image on the temporary canvas to obtain the color anti-counterfeiting code.
2. A method for generating a color anti-counterfeiting code according to claim 1, characterized in that: The data for generating the anti-counterfeiting code in step 1 is QR Code data in txt format.
3. The method for generating a color anti-counterfeiting code according to claim 1, wherein: The anti-counterfeiting lines are respectively arranged on the left and right sides of the QR code image.
4. A method for generating a color anti-counterfeiting code according to claim 1, characterized in that: The number of segments is set at the bottom of the QR code image.
5. The method for generating a color anti-counterfeiting code according to claim 1, wherein: The color anti-counterfeiting code generating method further comprises: in step 1, after the program is started, determining whether the data for generating the anti-counterfeiting code is loaded into the program memory; if not, prompting the user to perform a loading operation.
6. A method for generating a color anti-counterfeiting code according to claim 1, characterized in that: The color security code generation method further includes performing flipping, rotating, and picture height setting operations on the generated color security code.
7. A method for generating a color anti-counterfeiting code according to claim 1, characterized in that: The number of the anti-counterfeiting lines corresponds to the number of the segments.
Citation Information
Patent Citations
Novel bar-image code with anti-fake function and application method
CN108009616A