Image verification method and device, electronic equipment and computer program product

By randomly scrambling and encoding images to generate diffusion watermarks and authentication watermarks, the problems of poor image security and low detection accuracy are solved, achieving high security and high accuracy detection of images.

CN121842334APending Publication Date: 2026-04-10INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-03
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Current technologies suffer from poor image security and low detection accuracy, allowing attackers to bypass authentication mechanisms by tampering with images.

Method used

The image is scrambled and encoded using a random sequence to generate a diffusion watermark and an authentication watermark, which are then embedded in the image and verified using the random sequence.

Benefits of technology

It improves image security and detection accuracy, and can effectively detect image tampering and locate the tampered area.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121842334A_ABST
    Figure CN121842334A_ABST
Patent Text Reader

Abstract

The invention discloses an image verification method and device, electronic equipment and a computer program product. Relates to the field of financial science and technology, and the method comprises the steps: receiving an image transmission request, and extracting a to-be-processed image from the image transmission request, the image transmission request being a request for sending the to-be-processed image to a client of a target address; y random sequences are obtained, scrambling processing is carried out on the to-be-processed image according to the Y random sequences, a processed image is obtained, the Y random sequences are used for coding the processed image, a coding watermark is obtained, and the coding watermark comprises a diffusion watermark and an authentication watermark; the coding watermark is embedded into the to-be-processed image to obtain a target image, the target image is sent to the client of the target address, and the client of the target address verifies the target image. According to the image processing method and device, the technical problems that the security of the to-be-processed image is poor and the detection accuracy is low when the image is detected in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of financial technology, in particular to an image verification method and device, electronic equipment and computer program product. BACKGROUND

[0002] With the development of technology and the deep integration of the Internet, financial institutions have a high dependence on digital images. From remote identity verification to electronic contract signing, to the management of transaction records, images carry the function of transmitting and proving important information. However, with the help of advanced image editing software or mobile applications, attackers can modify or synthesize pictures, threatening user privacy and causing security risks.

[0003] To solve the above problems, digital watermarking technology, as an important branch of information hiding, uses the redundancy characteristics of digital carriers (such as images, audio, and video) to embed specific identification information in them. Even if the carrier is compressed, cropped, or subjected to other forms of processing, the watermark can still remain, allowing image authentication in this way.

[0004] However, the above image authentication technology mostly adopts a single watermark strategy, which encrypts the grayscale pixel values of the original image and then embeds them in a certain layer or position of the image. Although this approach can enhance image protection to some extent, it also has several defects. First, single watermarking or fixed mapping methods are vulnerable to statistical analysis, and attackers can infer the correlation between the watermark and the image pixels, thereby implementing forgery or bypassing the authentication mechanism. In addition, although fragile watermarks can reflect image modifications, their positioning mechanism is not accurate enough to limit the application of the technology in highly sensitive areas. Attackers can still pass off the tampered image as authentic without being detected through certain means.

[0005] The related art has not yet proposed an effective solution to the technical problems of poor security of the image to be processed and low detection accuracy when detecting the image. SUMMARY

[0006] The main purpose of the present application is to provide an image verification method, device, electronic equipment and computer program product to solve the technical problems of poor security of the image to be processed and low detection accuracy when detecting the image in the related art.

[0007] To achieve the above objectives, according to one aspect of this application, an image verification method is provided. The method includes: receiving an image transmission request; extracting an image to be processed from the image transmission request, wherein the image transmission request refers to a request to send the image to be processed to a client at a target address; obtaining Y random sequences; scrambling the image to be processed according to the Y random sequences to obtain a processed image; and encoding the processed image using the Y random sequences to obtain an encoded watermark, wherein the encoded watermark includes a diffusion watermark and an authentication watermark, and Y is a positive integer; embedding the encoded watermark into the image to be processed to obtain a target image; and sending the target image to the client at the target address, wherein, upon receiving the target image at the client at the target address, the target image is verified.

[0008] Further, obtaining Y random sequences includes: obtaining M master keys, where each master key includes K pairs of subkeys, and each pair of subkeys includes mapping parameters and initial mapping values, where M and K are positive integers; for a master key, extracting mapping parameters and initial mapping values ​​from a pair of subkeys of the master key, inputting the mapping parameters and initial mapping values ​​into a chaotic mapping function, and processing to obtain a random sequence.

[0009] Furthermore, the image to be processed is scrambled according to Y random sequences to obtain the processed image, including: obtaining N from the image to be processed. The pixel values ​​corresponding to N pixels are determined, and a first random sequence is obtained by randomly selecting one of Y random sequences; the N values ​​in the first random sequence are then retrieved. Given N sequence values, calculate N for each sequence value and each pixel value in the first random sequence. N initialized pixel values, and based on N The initial diffusion image is constructed from the pixels corresponding to N initialized pixel values, where N is a positive integer; the permutation parameter set is obtained, and a permutation matrix is ​​constructed using the permutation parameter set; a second random sequence is obtained by randomly selecting one random sequence from Y random sequences; and N in the initial diffusion image is obtained. Given N initial diffused pixels, use the permutation matrix to... The N initial diffused pixels are replaced to obtain N N permuted pixels; obtain N The permuted pixel values ​​corresponding to N permuted pixels are calculated by performing the calculation on each sequence value and each permuted pixel value in the second random sequence to obtain N. N scrambled pixel values, based on N The processed image is constructed from the pixels corresponding to the N scrambled pixel values.

[0010] Furthermore, the processed image is encoded using Y random sequences to obtain an encoded watermark, which includes: randomly selecting P random sequences from the Y random sequences to obtain P third random sequences; constructing a first encoding / decoding rule based on P1 third random sequences; and constructing a second encoding / decoding rule based on P2 third random sequences, where P1 + P2 = P, P is less than Y, and P is a positive integer; and extracting a set of preset bit codes from the scrambled pixel values ​​associated with each pixel of the processed image to obtain N... N sets of preset bit codes are encoded according to the first encoding and decoding rule to obtain N N encoded bits, and based on N The diffusion watermark is obtained by combining N encoded bit codes; L preset bit codes are obtained for each pixel of the image to be processed, and one preset bit code is obtained for each pixel of the diffusion watermark; the L preset bit codes for each pixel to be processed and the one preset bit code for each pixel of the diffusion watermark are combined to obtain N N sets of pre-defined diffusion bit codes are provided, where each set includes L pre-defined bit codes for a pixel to be processed and one pre-defined bit code for a pixel to be diffused, where L is a positive integer. Each set of pre-defined diffusion bit codes is encoded according to the second encoding / decoding rule to obtain N... N spread bit codes, and based on N The authentication watermark is obtained by combining N diffused bit codes.

[0011] Furthermore, each set of preset bit codes is encoded according to the first encoding / decoding rule to obtain N. The N encoded bit codes include: for a pixel in the processed image, obtaining H preset bit codes from the scrambled pixel values ​​associated with the pixel, where H preset bit codes constitute a set of preset bit codes, and H is a positive integer; identifying the H preset bit codes according to the first encoding and decoding rule to obtain the initial code; performing XOR processing on each sub-code in the initial code to obtain the base code, where the initial code includes H / 2 sub-codes; decoding the base code using the first encoding and decoding rule to obtain two decoded bit codes; performing XOR processing on the two decoded bit codes to obtain the encoded bit code of the pixel.

