File anti-counterfeiting method and system based on identification
1. A file anti-counterfeiting method based on identification is characterized by comprising the following steps:
acquiring a first identifier, and arraying the first identifier on a background picture to obtain an identifier layout;
acquiring a second identifier and acquiring the row and column positions of pixel points of the second identifier;
reserving pixel points corresponding to the line and row positions on the identification layout, and setting the pixel points outside the line and row positions on the identification layout to be transparent;
intercepting an image of the region of the reserved pixel points of the identification layout as an anti-counterfeiting image;
and overlapping the anti-counterfeiting image on the file picture and generating the anti-counterfeiting file picture.
2. The label-based document anti-counterfeiting method according to claim 1, wherein: the first mark or the second mark is a character.
3. The label-based document anti-counterfeiting method according to claim 1, wherein: the array first mark on the background picture comprises the following steps:
the distance between two adjacent first marks is the same.
4. The label-based document anti-counterfeiting method according to claim 1, wherein: the method further comprises the following steps after the first identifier is obtained:
and carrying out angle adjustment or color adjustment on the first mark.
5. The method of claim 1, wherein the generating the security document picture comprises:
and continuously overlapping the text information of the file content on the anti-counterfeiting file picture.
6. The method of claim 1, further comprising the steps of: and narrowing the first mark to enable the area of the first mark to be smaller than that of the second mark.
7. A file anti-counterfeiting system based on identification is characterized in that: comprising a memory, a processor, said memory having stored thereon a computer program which, when being executed by the processor, carries out the steps of the method according to any one of claims 1 to 6.
Background
The electronic license data is generally used in a picture format during application, but the license picture is easy to be tampered, so that the risk of counterfeiting exists. The data application in the authentication field is greatly limited due to low counterfeiting cost.
At present, the anti-counterfeiting mode adopted by the license picture still stays in a simple anti-counterfeiting two-dimensional code mode to achieve the anti-counterfeiting purpose. However, the anti-counterfeiting two-dimensional code mode is limited by the limitation of the server (after the code is scanned, the inquiry page provided by the server is opened to display detailed license information), and once the service of the server is abnormal, the license inquiry page cannot be opened after the code is scanned, and anti-counterfeiting verification cannot be performed. Aiming at the current two-dimensional code anti-counterfeiting technology, the following defects mainly exist:
a. the authenticity of the information on the reference picture cannot be visually identified by naked eyes.
b. And after the code is scanned, the license information needs to be displayed by relying on an anti-counterfeiting server.
Disclosure of Invention
Therefore, a file anti-counterfeiting method and a file anti-counterfeiting system based on the identification are needed to be provided, and the anti-counterfeiting problem of the existing license picture is solved.
In order to achieve the above object, the present invention provides a file anti-counterfeiting method based on identification, which comprises the following steps:
acquiring a first identifier, and arraying the first identifier on a background picture to obtain an identifier layout;
acquiring a second identifier and acquiring the row and column positions of pixel points of the second identifier;
reserving pixel points corresponding to the line and row positions on the identification layout, and setting the pixel points outside the line and row positions on the identification layout to be transparent;
intercepting an image of the region of the reserved pixel points of the identification layout as an anti-counterfeiting image;
and overlapping the anti-counterfeiting image on the file picture and generating the anti-counterfeiting file picture.
Further, the first mark or the second mark is a character.
Further, the array of first markers on the background picture comprises the steps of:
the distance between two adjacent first marks is the same.
Further, after the first identifier is obtained, the method further includes the steps of:
and carrying out angle adjustment or color adjustment on the first mark.
Further, the generating of the anti-counterfeiting file picture comprises the following steps:
and continuously overlapping the text information of the file content on the anti-counterfeiting file picture.
Further, the method also comprises the following steps: and narrowing the first mark to enable the area of the first mark to be smaller than that of the second mark.
The invention provides a file anti-counterfeiting system based on identification, which comprises a memory and a processor, wherein a computer program is stored on the memory, and the computer program realizes the steps of the method according to any one of the embodiments of the invention when being executed by the processor.
Different from the prior art, the technical scheme generates the specific anti-counterfeiting picture through the first mark and the second mark, and then the final anti-counterfeiting file picture is provided with the specific anti-counterfeiting mark, so that the authenticity of the information on the anti-counterfeiting file picture can be visually identified through naked eyes. The anti-counterfeiting server for displaying the anti-counterfeiting file and the picture information is not required to be relied on.
Drawings
FIG. 1 is a flow diagram of a method according to an embodiment;
FIG. 2 is a schematic diagram of pixel placement according to an embodiment;
FIG. 3 is an enlarged schematic view of a security image of the present invention;
FIG. 4 is an effect diagram of the anti-counterfeit document picture of the present invention;
fig. 5 is an effect diagram of the anti-counterfeit document picture with three-dimensional grains of the invention.
Detailed Description
To explain technical contents, structural features, and objects and effects of the technical solutions in detail, the following detailed description is given with reference to the accompanying drawings in conjunction with the embodiments.
Referring to fig. 1 to 5, the present embodiment provides a method for document anti-counterfeiting based on a mark, where a document of the present invention may be a certificate picture or other picture requiring anti-counterfeiting, and the key point of the present invention is to generate a mark that is not easily tampered with. When anti-counterfeiting is carried out, the method comprises the following steps: step S101, a first mark is obtained, and the first mark is arrayed on a background picture to obtain a mark layout. The first identifier may be customized by a user, and may be a graphic, a picture, or text, and the text of the first identifier may be randomly generated. The background picture is used for the first identification array effect and can be a completely white background picture or a completely transparent background picture. The array is that the first marks are tiled on the background picture, and can be formed by arranging a plurality of first marks in a row horizontally and then arranging the first marks in a plurality of rows vertically. And then, in step S102, the second identifier and the row and column positions of the pixels of the second identifier are obtained. The second identifier can also be customized by a user, and can be a figure, a picture or a word. The pixel point of the second identifier corresponds to a pixel point of the image or the character on the second identifier, namely, a colored area is non-white or transparent, and the image or the character content of the second identifier can be seen through the pixel point of the second identifier. And then extracting the content of the identification layout according to the row and column positions of the acquired pixel points of the second identification. Specifically, step S103 reserves the pixel points corresponding to the row and column positions on the identification layout, and sets the pixel points outside the row and column positions on the identification layout to be transparent. And then intercepting the image of the region of the reserved pixel point of the identification layout as an anti-counterfeiting image in step S104. The first mark on the mark layout is reserved, and the overall shape of the reserved first mark is as shown in fig. 3. And finally, step S105, the anti-counterfeiting image is superposed on the file picture to generate the anti-counterfeiting file picture. Therefore, the anti-counterfeiting image can be seen from the anti-counterfeiting file picture, the graph or the text content of the second identification can be seen from the anti-counterfeiting image, the first identification can be seen from the inside of the second identification of the anti-counterfeiting image, the first identification is irregularly reserved, the identification is difficult to modify, anti-counterfeiting is realized, and if the identification is modified, the identification can be distinguished by naked eyes. And greatly increases the difficulty of imitation.
The acquisition of the pixel points of the second identifier can be realized by judging the color of the pixel points, and if the pixel points are non-white and transparent, the pixel points are the positions of the pixel points. The row and column positions of the pixel points are XY coordinate values of the pixel points, and the coordinates can directly correspond to the coordinates of the identification layout or can be amplified or reduced in equal proportion. Then, the pixel processing can be performed on the identification layout, as shown in fig. 2, the pixels of XY coordinate values of the pixels corresponding to the identification layout are kept still, and the pixels of XY coordinate values of other non-pixels are set to be 100% transparent.
In some embodiments, the first marks are arranged at the same interval in the array. This may result in a neat first indication. In some embodiments, the distance between the first identifiers may be preset to a range, and then random values are taken within the range, and then distance arrangement is performed, so that the anti-counterfeiting security level can be improved, that is, the difficulty of possible modification is increased. In some embodiments, the random distance between every two adjacent first marks can be stored in the server and associated with the identification information of the anti-counterfeiting file picture, and the anti-counterfeiting file picture authenticity verification can be performed subsequently. The data storage amount is reduced through the storage of the space, and the verification capability of the subsequent anti-counterfeiting file pictures is further enhanced.
When the first identifier is processed, if the first identifier does not meet the preset angle or color requirement, angle adjustment or color adjustment may be performed on the first identifier, for example, the first identifier is rotated by an angle and the color of the first identifier is adjusted, so that the first identifier meets the requirement. In some embodiments, if the first identifier does not meet the size requirement, the first identifier may also be scaled down. The invention further comprises the steps of: and narrowing the first mark to enable the area of the first mark to be smaller than that of the second mark. In some embodiments, the scale of the reduction may be: the width of one character of the first identification is equal to the width of the vertical stroke of one character in the second identification. And when the characters are arranged, the first marks can be arranged horizontally, and the second marks can also be displayed horizontally, so that the characters of the first marks can be displayed completely in the strokes of the second marks, and the characters are convenient to view. After the identification layout is generated, the identification layout can be zoomed and the like, so that the identification layout can meet the size requirement. As shown in fig. 3 and 4, the identification layout of fig. 3 is reduced and placed in the upper left corner of fig. 4.
In some embodiments, the generating the anti-counterfeit document picture includes the following steps: and continuously superposing the text information of the file content on the anti-counterfeiting file picture, wherein the text information is the established date and the like in the figure 4. The characters are covered on the anti-counterfeiting file picture during superposition, and original pixel points of the anti-counterfeiting file picture can be covered, so that the characters can be kept to be highlighted, and normal reading of the characters is not affected. In some embodiments, the text information of the file content can also be generated as a second identifier, so that the anti-counterfeiting security level is improved.
The invention provides a file anti-counterfeiting system based on identification, which comprises a memory and a processor, wherein a computer program is stored on the memory, and the computer program realizes the steps of the method according to any one of the embodiments of the invention when being executed by the processor. The anti-counterfeiting system generates a specific anti-counterfeiting picture through the first identifier and the second identifier, and then the final anti-counterfeiting file picture is provided with the specific anti-counterfeiting identifier, so that the authenticity of information on the anti-counterfeiting file picture can be visually identified through naked eyes. The anti-counterfeiting server for displaying the anti-counterfeiting file and the picture information is not required to be relied on.
In some embodiments, the mark anti-counterfeiting of the invention can be further combined with a three-dimensional texture and color transition anti-counterfeiting technology after being superposed on the license, so that the anti-counterfeiting security level of the license picture is further improved.
Specifically, as shown in fig. 5, the key of the three-dimensional texture file anti-counterfeiting with color transition is to superimpose lines with different colors on a certificate or other anti-counterfeiting pictures, so that the integrity of the lines and the colors on the lines is influenced by modifying the text or image information, and the anti-counterfeiting effect can be achieved by human eyes. The method specifically comprises the following steps: generating lines, arranging a plurality of lines at intervals in the transverse direction and at intervals in the longitudinal direction, and enabling the transverse lines and the longitudinal lines to be crossed to form three-dimensional lines; the length of the lines should be greater than or equal to the length of the picture file to be anti-counterfeit, so that the anti-counterfeit of the whole picture can be realized. The lines are arranged at intervals, namely, the intervals are formed between the lines, preferably, the intervals of the lines are smaller than or equal to the height of the text information on the anti-counterfeiting picture, so that a text can pass through the anti-counterfeiting picture in a straight line, and the anti-counterfeiting effect is realized. Of course, if the heights of the text messages are different, the height of the smallest text message may be selected. Certainly, the distance is not too small, and the normal display of the anti-counterfeiting picture is affected by too many lines on the anti-counterfeiting picture. The minimum spacing should not be less than one third of the height of the text message. Meanwhile, the line width of the line is not too wide, and the line width can be set to be one width between the maximum width and the minimum width of the strokes of the character information. The values can be preset according to actual needs. Different colors are superposed on the lines in different areas of the three-dimensional grain, namely the colors of the lines in different areas are different. And then, superimposing the three-dimensional lines with different colors on the file picture and generating the anti-counterfeiting file picture. Therefore, the graphic information or the text information on the anti-counterfeiting file can be superposed with lines of different colors (for example, the left side is red, and the right side is green), so that the information on the anti-counterfeiting file can be modified to cause the damage of a straight line, and the authenticity of the information on the anti-counterfeiting file picture can be visually identified by naked eyes. The anti-counterfeiting server for displaying the anti-counterfeiting file and the picture information is not required to be relied on.
Further, the different regions include: the file image is divided into a plurality of regions with equal size according to the size of the file image, for example, the file image is divided into 8 regions, the upper half is divided into four regions side by side, and the lower half is divided into four regions side by side. Therefore, the color partition is neat, and the user experience is good.
There are various methods for generating colors, and in the embodiment of the present invention, as shown in fig. 2, the different colors are generated by three primary colors of RBG, and the color of the adjacent area is different by only one primary color. This allows a smooth transition of the colors without major differences. Preferably, the transformed value of said one primary color is smaller than a first preset value (e.g. 10, with a total variation range of 0-254). Therefore, the color change can be reflected, the large change can not be generated, and the whole visual effect is improved. In some embodiments, the variation of different colors may take a random value smaller than the first preset value, so that different colors of different pictures can be realized. In some embodiments, the random value may be obtained according to the encrypted value of the file picture and according to the encrypted value, for example, the first bits of the MD5 value after the file picture is superimposed with the file information (or an MD5 value may be generated after a verification icon is further superimposed on the file picture, and the verification icon only functions as the MD5 value and is not used as a subsequent file and a stereoscopic texture are superimposed) may be used as the change value of the color (if the change value is greater than the first preset value, the multiple of the preset value may be subtracted until the change value is smaller than the first preset value), so that the association with the file picture may be implemented, and the verification is facilitated. And because the information on each file picture is different, the color is different, realize the anti-counterfeiting and encryption of different colors. Preferably, the random value is a color value of a center of the corresponding region, and the color values of other portions of the region are values of centers of two adjacent regions that vary linearly with distance, and of course, the color values of the two adjacent regions should be different. If the color of the center of one region is R255G255B200, and the color value of the center of the other region is R255G255B100, the color of the part between the two regions varies linearly with the distance from the center of one region to the center of the other region, if the border between the two regions is R255G255B150, the distance between 1/4 and R255G255B175 is two distances from the center of one region, the distance between 1/4 and R255G255B125 is two distances from the center of the other region, and so on. Of course, there may be multiple adjacent regions per region, and the color determination within a region may be determined with the nearest of the adjacent region centers.
In a preferred embodiment, the different colors of all the regions vary cyclically between the different regions. If there are four regions, the cycle may be 1 region of the first color, 2 regions of the second color, 3 regions back to the first color, and 4 regions back to the second color. Thus, the color change is relatively regular, and the visual effect is better. In some embodiments, the cyclically varying value may be a random value as in the above embodiments (MD5 values).
In the above embodiments, the line includes a straight line or a curved line. The pitch of the lines may be fixed in the present invention, or in some embodiments, the pitch of the lines is randomly selected within a predetermined range of pitches. The predetermined range may be randomly selected between the height of the text message and one third of the height, as mentioned in the above embodiments. In some embodiments, the random process may be further controlled, a first random range with a larger spacing value and a second random range with a smaller spacing value may be determined, the value of the first random range is larger than the value of the second random range, and then the spacing of the lines is sequentially cycled to select a plurality of first preset numbers in the first random range and then select a plurality of second preset numbers in the second random range, so that as shown in fig. 3, the spacing of the lines is dense in one region, sparse in the other region, and relatively orderly arranged, and a phenomenon that the line spacing is very disordered due to random process is not generated, thereby not only playing a role of random spacing, but also achieving a better visual effect. Meanwhile, in order to achieve a better visual effect, the lines arranged transversely do not intersect with each other or the lines arranged longitudinally do not intersect with each other, that is, the lines arranged in rows (the length direction of the lines is longitudinal) do not intersect with each other and the lines arranged in columns (the length direction of the lines is transverse) do not intersect with each other. The random value here may also be a random value at a color, i.e., the random value is associated with a file picture.
When the embodiment is superposed, if the anti-counterfeiting picture has characters and information, the three-dimensional grains can be directly superposed. In some embodiments, in order to avoid the influence on the text information on the anti-counterfeiting file picture, the mark can be firstly superposed, then the colored three-dimensional grains can be superposed, and then the text can be superposed. The invention further comprises the steps of: and continuously overlapping the text information of the file content on the anti-counterfeiting file picture. When the characters are overlapped, the pixel points of the strokes of the character information directly cover the anti-counterfeiting picture or the three-dimensional texture below the anti-counterfeiting picture or the three-dimensional texture, so that the highlighted display is realized. And then the pixel points of the anti-counterfeiting straight line can pass through the blank places of the pixel points of the character strokes, so that the anti-counterfeiting property is improved.
It should be noted that, although the above embodiments have been described herein, the invention is not limited thereto. Therefore, based on the innovative concepts of the present invention, the technical solutions of the present invention can be directly or indirectly applied to other related technical fields by making changes and modifications to the embodiments described herein, or by using equivalent structures or equivalent processes performed in the content of the present specification and the attached drawings, which are included in the scope of the present invention.