Anti-counterfeiting picture generation and identification method and device
By embedding watermark information in product pictures, converting it into a watermark matrix using a spread spectrum sequence and embedding the transparency channel matrix, the problem of difficulty in identifying the authenticity of the product in the prior art is solved, and the uniqueness verification and efficient identification of the product are achieved.
Patent Information
- Application Number
- CN202411719298.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-04-11
AI Technical Summary
It is difficult for the existing technology to effectively identify the authenticity of products, resulting in the proliferation of counterfeit and inferior products in the market, harming consumer interests and the formal market.
By obtaining the initial product picture of the target product, extracting its transparency channel matrix and color channel matrix, generating watermark information of identification information and product attribute information, and converting it into a watermark matrix using a spread spectrum sequence, embedding it into the transparency channel matrix to form an anti-counterfeiting picture.
It realizes product uniqueness verification, improves the accuracy and difficulty of product identification, prevents the circulation of forged products, and protects consumer rights.
Smart Images

Figure CN119809904A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a method and device for generating and identifying anti-counterfeiting images. Background Art
[0002] With the development of economy, the printing industry is also advancing, and with it comes an increasing number of counterfeit and inferior products, trademarks, certificates, bills, etc. Various counterfeiting and illegal copying methods appear in people's lives, which easily cause confusion between real and fake products.
[0003] When counterfeiting goods, counterfeiters usually imitate genuine packaging and put the counterfeit products in counterfeit packaging, making it difficult for consumers to distinguish the counterfeit products from the genuine products. This practice not only harms the interests of consumers, but also has a serious impact on the formal market. Summary of the invention
[0004] In view of this, one or more embodiments of the present disclosure provide an anti-counterfeiting image generation and recognition method and device, which can effectively identify the authenticity of products and ensure that consumers purchase genuine goods.
[0005] In a first aspect, the present disclosure provides an anti-counterfeiting image generation method, the method comprising: obtaining an initial product image of a target product, and extracting an initial transparency channel matrix and an initial color channel matrix of the initial product image; generating identification information of the target product, and encapsulating the identification information and product attribute information of the target product into watermark information of the target product; obtaining a spread spectrum sequence, and using the spread spectrum sequence to convert the watermark information into a watermark matrix; embedding the watermark matrix into a target position of the initial transparency channel matrix to generate a target transparency channel matrix; merging the target transparency channel matrix with the initial color channel matrix to generate a target product image.
[0006] By encapsulating the identification information and product attribute information of the target product, a unique watermark information of the target product can be formed, which is conducive to effectively distinguishing the authenticity of the product. The watermark information is converted into a watermark matrix and embedded in the transparency channel matrix of the product image, which is conducive to forming a hidden dark pattern watermark, making it difficult for counterfeiters to imitate. In addition, in the process of generating the watermark matrix, the introduction of the spread spectrum sequence can further increase the concealment of the watermark and the difficulty of imitation.
[0007] Optionally, the using the spread spectrum sequence to convert the watermark information into a watermark matrix includes: encoding the watermark information to generate a watermark sequence; performing matrix multiplication of the watermark sequence and the spread spectrum sequence to generate the watermark matrix; wherein the spread spectrum sequence includes a pseudo-random noise sequence.
[0008] By encoding, the watermark information is converted into a watermark sequence, which is conducive to the accurate extraction and verification of the watermark information in the later stage. The introduction of a spread spectrum sequence of pseudo-random noise sequence type can further enhance the robustness and concealment of the watermark information.
[0009] Optionally, embedding the watermark matrix into the target position of the initial transparency channel matrix to generate a target transparency channel matrix includes: determining a candidate matrix based on the watermark matrix and a preset embedding strength coefficient; and embedding the candidate matrix into the target position of the initial transparency channel matrix to generate the target transparency channel matrix.
[0010] Embedding the watermark matrix containing the watermark information into the transparency channel of the product image can ensure that the watermark information is imperceptible. By presetting the embedding strength coefficient, the influence of the watermark matrix on the transparency channel matrix can be adjusted to avoid the product image from not being displayed normally.
[0011] Optionally, before embedding the watermark matrix into the target position of the initial transparency channel matrix, the method further includes at least one of the following: performing grayscale processing on the initial product image to determine a grayscale product image, and performing edge detection on the grayscale product image to determine a first position of the grayscale product image, wherein the first position corresponds to the target position; performing binarization processing on the initial product image to determine a binary product image, and performing edge detection on the binary product image to determine a second position of the binary product image, wherein the second position corresponds to the target position.
[0012] Using edge detection technology, the features of the initial product image can be extracted to ensure that the watermark matrix is embedded in the appropriate position of the initial transparency channel matrix. The efficiency and accuracy of edge detection can be increased through grayscale processing or binarization processing.
[0013] In a second aspect, the present disclosure provides an anti-counterfeiting image recognition method, the method comprising: obtaining a target product image of a target product, and extracting a target transparency channel matrix of the target product image; obtaining an initial transparency channel matrix and a spread spectrum sequence corresponding to the target product in a product database; determining a watermark matrix of the target product based on the target transparency channel matrix and the initial transparency channel matrix; determining watermark information of the target product based on the watermark matrix and the spread spectrum sequence, the watermark information comprising identification information of the target product and product attribute information of the target product; judging whether the target product is counterfeit based on a comparison result between the watermark information and product information pre-stored in the product database.
[0014] By acquiring the target product image, the target transparency channel matrix of the image can be extracted. Subsequently, the initial transparency channel matrix and the spread spectrum sequence stored in the database can be used to decode the watermark information in the target transparency channel matrix. Since the watermark information contains the identification information and product attribute information of the target product, it can be used to distinguish the authenticity of the product. The watermark information is hidden in the transparency channel of the image and is difficult to be imitated or forged, which ensures the reliability of the watermark information and increases the accuracy of product identification.
[0015] Optionally, determining the watermark matrix of the target product based on the target transparency channel matrix and the initial transparency channel matrix includes: obtaining a preset embedding strength coefficient corresponding to the target product in the product database; determining a candidate matrix based on the target transparency channel matrix and the initial transparency channel matrix; and determining the watermark matrix of the target product based on the candidate matrix and the preset embedding strength coefficient.
[0016] The watermark matrix containing the watermark information is embedded in the transparency channel of the product image to ensure that the watermark information is imperceptible. By presetting the embedding strength coefficient, the influence of the watermark matrix on the transparency channel matrix can be adjusted to avoid the product image from not being displayed normally.
[0017] Optionally, determining the watermark information of the target product based on the watermark matrix and the spread spectrum sequence includes: determining a watermark sequence based on the watermark matrix and the spread spectrum sequence; decoding the watermark sequence to determine the watermark information; wherein the spread spectrum sequence includes a pseudo-random noise sequence.
[0018] The introduction of a spread spectrum sequence of pseudo-random noise sequence type improves the anti-attack capability of the watermark information, making it more difficult to be tampered with or deleted. The mutual conversion between the watermark information and the watermark sequence is carried out through encoding and decoding, which is conducive to the accurate extraction and verification of the watermark information.
[0019] Optionally, judging whether the target product is counterfeit based on a comparison result between the watermark information and the pre-stored product information in the product database includes: if the watermark information is not detected, or the watermark information does not comply with a preset file rule, determining that the target product is counterfeit; if the watermark information is inconsistent with the pre-stored product information, determining that the target product is counterfeit.
[0020] By comparing the watermark information with the pre-stored product information, it can be determined whether the product is counterfeit. The collection and verification process of watermark information is simple and easy. Consumers can verify the authenticity of the product through mobile applications or mini-programs, which provides a good user experience.
[0021] In the third aspect, the present disclosure provides an anti-counterfeiting image generating device, which includes: an initial image acquisition unit, used to acquire the initial product image of the target product, and extract the initial transparency channel matrix and the initial color channel matrix of the initial product image; a watermark information generation unit, used to generate identification information of the target product, and encapsulate the identification information and the product attribute information of the target product into the watermark information of the target product; a watermark matrix generation unit, used to acquire a spread spectrum sequence, and use the spread spectrum sequence to convert the watermark information into a watermark matrix; a watermark matrix embedding unit, used to embed the watermark matrix into the target position of the initial transparency channel matrix to generate a target transparency channel matrix; a product image generation unit, used to merge the target transparency channel matrix with the initial color channel matrix to generate a target product image.
[0022] In a fourth aspect, the present disclosure provides an anti-counterfeiting image recognition device, the device comprising: a product image acquisition unit, used to acquire a target product image of a target product and extract a target transparency channel matrix of the target product image; a pre-stored information acquisition unit, used to acquire an initial transparency channel matrix and a spread spectrum sequence corresponding to the target product and stored in a database; a watermark matrix extraction unit, used to determine the watermark matrix of the target product based on the target transparency channel matrix and the initial transparency channel matrix; a watermark matrix parsing unit, used to determine the watermark information of the target product based on the watermark matrix and the spread spectrum sequence, the watermark information comprising identification information of the target product and product attribute information of the target product; a watermark information comparison unit, used to determine whether the target product is counterfeit based on a comparison result between the watermark information and the pre-stored product information in the database.
[0023] In a fifth aspect, the present disclosure provides an electronic device comprising a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the anti-counterfeiting image generation method of the first aspect or the anti-counterfeiting image recognition method of the second aspect is implemented.
[0024] In a sixth aspect, the present disclosure provides a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, it implements the anti-counterfeiting image generation method of the first aspect or the anti-counterfeiting image recognition method of the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The features and advantages of the embodiments of the present disclosure may be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the present disclosure in any way. In the accompanying drawings:
[0026] Figure 1A schematic diagram showing the steps of a method for generating an anti-counterfeiting image in one embodiment of the present disclosure is shown;
[0027] Figure 2 A schematic diagram of the process of generating an anti-counterfeiting picture in one embodiment of the present disclosure is shown;
[0028] Figure 3 A schematic diagram showing the steps of an anti-counterfeiting image recognition method in one embodiment of the present disclosure is shown;
[0029] Figure 4 A schematic diagram of the process of anti-counterfeiting image recognition in one embodiment of the present disclosure is shown;
[0030] Figure 5 A schematic diagram of functional units of an anti-counterfeiting image generating device in one embodiment of the present disclosure is shown;
[0031] Figure 6 A schematic diagram of functional units of an anti-counterfeiting image recognition device in one embodiment of the present disclosure is shown;
[0032] Figure 7 A schematic structural diagram of an electronic device in one embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0034] See also Figure 1 , an anti-counterfeiting image generation method provided in one embodiment of the present disclosure may include the following steps.
[0035] S11: Acquire an initial product image of a target product, and extract an initial transparency channel matrix and an initial color channel matrix of the initial product image.
[0036] In this embodiment, the transparency channel of the image represents the Alpha Channel, which can describe the transparency and translucency of an image. The transparency channel of the image usually constitutes an RGBA image together with the three color channels of the image, namely red, green, and blue. Generally, images in formats such as PNG, TIFF, BMP, and TGA support the use of Alpha channels. The transparency channel of the image can be expressed in the form of a two-dimensional matrix, and each element value (Alpha value) of the matrix can indicate the transparency of the corresponding image pixel, 0 means completely transparent, and 255 means completely opaque. Similarly, the color channels of the image can be expressed as three color (red, green, and blue) matrices, respectively, and the matrix element values can indicate the color depth of the corresponding image pixel.
[0037] In this embodiment, the initial product image can be the initial outer packaging design of the product, which can be modified and anti-counterfeiting information can be added to form the final outer packaging design. Using some image processing tools, such as OpenCV, the initial transparency channel matrix and the initial color channel matrix of the initial product image can be extracted.
[0038] S12: Generate identification information of the target product, and encapsulate the identification information and product attribute information of the target product into watermark information of the target product.
[0039] In this embodiment, the identification information of the target product may be a unique serial number of the product, which may be generated by the method implementation subject or obtained from a server. The product attribute information of the target product may include information such as the manufacturer, production batch, and production date of the target product. The identification information and product attribute information of the target product are packaged to form unique watermark information of the target product, which is conducive to effectively distinguishing the authenticity of the product.
[0040] S13: Acquire a spread spectrum sequence, and use the spread spectrum sequence to convert the watermark signal into a watermark matrix.
[0041] In this embodiment, the watermark information is converted into a watermark matrix and embedded in the transparency channel matrix of the product image, which is conducive to forming a hidden dark watermark, making it difficult for counterfeiters to imitate. In the process of generating the watermark matrix, the introduction of the spread spectrum sequence can further increase the concealment and counterfeiting difficulty of the watermark. The spread spectrum sequence can disperse the watermark information data into a wide spectrum to enhance the anti-interference ability and security of the watermark information data.
[0042] In some implementations, the use of the spread spectrum sequence to convert the watermark signal into a watermark matrix includes: encoding the watermark information to generate a watermark sequence; performing matrix multiplication of the watermark sequence and the spread spectrum sequence to generate the watermark matrix; wherein the spread spectrum sequence includes a pseudo-random noise sequence.
[0043] By encoding, the watermark information is converted into a watermark sequence, which is conducive to the accurate extraction and verification of the watermark information in the later stage. The introduction of a spread spectrum sequence of pseudo-random noise sequence type can further enhance the robustness and concealment of the watermark information.
[0044] In a practical application example, a standard character encoding method, such as ASCII encoding, can be used to convert the watermark information into a binary sequence to ensure that the information can be accurately extracted and verified. The spread spectrum sequence can be generated by the method implementation subject or obtained from the server. The spread spectrum sequence can be a binary pseudo-random noise sequence, and the elements of the sequence can be +1 or -1.
[0045] S14: Embed the watermark matrix into the target position of the initial transparency channel matrix to generate a target transparency channel matrix.
[0046] In this embodiment, the target position can be a priority position determined from the initial product image through feature detection technology. Embedding the watermark matrix into the target position of the initial transparency channel matrix can ensure the concealment of the watermark matrix and the integrity and coordination of the final product image.
[0047] In some embodiments, embedding the watermark matrix into the target position of the initial transparency channel matrix to generate the target transparency channel matrix includes: determining a candidate matrix based on the watermark matrix and a preset embedding strength coefficient; embedding the candidate matrix into the target position of the initial transparency channel matrix to generate the target transparency channel matrix.
[0048] Embedding the watermark matrix containing the watermark information into the transparency channel of the product image can make the watermark information appear transparent in the image and ensure the imperceptibility of the watermark information. By presetting the embedding strength coefficient, the influence of the watermark matrix on the transparency channel matrix can be adjusted to avoid the product image from not being displayed normally.
[0049] In some embodiments, before embedding the watermark matrix into the target position of the initial transparency channel matrix, the method further includes at least one of the following: grayscale processing the initial product image to determine a grayscale product image, and edge detection on the grayscale product image to determine a first position of the grayscale product image, wherein the first position corresponds to the target position; binarization processing the initial product image to determine a binary product image, and edge detection on the binary product image to determine a second position of the binary product image, wherein the second position corresponds to the target position.
[0050] Specifically, a grayscale image, also called a grayscale image, can refer to an image in which each pixel has only one sampled color. In a grayscale image, the value of each pixel is usually represented as an integer between 0 and 255, where 0 represents black, 255 represents white, and the values in between represent different shades of gray. The grayscale value reflects the brightness information of the image, but loses the color information. Since there is only one channel, processing grayscale images requires less computation and is faster than processing color images. Grayscale images are more convenient for identifying the edges of objects in the image and analyzing the texture features in the image.
[0051] A binary image can be considered as a special grayscale image, whose pixel values have only two possible values, 0 for black and 1 for white. A grayscale image can be converted to a binary image by setting a threshold. Binary images are often used to represent binary features of an image, such as text, shapes, and contours. Binary images greatly simplify image data, making it easier to perform further image analysis and processing. They can be used to extract key features of images in the fields of machine learning and computer vision.
[0052] Using edge detection technology, the features of the initial product image can be extracted to ensure that the watermark matrix is embedded in the appropriate position of the initial transparency channel matrix. The efficiency and accuracy of edge detection can be increased through grayscale processing or binarization processing.
[0053] S15: Merge the target transparency channel matrix with the initial color channel matrix to generate a target product image.
[0054] In this embodiment, the processed transparency channel matrix and the initially retained color channel matrix can be merged to form the final outer packaging design, so that the watermark information is cleverly hidden in the outer packaging design of the product. Users can obtain the outer packaging design of the product through the corresponding mobile phone application or applet, parse the watermark information, and identify the authenticity of the product.
[0055] See also Figure 2 , an anti-counterfeiting image generation method provided in one embodiment of the present disclosure can be implemented through the following process.
[0056] Before printing the product packaging, upload the product packaging design to the server. On the server side, you can use the OpenCV library to load the original design file and perform binarization on it, representing it as a binary image I. Here, I is a matrix. For the binary image I, edge detection and feature extraction can be performed to determine a target position for later embedding of watermark information (watermark matrix).
[0057] Next, the server can generate a unique serial number for the product and use it together with other possible detailed information, such as manufacturer, production batch, production date, etc., as the dark watermark information of the product to ensure that each product has a unique watermark. Then, using a standard character encoding method, such as ASCII encoding, the watermark information can be converted into a binary watermark sequence to ensure that the watermark information can be accurately extracted and verified. The watermark sequence can be expressed as M = [m 1 ,m 2 ,...,m n ]. This sequence can be embedded into the image of the product for subsequent anti-counterfeiting verification.
[0058] At the same time, the server can also generate a pseudo-random noise sequence as a key component of the spread spectrum sequence S. The elements of this sequence can be +1 or -1, which can be expressed as S = {s 1 ,s 2 ,s 3 ,...,s m}, where m is the length of the sequence. Spreading sequences play a key role in both the embedding and extraction stages, and can enhance the robustness and concealment of watermarks.
[0059] Embedding watermarks is a key step to ensure product uniqueness. In this process, the watermark sequence M containing the watermark information will be integrated into the Alpha channel of the product image, so that the watermark information can appear transparent in the product image. The Alpha channel determines the transparency of each image pixel, allowing certain areas to become transparent. Specifically, the watermark information can be embedded into the Alpha channel of the product image using the following formula:
[0060] W alpha =alpha_original+α·S·M
[0061] Among them, W alpha is the alpha channel with a transparent watermark, alpha_original is the alpha channel of the original image, α is the embedding strength coefficient, S is the spread spectrum sequence, and M is the watermark sequence. By adjusting the transparency, the watermark information can be cleverly hidden in the product image and is not easily detected.
[0062] Finally, the product image with transparent watermark is saved as an image format that supports alpha channel, such as PNG, TIFF, BMP, TGA, etc., to maintain the integrity and verifiability of the watermark.
[0063] Through the above steps, the product design drawing is successfully embedded with a unique dark watermark, providing stronger protection for the uniqueness and anti-counterfeiting verification of the product.
[0064] It should be noted that, in the process of converting the watermark information into a watermark sequence, an error correction code may be introduced to improve the fault tolerance of the watermark information.
[0065] See also Figure 3 , an anti-counterfeiting image recognition method provided in one embodiment of the present disclosure may include the following steps.
[0066] S21: Acquire a target product image of a target product, and extract a target transparency channel matrix of the target product image.
[0067] S22: Acquire an initial transparency channel matrix and a spread spectrum sequence corresponding to the target product in a product database.
[0068] S23: Determine the watermark matrix of the target product based on the target transparency channel matrix and the initial transparency channel matrix.
[0069] S24: Determine the watermark information of the target product based on the watermark matrix and the spread spectrum sequence, where the watermark information includes identification information of the target product and product attribute information of the target product.
[0070] S25: judging whether the target product is counterfeit based on the comparison result between the watermark information and the product information pre-stored in the product database.
[0071] In this embodiment, the target transparency channel matrix of the image can be extracted by acquiring the target product image. Subsequently, the watermark matrix in the target transparency channel matrix can be parsed using a decoding algorithm using the initial transparency channel matrix and the spread spectrum sequence stored in the database, thereby obtaining the watermark information of the product. Since the watermark information contains the identification information and product attribute information of the target product, it can be used to distinguish the authenticity of the product. The watermark information is hidden in the transparency channel of the image and is difficult to be imitated or forged, which ensures the reliability of the watermark information and increases the accuracy of identifying the product.
[0072] In some embodiments, determining the watermark matrix of the target product based on the target transparency channel matrix and the initial transparency channel matrix includes: obtaining a preset embedding strength coefficient corresponding to the target product in the product database; determining a candidate matrix based on the target transparency channel matrix and the initial transparency channel matrix; and determining the watermark matrix of the target product based on the candidate matrix and the preset embedding strength coefficient.
[0073] The watermark matrix containing the watermark information is embedded in the transparency channel of the product image to ensure that the watermark information is imperceptible. By presetting the embedding strength coefficient, the influence of the watermark matrix on the transparency channel matrix can be adjusted to avoid the product image from not being displayed normally.
[0074] In some embodiments, determining the watermark information of the target product based on the watermark matrix and the spread spectrum sequence includes: determining a watermark sequence based on the watermark matrix and the spread spectrum sequence; decoding the watermark sequence to determine the watermark information; wherein the spread spectrum sequence includes a pseudo-random noise sequence.
[0075] The introduction of a spread spectrum sequence of pseudo-random noise sequence type improves the anti-attack capability of the watermark information, making it more difficult to be tampered with or deleted. The mutual conversion between the watermark information and the watermark sequence is carried out through encoding and decoding, which is conducive to the accurate extraction and verification of the watermark information.
[0076] In some embodiments, judging whether the target product is counterfeit based on the comparison result between the watermark information and the pre-stored product information in the product database includes: if the watermark information is not detected, or the watermark information does not comply with a preset file rule, determining that the target product is counterfeit; if the watermark information is inconsistent with the pre-stored product information, determining that the target product is counterfeit.
[0077] By comparing the watermark information with the pre-stored product information, it can be determined whether the product is counterfeit. The collection and verification process of watermark information is simple and easy. Consumers can verify the authenticity of the product through mobile applications or mini-programs, which provides a good user experience.
[0078] See also Figure 4 , an anti-counterfeiting image recognition method provided in one embodiment of the present disclosure can be implemented through the following process.
[0079] Through applet or application, users can easily collect pictures of product packaging and upload them to the server. On the server side, with the help of image processing tools such as OpenCV, the dark pattern watermark extraction process can be performed. This process is opposite to the dark pattern embedding method. It obtains the alpha channel (alpha_original) of the original image and the spread spectrum sequence S used during embedding from the server's database. The core step of extracting watermark information applies the following formula:
[0080]
[0081] Among them, W alphais the alpha channel with transparent watermark, alpha_original is the alpha channel of the original image, α is the embedding strength coefficient, S is the spreading sequence, and M is the watermark sequence.
[0082] During anti-counterfeiting verification, if the dark pattern watermark sequence is not detected in the above steps, the product is considered to be fake; otherwise, the watermark sequence M extracted in the above steps is extracted Perform ASCII decoding to obtain the watermark information. The watermark information can include the unique serial number of the product and detailed information such as the manufacturer, production batch, and production date. According to the unique serial number of the watermark information, the relevant information of this product can be queried in the database and compared with the content of the watermark information. If the content information of the watermark information is detected to be inconsistent with the product information queried by the unique serial number, the product can be judged to be fake.
[0083] The technical solution provided by one or more embodiments of the present disclosure can use a dark pattern watermark as a carrier to embed the unique serial number and product information of the product as watermark information into the product outer packaging image during product anti-counterfeiting verification. Users can verify the authenticity of the product by collecting product packaging pictures and extracting watermark information.
[0084] The technical solutions provided by one or more embodiments of the present disclosure can be applied to the field of anti-counterfeiting of various products to ensure that consumers purchase genuine products. These products may include electronic products, medicines, food, luxury goods, etc. By embedding dark pattern watermarks, counterfeit products can be effectively prevented from entering the market and the rights and interests of consumers can be protected.
[0085] In the technical solutions provided by one or more embodiments of the present disclosure, the watermark information may include detailed information such as the production batch and production date of the product, which helps the manufacturer to track the production process of the product and recall it when necessary.
[0086] In addition, product regulatory agencies can use the technical solutions provided by one or more embodiments of the present disclosure to strengthen market supervision. Product regulatory agencies can inspect products on the market at any time and use watermark information to verify the legitimacy of the goods, thereby combating the production and sale of counterfeit products.
[0087] The technical solution provided in one or more embodiments of the present disclosure provides a powerful commodity anti-counterfeiting method, which can not only protect consumers from being deceived by counterfeit products, but also help manufacturers and product regulatory agencies to strengthen the management and supervision of products. By embedding unique watermark information into the product packaging image and using advanced image processing technology to verify the watermark information, the present disclosure ensures the high security and verifiability of the anti-counterfeiting system, which is expected to be widely used in various fields and provide greater convenience and protection for all parties.
[0088] See also Figure 5 The present disclosure also provides an anti-counterfeiting image generation device, the device comprising:
[0089] An initial image acquisition unit 501 is used to acquire an initial product image of a target product and extract an initial transparency channel matrix and an initial color channel matrix of the initial product image;
[0090] A watermark information generating unit 502 is used to generate identification information of the target product, and encapsulate the identification information and product attribute information of the target product into watermark information of the target product;
[0091] The watermark matrix generating unit 503 is used to obtain a spread spectrum sequence and convert the watermark signal into a watermark matrix using the spread spectrum sequence;
[0092] A watermark matrix embedding unit 504, configured to embed the watermark matrix into a target position of the initial transparency channel matrix to generate a target transparency channel matrix;
[0093] The product image generating unit 505 is used to merge the target transparency channel matrix with the initial color channel matrix to generate a target product image.
[0094] In one embodiment, the watermark matrix generating unit 503 is specifically used to encode the watermark information to generate a watermark sequence; perform matrix multiplication of the watermark sequence and the spread spectrum sequence to generate the watermark matrix; wherein the spread spectrum sequence includes a pseudo-random noise sequence.
[0095] In one embodiment, the watermark matrix embedding unit 504 is specifically configured to determine a candidate matrix based on the watermark matrix and a preset embedding strength coefficient; and embed the candidate matrix into the target position of the initial transparency channel matrix to generate the target transparency channel matrix.
[0096] In a real-time mode, the anti-counterfeiting image generation device further includes: a target position determination unit 506. The target position determination unit 506 is used to perform grayscale processing on the initial product image to determine a grayscale product image, and perform edge detection on the grayscale product image to determine a first position of the grayscale product image, the first position corresponding to the target position; or perform binarization processing on the initial product image to determine a binary product image, and perform edge detection on the binary product image to determine a second position of the binary product image, the second position corresponding to the target position.
[0097] See also Figure 6 The present disclosure also provides an anti-counterfeiting image recognition device, the device comprising:
[0098] A product image acquisition unit 601 is used to acquire a target product image of a target product and extract a target transparency channel matrix of the target product image;
[0099] A pre-stored information acquisition unit 602 is used to acquire an initial transparency channel matrix and a spread spectrum sequence corresponding to the target product and stored in a database;
[0100] A watermark matrix extraction unit 603, configured to determine a watermark matrix of the target product based on the target transparency channel matrix and the initial transparency channel matrix;
[0101] A watermark matrix parsing unit 604 is used to determine the watermark information of the target product based on the watermark matrix and the spread spectrum sequence, wherein the watermark information includes the identification information of the target product and the product attribute information of the target product;
[0102] The watermark information comparison unit 605 is used to determine whether the target product is counterfeit based on the comparison result between the watermark information and the product information pre-stored in the database.
[0103] In one embodiment, the watermark matrix extraction unit 603 is specifically used to obtain a preset embedding strength coefficient corresponding to the target product in the product database; determine a candidate matrix based on the target transparency channel matrix and the initial transparency channel matrix; and determine the watermark matrix of the target product based on the candidate matrix and the preset embedding strength coefficient.
[0104] In one embodiment, the watermark matrix parsing unit 604 is specifically configured to determine a watermark sequence based on the watermark matrix and the spread spectrum sequence; and decode the watermark sequence to determine the watermark information; wherein the spread spectrum sequence includes a pseudo-random noise sequence.
[0105] In a real-time manner, the watermark information comparison unit 605 is specifically used to determine that the target product is counterfeit if the watermark information is not detected or the watermark information does not comply with a preset file rule; if the watermark information is inconsistent with the pre-stored product information, determine that the target product is counterfeit.
[0106] Above Figure 5 and Figure 6Each unit described in the corresponding embodiment may be implemented by a computer chip or a product having a certain function. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0107] For the convenience of description, the above devices are described in terms of functions and are described separately in various units. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0108] See also Figure 7 The present disclosure also provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the above-mentioned anti-counterfeiting image generation method or anti-counterfeiting image recognition method is implemented.
[0109] The present disclosure also provides a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, the above-mentioned anti-counterfeiting image generation method or anti-counterfeiting image recognition method is implemented.
[0110] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0111] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory, that is, implementing the method in the above method embodiment.
[0112] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0113] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0114] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the device, equipment, and storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0115] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
[0116] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for generating an anti-counterfeiting image, characterized in that: The method comprises: Obtaining an initial product image of a target product, and extracting an initial transparency channel matrix and an initial color channel matrix of the initial product image; Generate identification information of the target product, and encapsulate the identification information and product attribute information of the target product into watermark information of the target product; Acquire a spread spectrum sequence, and use the spread spectrum sequence to convert the watermark signal into a watermark matrix; Embedding the watermark matrix into a target position of the initial transparency channel matrix to generate a target transparency channel matrix; The target transparency channel matrix is combined with the initial color channel matrix to generate a target product image.
2. The method according to claim 1, characterized in that The step of converting the watermark signal into a watermark matrix by using the spread spectrum sequence comprises: Encoding the watermark information to generate a watermark sequence; Performing matrix multiplication of the watermark sequence and the spread spectrum sequence to generate the watermark matrix; Wherein, the spread spectrum sequence includes a pseudo-random noise sequence.
3. The method according to claim 1 or 2, characterized in that: The step of embedding the watermark matrix into a target position of the initial transparency channel matrix to generate a target transparency channel matrix comprises: Determining a candidate matrix based on the watermark matrix and a preset embedding strength coefficient; The candidate matrix is embedded into the target position of the initial transparency channel matrix to generate the target transparency channel matrix.
4. The method according to claim 1, characterized in that: Before embedding the watermark matrix into the target position of the initial transparency channel matrix, the method further includes at least one of the following: Performing grayscale processing on the initial product image to determine a grayscale product image, and performing edge detection on the grayscale product image to determine a first position of the grayscale product image, wherein the first position corresponds to the target position; The initial product image is binarized to determine a binary product image, and edge detection is performed on the binary product image to determine a second position of the binary product image, where the second position corresponds to the target position.
5. A method for identifying anti-counterfeiting images, characterized in that: The method comprises: Obtaining a target product image of a target product, and extracting a target transparency channel matrix of the target product image; In a product database, an initial transparency channel matrix and a spread spectrum sequence corresponding to the target product are obtained; Determining a watermark matrix of the target product based on the target transparency channel matrix and the initial transparency channel matrix; Based on the watermark matrix and the spread spectrum sequence, determining the watermark information of the target product, the watermark information including the identification information of the target product and the product attribute information of the target product; According to the comparison result between the watermark information and the pre-stored product information in the product database, it is determined whether the target product is counterfeit.
6. The method according to claim 5, characterized in that The step of determining the watermark matrix of the target product based on the target transparency channel matrix and the initial transparency channel matrix comprises: In the product database, obtaining a preset embedding strength coefficient corresponding to the target product; Determine a candidate matrix based on the target transparency channel matrix and the initial transparency channel matrix; The watermark matrix of the target product is determined according to the candidate matrix and the preset embedding strength coefficient.
7. The method according to claim 5 or 6, characterized in that: The step of determining the watermark information of the target product based on the watermark matrix and the spread spectrum sequence includes: Determine a watermark sequence based on the watermark matrix and the spreading sequence; Decoding the watermark sequence to determine the watermark information; Wherein, the spread spectrum sequence includes a pseudo-random noise sequence.
8. The method according to claim 5, characterized in that The step of judging whether the target product is counterfeit according to the comparison result between the watermark information and the pre-stored product information in the product database includes: If the watermark information is not detected, or the watermark information does not conform to a preset file rule, determining that the target product is counterfeit; If the watermark information is inconsistent with the pre-stored product information, it is determined that the target product is counterfeit.
9. An anti-counterfeiting image generating device, characterized in that: The device comprises: An initial image acquisition unit, used to acquire an initial product image of a target product, and extract an initial transparency channel matrix and an initial color channel matrix of the initial product image; A watermark information generating unit, configured to generate identification information of the target product, and encapsulate the identification information and product attribute information of the target product into watermark information of the target product; A watermark matrix generating unit, used to obtain a spread spectrum sequence, and convert the watermark signal into a watermark matrix using the spread spectrum sequence; a watermark matrix embedding unit, used for embedding the watermark matrix into a target position of the initial transparency channel matrix to generate a target transparency channel matrix; The product image generation unit is used to merge the target transparency channel matrix with the initial color channel matrix to generate a target product image.
10. An anti-counterfeiting image recognition device, characterized in that: The device comprises: A product image acquisition unit, used to acquire a target product image of a target product and extract a target transparency channel matrix of the target product image; A pre-stored information acquisition unit, used to acquire an initial transparency channel matrix and a spread spectrum sequence corresponding to the target product and stored in a database; A watermark matrix extraction unit, used to determine the watermark matrix of the target product based on the target transparency channel matrix and the initial transparency channel matrix; A watermark matrix parsing unit, used to determine the watermark information of the target product based on the watermark matrix and the spread spectrum sequence, wherein the watermark information includes the identification information of the target product and the product attribute information of the target product; The watermark information comparison unit is used to determine whether the target product is counterfeit based on the comparison result between the watermark information and the product information pre-stored in the database.