[0012] Further, embedding the coded watermark into the image to be processed to obtain the target image includes: extracting the authentication watermark from the coded watermark, obtaining a preset Latin square matrix, scrambling the authentication watermark using the preset Latin square matrix to obtain the processed authentication watermark; randomly selecting a random sequence from Y random sequences to obtain a fourth random sequence, and obtaining N from the fourth random sequence. There are N sequence values. For the i-th sequence value, if the sequence value indicates the first parameter, the i-th bit code from the processed authentication watermark is embedded into the first bit layer of the image to be processed, and the i-th bit code from the diffusion watermark in the encoded watermark is embedded into the second bit layer of the image to be processed. The first bit layer is lower than the second bit layer, and i is less than or equal to N. N, where i is a positive integer; when the sequence value indicator is the second parameter, the i-th bit code in the processed authentication watermark is embedded into the second bit layer, and the i-th bit code in the diffusion watermark in the encoded watermark is embedded into the first bit layer; the first bit layer and the second bit layer in the image to be processed are replaced by the first bit layer and the second bit layer after embedding, respectively, to obtain the target image.

[0013] Furthermore, the target image is verified as follows: a random sequence is randomly selected from Y random sequences to obtain a fifth random sequence. The target authentication watermark is extracted from the target image using the fifth random sequence. The target authentication watermark is then subjected to an inverse Latin matrix transformation to obtain the restored target authentication watermark. The target image is scrambled to obtain a processed target image, and the processed target image is encoded to obtain an encoded authentication watermark. The restored target authentication watermark and the encoded authentication watermark are compared. If the restored target authentication watermark and the encoded authentication watermark are inconsistent, an alarm message is generated. The alarm message is used to indicate that there is an anomaly in the target image.

[0014] To achieve the above objectives, according to another aspect of this application, an image verification apparatus is provided. The apparatus includes: a receiving unit, configured to receive an image transmission request and extract an image to be processed from the image transmission request, wherein the image transmission request refers to a request to send the image to be processed to a client at a target address; an acquiring unit, configured to acquire Y random sequences, scramble the image to be processed according to the Y random sequences to obtain a processed image, and encode the processed image using the Y random sequences to obtain an encoded watermark, wherein the encoded watermark includes a diffusion watermark and an authentication watermark, and Y is a positive integer; and an embedding unit, configured to embed the encoded watermark into the image to be processed to obtain a target image, and send the target image to the client at the target address, wherein, upon receiving the target image at the client at the target address, the target image is verified.

[0015] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored executable program, wherein, when the executable program is executed, it controls the device where the computer-readable storage medium is located to execute the verification method for any of the above images.

[0016] According to another aspect of the present invention, an electronic device is also provided, including one or more processors and a memory, the memory storing an executable program, and the processor for running the program, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the image verification method described above.

[0017] According to another aspect of the present invention, a computer program product is also provided, the computer program product including a computer program, wherein the computer program, when executed by a processor, implements the verification method for any of the above-described images.

[0018] In this embodiment, an image verification method is adopted. This involves receiving an image transmission request, extracting the image to be processed from the request (where the image transmission request is a request to send the image to be processed to a client at a target address), obtaining Y random sequences, scrambling the image to be processed according to these sequences to obtain a processed image, and then encoding the processed image using the Y random sequences to obtain an encoded watermark. The encoded watermark includes a diffusion watermark and an authentication watermark, where Y is a positive integer. The encoded watermark is then embedded into the image to be processed to obtain a target image, which is then sent to the client at the target address. Upon receiving the target image, the client at the target address verifies it. This addresses the technical problems of poor security and low detection accuracy of the image to be processed in related technologies. By scrambling the image to be processed according to random sequences to obtain a processed image, encoding the processed image to obtain an encoded watermark, and embedding the encoded watermark into the image to be processed to obtain the target image, the technical effects of improving image security and increasing detection accuracy are achieved. Attached Figure Description

[0019] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0020] Figure 1 This is a hardware structure block diagram of a computer terminal (or mobile device) used to implement an image verification method;

[0021] Figure 2 This is a flowchart of an image verification method provided according to an embodiment of this application;

[0022] Figure 3 This is a schematic diagram of a diffusion watermark generation method provided according to an embodiment of this application;

[0023] Figure 4This is a schematic diagram of the authentication watermark generation method provided in the embodiments of this application;

[0024] Figure 5 This is a schematic diagram of the method for embedding coded watermarks according to an embodiment of this application;

[0025] Figure 6 This is a schematic diagram of the verification method provided according to an embodiment of this application;

[0026] Figure 7 This is a flowchart of an optional image verification method provided according to an embodiment of this application. Figure 1 ;

[0027] Figure 8 This is a flowchart of an optional image verification method provided according to an embodiment of this application. Figure 2 ;

[0028] Figure 9 This is a schematic diagram of an image verification device provided according to an embodiment of this application;

[0029] Figure 10 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0030] 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 with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0032] It should be noted that all information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this application are information and data authorized by the user or fully authorized by all parties. For example, this system has interfaces with relevant users or organizations to provide users with corresponding operation data for them to choose to agree to or refuse automated decision-making results. Before obtaining relevant information, a request for obtaining the information needs to be sent to the aforementioned user or organization through the interface, and the relevant information is obtained after receiving consent from the aforementioned user or organization; if the user chooses to refuse, the expert decision-making process is initiated. Users can view the purpose of data use in real time through authorization decoding and have the right to withdraw authorization or delete data at any time. After the authorization is withdrawn, the system will terminate the relevant data processing within 24 hours.

[0033] It should be noted that the information collected in this application is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data all comply with the relevant laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation access points for users to choose to authorize use or refuse use.

[0034] Example 1

[0035] According to an embodiment of this application, an embodiment of a method for verifying an image is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0036] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 This is a hardware structure block diagram of a computer terminal (or mobile device) used to implement an image verification method, such as... Figure 1 As shown, computer terminal 10 (or mobile device) may include one or more ( Figure 1The processor 102 (which may include, but is not limited to, a microprocessor MCU (Microcontroller Unit) or a programmable gate array (FPGA)) is shown as 102a, 102b, ..., 102n. It also includes a memory 104 for storing data and a transmission device 106 for communication functions. In addition, it may include: a display, an input / output interface, a Universal Serial Bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a keyboard, a cursor control device, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0037] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0038] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the image verification method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the image verification method described above. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0039] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network interface controller (NIC) and a network interface, which can be connected to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a radio frequency (RF) module, used for wireless communication with the Internet.

[0040] The display can be, for example, a touchscreen liquid crystal display (LCD), which allows the user to interact with the user interface of the computer terminal 10 (or mobile device).

[0041] Under the aforementioned operating environment, this application provides the following: Figure 2 The verification method for the image shown. Figure 2 This is a flowchart of an image verification method provided according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:

[0042] Step S201: Receive an image transmission request and extract the image to be processed from the image transmission request. The image transmission request refers to a request to send the image to be processed to a client at a target address.

[0043] Specifically, an image transmission request refers to a request initiated by a client to transmit a specific image file (such as a scanned copy of an ID card, transaction receipt, etc.) over a network to a financial institution's server or another designated target address. For example, in the process of handling financial transactions, a scanned copy of an ID card needs to be remotely verified. The image to be processed refers to the image file that will be embedded with a watermark and transmitted in the image transmission request; this image contains sensitive or critical information.

[0044] To enhance image security, upon receiving an image transmission request, the image to be processed is extracted from the request, and its basic attributes such as format and size are checked to ensure that it meets the requirements for watermark embedding and transmission. This avoids processing invalid or damaged images in subsequent steps, thereby improving the efficiency and security of the entire authentication process.

[0045] Step S202: Obtain Y random sequences, scramble the image to be processed according to the Y random sequences to obtain the processed image, and encode the processed image using the Y random sequences to obtain the encoded watermark, wherein the encoded watermark includes a diffusion watermark and an authentication watermark, and Y is a positive integer.

