Image encryption and decryption method, device, electronic device and storage medium
By obtaining labeled images and parameters from the image library, encrypting the text area of the image, and using convolution and pooling operations, the problems of low image encryption efficiency and insufficient key security are solved, and secure and efficient image transmission is achieved.
Patent Information
- Application Number
- CN202211336563.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-28
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2042-10-28
AI Technical Summary
The image encryption efficiency in the existing technology is low and the key security is low, which easily leads to the encryption content in the image being cracked.
By obtaining labeled images and parameters from a preset image library, the area containing text information in the image is encrypted to generate a target encrypted image, and unique convolution and pooling operations are used to ensure encryption security.
It improves the efficiency of image encryption, ensures the high security of text information, prevents the key from being cracked, and realizes safe and efficient image transmission.
Smart Images

Figure CN115941854B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of Internet technology, and in particular relates to an image encryption and decryption method, device, electronic device and storage medium. Background Art
[0002] With the development of information technology, in order to ensure data security, images containing sensitive data usually need to be encrypted before transmission.
[0003] Currently, images contain a large number of pixels, resulting in a large amount of data to be encrypted, low encryption efficiency, and low key security, making it easy for the encrypted content in the image to be cracked. Summary of the Invention
[0004] The embodiments of the present application provide an image encryption method, apparatus, device, and storage medium, which can effectively improve the security of image transmission.
[0005] In a first aspect, an embodiment of the present application provides an image encryption method, applied to a first electronic device, the method comprising:
[0006] In the case where the image to be sent includes text information, obtaining a first image from a preset image library;
[0007] Determine a first marked image and a first parameter according to the first image;
[0008] Encrypting a first region image in the image to be sent according to the first mark image and the first parameter to obtain a first encrypted image, where the first region image includes text information;
[0009] generating a target encrypted image based on the first encrypted image and the first marked image;
[0010] The target encrypted image is sent to the second electronic device.
[0011] In a second aspect, an embodiment of the present application provides an image decryption method, applied to a second electronic device, the method comprising:
[0012] receiving a target encrypted image sent by a first electronic device, where the target encrypted image includes a first encrypted image;
[0013] When it is detected that the target encrypted image includes the first marked image, searching for a first image matching the first marked image from a preset image library;
[0014] Determining a first parameter corresponding to the first image according to a preset corresponding relationship;
[0015] Decrypting the first encrypted image according to the first parameter and the first marked image to obtain a first decrypted image;
[0016] A target decrypted image is generated based on the first decrypted image and the first marked image.
[0017] In a third aspect, an embodiment of the present application provides an image encryption device, applied to a first electronic device, the image encryption device comprising:
[0018] an acquisition module, configured to acquire a first image from a preset image library when the image to be sent includes text information;
[0019] A first determining module, configured to determine a first marked image and a first parameter based on the first image;
[0020] an encryption module, configured to encrypt a first region image in the image to be transmitted according to the first mark image and the first parameter to obtain a first encrypted image, wherein the first region image includes text information;
[0021] A first generating module, configured to generate a target encrypted image according to the first encrypted image and the first marked image;
[0022] The sending module is used to send the target encrypted image to the second electronic device.
[0023] In a fourth aspect, an embodiment of the present application provides an image decryption device, applied to a second electronic device, the image decryption device comprising:
[0024] A receiving module, configured to receive a target encrypted image sent by a first electronic device, where the target encrypted image includes a first encrypted image;
[0025] a search module configured to search a preset image library for a first image matching the first marked image when detecting that the target encrypted image includes the first marked image;
[0026] A second determining module, configured to determine a first parameter corresponding to the first image according to a preset corresponding relationship;
[0027] a decryption module, configured to decrypt the first encrypted image according to the first parameter and the first marked image to obtain a first decrypted image;
[0028] The second generating module is used to generate a target decrypted image according to the first decrypted image and the first marked image.
[0029] In a fifth aspect, an embodiment of the present application provides an electronic device comprising: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, it implements the method in the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect.
[0030] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method of the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect is implemented.
[0031] In an embodiment of the present application, when the image to be sent includes text information, a first image is obtained from a preset image library; based on the first image, a first marked image and a first parameter are determined; based on the first marked image and the first parameter, a first area image in the image to be sent is encrypted to obtain a first encrypted image, and the first area image includes text information. Here, compared with encrypting each pixel in the image to be sent, only the first area image where the text information is located is encrypted, which can improve the encryption efficiency, and the first marked image and the first parameter used to encrypt the first area image are difficult to crack, and the text information can be highly securely encrypted to ensure the security of the text information. Finally, based on the first encrypted image and the first marked image, a target encrypted image is generated, and the target encrypted image is sent to the second electronic device, so that the target encrypted image containing text information can be sent to the second electronic device safely and efficiently. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0033] Figure 1 This is a flowchart of an image encryption method provided by an embodiment of the present application;
[0034] Figure 2 is a schematic diagram of an image encryption method provided in an embodiment of the present application;
[0035] Figure 3 This is a flowchart of an image decryption method provided by an embodiment of the present application;
[0036] Figure 4 This is a schematic structural diagram of an image encryption device provided in an embodiment of the present application;
[0037] Figure 5 This is a schematic structural diagram of an image decryption device provided in an embodiment of the present application;
[0038] Figure 6 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only configured to explain the present application and are not configured to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present application by illustrating the examples of the present application.
[0040] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0041] The following is a brief introduction to the technical terms involved in this application.
[0042] Convolution, the essence of convolution is to use the parameters of the convolution kernel to extract the features of the original data. Through the matrix dot multiplication operation, the value consistent with the convolution kernel feature is extracted. If the convolution layer has multiple convolution kernels, the neural network will automatically learn the parameter values of the convolution kernel so that each convolution kernel represents a feature.
[0043] Pooling. The main purpose of pooling is dimensionality reduction to reduce computational effort and provide some translation invariance during the initial stages of training. Two common pooling operations are average pooling and maximum pooling. Pooling involves sliding a fixed-size window over the input, aggregating each element within the window into a single value as the output.
[0044] Flattening: Flattens the data into a structure suitable for neural networks and is used in the input layer or between the convolutional layer and the fully connected layer. It is usually used between the input layer, convolutional layer, pooling layer, and fully connected layer.
[0045] The image encryption method provided in the embodiment of the present application can be applied to at least the following application scenarios, which are described below.
[0046] With the rapid development of the Internet, multimedia information such as images, videos, and audio has become an important data information on the Internet. Among them, images have become the mainstream information transmitted on the Internet due to their simplicity and visualization.
[0047] At the same time, images contain rich information. When electronic devices transmit images to each other, the text information in these images often involves information such as personal privacy and commercial secrets. Therefore, when transmitting images, the text information in the images needs to be securely encrypted.
[0048] Typically, to encrypt an image, the image is first converted into a one-dimensional array and then encrypted using a traditional encryption algorithm. This results in low encryption efficiency due to the large number of pixels and data volume in an image. Furthermore, if the key is not properly protected, its security is compromised, ultimately leading to the decryption of the encrypted content within the image.
[0049] Figure 1 This is a flowchart of an image encryption method provided in an embodiment of the present application.
[0050] like Figure 1 As shown, the image encryption method may include steps 110 to 150, and the method is applied to a first electronic device, specifically as follows:
[0051] Step 110: When the image to be sent includes text information, obtain a first image from a preset image library.
[0052] Step 120: Determine a first marked image and a first parameter based on the first image.
[0053] Step 130: Encrypt a first region image in the image to be sent according to the first mark image and the first parameter to obtain a first encrypted image, where the first region image includes text information.
[0054] Step 140: Generate a target encrypted image based on the first encrypted image and the first marked image.
[0055] Step 150: Send the target encrypted image to the second electronic device.
[0056] In an embodiment of the present application, when the image to be sent includes text information, a first image is obtained from a preset image library; based on the first image, a first marked image and a first parameter are determined; based on the first marked image and the first parameter, a first area image in the image to be sent is encrypted to obtain a first encrypted image, and the first area image includes text information. Here, compared with encrypting each pixel in the image to be sent, only the first area image where the text information is located is encrypted, which can improve the encryption efficiency, and the first marked image and the first parameter used to encrypt the first area image are difficult to crack, and the text information can be highly securely encrypted to ensure the security of the text information. Finally, based on the first encrypted image and the first marked image, a target encrypted image is generated, and the target encrypted image is sent to the second electronic device, so that the target encrypted image containing text information can be sent to the second electronic device safely and efficiently.
[0057] The contents of steps 110 to 150 are described below:
[0058] This involves step 110 .
[0059] In the case that the image to be sent includes text information, a first image is obtained from a preset image library.
[0060] When preparing to send an image, the first electronic device, acting as a transmitter, first detects whether the image includes text. If the image does not include text, it can be sent directly. If the image does include text, a first image is randomly selected from a preset image library.
[0061] Also, when the image to be sent includes text information, the image to be sent is detected by a text detection algorithm to detect the text box coordinates of the text information in the image to be sent, and the area image corresponding to the text box coordinates is marked as the first area image.
[0062] This involves step 120 .
[0063] Based on the first image, a first marker image and first parameters are determined.
[0064] In a possible embodiment, step 120 may specifically include the following steps:
[0065] Edit the first image according to the editing content input by the user for the first image to obtain a second image;
[0066] Acquire a first marked image corresponding to the edited content from the second image;
[0067] According to a preset correspondence, a first parameter corresponding to the first image is determined. The preset correspondence includes a correspondence between multiple groups of mutually corresponding parameters and images in a preset image library, and the parameters include the first parameter.
[0068] Among them, editing the first image to obtain the second image based on the editing content input by the user for the first image can specifically include: receiving the first input of the user for the first image, the first input includes the editing content; in response to the first input, editing the first image to obtain the second image.
[0069] If the text detection algorithm detects that the second image includes edited content, a first marked image corresponding to the edited content is obtained from the second image. The edited content may be a signature corresponding to the user's first input, and the edited content area is cut out according to the text box coordinates of the edited content and saved as the first marked image.
[0070] Then, a first parameter corresponding to the first image is determined based on a preset correspondence relationship, wherein the preset correspondence relationship includes a plurality of sets of corresponding parameters and correspondence relationships between images in a preset image library, for example, image A corresponds to parameter A, image B corresponds to parameter B, image C corresponds to parameter C, and so on.
[0071] This involves step 130 .
[0072] The first region image in the image to be sent is encrypted according to the first mark image and the first parameter to obtain a first encrypted image, where the first region image includes text information.
[0073] If the image to be sent includes text information, the image to be sent is detected using a text detection algorithm to detect the text box coordinates of the text information in the image to be sent, and the area image corresponding to the text box coordinates is marked as the first area image.
[0074] According to the first marked image and the first parameter, the first area image in the image to be sent is encrypted to obtain a first encrypted image. Compared with encrypting each pixel in the image to be sent, only the first area image where the text information is located is encrypted, which can improve the encryption efficiency.
[0075] In a possible embodiment, step 130 may specifically include the following steps:
[0076] processing the first marked image according to the first parameter to obtain a second marked image;
[0077] The first region image in the image to be sent is encrypted according to the second marked image to obtain a first encrypted image.
[0078] Specifically, according to the first parameter, the pixel values of the pixel points in the first marked image can be processed to obtain a second marked image, and then according to the pixel values of the pixel points in the second marked image, the first area image in the image to be sent is encrypted to obtain a first encrypted image, ensuring the security of the text information in the first area image.
[0079] Among them, the first parameter includes: convolution parameters and pooling parameters. In the above steps of processing the first marked image according to the first parameter to obtain a second marked image, the following steps can be specifically included:
[0080] Perform convolution processing on the first marked image according to the convolution parameters to obtain a third marked image;
[0081] Perform pooling processing on the third marked image according to the pooling parameters to obtain a second marked image.
[0082] Among them, the first parameter can include: convolution parameters and pooling parameters.
[0083] The convolution parameters can include the convolution kernel size and the convolution kernel content. Perform convolution processing on the first marked image according to the convolution kernel size and the convolution kernel content to obtain a third marked image.
[0084] Among them, the pooling parameters can include: the pooling layer size and the pooling method. Perform pooling processing on the third marked image according to the pooling layer size and the pooling method to obtain a second marked image.
[0085] As Figure 2 shown, first, perform convolution processing on the first marked image according to the convolution parameters to obtain a third marked image; among them, the convolution kernel corresponding to "filter" is a 2*2 convolution kernel. Since the pixel points have three channels, the convolution operation respectively performs moving convolution processing on the pixel values of the three channels of the pixel points in the first marked image to obtain a third marked image.
[0086] Then, perform pooling processing on the third marked image according to the pooling parameters to obtain a second marked image. The maximum pooling method can be used to perform pooling processing on the third marked image to obtain a second marked image.
[0087] Understanding the above steps based on the three channels of the pixel points, as Figure 2 shown, the first marked image is "Zhang San", and RGB represents the three-channel pixel values of the pixel points in the first marked image. F1, F2, F3, F4 are the third marked images obtained by performing convolution processing on the first marked image. The rectangle is used to represent the second marked image obtained by performing pooling processing on the third marked image according to the pooling parameters. The final circle is used to represent the first key obtained by flattening the second marked image.
[0088] The step of encrypting the first region image in the image to be sent according to the second marked image to obtain the first encrypted image may specifically include the following steps:
[0089] Flattening the second marked image to obtain a first key;
[0090] The first region image in the image to be sent is encrypted according to the first key to obtain a first encrypted image.
[0091] The second labeled image is flattened to convert the second labeled image into a three-dimensional vector of RGB channels, which is the first key.
[0092] like Figure 2 As shown, the second mark image is flattened to obtain the first key, namely "333".
[0093] Among them, for electronic devices other than the second electronic device, the first mark image and the first parameter are difficult to crack, that is, it is difficult to crack the first key, that is, it is difficult to crack the first area image encrypted based on the first key, and the text information in the first area image can be highly securely encrypted to ensure the security of the text information.
[0094] Encrypting the first region image in the image to be transmitted according to the first key to obtain the first encrypted image may specifically include:
[0095] An XOR operation is performed on the pixel values in the first region image and the first key to encrypt and obtain a first encrypted image.
[0096] Among them, XOR is a mathematical operator. It is used in logical operations. The mathematical symbol of XOR is The computer symbol is "xor". Its operation principle is: if the values of a and b are different, the XOR result is 1. If the values of a and b are the same, the XOR result is 0.
[0097] This involves step 140 .
[0098] A target encrypted image is generated based on the first encrypted image and the first marked image.
[0099] The first mark image is covered on the area of the image to be sent except the first encrypted image to generate a target encrypted image, and then the generated target encrypted image is sent.
[0100] This involves step 150 .
[0101] The target encrypted image is sent to the second electronic device.
[0102] In an embodiment of the present application, when the image to be sent includes text information, a first image is obtained from a preset image library; based on the first image, a first marked image and a first parameter are determined; based on the first marked image and the first parameter, a first area image in the image to be sent is encrypted to obtain a first encrypted image, and the first area image includes text information. Here, compared with encrypting each pixel in the image to be sent, only the first area image where the text information is located is encrypted, which can improve the encryption efficiency, and the first marked image and the first parameter used to encrypt the first area image are difficult to crack, and the text information can be highly securely encrypted to ensure the security of the text information. Finally, based on the first encrypted image and the first marked image, a target encrypted image is generated, and the target encrypted image is sent to the second electronic device, so that the target encrypted image containing text information can be sent to the second electronic device safely and efficiently.
[0103] Figure 1 This is a flowchart of an image encryption method provided in an embodiment of the present application.
[0104] like Figure 1 As shown, the image encryption method may include steps 310 to 350, and the method is applied to the second electronic device, as shown below:
[0105] Step 310: Receive a target encrypted image sent by a first electronic device, where the target encrypted image includes a first encrypted image.
[0106] Step 320: When it is detected that the target encrypted image includes the first marked image, a first image matching the first marked image is searched from a preset image library.
[0107] After receiving the target encrypted image, the second electronic device serving as the receiving end first detects whether the target encrypted image has a first marked image. If the first marked image is detected, the first image in the preset image library that matches the first marked image is found through image detection.
[0108] Step 330: Determine a first parameter corresponding to the first image according to a preset corresponding relationship.
[0109] Step 340: Decrypt the first encrypted image according to the first parameter and the first marked image to obtain a first decrypted image.
[0110] In a possible embodiment, step 340 may specifically include the following steps:
[0111] processing the first marked image according to the first parameter to obtain a second marked image;
[0112] Flattening the second marked image to obtain a first key;
[0113] The first encrypted image is decrypted according to the first key to obtain a first decrypted image.
[0114] Among them, the first parameter includes: a convolution parameter and a pooling parameter. The above-mentioned step of processing the first labeled image according to the first parameter to obtain the second labeled image can specifically include the following steps: performing convolution processing on the first labeled image according to the convolution parameter to obtain a third labeled image; and performing pooling processing on the third labeled image according to the pooling parameter to obtain the second labeled image.
[0115] The first labeled image is convolved and pooled to obtain a second labeled image, which is then flattened into a three-dimensional RGB array to obtain the first key. The irreversible nature of convolution and pooling operations prevents the first key from being cracked, resulting in a unique encryption method with high security.
[0116] Step 350: Generate a target decrypted image based on the first decrypted image and the first marked image.
[0117] After decryption, the first marked image in the target encrypted image is erased using image fusion technology, the original image is restored, and the reception of the target decrypted image is completed.
[0118] In an embodiment of the present application, a target encrypted image sent by a first electronic device is received, the target encrypted image includes a first encrypted image; when it is detected that the target encrypted image includes a first marked image, a first image matching the first marked image is searched from a preset image library; according to a preset correspondence, a first parameter corresponding to the first image is determined; according to the first parameter and the first marked image, the first encrypted image is decrypted to obtain a first decrypted image. Here, the first marked image and the first parameter used to decrypt the first area image can only be obtained by a pre-agreed second electronic device, which can ensure security, and the part of the target encrypted image that needs to be decrypted is only the first encrypted image, so the first encrypted image can be decrypted quickly and efficiently to obtain the first decrypted image. Finally, according to the first decrypted image and the first marked image, a target decrypted image is generated, and the target decrypted image can be obtained safely and efficiently.
[0119] Based on the above Figure 1 The image encryption method shown in the embodiment of the present application also provides an image encryption device, such as Figure 4 As shown, the image encryption device 400 may include:
[0120] The acquisition module 410 is configured to acquire a first image from a preset image library when the image to be sent includes text information.
[0121] The first determining module 420 is configured to determine a first marked image and a first parameter according to the first image.
[0122] The encryption module 430 is configured to encrypt a first region image in the image to be sent according to the first mark image and the first parameter to obtain a first encrypted image, where the first region image includes text information.
[0123] The first generating module 440 is configured to generate a target encrypted image according to the first encrypted image and the first marked image.
[0124] The sending module 440 is configured to send the target encrypted image to the second electronic device. In a possible embodiment, the first determining module 420 is specifically configured to:
[0125] Edit the first image according to the editing content input by the user for the first image to obtain a second image;
[0126] Acquire a first marked image corresponding to the edited content from the second image;
[0127] According to a preset correspondence, a first parameter corresponding to the first image is determined. The preset correspondence includes a correspondence between multiple groups of mutually corresponding parameters and images in a preset image library, and the parameters include the first parameter.
[0128] In a possible embodiment, the encryption module 430 is specifically configured to:
[0129] Encrypting a first region image in the image to be sent according to the first marked image and the first parameter to obtain a first encrypted image, including:
[0130] processing the first marked image according to the first parameter to obtain a second marked image;
[0131] The first region image in the image to be sent is encrypted according to the second marked image to obtain a first encrypted image.
[0132] In a possible embodiment, the first parameter includes: a convolution parameter and a pooling parameter, and the encryption module 430 is specifically configured to:
[0133] performing convolution processing on the first labeled image according to the convolution parameters to obtain a third labeled image;
[0134] Pooling is performed on the third labeled image according to the pooling parameters to obtain a second labeled image.
[0135] In a possible embodiment, the encryption module 430 is specifically configured to:
[0136] Flattening the second marked image to obtain a first key;
[0137] The first region image in the image to be sent is encrypted according to the first key to obtain a first encrypted image.
[0138] In an embodiment of the present application, when the image to be sent includes text information, a first image is obtained from a preset image library; based on the first image, a first marked image and a first parameter are determined; based on the first marked image and the first parameter, a first area image in the image to be sent is encrypted to obtain a first encrypted image, and the first area image includes text information. Here, compared with encrypting each pixel in the image to be sent, only the first area image where the text information is located is encrypted, which can improve the encryption efficiency, and the first marked image and the first parameter used to encrypt the first area image are difficult to crack, and the text information can be highly encrypted to ensure the security of the text information. Finally, based on the first encrypted image and the first marked image, a target encrypted image is generated, and the target encrypted image is sent to the second electronic device, so that the target encrypted image containing text information can be sent to the second electronic device safely and efficiently.
[0139] Based on the above Figure 3 The image decryption method shown in the embodiment of the present application also provides an image decryption device, which is applied to a first electronic device, such as Figure 5 As shown, the image decryption device 500 may include:
[0140] The receiving module 510 is configured to receive a target encrypted image sent by a first electronic device, where the target encrypted image includes a first encrypted image;
[0141] a search module 520 configured to search a preset image library for a first image matching the first marked image when detecting that the target encrypted image includes the first marked image;
[0142] A second determining module 530 is configured to determine a first parameter corresponding to the first image according to a preset corresponding relationship;
[0143] a decryption module 540 configured to decrypt the first encrypted image according to the first parameter and the first marked image to obtain a first decrypted image;
[0144] The second generating module 550 is configured to generate a target decrypted image according to the first decrypted image and the first marked image.
[0145] In a possible embodiment, the decryption module 540 is specifically configured to:
[0146] processing the first marked image according to the first parameter to obtain a second marked image;
[0147] performing flattening processing on the second marked image to obtain a first key;
[0148] The first encrypted image is decrypted according to the first key to obtain the first decrypted image.
[0149] In an embodiment of the present application, a target encrypted image sent by a first electronic device is received, and the target encrypted image includes a first encrypted image; when it is detected that the target encrypted image includes a first marked image, a first image matching the first marked image is searched from a preset image library; according to a preset correspondence, a first parameter corresponding to the first image is determined; according to the first parameter and the first marked image, the first encrypted image is decrypted to obtain a first decrypted image. Here, the first marked image and the first parameter used to decrypt the first area image can only be obtained by a pre-agreed second electronic device, which can ensure security, and the part of the target encrypted image that needs to be decrypted is only the first encrypted image, so the first encrypted image can be decrypted quickly and efficiently to obtain the first decrypted image. Finally, according to the first decrypted image and the first marked image, a target decrypted image is generated, and the target decrypted image can be obtained safely and efficiently.
[0150] Figure 6 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.
[0151] The electronic device may include a processor 601 and a memory 602 storing computer program instructions.
[0152] Specifically, the processor 601 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0153] The memory 602 may include a large-capacity memory for data or instructions. By way of example and not limitation, the memory 602 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 602 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 602 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 602 is a non-volatile solid-state memory. In a specific embodiment, the memory 602 includes a read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or a flash memory, or a combination of two or more of these.
[0154] The processor 601 reads and executes computer program instructions stored in the memory 602 to implement any one of the image encryption methods in the embodiments shown in the figure.
[0155] In one example, the electronic device may further include a communication interface 603 and a bus 610. Figure 6 As shown, the processor 601, the memory 602, and the communication interface 603 are connected via a bus 610 and communicate with each other.
[0156] The communication interface 603 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0157] Bus 610 comprises hardware, software or both, couples the parts of electronic equipment to each other.For example, and not limitation, bus can comprise accelerated graphics port (AGP) or other graphics bus, enhanced industry standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industry standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations.In suitable cases, bus 610 can comprise one or more buses.Although the present application embodiment describes and shows specific bus, the application considers any suitable bus or interconnection.
[0158] The electronic device can execute the method in the embodiment of the present application, thereby realizing the combination Figure 1-Figure 3 Described method.
[0159] In addition, in combination with the image encryption method in the above embodiment, the embodiment of the present application can provide a computer readable storage medium for implementation. The computer readable storage medium stores computer program instructions; when the computer program instructions are executed by the processor, the Figure 1 Image encryption method.
[0160] It should be understood that the present application is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and illustrated as examples. However, the method process of the present application is not limited to the specific steps described and illustrated. Those skilled in the art can make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present application.
[0161] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROMs, flash memories, erasable ROMs (EROMs), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0162] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps. In other words, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0163] The above description is only a specific embodiment of the present application. Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the scope of protection of the present application.
Claims
1. An image encryption method, characterized in that: Applied to a first electronic device, the method includes: In the case where the image to be sent includes text information, obtaining a first image from a preset image library; determining a first marked image and a first parameter according to the first image; Encrypting a first region image in the image to be sent according to the first marked image and the first parameter to obtain a first encrypted image, where the first region image includes the text information; generating a target encrypted image based on the first encrypted image and the first marked image; sending the target encrypted image to a second electronic device; The step of encrypting the first region image in the image to be sent according to the first marked image and the first parameter to obtain a first encrypted image includes: processing the first marked image according to the first parameter to obtain a second marked image; encrypting the first region image in the image to be sent according to the second marked image to obtain the first encrypted image; The first parameters include: convolution parameters and pooling parameters, and the first marked image is processed according to the first parameters to obtain the second marked image, including: performing convolution processing on the first labeled image according to the convolution parameters to obtain a third labeled image; performing pooling processing on the third labeled image according to the pooling parameters to obtain the second labeled image; The step of encrypting the first region image in the image to be sent according to the second marked image to obtain the first encrypted image includes: performing flattening processing on the second marked image to obtain a first key; The first region image in the image to be sent is encrypted according to the first key to obtain the first encrypted image.
2. The method according to claim 1, characterized in that The determining of a first marked image and a first parameter according to the first image includes: Editing the first image according to the editing content input by the user for the first image to obtain a second image; Acquire a first marked image corresponding to the edited content from the second image; The first parameter corresponding to the first image is determined according to a preset correspondence relationship, wherein the preset correspondence relationship includes a correspondence relationship between multiple groups of mutually corresponding parameters and images in the preset image library, and the parameters include the first parameter.
3. An image decryption method, characterized in that: Applied to a second electronic device, the method includes: receiving a target encrypted image sent by a first electronic device, wherein the target encrypted image includes a first encrypted image; When detecting that the target encrypted image includes a first marked image, searching a preset image library for a first image that matches the first marked image; Determining a first parameter corresponding to the first image according to a preset corresponding relationship; decrypting the first encrypted image according to the first parameter and the first marked image to obtain a first decrypted image; generating a target decrypted image based on the first decrypted image and the first marked image; The decrypting of the first encrypted image according to the first parameter and the first marked image to obtain a first decrypted image includes: processing the first marked image according to the first parameter to obtain a second marked image; performing flattening processing on the second marked image to obtain a first key; The first encrypted image is decrypted according to the first key to obtain the first decrypted image.
4. An image encryption device, characterized in that: Applied to a first electronic device, the image encryption device includes: an acquisition module, configured to acquire a first image from a preset image library when the image to be sent includes text information; a first determining module, configured to determine a first marked image and a first parameter based on the first image; an encryption module, configured to encrypt a first region image in the image to be sent according to the first marked image and the first parameter to obtain a first encrypted image, wherein the first region image includes the text information; A first generating module, configured to generate a target encrypted image according to the first encrypted image and the first marked image; A sending module, configured to send the target encrypted image to a second electronic device; The encryption module is specifically used to: Encrypting a first region image in the image to be sent according to the first marked image and the first parameter to obtain a first encrypted image, including: processing the first marked image according to the first parameter to obtain a second marked image; Encrypting the first region image in the image to be sent according to the second marked image to obtain a first encrypted image; The first parameters include: convolution parameters and pooling parameters, encryption module, and are also specifically used for: performing convolution processing on the first labeled image according to the convolution parameters to obtain a third labeled image; Performing pooling processing on the third labeled image according to the pooling parameters to obtain a second labeled image; The encryption device is also used to: The step of encrypting the first region image in the image to be sent according to the second marked image to obtain the first encrypted image includes: performing flattening processing on the second marked image to obtain a first key; The first region image in the image to be sent is encrypted according to the first key to obtain the first encrypted image.
5. An image decryption device, characterized in that: Applied to a second electronic device, the image decryption device comprises: A receiving module, configured to receive a target encrypted image sent by a first electronic device, wherein the target encrypted image includes a first encrypted image; a search module configured to search a preset image library for a first image matching the first marked image when detecting that the target encrypted image includes a first marked image; A second determining module, configured to determine a first parameter corresponding to the first image according to a preset corresponding relationship; a decryption module, configured to decrypt the first encrypted image according to the first parameter and the first marked image to obtain a first decrypted image; a second generating module, configured to generate a target decrypted image based on the first decrypted image and the first marked image; The decryption module is specifically used to: processing the first marked image according to the first parameter to obtain a second marked image; performing flattening processing on the second marked image to obtain a first key; The first encrypted image is decrypted according to the first key to obtain the first decrypted image.
6. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the method according to any one of claims 1 to 3 is implemented.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Image processing method, terminal and storage medium
CN109118551A
Plaintext correlation-based full-connection-like network image encryption method
CN112887075A