Anti-counterfeiting method for encrypting by combining watermark content and image content and related equipment
The integration of watermark and encryption methods using image capturing and business information generates a unique encryption key, embedding the encrypted watermark as color, enhancing anti-counterfeiting capabilities and providing detailed verification.
Patent Information
- Application Number
- CN202411274712.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-27
AI Technical Summary
Existing digital media anti-counterfeiting technologies focus primarily on information embedding and extraction, lacking comprehensive anti-counterfeiting capabilities, and image hash algorithms can only detect changes without providing additional verification information.
An anti-counterfeiting method that integrates watermark and encryption by using image capturing information and business information to generate a unique encryption key, embedding the encrypted watermark as color on the image, and verifying through color comparison.
Enhances encryption effectiveness by making the process independent of servers, reduces storage needs, and supports flexible deployment options while providing detailed verification information.
Smart Images

Figure CN119211437A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image encryption, and in particular relates to an anti-counterfeiting method and related equipment for encrypting watermark content and image content. Background Art
[0002] In today's digital age, digital media anti-counterfeiting technology has become increasingly important, and watermarking technology has been widely adopted as a common method. The core of watermarking technology is to secretly embed information such as copyright logos, timestamps, and geographic locations into digital content, such as pictures, audio or video files, to achieve the purpose of copyright protection and authenticity verification. However, traditional watermarking technology mostly focuses on how to efficiently embed and extract information, while paying relatively little attention to preventing counterfeiting.
[0003] As a branch of watermarking technology, encrypted watermarking is characterized by using encryption to enhance the security of watermark information. This method usually involves encrypting the watermark data using a specific key, and using the corresponding key to complete the decryption and compare it with the original information during the verification stage. Despite this, existing encryption technologies often rely on centralized servers to perform encryption operations, which means that the encryption process cannot be completely independent of the network environment. In addition, although the asymmetric encryption method based on public and private keys improves security, if the key is accidentally leaked, it may cause all watermarks encrypted with the key to lose their protective effect; at the same time, after the key is changed, the validity of the original watermark will also be affected. On the other hand, some anti-counterfeiting measures use the MD5 hash value or hash value of the calculated file as a verification method. This method ensures the integrity and consistency of the image by generating a unique digital fingerprint - hash value for each image. Any slight change to the image will cause a huge change in the hash value, which can effectively identify whether the image has been tampered with. However, the anti-counterfeiting mechanism that relies solely on hash values has limitations, that is, it can only detect whether the image has been changed, but cannot provide additional information about the source, creation time and location of the image.
[0004] In view of the above situation, there is an urgent need to develop a comprehensive digital media anti-counterfeiting solution that integrates watermarking and encryption technology, in order to further improve the anti-counterfeiting effectiveness while ensuring the authenticity of information. Summary of the invention
[0005] The main purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art and to provide an anti-counterfeiting method and related equipment for encrypting watermark content and image content. The present invention performs comprehensive encryption based on the shooting information and watermark information of the picture, and puts the encryption result on the picture in the form of color to solve the problems of information verification and extraction, and image content anti-counterfeiting.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] In a first aspect, the present invention provides an anti-counterfeiting method for encrypting watermark content and image content, comprising the following steps:
[0008] Acquire the captured picture and record the capturing information of the picture; the capturing information at least includes the capturing time;
[0009] Adding the business information and shooting information to be displayed to the picture in the form of a watermark to obtain a watermark picture to be encrypted; the watermark picture to be encrypted includes watermark information composed of the business information and the shooting information;
[0010] Generate a key according to the watermark image to be encrypted, digitally sign the watermark information using the key, convert the signature result into a first verification color and add the first verification color to the image; the key is a combination of the sampled color and the average color of the sampled area;
[0011] The image with the first verification color added is saved in a set format, and the unencrypted watermark information is uploaded to the server. After receiving the unencrypted watermark information, the server returns the image ID. After receiving the image, the client records the image ID and adds the image ID as a watermark to the non-sampling area of the image.
[0012] The image to be verified is submitted to the server. The server identifies the image ID according to the position of the agreed image ID watermark. If the image ID is not identified, the server directly returns the verification failure. If the image ID is identified, the second verification color of the image to be verified is calculated, and the second verification color is compared with the first verification color. If the colors are consistent, the verification passes. If the colors are inconsistent, the verification fails.
[0013] As a preferred technical solution, the step of obtaining the photographed picture and recording the photographing information of the picture is specifically as follows:
[0014] Take pictures through a mobile terminal, use the mobile terminal to obtain the longitude and latitude and local time when the picture was taken, then reverse geocode the longitude and latitude to obtain the address string when the picture was taken, display the time, location, longitude and latitude of the picture in real time on the preview interface of the picture, and store the shooting information.
[0015] As a preferred technical solution, the business information includes the object name and the purpose of shooting.
[0016] As a preferred technical solution, the first verification color is added to the picture, specifically:
[0017] Set the sampling area, sample the colors in the sampling area and calculate the average color, and set the calibration color outside the sampling area of the image;
[0018] Calculate the encryption key, specifically: first calculate the sampling color, convert the shooting time of the picture into a second-level timestamp, obtain the sampling parameters based on the timestamp, convert the sampling parameters into corresponding coordinate information, and sample the picture; secondly, traverse the RGB values of the colors of all pixels in the sampling area and calculate the average color; finally, convert the sampling color and the average color into strings, and concatenate the strings to obtain the encryption key;
[0019] Encrypt the watermark information based on the encryption key and the AES encryption algorithm to obtain an encrypted byte array;
[0020] The encrypted byte array is converted into a hexadecimal string, and then the last six digits of the hexadecimal string are obtained as the hexadecimal RGB value, the RGB value is used as the first verification color, and the first verification color is added to the non-sampling area of the image.
[0021] As a preferred technical solution, the sampling area is set to remove 10% of the width and height of the area around the picture, that is, to retain 80% of the width and 80% of the height of the area around the center of the picture.
[0022] As a preferred technical solution, the unencrypted watermark information includes business information and shooting information; the set format is PNG format.
[0023] As a preferred technical solution, the calculated verification color is compared with the verification color in the picture. If the colors are consistent, the verification is passed; if the colors are inconsistent, the verification fails. Specifically:
[0024] According to the watermark information and shooting information extracted from the database, the second verification color is calculated according to the same steps as the first verification color, specifically: firstly, the sampling area of the picture is sampled according to the last four digits of the shooting time to obtain the sampling color, and then the average color of the sampling area is calculated to obtain the average color, and then the sampling color and the average color are spliced to obtain the encryption key; then the watermark information and shooting information extracted from the database are combined into a watermark string to be encrypted, and according to the AES encryption algorithm, the watermark string to be encrypted is encrypted using the key to obtain a digital signature; the calculated digital signature is converted into a hexadecimal string to obtain the calculated verification color;
[0025] Then extract the verification color in the lower right corner of the picture at the agreed position, and compare the two colors. If they are the same, the verification passes, otherwise the verification fails.
[0026] In a second aspect, the present invention provides an anti-counterfeiting system for encrypting watermark content and image content, which is applied to the anti-counterfeiting method for encrypting watermark content and image content, and includes a shooting information acquisition module, an encryption module, a verification color adding module, a storage module and a verification module;
[0027] The photographing information acquisition module is used to acquire the photographed picture and record the photographing information of the picture; the photographing information at least includes the photographing time;
[0028] The encryption module is used to add the business information and shooting information to be displayed to the picture in the form of a watermark to obtain a watermark picture to be encrypted; the watermark picture to be encrypted includes watermark information composed of the business information and the shooting information;
[0029] The verification color adding module is used to generate a key according to the watermark image to be encrypted, digitally sign the watermark information through the key, convert the signature result into a first verification color and add the first verification color to the image; the key is a combination of the sampling color and the average color of the sampling area;
[0030] The storage module is used to save the picture with the first verification color added in a set format, and upload the unencrypted watermark information to the server. After receiving the unencrypted watermark information, the server returns the picture ID. After receiving the picture ID, the client records it and adds the picture ID as a watermark to the non-sampling area of the picture.
[0031] The authentication module is used to submit the image to be authenticated to the server. The server identifies the image ID according to the position of the agreed image ID watermark. If the image ID is not identified, the authentication failure is directly returned. If the image ID is identified, the second verification color of the image to be authenticated is calculated, and the second verification color is compared with the first verification color. If the colors are consistent, the authentication is passed; if the colors are inconsistent, the authentication fails.
[0032] In a third aspect, the present invention provides an electronic device, the electronic device comprising:
[0033] at least one processor; and,
[0034] a memory communicatively connected to the at least one processor; wherein,
[0035] The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute the anti-counterfeiting method of combining watermark content and image content for encryption.
[0036] In a fourth aspect, the present invention provides a computer-readable storage medium storing a program, which, when executed by a processor, implements the anti-counterfeiting method of encrypting watermark content and image content.
[0037] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0038] (1) The present invention provides an anti-counterfeiting method for encrypting watermark content and image content, which overcomes the limitations of existing digital media anti-counterfeiting technologies in terms of security and reliability by integrating watermark content and image content for encryption. At present, although watermark technology has been widely used in the field of digital media anti-counterfeiting, most technologies mainly focus on the information embedding and extraction process of watermarks rather than comprehensive anti-counterfeiting functions. Although existing encrypted watermark technology can ensure the security of watermark information, it is insufficient in ensuring the anti-counterfeiting effectiveness of the image itself; in addition, although the image hash algorithm can identify whether the image has been tampered with, it cannot provide further verification information.
[0039] (2) This method uses color as the basis and result of encryption, which not only enhances the effectiveness of encryption, because the content and time of the picture are random, which means that the key generated each time is unique. At the same time, because the key, the content to be encrypted, and the encrypted result are directly embedded in the picture, this method can reduce storage requirements, save space for storing watermarks separately, and make the encryption and verification process completely independent of the server, and can be deployed offline - the watermark information is read directly from the picture through OCR technology, without relying on the server and database. Of course, you can also choose an online deployment mode to upload the watermark information to the database so that you can subsequently query the watermark information of the picture through the database for verification. This invention provides highly flexible implementation options, and you can choose the most appropriate deployment method according to the actual application scenario.
[0040] (3) The watermark encryption method of the present invention has strong applicability because it supports customized watermark content for business scenarios. In different industries and different usage scenarios, since the part to be encrypted contains customized watermark content, the watermark content that meets the usage scenario can be input and then encrypted. The specific implementation can be adjusted according to the scenario. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0042] Figure 1 A flowchart of an anti-counterfeiting method for encrypting watermark content and image content according to an embodiment of the present invention;
[0043] Figure 2 is an anti-counterfeiting process flow chart of another specific embodiment of the present invention;
[0044] Figure 3 The block diagram of the anti-counterfeiting system for encrypting watermark content and image content according to an embodiment of the present invention.
[0045] Figure 4 4 is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0046] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0047] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0048] like Figure 1 As shown, this embodiment provides an anti-counterfeiting method that combines watermark content and image content for encryption, extracts sample colors according to watermark content and image features, and generates an anti-counterfeiting and verification method for verification colors. The main steps of the present invention are as follows:
[0049] S1. Obtain a captured image and record the image's capture information.
[0050] Specifically, when a user takes a picture with a mobile terminal, it is necessary to record the shooting information of the picture, which includes but is not limited to the time, location, longitude and latitude of the shooting, among which the shooting time must be recorded; among which, the location information is first obtained by locating the longitude and latitude through the user's mobile terminal, and then reverse geocoding is performed through other interfaces to obtain a specific address string, and the time is the local time of the mobile terminal. These contents are displayed in real time on the preview interface, and when the user presses the shutter, the shooting information will be stored.
[0051] More specifically, when the shooting time is displayed in the preview interface, it includes the shooting date, the specific shooting time and the day of the week.
[0052] It is understandable that the mobile terminal includes electronic devices such as mobile phones and PADs.
[0053] In a specific embodiment, when a user uses a mobile terminal (such as a smart phone or tablet) to take a picture, the system will record a series of metadata related to the shooting. These metadata include at least the shooting time, which is information that must be recorded. In addition, it also includes the specific location information of the shooting location, such as longitude and latitude coordinates. In order to obtain accurate location information, the mobile terminal first determines the user's geographic location, that is, longitude and latitude information, through a built-in GPS module or other positioning technology. Subsequently, the system will use these longitude and latitude data to call the reverse geocoding service through a network request to convert the coordinates into an easy-to-understand specific address string.
[0054] The shooting time is directly taken from the local time of the mobile terminal to ensure consistency with the user's time zone. All this information will be displayed in real time on the preview interface of the camera application, allowing users to see the data that will be recorded before shooting. When the user presses the shutter button to complete the shooting action, the system will immediately save the shooting information together with the picture, ensuring that each picture has detailed metadata support, which is convenient for subsequent management and verification. This method not only improves the authenticity of the picture, but also provides reliable data support for subsequent occasions where the original information of the picture may need to be verified.
[0055] S2. Add the business information and shooting information to be displayed to the picture in the form of a watermark to obtain a watermarked picture to be encrypted.
[0056] Specifically, after the user completes the shooting, the business information and shooting information to be displayed are added to the lower left corner of the picture in the form of a watermark to obtain a watermarked picture to be encrypted.
[0057] It is understandable that the business information does not include the shooting information acquired by the mobile terminal in step S1; the business information mainly includes the name of the shooting object, the purpose of shooting, etc.; of course, the business information can also be adjusted according to actual needs.
[0058] In a specific embodiment, when a tobacco store employee uses a mobile device (such as a smartphone or tablet) to take a picture of a product, the system automatically records some key business information and shooting information. For example, the product being photographed may be a certain brand of cigarettes, so the business information may include the barcode, batch number, expiration date, etc. of the product, while the shooting information includes the time and location of the shooting (store name or location), the identity of the photographer, etc.
[0059] After the photo is taken, the system will superimpose this information in the form of a watermark on the lower left corner of the image. This information will be embedded in the lower left corner of the image in a clear and easy-to-read manner, forming a watermark image to be encrypted. The advantage of this is that even if the image is shared or forwarded, the watermark information is still retained and can be used to verify the authenticity and integrity of the image, ensuring that consumers can identify whether the product information in the image is accurate.
[0060] S3. Generate a key according to the watermark image to be encrypted, digitally sign the watermark information using the key, convert the signature result into a first verification color and add the first verification color to the image.
[0061] In order to prevent the watermark information and the image content from being counterfeited, and also for the convenience of subsequent verification, the present invention uses the color and shooting time of the captured image as encryption credentials to encrypt the watermark information. The source of the encryption key is sampled and calculated based on the shooting time and image content, and then the watermark is encrypted and converted. The calculation of the verification color is mainly divided into the following 4 steps:
[0062] S31, setting a sampling area;
[0063] Since the first calibration color will eventually cover the color of the original area on the image, in order to ensure that the calibration color will not affect the sampled color and the average high color after covering, it is necessary to set a sampling area, sample only the colors in the area and calculate the average color, and finally place the first calibration color outside the sampling area.
[0064] More specifically, in this embodiment, the sampling area is set to remove 10% of the width and height of the area around the picture, that is, 80% of the width and 80% of the height around the center of the picture are used as the sampling area.
[0065] S32, calculating an encryption key;
[0066] In order to enhance the anti-counterfeiting effect, the encryption key is mainly composed of two parts, namely the sampling color and the average color of the sampling area.
[0067] The sampling color is calculated based on the shooting time, so that even if the image content is consistent with the watermark content, the final calculated verification color is different for different shooting times. The calculation method is to convert the shooting time into a second-level timestamp, and take the last 4 digits of the timestamp as the sampling parameter. The image is sampled based on the corresponding coordinate information converted according to the last four digits of the timestamp. In a specific embodiment, assuming that the last four digits are: 3847, it means that the color of the point in the sampling area whose x coordinate is 38% of the width of the sampling area and whose height is 47% of the height of the sampling area is selected as the sampling color.
[0068] In order to ensure that the image content is not tampered with, the average color is calculated to enhance the anti-counterfeiting effect. Specifically, the average color is calculated by traversing the RGB values of the colors of all pixels in the sampling area.
[0069] Finally, the sampled color and average color are converted into strings, and the strings are concatenated to obtain the encryption key.
[0070] S33, encrypting watermark information;
[0071] After obtaining the encryption key, the watermark information of the image to be encrypted, including the subject information and business information, is concatenated to form a string to be encrypted; the watermark information is encrypted using the calculated key and the AES encryption algorithm to obtain an encrypted byte array. This byte array is the result of the electronic signature. The subject information and business information include: shooting time, shooting location, shooting latitude and longitude, shooting subject evaluation, shooting purpose, etc.
[0072] S34, converting the encryption result into color and adding it to the picture;
[0073] Convert the byte array to a hexadecimal string, then obtain the last six digits of the hexadecimal string as the hexadecimal RGB value, and use the RGB value as the verification color. Then place the first verification color in the non-sampling area in the lower right corner of the image to avoid adding the verification color to affect the calculation of the sampling color and the average color during the subsequent verification, resulting in verification failure.
[0074] S4, save the image and upload the watermark information to the server;
[0075] Because the image color is used as the source of encryption, in order to ensure the accuracy of verification, the image needs to be saved in PNG format to ensure that the color is not distorted. After the image is saved, the unencrypted watermark information, including business information and shooting information, is uploaded to the server. After receiving the data, the server returns the image ID. After receiving it, the client records the image ID and puts it in the non-sampling area of the image for subsequent verification to identify which image it is.
[0076] S5. Submit the image to be verified to the server for verification.
[0077] When a user needs to verify the authenticity of a photo and whether it has been tampered with, he needs to submit the photo to be verified to the server first, and the server will determine the authenticity of the photo. The verification steps are mainly divided into three steps: the user uploads the photo to be verified and identifies the photo, the server calculates the digital signature and converts it into a verification book, and the server compares the verification color to see if it is consistent.
[0078] S51. The user uploads the picture to be verified and extracts the anti-counterfeiting information; when the user needs to verify the picture, the picture needs to be uploaded to the server first. After the server receives the picture, it first identifies the picture ID according to the agreed picture ID position. If the picture ID is not identified, it directly returns the verification failure. The way to identify the picture ID is through OCR text recognition. After finding the picture ID, it is necessary to search the database for the corresponding anti-counterfeiting information according to the picture ID, including watermark information and shooting information, and record it for subsequent calculation of the verification color.
[0079] S52, calculate the second verification color; according to the watermark information and shooting information extracted from the database, the second verification color is calculated according to the same steps as the first verification color calculation, specifically: firstly, the sampling area of the image is sampled according to the last four digits of the shooting time to obtain the sampling color, then the average color of the sampling area is calculated to obtain the average color, and then the sampling color and the average color are concatenated to obtain the encryption key. Then, the watermark information and shooting information extracted from the database are combined into a watermark string to be encrypted, and the watermark string to be encrypted is encrypted using the key according to the AES encryption algorithm to obtain a digital signature.
[0080] S53, compare the first verification color and the second verification color; convert the calculated digital signature into a hexadecimal string to obtain the second verification color, and then extract the first verification color at the lower right corner of the agreed position image, and compare the two verification colors. If they are the same, it means that the authentication is passed, otherwise the authentication fails.
[0081] On the one hand, the present invention uses the content of the image itself as a verification benchmark, which means that all data required for verification can be directly extracted from the image, thereby reducing the demand for storage space, supporting local verification, and reducing network and storage requirements. On the other hand, the present invention also proposes a method for calculating the verification color value, which combines the watermark information with the image content to enhance the anti-counterfeiting properties of the image itself. In addition, the introduction of the time variable further enhances the anti-counterfeiting effect and increases the difficulty of cracking. Even if the encryption key is mastered, if the specific encryption process is not understood, other images cannot be effectively encrypted.
[0082] In another specific embodiment, a tobacco star rating system was developed based on the technical solution of the present invention. The system is mainly used to rate and assign stars to local tobacco business operators. The data basis for rating and assigning stars mainly comes from the customer manager's inspection of the merchants. During the inspection, information on the business conditions of the merchants is collected, including storefront photos, tobacco product display photos, store business area photos, etc. Therefore, it is necessary to develop a working watermark camera in the information collection software to ensure the accuracy and authenticity of the information collected. In this information collection software, the results of the present invention are directly applied. Figure 2As shown in parts (a)-(f) of Figure 1, the software has the following functions:
[0083] (1) Enter the basic information of the store: including the store name, store address, tobacco business license information, business entity information, etc. This step mainly collects business information for adding watermarks to subsequent photos.
[0084] (2) Take photos: Take photos of the store's front door, display, and business area. This step uses the anti-counterfeiting method of combining watermark content and image content for encryption. After the photo is taken, the watermark information and photo information will be automatically uploaded to the server, and the verification color will be added to the image.
[0085] (3) Measurement: Measure the storefront area, display area, and business area. This step also collects business information, which will be used as an anti-counterfeiting watermark when filling out questionnaires and taking photos.
[0086] (4) Fill in the questionnaire: Fill in the inspection questionnaire according to the business situation. Some questions require taking photos according to the actual problems. According to the questionnaire information, add watermark information and verification color to the picture according to the method of the present invention, and upload the watermark information to the server.
[0087] (5) Save information: Save the above-mentioned photos and questionnaire contents to the user’s mobile phone
[0088] (6) Verify and upload: Due to compliance requirements, images and information need to be uploaded using dedicated office software. The server needs to verify the authenticity of the image before uploading it, and only after the verification is passed can it be uploaded. The server will extract the image ID, identify the watermark, and calculate and compare the verification color of the image uploaded by the user. Only after passing the verification can it be uploaded.
[0089] It should be noted that, for the sake of convenience, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited to the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously.
[0090] Based on the same idea as the anti-counterfeiting method for encrypting watermark content and image content in the above embodiment, the present invention also provides an anti-counterfeiting system for encrypting watermark content and image content, which can be used to execute the above anti-counterfeiting method for encrypting watermark content and image content. For ease of explanation, the structural schematic diagram of the embodiment of the anti-counterfeiting system for encrypting watermark content and image content only shows the parts related to the embodiment of the present invention. Those skilled in the art can understand that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than shown in the diagram, or combine certain components, or arrange the components differently.
[0091] See also Figure 3 In another embodiment of the present application, an anti-counterfeiting system 100 for encrypting watermark content and image content is provided, the system comprising a shooting information acquisition module 101, an encryption module 102, a verification color adding module 103, a storage module 104 and a verification module 105;
[0092] The photographing information acquisition module 101 is used to acquire the photographed picture and record the photographing information of the picture; the photographing information at least includes the photographing time;
[0093] The encryption module 102 is used to add the business information and shooting information to be displayed to the picture in the form of a watermark to obtain a watermark picture to be encrypted; the watermark picture to be encrypted includes watermark information composed of the business information and the shooting information;
[0094] The verification color adding module 103 is used to generate a key according to the watermark image to be encrypted, digitally sign the watermark information with the key, convert the signature result into a first verification color and add the first verification color to the image; the key is a combination of the sampled color and the average color of the sampled area;
[0095] The storage module 104 is used to save the picture with the first verification color added in a set format, and upload the unencrypted watermark information to the server. After receiving the unencrypted watermark information, the server returns the picture ID. After receiving the picture ID, the client records it and adds the picture ID as a watermark to the non-sampling area of the picture.
[0096] The authentication module 105 is used to submit the image to be authenticated to the server. The server identifies the image ID according to the position of the agreed image ID watermark. If the image ID is not identified, the authentication failure is directly returned. If the image ID is identified, the second verification color of the image to be authenticated is calculated, and the second verification color is compared with the first verification color. If the colors are consistent, the authentication is passed, and if the colors are inconsistent, the authentication fails.
[0097] It should be noted that the anti-counterfeiting system for encrypting watermark content and image content in combination with the present invention corresponds one to one with the anti-counterfeiting method for encrypting watermark content and image content in combination with the present invention. The technical features and beneficial effects described in the above-mentioned embodiment of the anti-counterfeiting method for encrypting watermark content and image content are applicable to the embodiment of the anti-counterfeiting method for encrypting watermark content and image content. For specific contents, please refer to the description in the embodiment of the method of the present invention, which will not be repeated here. This is hereby declared.
[0098] In addition, in the implementation of the anti-counterfeiting system for encrypting watermark content and image content in the above-mentioned embodiment, the logical division of each program module is only an example. In actual application, the above-mentioned functions can be assigned to different program modules as needed, for example, for the configuration requirements of the corresponding hardware or the convenience of software implementation. That is, the internal structure of the anti-counterfeiting system for encrypting watermark content and image content is divided into different program modules to complete all or part of the functions described above.
[0099] See also Figure 3 In one embodiment, an electronic device that implements an anti-counterfeiting method for encrypting watermark content and image content is provided. The electronic device 200 may include a first processor 201, a first memory 202 and a bus, and may also include a computer program stored in the first memory 202 and executable on the first processor 201, such as an anti-counterfeiting program 203 that encrypts watermark content and image content.
[0100] The first memory 202 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the first memory 202 may be an internal storage unit of the electronic device 200, such as a mobile hard disk of the electronic device 200. In other embodiments, the first memory 202 may also be an external storage device of the electronic device 200, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 200. Further, the first memory 202 may also include both an internal storage unit of the electronic device 200 and an external storage device. The first memory 202 may not only be used to store application software and various types of data installed in the electronic device 200, such as the code of the anti-counterfeiting program 203 encrypted in combination with the watermark content and the image content, but may also be used to temporarily store data that has been output or is to be output.
[0101] In some embodiments, the first processor 201 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The first processor 201 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes various functions and processes data of the electronic device 200 by running or executing programs or modules stored in the first memory 202, and calling data stored in the first memory 202.
[0102] Figure 4 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 4 The structure shown does not constitute a limitation on the electronic device 200 , and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0103] The anti-counterfeiting program 203 for encrypting watermark content and image content stored in the first memory 202 of the electronic device 200 is a combination of multiple instructions. When running in the first processor 201, it can achieve:
[0104] Acquire the captured picture and record the capturing information of the picture; the capturing information at least includes the capturing time;
[0105] Adding the business information and shooting information to be displayed to the picture in the form of a watermark to obtain a watermark picture to be encrypted; the watermark picture to be encrypted includes watermark information composed of the business information and the shooting information;
[0106] Generate a key according to the watermark image to be encrypted, digitally sign the watermark information using the key, convert the signature result into a first verification color and add the first verification color to the image; the key is a combination of the sampled color and the average color of the sampled area;
[0107] The image with the first verification color added is saved in a set format, and the unencrypted watermark information is uploaded to the server. After receiving the unencrypted watermark information, the server returns the image ID. After receiving the image, the client records the image ID and adds the image ID as a watermark to the non-sampling area of the image.
[0108] The image to be verified is submitted to the server. The server identifies the image ID according to the position of the agreed image ID watermark. If the image ID is not identified, the server directly returns the verification failure. If the image ID is identified, the second verification color of the image to be verified is calculated, and the second verification color is compared with the first verification color. If the colors are consistent, the verification passes. If the colors are inconsistent, the verification fails.
[0109] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0110] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0111] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. An anti-counterfeiting method combining watermark content and image content for encryption, characterized in that: The steps include: Acquire the captured picture and record the capturing information of the picture; the capturing information at least includes the capturing time; Adding the business information and shooting information to be displayed to the picture in the form of a watermark to obtain a watermark picture to be encrypted; the watermark picture to be encrypted includes watermark information composed of the business information and the shooting information; Generate a key according to the watermark image to be encrypted, digitally sign the watermark information using the key, convert the signature result into a first verification color and add the first verification color to the image; the key is a combination of the sampled color and the average color of the sampled area; The image with the first verification color added is saved in a set format, and the unencrypted watermark information is uploaded to the server. After receiving the unencrypted watermark information, the server returns the image ID. After receiving the image, the client records the image ID and adds the image ID as a watermark to the non-sampling area of the image. The image to be verified is submitted to the server. The server identifies the image ID according to the position of the agreed image ID watermark. If the image ID is not identified, the server directly returns the verification failure. If the image ID is identified, the second verification color of the image to be verified is calculated, and the second verification color is compared with the first verification color. If the colors are consistent, the verification passes. If the colors are inconsistent, the verification fails.
2. The anti-counterfeiting method of combining watermark content and image content for encryption according to claim 1, characterized in that: The step of obtaining the captured image and recording the capturing information of the image is as follows: Take pictures through a mobile terminal, use the mobile terminal to obtain the longitude and latitude and local time when the picture was taken, then reverse geocode the longitude and latitude to obtain the address string when the picture was taken, display the time, location, longitude and latitude of the picture in real time on the preview interface of the picture, and store the shooting information.
3. The anti-counterfeiting method of combining watermark content and image content for encryption according to claim 1, characterized in that: The business information includes the object name and the purpose of shooting.
4. The anti-counterfeiting method of combining watermark content and image content for encryption according to claim 1, characterized in that: Add the first verification color to the picture, specifically: Set the sampling area, sample the colors in the sampling area and calculate the average color, and set the calibration color outside the sampling area of the image; Calculate the encryption key, specifically: first calculate the sampling color, convert the shooting time of the picture into a second-level timestamp, obtain the sampling parameters based on the timestamp, convert the sampling parameters into corresponding coordinate information, and sample the picture; secondly, traverse the RGB values of the colors of all pixels in the sampling area and calculate the average color; finally, convert the sampling color and the average color into strings, and concatenate the strings to obtain the encryption key; Encrypt the watermark information based on the encryption key and the AES encryption algorithm to obtain an encrypted byte array; The encrypted byte array is converted into a hexadecimal string, and then the last six digits of the hexadecimal string are obtained as the hexadecimal RGB value, the RGB value is used as the first verification color, and the first verification color is added to the non-sampling area of the image.
5. The anti-counterfeiting method of combining watermark content and image content for encryption according to claim 4, characterized in that: The sampling area is set to remove 10% of the width and height of the area around the picture, that is, to retain 80% of the width and 80% of the height of the area around the center of the picture.
6. The anti-counterfeiting method of combining watermark content and image content for encryption according to claim 1, characterized in that: The unencrypted watermark information includes business information and shooting information; the set format is PNG format.
7. The anti-counterfeiting method of combining watermark content and image content for encryption according to claim 4, characterized in that: The calculated verification color is compared with the verification color in the picture. If the colors are consistent, the verification is passed. If the colors are inconsistent, the verification fails. Specifically: According to the watermark information and shooting information extracted from the database, the second verification color is calculated according to the same steps as the first verification color, specifically: firstly, the sampling area of the picture is sampled according to the last four digits of the shooting time to obtain the sampling color, and then the average color of the sampling area is calculated to obtain the average color, and then the sampling color and the average color are spliced to obtain the encryption key; then the watermark information and shooting information extracted from the database are combined into a watermark string to be encrypted, and according to the AES encryption algorithm, the watermark string to be encrypted is encrypted using the key to obtain a digital signature; the calculated digital signature is converted into a hexadecimal string to obtain the calculated verification color; Then extract the verification color in the lower right corner of the picture at the agreed position, and compare the two colors. If they are the same, the verification passes, otherwise the verification fails.
8. An anti-counterfeiting system combining watermark content and image content for encryption, characterized in that: The anti-counterfeiting method for encrypting watermark content and image content according to any one of claims 1 to 7 comprises a shooting information acquisition module, an encryption module, a verification color adding module, a storage module and a verification module; The photographing information acquisition module is used to acquire the photographed picture and record the photographing information of the picture; the photographing information at least includes the photographing time; The encryption module is used to add the business information and shooting information to be displayed to the picture in the form of a watermark to obtain a watermark picture to be encrypted; the watermark picture to be encrypted includes watermark information composed of the business information and the shooting information; The verification color adding module is used to generate a key according to the watermark image to be encrypted, digitally sign the watermark information through the key, convert the signature result into a first verification color and add the first verification color to the image; the key is a combination of the sampling color and the average color of the sampling area; The storage module is used to save the picture with the first verification color added in a set format, and upload the unencrypted watermark information to the server. After receiving the unencrypted watermark information, the server returns the picture ID. After receiving the picture ID, the client records it and adds the picture ID as a watermark to the non-sampling area of the picture. The authentication module is used to submit the image to be authenticated to the server. The server identifies the image ID according to the position of the agreed image ID watermark. If the image ID is not identified, the authentication failure is directly returned. If the image ID is identified, the second verification color of the image to be authenticated is calculated, and the second verification color is compared with the first verification color. If the colors are consistent, the authentication is passed; if the colors are inconsistent, the authentication fails.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute the anti-counterfeiting method for encrypting watermark content and image content as described in any one of claims 1-7.
10. A computer-readable storage medium storing a program, characterized in that: When the program is executed by a processor, the anti-counterfeiting method of encrypting watermark content and image content as described in any one of claims 1 to 7 is implemented.