[0046] It should be noted that a random sequence refers to a series of random values ​​generated through chaos theory (such as the Logistic chaotic mapping). This can scramble the original image, increasing its randomness and making it difficult to predict and reverse engineer. It can also guide the selection of subsequent encoding rules and the embedding of watermarks, further enhancing the concealment and security of the watermark. Each random sequence can be controlled by specific key parameters (such as the parameters and initial values ​​of the Logistic mapping).

[0047] After obtaining the image to be processed, it can be scrambled using the above-mentioned random sequence. That is, using the random sequence as a seed, the pixel values ​​of the image are rearranged and fine-tuned through chaotic mapping (such as 3DCat mapping) or other scrambling algorithms, which destroys the original structure of the image and introduces more uncertainty, thereby obtaining the processed image. This means that the structure and layout of the image to be processed are changed while retaining its visual features. Even after scrambling, the appearance of the image is still recognizable to the human eye, while enhancing the watermark's sensitivity to image changes.

[0048] Furthermore, different encoding rules are selected using random sequences to generate unique watermark bits for each pixel, that is, the processed image is encoded to obtain an encoded watermark. The encoded watermark refers to watermark information that can be embedded into the original image after being converted by a specific algorithm. It can include diffusion watermarks and authentication watermarks. Diffusion watermarks are mainly used to resist selected carrier attacks, while authentication watermarks are used to verify the overall integrity of the image and locate the tampered area.

[0049] Step S203: Embed the coded watermark into the image to be processed to obtain the target image, and send the target image to the client at the target address. When the client at the target address receives the target image, it verifies the target image.

[0050] Specifically, after obtaining the coded watermark corresponding to the image to be processed, the coded watermark can be embedded into the low bit layer (which can be the lowest two bit layers) of the image to be processed through a specific embedding algorithm, thereby obtaining the target image. This maintains the visual quality of the image and allows the image itself to carry information to verify its integrity and authenticity. Even if the image is modified during transmission, the receiver can determine whether the image has been tampered with and the specific area of ​​tampering by extracting the watermark information and comparing it with the original information.

[0051] Furthermore, after obtaining the target image, it is sent to the client at the target address. Upon receiving the target image, the client at the target address verifies it. This is done through blind detection (i.e., verification can be performed without the original image and watermark information) to determine whether the received image has been tampered with and the precise location of the tampering. This not only improves the security of image information but also enhances the efficiency and transparency of financial institutions' operations.

[0052] The image verification method provided in this application embodiment receives an image transmission request, extracts the image to be processed from the image transmission request (the image transmission request refers to a request to send the image to be processed to a client at a target address), obtains Y random sequences, scrambles the image to be processed according to the Y random sequences to obtain a processed image, and encodes the processed image using the Y random sequences to obtain an encoded watermark, wherein the encoded watermark includes a diffusion watermark and an authentication watermark, and Y is a positive integer; embeds the encoded watermark into the image to be processed to obtain a target image, and sends the target image to the client at the target address. Upon receiving the target image, the client at the target address verifies the target image. This method solves the technical problems of poor security of the image to be processed and low detection accuracy when detecting the image in related technologies. By scrambling the image to be processed according to random sequences to obtain a processed image, encoding the processed image to obtain an encoded watermark, and embedding the encoded watermark into the image to be processed to obtain the target image, the method achieves the technical effects of improving image security and increasing the detection accuracy when detecting the image.

[0053] Optionally, in the image verification method provided in this application embodiment, obtaining Y random sequences includes: obtaining M master keys, wherein each master key includes K pairs of subkeys, each pair of subkeys includes mapping parameters and mapping initial values, and M and K are positive integers; for a master key, extracting mapping parameters and mapping initial values ​​from a pair of subkeys of the master key, inputting the mapping parameters and mapping initial values ​​into a chaotic mapping function, and processing to obtain a random sequence.

[0054] Specifically, when obtaining a random sequence, since a single key is easily cracked or bypassed in traditional image authentication technology, multiple master keys can be obtained. A master key refers to a high-level key structure composed of a set or series of subkeys. Each master key contains multiple pairs of subkeys. For example, when the master keys are Key1, Key2, and Key3, Key1 can contain two pairs of subkeys μ1 and x1, μ2 and x2; Key2 contains one pair of subkeys μ3 and x3; and Key3 contains two pairs of subkeys μ4 and x4, μ5 and x5. Furthermore, each pair of subkeys consists of two key components: "mapping parameters and initial mapping values." For example, the mapping parameters are... The initial value of the mapping is: ( This can generate random numbers. Then, using chaotic mapping functions, such as the Logistic mapping, the above parameters are processed to obtain multiple random sequences, which can be obtained through the following formula: ,in, Indicates the mapping parameters. Indicates the initial value of the mapping. This function represents a random sequence and can generate a series of unpredictable random values ​​based on the input parameters, thus forming the final random sequence.

[0055] This embodiment utilizes the master key to generate a random sequence, which can be used as the basis for image scrambling. This allows different combinations of master keys and preset parameters to produce drastically different watermarks even when faced with the same original image, greatly enhancing the anti-attack capability and the sensitivity to tamper detection, thereby improving the security and efficiency of the entire image authentication process.

[0056] Optionally, in the image verification method provided in this application embodiment, scrambling the image to be processed according to Y random sequences to obtain the processed image includes: obtaining N from the image to be processed. The pixel values ​​corresponding to N pixels are determined, and a first random sequence is obtained by randomly selecting one of Y random sequences; the N values ​​in the first random sequence are then retrieved. Given N sequence values, calculate N for each sequence value and each pixel value in the first random sequence. N initialized pixel values, and based on N The initial diffusion image is constructed from the pixels corresponding to N initialized pixel values, where N is a positive integer; the permutation parameter set is obtained, and a permutation matrix is ​​constructed using the permutation parameter set; a second random sequence is obtained by randomly selecting one random sequence from Y random sequences; and N in the initial diffusion image is obtained. Given N initial diffused pixels, use the permutation matrix to... The N initial diffused pixels are replaced to obtain N N permuted pixels; obtain N The permuted pixel values ​​corresponding to N permuted pixels are calculated by performing the calculation on each sequence value and each permuted pixel value in the second random sequence to obtain N. N scrambled pixel values, based on N The processed image is constructed from the pixels corresponding to the N scrambled pixel values.

[0057] Specifically, after obtaining multiple random sequences, in order to improve the embedding efficiency and security of the watermark while maintaining the visual quality of the image, the pixel value corresponding to each pixel in the image to be processed can first be obtained, and a first random sequence can be extracted from the random sequences to achieve unpredictability in the scrambling and diffusion watermark generation process. Then, the sequence value corresponding to the first random sequence is used to calculate with each pixel value in the original image. At this time, N can be calculated using the following formula. N initialized pixel values:

[0058] ;

[0059] in, and These represent the pixel values ​​before and after initialization, respectively. It is the master key Key1 ( and A random sequence controlled by ) In other words, by transforming the pixel values ​​of the original image into new values ​​after chaotic scrambling, the original structure of the image data is destroyed, increasing the concealment of the watermark embedding and its sensitivity to image modifications. Thus, based on the initialized pixel values, an initial diffusion image can be constructed, laying the foundation for subsequent watermark embedding.

[0060] Furthermore, after obtaining the initial diffusion image, a permutation matrix can be constructed, and this permutation matrix can be used to perform a secondary scrambling of the initial diffusion image, that is, secondary scrambling via 3DCat mapping. The permutation matrix can be constructed from a set of permutation parameters, and this matrix can be represented as: ,in, to This is represented as a set of permutation parameters. Then, another sequence (i.e., a second random sequence) is randomly selected from the random sequence and used to control the permutation operation of pixels in the initial diffused image, further enhancing the randomness of the image and the vulnerability of the watermark. This can be calculated using the following formula:

[0061]

[0062] ;

[0063] in, )and These are the pixel values ​​before and after scrambling, respectively. Finally, the processed image is constructed based on the pixels corresponding to the scrambled pixel values.

[0064] This embodiment utilizes a random sequence to process the image to be processed, achieving image scrambling, diffusion watermark generation, and image structure replacement. The final processed image retains the visual information of the original image, laying the foundation for embedding fragile watermarks that can detect and resist image tampering.

[0065] Optionally, in the image verification method provided in this application embodiment, encoding the processed image using Y random sequences to obtain an encoded watermark includes: randomly selecting P random sequences from the Y random sequences to obtain P third random sequences; constructing a first encoding / decoding rule based on P1 third random sequences; and constructing a second encoding / decoding rule based on P2 third random sequences, where P1 + P2 = P, P is less than Y, and P is a positive integer; extracting a set of preset bit codes from the scrambled pixel values ​​associated with each pixel of the processed image to obtain N... N sets of preset bit codes are encoded according to the first encoding and decoding rule to obtain N N encoded bits, and based on N The diffusion watermark is obtained by combining N encoded bit codes; L preset bit codes are obtained for each pixel of the image to be processed, and one preset bit code is obtained for each pixel of the diffusion watermark; the L preset bit codes for each pixel to be processed and the one preset bit code for each pixel of the diffusion watermark are combined to obtain N N sets of pre-defined diffusion bit codes are provided, where each set includes L pre-defined bit codes for a pixel to be processed and one pre-defined bit code for a pixel to be diffused, where L is a positive integer. Each set of pre-defined diffusion bit codes is encoded according to the second encoding / decoding rule to obtain N... N spread bit codes, and based on N The authentication watermark is obtained by combining N diffused bit codes.

[0066] Specifically, after scrambling the image to be processed and obtaining the processed image, the image can be encoded using random sequences. That is, multiple random sequences are first randomly selected, and then encoding and decoding rules for generating diffusion watermarks and authentication watermarks can be constructed based on these random sequences. In other words, the first encoding and decoding rules and the second encoding and decoding rules are constructed. For example, Table 1 is the encoding and decoding rule table. As shown in Table 1, encoding can be performed based on the following table:

[0067] Table 1

[0068]

[0069] During encoding, Figure 3 This is a schematic diagram of a diffusion watermark generation method provided in an embodiment of this application, as shown below. Figure 3As shown, firstly, a set of preset bit codes needs to be extracted from the pixel values ​​associated with each pixel in the processed image. For example, six preset bit codes (i.e., 6MSBs / pixel) are extracted. Then, according to the constructed first encoding and decoding rule, DNA encoding and decoding are performed on each set of preset bit codes. That is, the six high bits of each pixel value are encoded in pairs to obtain three DNA codes for each pixel value. The three DNA codes of each pixel value are then XORed. That is, for each of the three DNA codes of a pixel value, XORing is performed separately to obtain one bit, which is one encoded bit code for each pixel value. For example, for three DNA codes CTA, DNA codes C and T are first XORed, and the output DNA code G is obtained by looking up Table 1. Then, DNA code G is XORed with another DNA code A, and the final DNA code G is generated by looking up Table 1. Finally, the DNA code of each pixel value is decoded according to the first encoding and decoding rule, and two encoded bit codes are output for each pixel value. The encoded bits are combined to obtain the diffusion watermark. It should be noted that for each pixel value... The three DNA codes generated by DNA encoding are all produced by different first encoding / decoding rules, and the encoding rules in the first encoding / decoding rules can be generated by a third random sequence. , Control, the decoding rules in the first encoding / decoding rule can be determined by a third random sequence. , The XOR rules mentioned above can be used for control, as shown in Table 2:

[0070] Table 2

[0071]

[0072] Furthermore, in order to generate an authentication watermark, Figure 4 This is a schematic diagram of the authentication watermark generation method provided in the embodiments of this application, such as... Figure 4 As shown, the authentication watermark is derived from the original image to be processed. and diffusion watermark The generated, and the second encoding / decoding rule during the authentication watermark generation process can be derived from the master key. The control is constructed using a third random sequence. Specifically, firstly, the preset bit code of each pixel to be processed in the image to be processed and the preset bit code of the pixels for the diffusion watermark can be obtained. Then, the preset bit code of each pixel to be processed and a preset bit code of each diffusion pixel are combined to obtain N. N sets of pre-defined diffusion bit codes. Then, according to the constructed second encoding / decoding rule, DNA encoding / decoding and XOR operations are performed on each set of pre-defined diffusion bit codes to obtain N... N diffused bit codes are used to ultimately combine these diffused bit codes into an authentication watermark. For example, for the original image to be processed... Five high-order bits of each pixel and diffusion watermark Each pixel's bit is used for DNA encoding and decoding operations. It should be noted that the encoding and decoding rules can be controlled by four random sequences, namely... After DNA encoding is complete, each pixel corresponds to two bits. These two bits are then XORed to obtain a single bit. This single bit is then used for DNA decoding to output the result. A number of diffused bits form the authentication watermark. .

[0073] This embodiment utilizes random sequences to generate diffusion watermarks and authentication watermarks, which can effectively resist selected carrier attacks, accurately detect image tampering, and locate tampered areas. This not only improves the robustness of image authentication but also enhances the accuracy and security of tampering detection, providing strong technical support for verifying the authenticity and integrity of images in financial institution business scenarios.

[0074] Optionally, in the image verification method provided in this application embodiment, each group of preset bit codes is encoded according to the first encoding / decoding rule to obtain N. The N encoded bit codes include: for a pixel in the processed image, obtaining H preset bit codes from the scrambled pixel values ​​associated with the pixel, where H preset bit codes constitute a set of preset bit codes, and H is a positive integer; identifying the H preset bit codes according to the first encoding and decoding rule to obtain the initial code; performing XOR processing on each sub-code in the initial code to obtain the base code, where the initial code includes H / 2 sub-codes; decoding the base code using the first encoding and decoding rule to obtain two decoded bit codes; performing XOR processing on the two decoded bit codes to obtain the encoded bit code of the pixel.

[0075] Specifically, when processing the preset bit codes, for each pixel in the processed image, six preset bit codes are obtained from the scrambled pixel values ​​associated with that pixel. Then, according to the constructed first encoding and decoding rule, the preset bit codes are paired to obtain three initial codes. Each sub-code in the initial codes is then XORed to obtain the base code, that is, the numerical sub-code is converted into a code form similar to DNA bases to increase the complexity and randomness of the encoding. For example, for the three sub-codes CTA, first, sub-codes C and T are XORed, and the output code G is obtained by looking up a table. Then, code G is XORed with another sub-code A, and the final generated base code G is obtained by looking up a table.

[0076] After obtaining the base code, the first encoding / decoding rule is used again to decode the base code, resulting in two decoded bit codes, which restore the information extracted from the original pixel value. Finally, these two decoded bit codes are XORed to obtain the final encoded bit code for that pixel, forming part of the diffusion watermark.

[0077] This embodiment generates a diffusion watermark by effectively extracting and encoding information from the processed image. The resulting encoded bit code forms the basis of the diffusion watermark, which can effectively resist selected carrier attacks. Even slight modifications to the image can be detected in time, greatly increasing the complexity and randomness of watermark generation. This improves the overall security of image authentication and the accuracy of tamper detection, providing a strong guarantee for the verification of image authenticity and integrity in financial institution business scenarios.

[0078] Optionally, in the image verification method provided in this application embodiment, embedding the encoded watermark into the image to be processed to obtain the target image includes: extracting the authentication watermark from the encoded watermark, obtaining a preset Latin square matrix, scrambling the authentication watermark using the preset Latin square matrix to obtain the processed authentication watermark; randomly selecting a random sequence from Y random sequences to obtain a fourth random sequence, and obtaining N from the fourth random sequence. There are N sequence values. For the i-th sequence value, if the sequence value indicates the first parameter, the i-th bit code from the processed authentication watermark is embedded into the first bit layer of the image to be processed, and the i-th bit code from the diffusion watermark in the encoded watermark is embedded into the second bit layer of the image to be processed. The first bit layer is lower than the second bit layer, and i is less than or equal to N. N, where i is a positive integer; when the sequence value indicator is the second parameter, the i-th bit code in the processed authentication watermark is embedded into the second bit layer, and the i-th bit code in the diffusion watermark in the encoded watermark is embedded into the first bit layer; the first bit layer and the second bit layer in the image to be processed are replaced by the first bit layer and the second bit layer after embedding, respectively, to obtain the target image.

[0079] Specifically, after obtaining the diffusion watermark and the coded watermark, they can be embedded into the image to be processed. Figure 5 This is a schematic diagram of the coded watermark embedding method provided in the embodiments of this application, as shown below. Figure 5 As shown, firstly, in order to further increase the randomness and complexity of the watermark, it is necessary to obtain... A preset Latin square matrix is ​​used to scramble the authentication watermark, resulting in a processed authentication watermark. Scrambling the bit sequence of the authentication watermark using the Latin square matrix breaks any potential regularity in the watermark, adding an extra layer of protection for watermark embedding and subsequent verification processes.

[0080] Furthermore, the scrambled authentication watermark and diffusion watermark The watermark is embedded into the two lowest bit layers of the image to be processed. During the embedding process, a fourth random sequence is first extracted from the random sequence to introduce additional randomness, which is used to control the specific method of watermark embedding. The fourth random sequence can determine which layer of the image the authentication watermark and diffusion watermark are embedded into, and whether bit code exchange is required between the two lowest bit layers.

[0081] During embedding, N can be obtained from the fourth random sequence. Given N sequence values, for each sequence value (labeled as the i-th sequence value), watermark embedding is performed according to the parameter indicated by that sequence value: if the sequence value indicates the first parameter (e.g., Then, the i-th bit code from the processed authentication watermark is embedded into the first bit layer of the image to be processed, while the i-th bit code from the diffusion watermark in the encoded watermark is embedded into the second bit layer. The first bit layer is a lower bit layer than the second bit layer, i.e., the authentication watermark. and diffusion watermark The corresponding bits are then embedded into the first and second low-order bit layers of the image to be processed, respectively. Conversely, if the sequence value indicates the second parameter (e.g., If the i-th bit code in the processed authentication watermark is embedded into the second bit layer, and the i-th bit code in the diffusion watermark is embedded into the first bit layer, the concealment and resistance to attacks of the watermark are further enhanced.

[0082] Finally, the first and second bit layers embedded with bitcode are used to replace the corresponding bit layers in the image to be processed, thus completing the watermark embedding process. After the replacement, the resulting image is the target image, which not only retains the original visual quality but also implicitly contains double fragile watermark information that can be used for integrity verification and tamper detection.

[0083] This embodiment scrambles the authentication watermark using a Latin square matrix, increasing its randomness and making it difficult for attackers to predict the watermark's embedding location. Then, a fourth random sequence is used to control the specific bit layer of the watermark embedding, achieving dynamic watermark embedding. The resulting target image not only resists carrier-selective attacks but also accurately detects whether the image has been tampered with, thus providing strong technical support for image authentication and risk control in financial institutions.

[0084] Optionally, in the image verification method provided in this application embodiment, the target image is verified in the following manner: a random sequence is randomly selected from Y random sequences to obtain a fifth random sequence; the target authentication watermark is extracted from the target image using the fifth random sequence; the target authentication watermark is subjected to an inverse Latin matrix transformation to obtain a restored target authentication watermark; the target image is scrambled to obtain a processed target image; the processed target image is encoded to obtain an encoded authentication watermark; the restored target authentication watermark and the encoded authentication watermark are compared; if the restored target authentication watermark and the encoded authentication watermark are inconsistent, an alarm message is generated, wherein the alarm message is used to indicate that there is an anomaly in the target image.

[0085] Specifically, the target image, after being embedded with dual watermarks, is transmitted from the sender to the receiver via a channel. Since the security of the transmission channel is uncertain, the receiver, upon receiving the target image, needs to verify its integrity, i.e., whether the image has been maliciously tampered with by an attacker. Therefore, when verifying the target image, a fifth random sequence is first extracted, and then the target authentication watermark, i.e., the fifth random sequence controlled by a key, is extracted from the target image using this fifth random sequence. Extracting the target authentication watermark after Latin square array scrambling and diffusion watermark To perform further comparative testing, the authentication watermark before scrambling was restored using an inverse Latin matrix transformation. That is, the target authentication watermark is obtained after restoration.

[0086] Furthermore, the target image is scrambled, a process similar to the scrambling operation during diffusion watermark generation. This disrupts the original image structure, providing a chaotic background for watermark detection, resulting in the processed target image. Then, the processed target image undergoes DNA encoding and decoding, following the same second encoding / decoding rules as during authentication watermark generation, yielding the encoded authentication watermark. This process calculates the authentication watermark for the processed target image. This allows for the regeneration of an authentication watermark with similar embedding conditions without the original image, facilitating comparative detection.

[0087] Finally, the restored target authentication watermark and the encoded authentication watermark are compared. If they are different, or if the two authentication watermarks are equal, then this watermark image is invalid. The image is complete, meaning it has not been maliciously tampered with. If the two are not equal, the watermarked image is incomplete, meaning it has been maliciously tampered with during transmission. In this case, an alarm message can be generated to indicate that the target image is abnormal.

[0088] It should be noted that, Figure 6This is a schematic diagram of the verification method provided according to the embodiments of this application, such as... Figure 6 As shown, the pixel values ​​corresponding to unequal watermark bits are the tampered pixel values, thus locating the tampered area. There is a certain error in the tamper detection location process. To obtain a more accurate tampered location area, the values ​​of adjacent pixels of each pixel can be checked. If the pixel... It is believed to be unaltered, but the four pixels surrounding it... If it is determined to be tampered with, then the pixel... Then the pixel is determined to have been tampered with. Similarly, if the pixel... It was thought to have been tampered with, but the four pixels around it... If it is determined that the pixel has not been tampered with, then the pixel... Then it is determined to be a pixel that has not been tampered with.

[0089] This embodiment utilizes a fifth random sequence to extract and restore the target authentication watermark. Combined with scrambling and encoding of the target image, it effectively resists selected carrier attacks. Finally, by comparing the restored target authentication watermark with the encoded authentication watermark, it can promptly detect and locate tampered areas in the image, generating alarm information. This provides strong technical support for verifying the authenticity and integrity of images in financial institution business scenarios.

[0090] This embodiment also provides an image verification method. Figure 7 This is a flowchart of an optional image verification method provided according to an embodiment of this application. Figure 1 , Figure 8 This is a flowchart of an optional image verification method provided according to an embodiment of this application. Figure 2 ,like Figure 7 , Figure 8 As shown, the method includes:

[0091] To improve image security, after receiving an image transmission request, the image to be processed is extracted from the image transmission request. Then, a random sequence generated by the master key is used to scramble the image to obtain the processed image. The processed image is then encoded using the random sequence generated by the master key to obtain the diffusion watermark in the encoded watermark. Based on the diffusion watermark and the image to be processed, an authentication watermark in the encoded watermark is generated.

[0092] After obtaining the two types of coded watermarks—diffusion watermark and authentication watermark (i.e., double fragile watermarks)—they can be embedded into the image to be processed to obtain the target image. .

[0093] After obtaining the target image, the image, after being embedded with dual watermarks, is transmitted from the sender to the receiver via a channel. Since the security of the transmission channel is uncertain, the receiver needs to verify the integrity of the target image upon receiving it, i.e., whether the image has been maliciously tampered with by an attacker. This requires extracting the dual fragile watermarks. First, a random sequence is generated based on the master key Key3. Then, this random sequence and an inverse Latin square matrix are used to extract the target authentication watermark before scrambling (i.e., the restored target authentication watermark) from the image. and diffusion watermark .

[0094] Furthermore, the authentication watermark of the target image is calculated. The authentication watermark And the restored target authentication watermark The two authentication watermarks are compared. If they are equal, the target image is complete, meaning it has not been maliciously tampered with. If they are not equal, the target image is incomplete, meaning it has been maliciously tampered with during transmission.

[0095] This embodiment scrambles the image to be processed according to a random sequence to obtain a processed image, encodes the processed image to obtain an encoded watermark, and embeds the encoded watermark into the image to be processed to obtain the target image. This achieves the technical effect of improving image security and increasing the detection accuracy when detecting images.

[0096] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0097] Example 2

[0098] This application also provides an image verification device. It should be noted that the image verification device of this application can be used to execute the image verification method provided in this application. The image verification device provided in this application is described below.

[0099] According to an embodiment of this application, an apparatus for implementing the above-described image verification method is also provided. Figure 9 This is a schematic diagram of an image verification device provided according to an embodiment of this application, such as... Figure 9 As shown, the device includes: a receiving unit 90, an acquiring unit 91, and an embedding unit 92.

[0100] The receiving unit 90 is used to receive an image transmission request and extract the image to be processed from the image transmission request. The image transmission request is a request to send the image to be processed to a client at a target address.

[0101] The acquisition unit 91 is used to acquire Y random sequences, scramble the image to be processed according to the Y random sequences to obtain the processed image, and encode the processed image using the Y random sequences to obtain an encoded watermark, wherein the encoded watermark includes a diffusion watermark and an authentication watermark, and Y is a positive integer;

[0102] The embedding unit 92 is used to embed the coded watermark into the image to be processed to obtain the target image, and send the target image to the client at the target address. When the client at the target address receives the target image, it verifies the target image.

[0103] The image verification device provided in this application embodiment receives an image transmission request through a receiving unit 90, extracts the image to be processed from the image transmission request, wherein the image transmission request refers to a request to send the image to be processed to a client at a target address; an acquisition unit 91 acquires Y random sequences, scrambles the image to be processed according to the Y random sequences to obtain a processed image, and encodes the processed image using the Y random sequences to obtain an encoded watermark, wherein the encoded watermark includes a diffusion watermark and an authentication watermark, and Y is a positive integer; an embedding unit 92 embeds the encoded watermark into the image to be processed to obtain a target image, and sends the target image to the client at the target address. Upon receiving the target image at the client at the target address, the target image is verified. This solves the technical problems of poor security of the image to be processed and low detection accuracy when detecting the image in related technologies. By scrambling the image to be processed according to random sequences to obtain a processed image, encoding the processed image to obtain an encoded watermark, and embedding the encoded watermark into the image to be processed to obtain the target image, the technical effects of improving image security and improving detection accuracy when detecting the image are achieved.

[0104] Optionally, in the image verification device provided in this application embodiment, the acquisition unit 91 includes: a first acquisition module, used to acquire M master keys, wherein each master key includes K pairs of subkeys, each pair of subkeys includes mapping parameters and mapping initial values, and M and K are positive integers; and a first extraction module, used to extract mapping parameters and mapping initial values ​​from a pair of subkeys of a master key for a master key, input the mapping parameters and mapping initial values ​​into a chaotic mapping function, and process them to obtain a random sequence.

[0105] Optionally, in the image verification apparatus provided in this application embodiment, the acquisition unit 91 includes: a second acquisition module, used to acquire N in the image to be processed. The first random sequence is obtained by randomly selecting one random sequence from a set of Y random sequences, corresponding to the pixel values ​​of N pixels. The third acquisition module is used to acquire the N values ​​from the first random sequence. Given N sequence values, calculate N for each sequence value and each pixel value in the first random sequence. N initialized pixel values, and based on N The initial diffusion image is constructed from the pixels corresponding to N initialized pixel values, where N is a positive integer; the fourth acquisition module is used to acquire the permutation parameter set, construct the permutation matrix using the permutation parameter set, and randomly select a random sequence from Y random sequences to obtain the second random sequence; the fifth acquisition module is used to acquire N in the initial diffusion image. Given N initial diffused pixels, use the permutation matrix to... The N initial diffused pixels are replaced to obtain N N permuted pixels; the sixth acquisition module is used to acquire N The permuted pixel values ​​corresponding to N permuted pixels are calculated by performing the calculation on each sequence value and each permuted pixel value in the second random sequence to obtain N. N scrambled pixel values, based on N The processed image is constructed from the pixels corresponding to the N scrambled pixel values.

[0106] Optionally, in the image verification device provided in this application embodiment, the acquisition unit 91 includes: a first extraction module, configured to randomly extract P random sequences from Y random sequences to obtain P third random sequences, construct a first encoding / decoding rule based on P1 third random sequences, and construct a second encoding / decoding rule based on P2 third random sequences, wherein P1 + P2 = P, P is less than Y, and P is a positive integer; and a second extraction module, configured to extract a set of preset bit codes from the scrambled pixel values ​​associated with each pixel of the processed image to obtain N N sets of preset bit codes are encoded according to the first encoding and decoding rule to obtain N N encoded bits, and based on N The N encoded bit codes are combined to obtain the diffusion watermark; the seventh acquisition module is used to acquire L preset bit codes for each pixel to be processed in the image to be processed, and to acquire one preset bit code for each diffusion pixel of the diffusion watermark. The L preset bit codes for each pixel to be processed and the one preset bit code for each diffusion pixel are combined to obtain N N sets of diffusion preset bit codes, wherein each set of diffusion preset bit codes includes L preset bit codes of a pixel to be processed and one preset bit code of a diffusion pixel, where L is a positive integer; the first encoding module is used to encode each set of diffusion preset bit codes according to the second encoding and decoding rules to obtain N N spread bit codes, and based on N The authentication watermark is obtained by combining N diffused bit codes.

[0107] Optionally, in the image verification device provided in this application embodiment, the acquisition unit 91 includes: an eighth acquisition module, used to acquire H preset bit codes from the scrambled pixel values ​​associated with a pixel in the processed image, wherein the H preset bit codes constitute a set of preset bit codes, and H is a positive integer; an identification module, used to identify the H preset bit codes according to the first encoding and decoding rules to obtain an initial code, and to perform XOR processing on each sub-code in the initial code to obtain a base code, wherein the initial code includes H / 2 sub-codes; and a second encoding module, used to decode the base code using the first encoding and decoding rules to obtain two decoded bit codes, and to perform XOR processing on the two decoded bit codes to obtain the encoded bit code of the pixel.

[0108] Optionally, in the image verification device provided in this application embodiment, the embedding unit 92 includes: a third extraction module, used to extract the authentication watermark from the encoded watermark, obtain a preset Latin square matrix, and scramble the authentication watermark using the preset Latin square matrix to obtain the processed authentication watermark; and a second extraction module, used to randomly extract a random sequence from Y random sequences to obtain a fourth random sequence, and obtain N from the fourth random sequence. N sequence values; a first embedding module, configured to, for the i-th sequence value, embed the i-th bit code from the processed authentication watermark into the first bit layer of the image to be processed, and embed the i-th bit code from the diffusion watermark in the encoded watermark into the second bit layer of the image to be processed, when the sequence value is indicated by the first parameter, wherein the first bit layer is lower than the second bit layer, and i is less than or equal to N. N, where i is a positive integer; the second embedding module is used to embed the i-th bit code in the processed authentication watermark into the second bit layer when the sequence value indicates the second parameter, and to embed the i-th bit code in the diffusion watermark in the encoded watermark into the first bit layer; the replacement module is used to replace the first bit layer and the second bit layer in the image to be processed with the embedded first bit layer and the embedded second bit layer respectively to obtain the target image.

[0109] Optionally, in the image verification device provided in this application embodiment, the embedding unit 92 includes: a third extraction module, used to randomly extract a random sequence from Y random sequences to obtain a fifth random sequence, extract a target authentication watermark from the target image using the fifth random sequence, perform an inverse Latin matrix transformation on the target authentication watermark to obtain a restored target authentication watermark; a processing module, used to scramble the target image to obtain a processed target image, and encode the processed target image to obtain an encoded authentication watermark; and a comparison module, used to compare the restored target authentication watermark and the encoded authentication watermark, and generate alarm information if the restored target authentication watermark and the encoded authentication watermark are inconsistent, wherein the alarm information is used to indicate that there is an anomaly in the target image.

[0110] It should be noted that the receiving unit 90, acquiring unit 91, and embedding unit 92 mentioned above correspond to steps S201 to S203 in Embodiment 1. The instances and application scenarios implemented by the above units and corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above units can also be part of a device and run in the computer terminal 10 provided in Embodiment 1.

[0111] Example 3

[0112] Embodiments of this application may provide a computer terminal, which may be any computer terminal device in a group of computer terminals. Optionally, in this embodiment, the aforementioned computer terminal may also be replaced with a mobile terminal or an electronic device, etc.

[0113] Optionally, in this embodiment, the computer terminal may be located in at least one of a plurality of network devices in a computer network.

[0114] In this embodiment, the computer terminal described above can execute the following steps of the image verification method: receiving an image transmission request, extracting the image to be processed from the image transmission request, wherein the image transmission request refers to a request to send the image to be processed to a client at a target address; obtaining Y random sequences, scrambling the image to be processed according to the Y random sequences to obtain a processed image, and encoding the processed image using the Y random sequences to obtain an encoded watermark, wherein the encoded watermark includes a diffusion watermark and an authentication watermark, and Y is a positive integer; embedding the encoded watermark into the image to be processed to obtain a target image, and sending the target image to a client at the target address, wherein, when the client at the target address receives the target image, the target image is verified.

[0115] Optionally, the computer terminal described above can execute the following steps in the image verification method: obtain M master keys, wherein each master key includes K pairs of subkeys, each pair of subkeys includes mapping parameters and mapping initial values, and M and K are positive integers; for a master key, extract the mapping parameters and mapping initial values ​​from a pair of subkeys of the master key, input the mapping parameters and mapping initial values ​​into a chaotic mapping function, and process to obtain a random sequence.

[0116] Optionally, the computer terminal described above can execute the program code for the following steps in the image verification method: obtaining N in the image to be processed. The pixel values ​​corresponding to N pixels are determined, and a first random sequence is obtained by randomly selecting one of Y random sequences; the N values ​​in the first random sequence are then retrieved. Given N sequence values, calculate N for each sequence value and each pixel value in the first random sequence. N initialized pixel values, and based on N The initial diffusion image is constructed from the pixels corresponding to N initialized pixel values, where N is a positive integer; the permutation parameter set is obtained, and a permutation matrix is ​​constructed using the permutation parameter set; a second random sequence is obtained by randomly selecting one random sequence from Y random sequences; and N in the initial diffusion image is obtained. Given N initial diffused pixels, use the permutation matrix to... The N initial diffused pixels are replaced to obtain N N permuted pixels; obtain N The permuted pixel values ​​corresponding to N permuted pixels are calculated by performing the calculation on each sequence value and each permuted pixel value in the second random sequence to obtain N. N scrambled pixel values, based on N The processed image is constructed from the pixels corresponding to the N scrambled pixel values.

[0117] Optionally, the aforementioned computer terminal can execute the following steps in the image verification method: randomly select P random sequences from Y random sequences to obtain P third random sequences; construct a first encoding / decoding rule based on P1 third random sequences; construct a second encoding / decoding rule based on P2 third random sequences, where P1 + P2 = P, P is less than Y, and P is a positive integer; extract a set of preset bit codes from the scrambled pixel values ​​associated with each pixel of the processed image to obtain N... N sets of preset bit codes are encoded according to the first encoding and decoding rule to obtain N N encoded bits, and based on N The diffusion watermark is obtained by combining N encoded bit codes; L preset bit codes are obtained for each pixel of the image to be processed, and one preset bit code is obtained for each pixel of the diffusion watermark; the L preset bit codes for each pixel to be processed and the one preset bit code for each pixel of the diffusion watermark are combined to obtain N N sets of pre-defined diffusion bit codes are provided, where each set includes L pre-defined bit codes for a pixel to be processed and one pre-defined bit code for a pixel to be diffused, where L is a positive integer. Each set of pre-defined diffusion bit codes is encoded according to the second encoding / decoding rule to obtain N... N spread bit codes, and based on N The authentication watermark is obtained by combining N diffused bit codes.

[0118] Optionally, the computer terminal described above can execute the following steps in the image verification method: For a pixel in the processed image, obtain H preset bit codes from the scrambled pixel values ​​associated with the pixel, wherein the H preset bit codes constitute a set of preset bit codes, and H is a positive integer; identify the H preset bit codes according to the first encoding and decoding rule to obtain an initial code; perform XOR processing on each sub-code in the initial code to obtain a base code, wherein the initial code includes H / 2 sub-codes; decode the base code using the first encoding and decoding rule to obtain two decoded bit codes; perform XOR processing on the two decoded bit codes to obtain the encoded bit code of the pixel.

[0119] Optionally, the computer terminal described above can execute the program code for the following steps in the image verification method: extracting the authentication watermark from the encoded watermark, obtaining a preset Latin square matrix, scrambling the authentication watermark using the preset Latin square matrix to obtain the processed authentication watermark; randomly selecting a random sequence from Y random sequences to obtain a fourth random sequence, and obtaining N from the fourth random sequence. There are N sequence values. For the i-th sequence value, if the sequence value indicates the first parameter, the i-th bit code from the processed authentication watermark is embedded into the first bit layer of the image to be processed, and the i-th bit code from the diffusion watermark in the encoded watermark is embedded into the second bit layer of the image to be processed. The first bit layer is lower than the second bit layer, and i is less than or equal to N. N, where i is a positive integer; when the sequence value indicator is the second parameter, the i-th bit code in the processed authentication watermark is embedded into the second bit layer, and the i-th bit code in the diffusion watermark in the encoded watermark is embedded into the first bit layer; the first bit layer and the second bit layer in the image to be processed are replaced by the first bit layer and the second bit layer after embedding, respectively, to obtain the target image.

[0120] Optionally, the computer terminal described above can execute the following steps in the image verification method: randomly select a random sequence from Y random sequences to obtain a fifth random sequence; extract the target authentication watermark from the target image using the fifth random sequence; perform an inverse Latin matrix transformation on the target authentication watermark to obtain the restored target authentication watermark; scramble the target image to obtain a processed target image; encode the processed target image to obtain an encoded authentication watermark; compare the restored target authentication watermark with the encoded authentication watermark; if the restored target authentication watermark and the encoded authentication watermark are inconsistent, generate an alarm message, wherein the alarm message is used to indicate that there is an anomaly in the target image.

[0121] Optionally, Figure 10 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 10 As shown, the electronic device may include: one or more ( Figure 10 (Only one is shown) processor 1002, memory 1004, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.

[0122] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the image verification method and apparatus in this embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby realizing the aforementioned image verification method. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0123] The processor can access the information and application programs stored in the memory via the transmission device to execute the steps described above in the image verification method.

[0124] Those skilled in the art will understand that Figure 10 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 10 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 10 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 10 The different configurations shown.

[0125] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0126] Example 4

[0127] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the image verification method provided in Embodiment 1.

[0128] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.

[0129] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: receiving an image transmission request, extracting the image to be processed from the image transmission request, wherein the image transmission request refers to a request to send the image to be processed to a client at a target address; obtaining Y random sequences, scrambling the image to be processed according to the Y random sequences to obtain a processed image, and encoding the processed image using the Y random sequences to obtain an encoded watermark, wherein the encoded watermark includes a diffusion watermark and an authentication watermark, and Y is a positive integer; embedding the encoded watermark into the image to be processed to obtain a target image, and sending the target image to a client at the target address, wherein, when the client at the target address receives the target image, the target image is verified.

[0130] This application also provides a computer program product, which, when executed on a data processing device, is adapted to perform image verification method steps.

[0131] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0132] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0133] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of units or modules may be electrical or other forms.

[0134] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0135] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0136] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0137] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. An image verification method, characterized in that, include: Receive an image transmission request, and extract the image to be processed from the image transmission request, wherein the image transmission request refers to a request to send the image to be processed to a client at a target address; Y random sequences are obtained, and the image to be processed is scrambled according to the Y random sequences to obtain a processed image. The processed image is then encoded using the Y random sequences to obtain an encoded watermark, wherein the encoded watermark includes a diffusion watermark and an authentication watermark, and Y is a positive integer. The encoded watermark is embedded in the image to be processed to obtain the target image, and the target image is sent to the client at the target address. When the client at the target address receives the target image, the target image is verified.

2. The method according to claim 1, characterized in that, Obtaining Y random sequences includes: Obtain M master keys, where each master key includes K pairs of subkeys, and each pair of subkeys includes mapping parameters and initial mapping values, where M and K are positive integers; For a master key, the mapping parameters and initial mapping values ​​are extracted from a pair of subkeys of the master key. The mapping parameters and initial mapping values ​​are then input into a chaotic mapping function to process and obtain a random sequence.

3. The method according to claim 1, characterized in that, The image to be processed is scrambled according to the Y random sequences to obtain the processed image, including: Obtain N from the image to be processed The pixel values ​​corresponding to N pixels are obtained, and a random sequence is randomly selected from the Y random sequences to obtain the first random sequence; Obtain N from the first random sequence Given N sequence values, calculate N for each sequence value and each pixel value in the first random sequence. N initialized pixel values, and based on the N The initial diffusion image is constructed from the pixels corresponding to the N initialized pixel values, where N is a positive integer; Obtain a set of permutation parameters, construct a permutation matrix using the set of permutation parameters, and randomly select a second random sequence from the Y random sequences. Obtain N from the initial diffusion image N initial diffusion pixels, using the permutation matrix to process the N... The N initial diffused pixels are replaced to obtain N N replaced pixels; Obtain the N The permuted pixel values ​​corresponding to the N permuted pixels are calculated by performing a calculation on each sequence value and each permuted pixel value in the second random sequence to obtain N. N scrambled pixel values, based on the N The processed image is constructed from the pixels corresponding to the N scrambled pixel values.

4. The method according to claim 1, characterized in that, The processed image is encoded using the Y random sequences to obtain an encoded watermark, including: P random sequences are randomly selected from the Y random sequences to obtain P third random sequences. A first encoding and decoding rule is constructed based on P1 third random sequences, and a second encoding and decoding rule is constructed based on P2 third random sequences, where P1 + P2 = P, P is less than Y, and P is a positive integer. Extract a set of preset bit codes from the scrambled pixel values ​​associated with each pixel in the processed image to obtain N. N sets of preset bit codes are encoded according to the first encoding / decoding rule to obtain N N encoded bits, and based on the N The diffusion watermark is obtained by combining N encoded bit codes; Obtain L preset bit codes for each pixel in the image to be processed, and obtain one preset bit code for each pixel in the diffusion watermark. Combine the L preset bit codes for each pixel to be processed and the one preset bit code for each pixel in the diffusion watermark to obtain N. N sets of diffusion preset bit codes, wherein each set of diffusion preset bit codes includes L preset bit codes of a pixel to be processed and a preset bit code of a diffusion pixel, where L is a positive integer; Each group of pre-spreading bit codes is encoded according to the second encoding / decoding rule to obtain N. N spread bit codes, and based on the N The authentication watermark is obtained by combining N diffused bit codes.

5. The method according to claim 4, characterized in that, Each set of preset bit codes is encoded according to the first encoding / decoding rule to obtain N. The N encoded bits include: For a pixel in the processed image, H preset bit codes are obtained from the scrambled pixel values ​​associated with the pixel, wherein the H preset bit codes constitute the set of preset bit codes, and H is a positive integer; The H preset bit codes are identified according to the first encoding and decoding rule to obtain an initial code. Each sub-code in the initial code is XORed to obtain a base code. The initial code includes H / 2 sub-codes. The base code is decoded using the first encoding / decoding rule to obtain two decoded bit codes. The two decoded bit codes are then XORed to obtain the encoded bit code of the pixel.

6. The method according to claim 1, characterized in that, Embedding the encoded watermark into the image to be processed to obtain the target image includes: Extract the authentication watermark from the encoded watermark, obtain a preset Latin matrix, and scramble the authentication watermark using the preset Latin matrix to obtain the processed authentication watermark. A fourth random sequence is obtained by randomly selecting one random sequence from the Y random sequences, and N in the fourth random sequence is obtained. N sequence values; For the i-th sequence value, when the sequence value indicates the first parameter, the i-th bit code in the processed authentication watermark is embedded into the first bit layer of the image to be processed, and the i-th bit code in the diffusion watermark of the encoded watermark is embedded into the second bit layer of the image to be processed, wherein the first bit layer is lower than the second bit layer, and i is less than or equal to N. N, where i is a positive integer; When the sequence value indicates the second parameter, the i-th bit code in the processed authentication watermark is embedded in the second bit layer, and the i-th bit code in the diffusion watermark in the encoded watermark is embedded in the first bit layer. The first bit layer and the second bit layer in the image to be processed are replaced by the first bit layer and the second bit layer after embedding, respectively, to obtain the target image.

7. The method according to claim 1, characterized in that, The target image is verified using the following methods: Randomly select one random sequence from the Y random sequences to obtain the fifth random sequence. Use the fifth random sequence to extract the target authentication watermark from the target image. Perform an inverse Latin matrix transformation on the target authentication watermark to obtain the restored target authentication watermark. The target image is scrambled to obtain a processed target image, and the processed target image is encoded to obtain an encoded authentication watermark. The restored target authentication watermark is compared with the encoded authentication watermark. If the restored target authentication watermark and the encoded authentication watermark are inconsistent, an alarm message is generated, wherein the alarm message is used to indicate that there is an anomaly in the target image.

8. An image verification device, characterized in that, include: A receiving unit is configured to receive an image transmission request and extract an image to be processed from the image transmission request, wherein the image transmission request refers to a request to send the image to be processed to a client at a target address; The acquisition unit is used to acquire Y random sequences, scramble the image to be processed according to the Y random sequences to obtain a processed image, and encode the processed image using the Y random sequences to obtain an encoded watermark, wherein the encoded watermark includes a diffusion watermark and an authentication watermark, and Y is a positive integer; An embedding unit is used to embed the encoded watermark into the image to be processed to obtain a target image, and to send the target image to a client at the target address, wherein, when the client at the target address receives the target image, it verifies the target image.

9. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, performs the image verification method according to any one of claims 1 to 7.

10. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the image verification method according to any one of claims 1 to 7.