CN113012021B - Image encryption and decryption method, computer and readable storage medium - Google Patents

Image encryption and decryption method, computer and readable storage medium Download PDF

Info

Publication number
CN113012021B
CN113012021B CN202110563525.6A CN202110563525A CN113012021B CN 113012021 B CN113012021 B CN 113012021B CN 202110563525 A CN202110563525 A CN 202110563525A CN 113012021 B CN113012021 B CN 113012021B
Authority
CN
China
Prior art keywords
image
channel
image data
data
watermark
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110563525.6A
Other languages
Chinese (zh)
Other versions
CN113012021A (en
Inventor
张伟
张志欢
农益辉
邹同海
陈阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110563525.6A priority Critical patent/CN113012021B/en
Publication of CN113012021A publication Critical patent/CN113012021A/en
Application granted granted Critical
Publication of CN113012021B publication Critical patent/CN113012021B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0021Image watermarking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4007Scaling of whole images or parts thereof, e.g. expanding or contracting based on interpolation, e.g. bilinear interpolation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the application discloses an image encryption and decryption method, a computer and a readable storage medium, wherein the method comprises the following steps: acquiring an initial image, performing channel division on the initial image to obtain N first channel image data, and acquiring first target channel image data from the N first channel image data; n is a positive integer; carrying out spectrum conversion on the first target channel image data to generate a first channel spectrum image, writing the hidden watermark data into the first channel spectrum image, and generating a channel encryption spectrum image; carrying out image fusion on the channel encryption frequency spectrum image and the original channel image data to generate a target encryption image; the original channel image data is first channel image data except the first target channel image data in the N first channel image data. By the method and the device, the concealment of image encryption and the efficiency of image encryption and decryption can be improved.

Description

Image encryption and decryption method, computer and readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to an image encryption and decryption method, a computer, and a readable storage medium.
Background
In order to protect data contained in an image or protect the copyright of the image, a watermark or the like is generally added to the image, and the image is encrypted so that the image can represent information such as the copyright based on the watermark or the like. That is, the range of use of encryption and decryption of images is becoming wider. At present, characters are generally converted into pictures or smaller watermark images are used, and the obtained pictures or watermark images are added into an original image, that is, the obtained pictures or watermark images are overlaid with pixel points in the original image based on the obtained picture or watermark images, so that the obtained pictures or watermark images are covered in the original image to realize encryption of the original image. When the image obtained by the encryption in the mode is decrypted, the original image and the watermark image and the like are required to be reserved to restore the original image, so that the image decryption process is complex and the decryption efficiency is low.
Disclosure of Invention
The embodiment of the application provides an image encryption and decryption method, a computer and a readable storage medium, which can improve the concealment of image encryption and the efficiency of image encryption and decryption.
An aspect of the present embodiment provides an image encryption method, including:
acquiring an initial image, performing channel division on the initial image to obtain N first channel image data, and acquiring first target channel image data from the N first channel image data; n is a positive integer;
carrying out spectrum conversion on the first target channel image data to generate a first channel spectrum image, writing the hidden watermark data into the first channel spectrum image, and generating a channel encryption spectrum image;
carrying out image fusion on the channel encryption frequency spectrum image and the original channel image data to generate a target encryption image; the original channel image data is first channel image data except the first target channel image data in the N first channel image data.
Wherein acquiring an initial image comprises:
acquiring an image to be encrypted and plaintext watermark data;
carrying out image loading on an image to be encrypted to obtain original image information of the image to be encrypted;
acquiring first watermark size information of plaintext watermark data, acquiring encryption position information, and drawing a watermark frame in original image information based on the encryption position information and the first watermark size information;
writing the plaintext watermark data into a watermark frame of the original image information to generate an initial image containing the plaintext watermark; and the plain text watermark is a watermark corresponding to the plain text watermark data.
The method for performing spectrum conversion on the first target channel image data to generate a first channel spectrum image includes:
performing interpolation processing and image information extension on the first target channel image data to generate first completion channel image data;
performing data format conversion on the first completion channel image data to generate first floating point channel image data;
and carrying out spectrum conversion on the first floating-point channel image data to generate a first channel spectrum image.
The method for generating the first completion channel image data by performing interpolation processing and image information extension on the first target channel image data comprises the following steps:
determining a first image extension size based on a first channel image size of the first target channel image data, and creating first interpolation image data based on the first image extension size;
and merging the first interpolation image data and the first target channel image data to generate first completion channel image data.
The method for writing the hidden watermark data into the first channel spectrum image to generate the channel encrypted spectrum image comprises the following steps:
acquiring a hidden watermark format, and performing data format conversion on hidden watermark data based on the hidden watermark format to obtain target hidden watermark data;
and acquiring second watermark size information of the target hidden watermark data, writing the target hidden watermark data into the first channel spectrum image based on the second watermark size information, and generating a channel encryption spectrum image.
Based on the second watermark size information, writing the target hidden watermark data into the first channel spectrum image to generate a channel encrypted spectrum image, including:
writing target hidden watermark data into a first channel frequency spectrum image based on the second watermark size information to generate initial quadrant image data;
carrying out symmetrical transformation on the initial quadrant image data to generate transformation quadrant image data;
and writing the target hidden watermark data into the conversion quadrant image data based on the second watermark size information to generate a channel encryption spectrum image.
The image fusion of the channel encryption spectrum image and the original channel image data is carried out to generate a target encryption image, and the method comprises the following steps:
performing inverse Fourier transform processing on the channel encrypted frequency spectrum image to generate second floating point channel image data;
and carrying out image fusion on the second floating point channel image data and the original channel image data to generate a target encrypted image.
The image fusion of the second floating-point channel image data and the original channel image data is performed to generate a target encrypted image, and the method comprises the following steps:
acquiring a channel encryption size of second floating point channel image data, and performing interpolation processing and image information extension on an original channel image based on the channel encryption size to generate conversion channel image data;
and merging the second floating point channel image data and the conversion channel image data to generate a target encrypted image.
An aspect of the embodiments of the present application provides an image decryption method, including:
acquiring an image to be decrypted, performing channel division on the image to be decrypted to obtain N second channel image data, and acquiring second target channel image data from the N second channel image data; n is a positive integer; the second target channel image data is obtained by writing hidden watermark data into the first target channel image data, the first target channel image data is obtained by carrying out channel division on the initial image, and the image to be decrypted is generated by carrying out image encryption on the initial image;
carrying out spectrum conversion on the second target channel image data to generate a second channel spectrum image;
carrying out amplitude suppression processing on the second channel frequency spectrum image to generate a hidden watermark image; the hidden watermark image includes hidden watermark data.
The frequency spectrum conversion is performed on the second target channel image data to generate a second channel frequency spectrum image, and the method comprises the following steps:
performing interpolation processing and image information extension on the second target channel image data to generate second completion channel image data;
performing data format conversion on the second completion channel image data to generate third floating point channel image data;
and performing spectrum conversion on the third floating point channel image data to generate a second channel spectrum image.
The interpolation processing and the image information extension are carried out on the second target channel image data to generate second completion channel image data, and the method comprises the following steps:
determining a second image extension size based on a second channel image size of the second target channel image data, and creating second interpolation image data based on the second image extension size;
and merging the second interpolation image data and the second target channel image data to generate second completion channel image data.
The amplitude suppression processing is performed on the second channel frequency spectrum image to generate a hidden watermark image, and the method comprises the following steps:
carrying out data splitting on the second channel frequency spectrum image to obtain real part image data and imaginary part image data;
performing gradient conversion on the real part image data and the imaginary part image data to generate gradient image data;
and carrying out amplitude suppression processing on the gradient image data to generate a hidden watermark image.
The method for carrying out amplitude suppression processing on gradient image data to generate a hidden watermark image comprises the following steps:
carrying out numerical scale transformation on the gradient image data to generate scale image data;
cutting empty image data in the scale image data to obtain cut image data;
acquiring encryption quadrant information, and performing quadrant conversion on the cut image data based on the encryption quadrant information to generate watermark quadrant image data;
and carrying out normalization processing on the watermark quadrant image data to generate a hidden watermark image.
An aspect of an embodiment of the present application provides an image encryption apparatus, including:
the image acquisition module is used for acquiring an initial image;
the first channel division module is used for carrying out channel division on the initial image to obtain N first channel image data and acquiring first target channel image data from the N first channel image data; n is a positive integer;
the first frequency spectrum conversion module is used for carrying out frequency spectrum conversion on the first target channel image data to generate a first channel frequency spectrum image;
the watermark writing module is used for writing the hidden watermark data into a first channel spectrum image to generate a channel encrypted spectrum image;
the image fusion module is used for carrying out image fusion on the channel encrypted frequency spectrum image and the original channel image data to generate a target encrypted image; the original channel image data is first channel image data except the first target channel image data in the N first channel image data.
Wherein, this image acquisition module includes:
the data acquisition unit is used for acquiring an image to be encrypted and plaintext watermark data;
the image loading unit is used for loading the image to be encrypted to obtain the original image information of the image to be encrypted;
the first information acquisition unit is used for acquiring first watermark size information of plaintext watermark data, acquiring encryption position information, and drawing a watermark frame in original image information based on the encryption position information and the first watermark size information;
the initial image generating unit is used for writing the plaintext watermark data into a watermark frame of the original image information and generating an initial image containing the plaintext watermark; and the plain text watermark is a watermark corresponding to the plain text watermark data.
Wherein, the first spectrum conversion module comprises:
the first image extension unit is used for carrying out interpolation processing and image information extension on the first target channel image data to generate first completion channel image data;
the first format conversion unit is used for carrying out data format conversion on the first completion channel image data to generate first floating point channel image data;
and the first spectrum conversion unit is used for performing spectrum conversion on the first floating-point channel image data to generate a first channel spectrum image.
Wherein, the first image extension unit comprises:
a first image creating subunit operable to determine a first image extension size based on a first channel image size of the first target channel image data, and create first interpolation image data based on the first image extension size;
and the first image completion subunit is used for merging the first interpolation image data and the first target channel image data to generate first completion channel image data.
Wherein, the watermark writing module comprises:
the second format conversion unit is used for acquiring a hidden watermark format and performing data format conversion on the hidden watermark data based on the hidden watermark format to obtain target hidden watermark data;
the second information acquisition unit is used for acquiring second watermark size information of the target hidden watermark data;
and the watermark writing unit is used for writing the target hidden watermark data into the first channel spectrum image based on the second watermark size information to generate a channel encrypted spectrum image.
Wherein, the watermark writing unit includes:
the initial writing subunit is used for writing the target hidden watermark data into the first channel frequency spectrum image based on the second watermark size information to generate initial quadrant image data;
the image transformation subunit is used for carrying out symmetrical transformation on the initial quadrant image data to generate transformation quadrant image data;
and the image encryption subunit is used for writing the target hidden watermark data into the conversion quadrant image data based on the second watermark size information to generate a channel encryption spectrum image.
Wherein, this image fusion module includes:
the inverse conversion unit is used for performing inverse Fourier transform processing on the channel encrypted frequency spectrum image to generate second floating point channel image data;
and the image fusion unit is used for carrying out image fusion on the second floating point channel image data and the original channel image data to generate a target encrypted image.
Wherein, this image fusion unit includes:
the original completion subunit is used for acquiring the channel encryption size of the second floating point channel image data, and performing interpolation processing and image information extension on the original channel image based on the channel encryption size to generate conversion channel image data;
and the image merging subunit is used for merging the second floating point channel image data and the conversion channel image data to generate a target encrypted image.
An aspect of an embodiment of the present application provides an image decryption apparatus, including:
the second channel dividing module is used for acquiring an image to be decrypted, performing channel division on the image to be decrypted to obtain N second channel image data, and acquiring second target channel image data from the N second channel image data; n is a positive integer; the second target channel image data is obtained by writing hidden watermark data into the first target channel image data, the first target channel image data is obtained by carrying out channel division on the initial image, and the image to be decrypted is generated by carrying out image encryption on the initial image;
the second frequency spectrum conversion module is used for carrying out frequency spectrum conversion on the second target channel image data to generate a second channel frequency spectrum image;
the amplitude suppression module is used for performing amplitude suppression processing on the second channel frequency spectrum image to generate a hidden watermark image; the hidden watermark image includes hidden watermark data.
Wherein, the second spectrum conversion module comprises:
the second image extension unit is used for carrying out interpolation processing and image information extension on the second target channel image data to generate second completion channel image data;
the second format conversion unit is used for performing data format conversion on the second completion channel image data to generate third floating point channel image data;
and the second spectrum conversion unit is used for performing spectrum conversion on the third floating-point channel image data to generate a second channel spectrum image.
Wherein, the second image extension unit includes:
a second image creating subunit operable to determine a second image extension size based on a second channel image size of the second target channel image data, and create second interpolation image data based on the second image extension size;
and the second image completion subunit is used for merging the second interpolation image data and the second target channel image data to generate second completion channel image data.
Wherein, the amplitude suppression module comprises:
the data splitting unit is used for splitting the second channel frequency spectrum image to obtain real part image data and imaginary part image data;
the gradient conversion unit is used for carrying out gradient conversion on the real part image data and the imaginary part image data to generate gradient image data;
and the amplitude suppression unit is used for performing amplitude suppression processing on the gradient image data to generate a hidden watermark image.
Wherein, this amplitude suppression unit includes:
the scale transformation subunit is used for carrying out numerical scale transformation on the gradient image data to generate scale image data;
the image cutting subunit is used for cutting the empty image data in the scale image data to obtain cut image data;
the quadrant conversion subunit is used for acquiring encryption quadrant information, performing quadrant conversion on the cut image data based on the encryption quadrant information, and generating watermark quadrant image data;
and the normalization processing subunit is used for performing normalization processing on the watermark quadrant image data to generate a hidden watermark image.
One aspect of the embodiments of the present application provides a computer device, including a processor, a memory, and an input/output interface;
the processor is respectively connected with the memory and the input/output interface, wherein the input/output interface is used for receiving data and outputting data, the memory is used for storing a computer program, and the processor is used for calling the computer program so as to enable the computer device comprising the processor to execute the image encryption method or the image decryption method in one aspect of the embodiment of the application.
An aspect of the embodiments of the present application provides a computer-readable storage medium, which stores a computer program, the computer program being adapted to be loaded and executed by a processor, so as to enable a computer device having the processor to execute an image encryption method or an image decryption method in an aspect of the embodiments of the present application.
An aspect of an embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method provided in the various alternatives in one aspect of the embodiments of the application.
The embodiment of the application has the following beneficial effects:
in the embodiment of the application, an initial image is obtained, channels of the initial image are divided to obtain N first channel image data, and first target channel image data are obtained from the N first channel image data; n is a positive integer; carrying out spectrum conversion on the first target channel image data to generate a first channel spectrum image, writing the hidden watermark data into the first channel spectrum image, and generating a channel encryption spectrum image; carrying out image fusion on the channel encryption frequency spectrum image and the original channel image data to generate a target encryption image; the original channel image data is first channel image data except the first target channel image data in the N first channel image data. The initial image is subjected to channel division, first target channel image data are obtained from each first channel image data obtained after division, and the hidden watermark data are written in the first target channel image data, so that the hidden watermark data are only added into a single channel in the initial image, the influence on the initial image is small, the change of the hidden watermark data on the data of the initial image is reduced as much as possible, and the practicability of image encryption can be improved. Moreover, when the hidden watermark data is added to the first target channel image data, the hidden watermark data is added to the spectrogram corresponding to the first target channel image data, so that hidden encryption of the hidden watermark data is realized, the hidden watermark data in the obtained target encrypted image is almost invisible to naked eyes, and the visual invisibility and the concealment of image encryption are improved. In addition, through the single-channel data processing, the spectrum image encryption and the like, the information integrity of reverse reduction decryption is greatly reserved, and therefore the efficiency and the flexibility of image encryption and decryption can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a diagram of a network interaction architecture for image encryption or decryption according to an embodiment of the present application;
fig. 2 is a schematic diagram of an image encryption scene provided in an embodiment of the present application;
FIG. 3 is a flowchart of a method for encrypting an image according to an embodiment of the present application;
fig. 4 is a schematic diagram of an image multi-layer encryption scene provided in an embodiment of the present application;
FIG. 5 is a diagram of a data conversion scenario in an image encryption process according to an embodiment of the present application;
FIG. 6 is a flowchart of a method for image decryption according to an embodiment of the present disclosure;
fig. 7 is a schematic diagram of an image decryption scene according to an embodiment of the present application;
fig. 8 is a view of a data conversion scene in an image decryption process according to an embodiment of the present application;
fig. 9a is a schematic diagram illustrating an image decryption effect based on a region screenshot according to an embodiment of the present application;
FIG. 9b is a schematic diagram illustrating an image decryption effect based on a region screenshot according to an embodiment of the present application;
fig. 10 is a schematic diagram of an image encryption apparatus according to an embodiment of the present application;
fig. 11 is a schematic diagram of an image decryption apparatus according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the embodiment of the present application, please refer to fig. 1, where fig. 1 is a network interaction architecture diagram for image encryption or decryption according to the embodiment of the present application. As shown in fig. 1, the computer device 101 may encrypt or decrypt an image stored in the computer device 101, or may encrypt or decrypt an image obtained from a user device (e.g., the user device 102a, the user device 102b, and the user device 102 c), and the like, which is not limited herein. For example, the computer device 101 may encrypt an image based on an image encryption period, decrypt an image based on an image decryption period, and the like, where the image may be stored in the computer device 101, stored based on a cloud storage technology, or obtained from a user device; alternatively, the computer apparatus 101 may perform encryption processing on an image to be encrypted when receiving an image encryption request for the image to be encrypted, and perform decryption processing on the image to be decrypted when receiving an image decryption request for the image to be decrypted.
Specifically, please refer to fig. 2, where fig. 2 is a schematic diagram of an image encryption scene according to an embodiment of the present application. As shown in fig. 2, a computer device acquires an initial image 201, and performs channel division on the initial image 201 to obtain N pieces of first channel image data composing the initial image 201, such as first channel image data 2021, first channel image data 2022, first channel image data 2023, and the like. The computer device may obtain first target channel image data from the N first channel image data, where the first target channel image data may be any one of the N first channel image data, or may be first channel image data corresponding to a default channel, and the like, and this is not limited herein. Assuming that the first target channel image data is the first channel image data 2022, the first target channel image data is subjected to spectrum conversion to generate a first channel spectrum image 203, and the hidden watermark data is written in the first channel spectrum image 203 to generate a channel encrypted spectrum image 204. The computer device performs image fusion on the channel encrypted spectrum image 204 and original channel image data to generate a target encrypted image 205, wherein the original channel image data is first channel image data of the N first channel image data except for the first target channel image data. For example, assuming that the first target channel image data is the first channel image data 2022, the original channel image data includes the first channel image data 2021, the first channel image data 2023, and the like. Through single-channel data processing and encryption in a spectrogram, the visibility of the hidden watermark data in the target encrypted image 205 obtained through encryption processing is low, the influence of the hidden watermark data on the initial image 201 is small, the practicability and the concealment of image encryption can be improved, and the efficiency of image encryption is improved.
It is understood that the computer device or the user equipment mentioned in the embodiments of the present application include, but are not limited to, a terminal device or a server. In other words, the computer device or the user device may be a server or a terminal device, or may be a system composed of a server and a terminal device. The above-mentioned terminal device may be an electronic device, including but not limited to a mobile phone, a tablet computer, a desktop computer, a notebook computer, a palm computer, a vehicle-mounted device, an Augmented Reality/Virtual Reality (AR/VR) device, a helmet display, a smart television, a wearable device, a smart speaker, a digital camera, a camera, and other Mobile Internet Devices (MID) with network access capability, or a terminal device in a scene such as a train, a ship, or a flight, and the like. The above-mentioned server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, Network service, cloud communication, middleware service, domain name service, security service, vehicle-road cooperation, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like.
Optionally, data related to in this embodiment of the present application may be stored in a computer device, or may be stored based on a cloud storage technology, or may be stored in a block chain network, which is not limited herein, where the data related to in this embodiment of the present application includes but is not limited to an image that needs to be encrypted, plaintext watermark data used in an image encryption process, hidden watermark data, an image obtained by encryption, an image that needs to be decrypted, an image obtained by decryption, and the like. Optionally, the embodiment of the present application may be applied to the field of blockchains, and the image encryption process or the image decryption process may be implemented based on an intelligent contract, which is not limited herein.
Further, please refer to fig. 3, fig. 3 is a flowchart of an image encryption method according to an embodiment of the present disclosure. As shown in fig. 3, the image encryption process includes the following steps:
step S301, acquiring an initial image, performing channel division on the initial image to obtain N first channel image data, and acquiring first target channel image data from the N first channel image data.
In the embodiment of the application, N is a positive integer. The computer equipment can acquire an image to be encrypted and determine the image to be encrypted as an initial image; or, plaintext watermark data can be written in the image to be encrypted, the image to be encrypted is subjected to initial encryption processing to generate an initial image, double encryption of the image to be encrypted is achieved, the plaintext watermark data comprises plaintext encryption processing and hidden encryption processing and the like, watermark data which can be viewed by a user can be added to the image to be encrypted through the plaintext encryption processing, watermark data which cannot be viewed by the user can be added to the image to be encrypted through the hidden encryption processing, and the safety of the image is improved. Writing plaintext watermark data into the image to be encrypted, and performing initial encryption processing on the image to be encrypted to generate an initial image, wherein specifically, the computer equipment can acquire the image to be encrypted and the plaintext watermark data; the plaintext watermark data may be any watermark type data, such as text watermark type data (i.e., text plaintext watermark data), digital watermark type data (i.e., digital plaintext watermark data), or image watermark type data (i.e., image plaintext watermark data).
Further, the computer device may perform image loading on the image to be encrypted to obtain the original image information of the image to be encrypted, specifically, the computer device may perform image loading on the image to be encrypted by using an image reading algorithm to obtain the original image information of the image to be encrypted, where the computer device may perform image loading on the image to be encrypted by using any one programming language, and the computer device may obtain the type of the adopted programming language, obtain an image reading algorithm included in the type of the programming language, obtain a target image reading algorithm from the image reading algorithm included in the type of the programming language, and perform image loading on the image to be encrypted to obtain the original image information of the image to be encrypted. The image reading algorithm may be any algorithm for reading data in an image to be encrypted, such as an imread algorithm or an imshow algorithm, which is not limited herein, and optionally, the original image information of the image to be encrypted may be an array data used to represent image content in the image to be encrypted. The computer equipment can obtain first watermark size information of the plaintext watermark data, obtain encryption position information, and draw a watermark frame in the original image information based on the encryption position information and the first watermark size information, wherein the watermark frame can be a solid frame or a virtual frame, and is used for representing the adding position of the plaintext watermark data in the original image information; writing the plaintext watermark data into a watermark frame of the original image information to generate an initial image containing the plaintext watermark; and the plain text watermark is a watermark corresponding to the plain text watermark data. Optionally, the computer device may obtain a target watermark type of the plaintext watermark data, and write the plaintext watermark data into the original image information by using a first watermark writing algorithm corresponding to the target watermark type.
Further, the computer device may perform channel division on the initial image to obtain N first channel image data, and obtain first target channel image data from the N first channel image data, where N is a positive integer. Optionally, the channel division manner is not limited herein, for example, the initial image may be subjected to channel division based on an RGB manner, or the initial image may be subjected to channel division based on an RGBA manner, and the like, that is, the channel division manner includes, but is not limited to, an RGB manner and an RGBA manner. The RGB mode is a channel division mode based on a Red (R, R) channel, a Green (Green, G) channel and a Blue (Blue, B) channel, and the channel division is carried out on the initial image based on the RGB mode to obtain N first channel image data, wherein the N first channel image data comprise first channel image data corresponding to the R channel, first channel image data corresponding to the G channel and first channel image data corresponding to the B channel; the RGBA mode is a channel division mode based on a Red (Red, R) channel, a Green (G) channel, a Blue (B) channel, and a transparency (Alpha, a) channel, and performs channel division on the initial image based on the RGBA mode to obtain N first channel image data, including first channel image data corresponding to the R channel, first channel image data corresponding to the G channel, first channel image data corresponding to the B channel, and first channel image data corresponding to the a channel. Further, the computer device may randomly select one first channel image data from the N first channel image data as a first target channel image data; or, of the N pieces of first channel image data, the first channel image data corresponding to the default channel may be determined as the first target channel image data, for example, if the default channel is a green channel, the first channel image data corresponding to the green channel may be determined as the first target channel image data, and if the default channel is a red channel, the first channel image data corresponding to the red channel may be determined as the first target channel image data. By selecting the first target channel image data from the N first channel image data, single-channel encryption of the initial image is realized, and the influence of the hidden watermark data on the content of the initial image is reduced, so that the display effect of the initial image cannot be influenced by the hidden watermark data, and the practicability of image encryption is improved. Further optionally, the green channel may be directly determined as a default channel, the first target channel image data for writing the hidden watermark data may be determined based on a processing principle of a green screen in the field of video, that is, the green channel may form a strong contrast with other colors, and has a better imaging effect and a better separation effect.
For example, please refer to fig. 4, fig. 4 is a schematic diagram of an image multi-layer encryption scene according to an embodiment of the present disclosure. As shown in fig. 4, a computer device may obtain an image 401 to be encrypted and plaintext watermark data, and assuming that the plaintext watermark data is "2021030632", write the plaintext watermark data into the image 401 to be encrypted, and generate an initial image 402 containing a plaintext watermark. Optionally, the computer device may write m pieces of plaintext watermark data in the image to be encrypted 401 to generate the initial image 4002, where m is a positive integer. As shown in fig. 4, plaintext watermark data is written in three positions, namely, the upper left corner, the middle position, and the lower right corner of the image to be encrypted 401, where m is 3, and of course, the number of plaintext watermark data to be written in the image to be encrypted 401 may be determined as needed, that is, the value of m may be determined as needed. The computer device may perform channel division on the initial image 402 to obtain N first channel image data 403, including the first channel image data 4031, the first channel image data 4032, the first channel image data 4033, and the like, and acquire first target channel image data from the N first channel image data 403.
Step S302, performing spectrum conversion on the first target channel image data to generate a first channel spectrum image, writing the hidden watermark data into the first channel spectrum image, and generating a channel encrypted spectrum image.
In this embodiment of the application, the computer device may perform interpolation processing and image information extension on the first target channel image data to generate first completion channel image data, where the interpolation processing and the image information extension are used to perform scale conversion on the first target channel image data, so that an image obtained after the scale conversion is more suitable for performing spectrum conversion, that is, the image obtained after the scale conversion is subjected to spectrum conversion, and spectrum conversion efficiency may be improved. Further, the computer device may perform data format conversion on the first completion channel image data to generate first floating point channel image data, where the first floating point channel image data may be a floating point number two-dimensional array, and optionally, the floating point number of the floating point number two-dimensional array may be determined based on spectrum conversion, for example, the first floating point channel image data may be a 32-bit floating point number two-dimensional array, or the like, that is, the floating point number may be 32, or the like, which is not limited herein, where the first floating point channel image data may be subjected to spectrum conversion, that is, the computer device performs data format conversion on the first completion channel image data to generate first floating point channel image data that can be used for spectrum conversion. The computer device may perform a spectrum conversion on the first floating-point channel image data to generate a first channel spectrum image, where a spectrum conversion algorithm for performing the spectrum conversion on the first floating-point channel image data may be any algorithm that can perform the spectrum conversion, such as Discrete Fourier Transform (DFT) and the like. Optionally, the first channel spectrum image may be an image in a complex format, and the first channel spectrum image may include real-part spectrum data and imaginary-part spectrum data, where the real-part spectrum data may represent location information of a pixel point in the first floating-point channel image data, and the imaginary-part spectrum data may represent pixel information of the pixel point, where the pixel information includes, but is not limited to, an amplitude, a color, a brightness, a depth, a pixel value size, and the like of the pixel point.
When interpolation processing and image information extension are performed on the first target channel image data to generate first completion channel image data, the computer device may determine a first image extension size based on a first channel image size of the first target channel image data, and perform interpolation completion (plug-and-play processing) on the first target channel image data based on the first image extension size, that is, may perform interpolation completion (plug-and-play processing) on each pixel point based on an adjacency relation between each pixel point in the first target channel image data and pixel data and the like corresponding to each pixel point, respectively, to generate the first completion channel image data. Alternatively, the computer device may determine the first image extension size based on the first channel image size of the first target channel image data, and create the first interpolated image data based on the first image extension size, and optionally, the first interpolated image data may be a blank image data, and the transparency of the first interpolated image data may be 0, so that when the first interpolated image data is added to the first target channel image data, the first target channel image data is not noisy. And merging the first interpolation image data and the first target channel image data to generate first completion channel image data. Wherein, the computer device may obtain a spectrum transformation size condition, determine the first image extension size based on the first channel image size and the spectrum transformation size condition, for example, the spectrum transformation algorithm for performing the spectrum transformation is Discrete Fourier Transform (DFT), the spectrum transformation size condition corresponding to the spectrum transformation algorithm may be "the picture length and the picture width are multiples of 2, 3 or 5, etc., on the basis of the first channel image size, the computer device determines the first image extension size based on the spectrum transformation size condition, at this time, the first image extension size is multiples of 2, 3 or 5, etc., and the first image extension size is greater than or equal to the first channel image size, so that the complete information of the first target channel image data can be retained, the data loss of the first target channel image data can be reduced, and the first channel image size is processed under the spectrum transformation size condition, and obtaining a first image extension size, and after image information extension is performed on the first target channel image data based on the first image extension size, improving the frequency spectrum conversion efficiency of the generated first complementing channel image data, and further improving the image encryption efficiency. The spectrum conversion size condition may be updated based on a spectrum conversion algorithm, experimental data of spectrum conversion, and the like.
Further, the computer device can acquire a hidden watermark format, and perform data format conversion on the hidden watermark data based on the hidden watermark format to obtain target hidden watermark data; the hidden watermark format may include a hidden watermark font format (such as a font size, a font type, a font baseline, and the like) and a hidden watermark color format, and the hidden watermark data may be any watermark type data, such as text watermark type data (i.e., text hidden watermark data), digital watermark type data (i.e., digital hidden watermark data), or image watermark type data (i.e., image hidden watermark data). The computer device can obtain second watermark size information of the target hidden watermark data, and based on the second watermark size information, the target hidden watermark data is written into the first channel spectrum image to generate a channel encrypted spectrum image. The second watermark size information may include watermark size information and watermark position information when the target hidden watermark data is written in the first channel spectrum image. Based on the spectrum encryption, the hidden watermark data is written into a spectrogram corresponding to a single channel of the initial image, the influence on the display effect of the image is small, and the concealment of the watermark in the image encryption is improved.
Further, when the target hidden watermark data is written into the first channel spectrum image based on the second watermark size information to generate the channel encrypted spectrum image, the computer device may write k target hidden watermark data into the first channel spectrum image, where the k target hidden watermark data are written into the first channel spectrum image, and the positions of the k target hidden watermark data written into the first channel spectrum image may be random, such as sequentially arranged writing or default positions; or, based on quadrant conversion, writing k pieces of target hidden watermark data into a first channel spectrum image to obtain an image with symmetric watermarks, specifically, based on second watermark size information, writing the target hidden watermark data into the first channel spectrum image by the computer device to generate initial quadrant image data; carrying out symmetrical transformation on the initial quadrant image data to generate transformation quadrant image data, wherein the symmetrical transformation can be carried out on the basis of a central axis of the initial quadrant image data, or can be carried out on the basis of dividing the initial quadrant image data into a plurality of quadrant areas, carrying out symmetrical transformation on the basis of quadrant adjacent lines among the quadrant areas and the like; and writing the target hidden watermark data into the conversion quadrant image data based on the second watermark size information to generate a channel encryption spectrum image. Optionally, the computer device writes the target hidden watermark data into the transform quadrant image data, may also perform rotation transform on the transform quadrant image data written with the target hidden watermark data, and writes the target hidden watermark data into the image after rotation transform again until a channel encrypted spectrum image is obtained.
For example, as shown in fig. 4, the computer device performs spectrum conversion on first target channel image data to generate a first channel spectrum image 404, writes the target hidden watermark data "txcontent" into the first channel spectrum image 404 assuming that the target hidden watermark data is "txcontent", generates initial quadrant image data 405, and performs symmetric transformation on the initial quadrant image data 405 to generate transformed quadrant image data 406. The target hidden watermark data "txcontent" is written into the transform quadrant image data 406, and a channel encrypted spectrum image 407 is generated.
And step S303, carrying out image fusion on the channel encrypted frequency spectrum image and the original channel image data to generate a target encrypted image.
In the embodiment of the present application, the original channel image data is the first channel image data except the first target channel image data in the N first channel image data. The computer device may perform Inverse Fourier Transform (IDFT) processing on the channel-encrypted spectral image to generate second floating-point channel image data; and carrying out image fusion on the second floating point channel image data and the original channel image data to generate a target encrypted image. Specifically, the computer device may obtain a channel encryption size of the second floating point channel image data, perform interpolation processing and image information extension on the original channel image based on the channel encryption size, and generate conversion channel image data, where the image size of the conversion channel image data is the channel encryption size, so that the conversion channel image data may be merged with the second floating point channel image data; and merging the second floating point channel image data and the conversion channel image data to generate a target encrypted image. As shown in fig. 4, the computer device may combine the second floating-point channel image data corresponding to the channel encrypted spectral image 407 with the transformed channel image data after the original channel image is transformed, to generate a target encrypted image 408, where the target encrypted image 408 is almost the same as the original image 402, that is, the hidden watermark data is almost invisible in the target encrypted image 408 obtained after the encryption, so as to improve the concealment of the watermark in the image encryption. The computer device may also store the target encrypted image 408, among other things.
The image encryption may be used for copyright maintenance, or may be used for information protection, etc. For example, the computer device receives an acquisition request of a target user for service data, acquires the service data of the target user, performs image encryption on the service data based on the image encryption method, generates a target encrypted image corresponding to the service data, and sends the target encrypted image to target user equipment where the target user is located. The service data may be any kind of data, such as data generated by a target user in an application program, and the application program may be an instant messaging program, a game application, a transaction application, or the like, which is not limited herein. Optionally, the computer device may only write hidden watermark data in the service data, where the hidden watermark data may be a user identifier of a target user, a program identifier of an application program where the service data is located, or randomly generated watermark data, and the like, which is not limited herein. The computer equipment can also write the plain text watermark data and the hidden watermark data into the service data. The plaintext watermark data and the hidden watermark data may be the same, for example, both the plaintext watermark data and the hidden watermark data may be a user identifier of a target user, a program identifier of an application program in which the service data is located, or randomly generated watermark data. Or, the plaintext watermark data and the hidden watermark data may also be different, for example, the plaintext watermark data is a user identifier of a target user, and is used for displaying on an image to indicate that the service data is data of the target user, and the hidden watermark data may be any watermark data except the user identifier of the target user, such as a program identifier of an application program where the service data is located, or randomly generated watermark data; alternatively, the service data is randomly generated watermark data, and the hidden watermark data may be any watermark data other than the randomly generated watermark data, and the like, which is not limited herein.
Alternatively, the computer device may perform image encryption on data and the like generated in the target application program based on the image encryption method, that is, the computer device may generate an initial image based on the data and the like generated in the target application program, perform image encryption on the initial image, and generate a target encrypted image, so as to indicate that the copyright of the target encrypted image belongs based on a hidden watermark (i.e., a watermark corresponding to the hidden watermark data) carried in the target encrypted image.
Further, referring to fig. 5, fig. 5 is a diagram of a data conversion scenario in an image encryption process according to an embodiment of the present application. As shown in fig. 5, the computer device obtains an image to be encrypted, and performs image loading on the image to be encrypted to obtain original image information of the image to be encrypted; writing the plaintext watermark data into the original image information to perform plaintext encryption on the original image information to generate an initial image containing the plaintext watermark; the method comprises the steps of performing channel division on an initial image to obtain N first channel image data, and obtaining first target channel image data from the N first channel image data; performing interpolation processing on the first target channel image data to create first interpolation image data; merging the first interpolation image data and the first target channel image data to generate first completion channel image data; the first completion channel image data is subjected to spectrum conversion to obtain a first channel spectrum image, specifically, the first completion channel image data is subjected to data format conversion to generate first floating point channel image data, and the first floating point channel image data is subjected to spectrum conversion to generate a first channel spectrum image.
Further, writing the target hidden watermark data into a first channel frequency spectrum image to encrypt a ciphertext of the first channel frequency spectrum image to generate initial quadrant image data; carrying out symmetrical transformation on the initial quadrant image data to generate transformation quadrant image data; the target hidden watermark data is written into the transform quadrant image data to generate a channel encrypted spectrum image, and specifically, the target hidden watermark data can be written into the transform quadrant image data to encrypt the transform quadrant image data to generate transform encrypted image data, and the transform encrypted image data is transformed to restore the quadrant of the transform encrypted image data to generate the channel encrypted spectrum image. The channel encrypted spectrum image is subjected to inverse spectrum conversion (i.e., inverse fourier transform processing) to generate second floating-point channel image data, specifically, the channel encrypted spectrum image is subjected to inverse spectrum conversion to generate inverse spectrum image data, and the inverse spectrum image data is subjected to numerical processing to obtain second floating-point channel image data, where the second floating-point channel image data may be a floating-point two-dimensional array, such as a 32-bit floating-point two-dimensional array. And merging the second floating point channel image data and the original channel image data to realize image fusion between the second floating point channel image data and the original channel image data and generate a target encrypted image, wherein the original channel image data is first channel image data except the first target channel image data in the N first channel image data.
In the embodiment of the application, a computer device acquires an initial image, performs channel division on the initial image to obtain N first channel image data, and acquires first target channel image data from the N first channel image data; n is a positive integer; carrying out spectrum conversion on the first target channel image data to generate a first channel spectrum image, writing the hidden watermark data into the first channel spectrum image, and generating a channel encryption spectrum image; carrying out image fusion on the channel encryption frequency spectrum image and the original channel image data to generate a target encryption image; the original channel image data is first channel image data except the first target channel image data in the N first channel image data. The initial image is subjected to channel division, first target channel image data are obtained from each first channel image data obtained after division, and the hidden watermark data are written in the first target channel image data, so that the hidden watermark data are only added into a single channel in the initial image, the influence on the initial image is small, the change of the hidden watermark data on the data of the initial image is reduced as much as possible, and the practicability of image encryption can be improved. Moreover, when the hidden watermark data is added to the first target channel image data, the hidden watermark data is added to the spectrogram corresponding to the first target channel image data, so that hidden encryption of the hidden watermark data is realized, the hidden watermark data in the obtained target encrypted image is almost invisible to naked eyes, and the visual invisibility and the concealment of image encryption are improved. In addition, through the single-channel data processing, the spectrum image encryption and the like, the information integrity of reverse reduction decryption is greatly reserved, and therefore the efficiency and the flexibility of image encryption and decryption can be improved.
Further, please refer to fig. 6, fig. 6 is a flowchart of an image decryption method according to an embodiment of the present application. As shown in fig. 6, the image decryption process includes the following steps:
step S601, obtaining an image to be decrypted, dividing channels of the image to be decrypted to obtain N second channel image data, and obtaining second target channel image data from the N second channel image data.
In the embodiment of the application, N is a positive integer, the second target channel image data is obtained by writing the hidden watermark data into the first target channel image data, the first target channel image data is obtained by performing channel division on the initial image, and the image to be decrypted is generated by performing image encryption on the initial image. In other words, the image decryption process is configured to perform image decryption on the target encrypted image generated in the image encryption process, at this time, the image to be decrypted is the target encrypted image, and the second target channel image data is generated according to the target hidden watermark data corresponding to the hidden watermark data written in the first target channel image data, and the second floating point channel image data obtained after the image conversion is performed. The process of dividing the channel of the image to be decrypted may refer to a process of dividing the channel of the initial image, a process of acquiring the second target channel image data from the N second channel image data, and a process of acquiring the first target channel image data from the N first channel image data, which are not described herein again. And the channel corresponding to the second target channel image data is the same as the channel corresponding to the first target channel image data.
For example, please refer to fig. 7, fig. 7 is a schematic diagram of an image decryption scenario provided in the embodiment of the present application. As shown in fig. 7, the computer device may obtain an image 701 to be decrypted, perform channel division on the image 701 to be decrypted to obtain N second channel image data 702, where the N second channel image data 702 includes second channel image data 7021, second channel image data 7022, second channel image data 7023, and the like, and obtain second target channel image data 703 from the N second channel image data 702, where it is assumed in fig. 7 that the second target channel image data 703 is the second channel image data 7022.
Step S602, performing spectrum conversion on the second target channel image data to generate a second channel spectrum image.
In this embodiment of the application, the computer device may perform interpolation processing and image information extension on the second target channel image data to generate second completion channel image data, where the interpolation processing and the image information extension are used to perform scale conversion on the second target channel image data, so that an image obtained after the scale conversion is more suitable for performing spectrum conversion, that is, the image obtained after the scale conversion is subjected to spectrum conversion, and spectrum conversion efficiency may be improved. Further, the computer device may perform data format conversion on the second completion channel image data to generate third floating-point channel image data, where the third floating-point channel image data may be subjected to spectrum conversion, that is, the computer device performs data format conversion on the second completion channel image data to generate third floating-point channel image data that may be used for spectrum conversion. The computer device may perform spectrum conversion on the third floating-point channel image data to generate a second channel spectrum image, where the spectrum conversion algorithm for performing spectrum conversion on the third floating-point channel image data may be any algorithm that can perform spectrum conversion, such as DFT or the like. Optionally, the second channel spectrum image may be an image in a complex format, and the second channel spectrum image may include real part image data and imaginary part image data, where the real part image data may represent position information of a pixel point in the third floating point channel image data, and the imaginary part image data may represent pixel information of the pixel point, where the pixel information includes, but is not limited to, an amplitude, a color, a brightness, a depth, a pixel value size, and the like of the pixel point.
When interpolation processing and image information extension are performed on the second target channel image data to generate second completion channel image data, the computer device may determine a second image extension size based on a second channel image size of the second target channel image data, and create second interpolation image data based on the second image extension size; and merging the second interpolation image data and the second target channel image data to generate second completion channel image data. The generation process of the second completion channel image data may refer to the generation process of the first completion channel image data in step S302 in fig. 3, and is not described herein again.
Step S603, performing amplitude suppression processing on the second channel spectrum image to generate a hidden watermark image.
In an embodiment of the present application, the hidden watermark image includes hidden watermark data. The computer device may perform data splitting on the second channel spectrum image to obtain real part image data and imaginary part image data, and may record the real part image data as planes [0] and record the imaginary part image data as planes [1 ]. Further, the computer device may perform gradient transformation on the real part image data and the imaginary part image data to generate gradient image data, and the gradient transformation function used for the gradient transformation may be any function that can calculate the amplitude of the two-dimensional vector, such as a magnitude function; at this time, the obtained gradient image data has too large amplitude and is not suitable for display, for example, assuming that the image to be decrypted is an RGB image, the normal amplitude range for the RGB image is 0 to 255, and the gradient image data has an amplitude larger than 255, so that the gradient image data cannot be normally displayed, the gradient image data may be subjected to amplitude suppression processing to generate a hidden watermark image. As shown in fig. 7, the second target channel image data 703 is subjected to spectrum conversion to generate a second channel spectrum image 704, and the second channel spectrum image is subjected to amplitude suppression processing to generate a hidden watermark image 705.
Specifically, when the amplitude suppression processing is performed on the gradient image data to generate the hidden watermark image, the computer device may perform numerical scale transformation on the gradient image data to generate scale image data, where the numerical scale transformation may be logarithmic scale transformation or open scale transformation, and the like. Further, the computer device may process the scale image data to obtain a hidden watermark image, and specifically, may cut the null image data in the scale image data to obtain cut image data (the process is a process that needs to be retained after experimental verification, and may improve the effect and accuracy of image decryption); acquiring encryption quadrant information, performing quadrant conversion on the clipped image data based on the encryption quadrant information, and generating watermark quadrant image data, wherein the encryption quadrant information may include quadrant boundary information, quadrant division information, and the like, for example, the encryption quadrant information is four-quadrant division information based on an image central axis, the computer device may divide the clipped image data into four clipped subgraphs based on the central axis of the clipped image data, regard each clipped subgraph as a quadrant of the clipped image data, redistribute the four clipped subgraphs, and generate watermark quadrant image data, that is, may overlap vertices corresponding to the distribution of the four clipped subgraphs to a picture center, and generate watermark quadrant image data. And normalizing the watermark quadrant image data to generate a hidden watermark image, so that the amplitude of the hidden watermark image is within a normal amplitude range, if the image to be decrypted is an RGB image, the normal amplitude range is 0-255, and the amplitude of the hidden watermark image is within 0-255. Alternatively, the computer device may output the hidden watermark image, or may store the hidden watermark image.
Further, referring to fig. 8, fig. 8 is a view of a data conversion scenario in an image decryption process according to an embodiment of the present application. As shown in fig. 8, the computer device obtains an image to be decrypted, performs channel division on the image to be decrypted to obtain N second channel image data, specifically, performs image loading on the image to be decrypted to obtain image information to be decrypted of the image to be decrypted, and performs channel division on the image information to be decrypted to obtain N second channel image data. And acquiring second target channel image data from the N second channel image data. Performing interpolation processing on the second target channel image data to create second interpolation image data; merging the second interpolation image data and the second target channel image data to generate second completion channel image data; and performing spectrum conversion on the second completion channel image data to obtain a second channel spectrum image, specifically, performing data format conversion on the second completion channel image data to generate third floating point channel image data, and performing spectrum conversion on the third floating point channel image data to generate the second channel spectrum image. Carrying out data splitting on the second channel frequency spectrum image to obtain an image group comprising real part image data and imaginary part image data; and performing gradient conversion on the real part image data and the imaginary part image data included in the image group to generate gradient image data. Carrying out numerical scale transformation on the gradient image data to generate scale image data; cutting the scale image data to obtain cut image data; performing quadrant conversion on the cut image data to generate watermark quadrant image data; and normalizing the watermark quadrant image data to obtain a gray level image after amplitude suppression, and outputting the gray level image as a hidden watermark image.
The image decryption can be used for extracting the watermark in the image to be verified, and the copyright of the image to be verified is determined based on the extracted watermark. When the user equipment uses the target encrypted image, the computer equipment can determine the copyright of the target encrypted image based on the watermark data carried in the target encrypted image, and further detect whether the target encrypted image is abnormally used. If the to-be-verified image used in the to-be-verified device is obtained, the to-be-verified image can be subjected to image decryption to obtain to-be-verified watermark data carried in the to-be-verified image, if the to-be-verified watermark data belongs to watermark data associated with a target application program, the to-be-verified image is determined to be an abnormal use image, and an image abnormality prompting message is sent to the to-be-verified device.
In the embodiment of the present application, the image decryption process is a process responding to the image encryption process, and the beneficial effects of the image decryption process can be referred to as the beneficial effects of the image encryption process, which are not described herein again. Furthermore, the image decryption process can realize the image decryption of the image to be decrypted without reserving the initial image and the hidden watermark data, thereby improving the flexibility of the image decryption.
Further, referring to fig. 9a to 9b, fig. 9a is a schematic diagram of an image decryption effect based on the region screenshot provided in the embodiment of the present application, and is an experimental result of the effect of decrypting the image. As shown in fig. 9a, a computer device may perform a region screenshot on an image 901 to be decrypted to obtain a first captured image 902, perform image decryption on the first captured image 902 to obtain a first hidden watermark image 903 corresponding to the first captured image 902, and as can be seen from the first hidden watermark image 903, the hidden watermark data included in the image 901 to be decrypted is "txcontent". Fig. 9b is a schematic diagram of another image decryption effect based on a region screenshot provided in this embodiment of the present application, as shown in fig. 9b, a computer device may perform the region screenshot on an image to be decrypted 904 to obtain a second captured image 905, perform image decryption on the second captured image 905 to obtain a second hidden watermark image 906 corresponding to the second captured image 905, and as can be seen from the second hidden watermark image 906, hidden watermark data included in the image to be decrypted 904 is "txcontent". As can be seen from fig. 9a to 9b, since the hidden watermark data is located in the spectral image, for the interception of the image to be decrypted and the like, the loss of information in the spectral image is small, and the intercepted image intercepted from the image to be decrypted is decrypted, so that relatively complete hidden watermark data can be obtained, that is, the image encryption and decryption method in the present application has relatively good attack resistance, and the security of the encrypted image can be improved to a certain extent.
Further, the application can be applied to data transmission in the field of games, for example, in a game application program, a computer device responds to a service data query request for a game user, obtains target service data corresponding to the service data query request, encrypts the target service data based on an image encryption method in the application, generates an encrypted service encryption image, and sends the encrypted service encryption image to a user device where the game user is located. The target business data may be any game data generated by the game user in a game application, such as account information, equipment data, game asset circulation information, or game social information of the game user.
Optionally, whether the image to be verified belongs to the game application program may be detected based on the image decryption method in the present application. For example, the computer device may receive an image to be verified sent by a game user, perform decryption processing on the image to be verified, obtain watermark data to be verified carried in the image to be verified, and if the watermark data to be verified belongs to game watermark data associated with a game application program, consider that the image to be verified belongs to the game application program. The image detection result obtained by detecting whether the image to be verified belongs to the game application program may include a result that the image to be verified belongs to the game application program and a result that the image to be verified does not belong to the game application program, and may be used to detect an abnormal use condition of the image to be verified, or may be used to indicate image validity of the image to be verified, and the like, which is not limited herein. For example, the image to be verified is acquired by the computer device in another application program, if the image to be verified belongs to the game application program, the image usage right of the other application program is acquired, and when the other application program does not have the image usage right of the game application program, it is determined that the image to be verified is an abnormal usage image, and an image abnormality prompting message is sent to the device associated with the other application program using the image to be verified. Or, the image to be verified is sent by the game user, for example, the game application program performs a game activity, the credential of the game user participating in the game activity is encrypted to generate a credential encrypted image, the credential encrypted image is sent to the user equipment where the game user is located, when the game activity starts, the image to be verified can be obtained from the game user, the image to be verified is decrypted to obtain the watermark data to be verified in the image to be verified, if the watermark data to be verified belongs to the game application program, the image to be verified is determined to be an effective image, and at this time, the image to be verified is the credential encrypted image; and if the watermark data to be verified does not belong to the game application program, determining that the image to be verified is an invalid image, and sending an image invalid prompt message to the user equipment where the game user is located.
Further, please refer to fig. 10, where fig. 10 is a schematic diagram of an image encryption apparatus according to an embodiment of the present application. The image encryption apparatus may be a computer program (including program code, etc.) running in a computer device, for example, the image encryption apparatus 1000 may be an application software; the apparatus may be used to perform the corresponding steps in the methods provided by the embodiments of the present application. As shown in fig. 10, the image encryption apparatus 1000 may be used in the computer device in the embodiment corresponding to fig. 3, and specifically, the apparatus may include: the system comprises an image acquisition module 11, a first channel division module 12, a first spectrum conversion module 13, a watermark writing module 14 and an image fusion module 15.
An image acquisition module 11, configured to acquire an initial image;
the first channel division module 12 is configured to perform channel division on the initial image to obtain N first channel image data, and obtain first target channel image data from the N first channel image data; n is a positive integer;
the first spectrum conversion module 13 is configured to perform spectrum conversion on the first target channel image data to generate a first channel spectrum image;
the watermark writing module 14 is configured to write the hidden watermark data into the first channel spectrum image, and generate a channel encrypted spectrum image;
the image fusion module 15 is configured to perform image fusion on the channel encrypted spectrum image and the original channel image data to generate a target encrypted image; the original channel image data is first channel image data except the first target channel image data in the N first channel image data.
Wherein, this image acquisition module 11 includes:
a data obtaining unit 111, configured to obtain an image to be encrypted and plaintext watermark data;
the image loading unit 112 is configured to perform image loading on an image to be encrypted to obtain original image information of the image to be encrypted;
a first information obtaining unit 113, configured to obtain first watermark size information of plaintext watermark data, obtain encrypted position information, and draw a watermark frame in original image information based on the encrypted position information and the first watermark size information;
an initial image generating unit 114, configured to write plaintext watermark data into a watermark frame of original image information, and generate an initial image containing a plaintext watermark; and the plain text watermark is a watermark corresponding to the plain text watermark data.
The first spectrum conversion module 13 includes:
a first image extension unit 131, configured to perform interpolation processing and image information extension on the first target channel image data to generate first completion channel image data;
a first format conversion unit 132, configured to perform data format conversion on the first completion channel image data to generate first floating point channel image data;
the first spectrum conversion unit 133 is configured to perform spectrum conversion on the first floating-point channel image data to generate a first channel spectrum image.
The first image extending unit 131 includes:
a first image creating subunit 1311 configured to determine a first image extension size based on a first channel image size of the first target channel image data, and create first interpolation image data based on the first image extension size;
a first image completing subunit 1312, configured to perform merging processing on the first interpolation image data and the first target channel image data, and generate first completing channel image data.
The watermark writing module 14 includes:
a second format conversion unit 141, configured to obtain a hidden watermark format, and perform data format conversion on the hidden watermark data based on the hidden watermark format to obtain target hidden watermark data;
a second information obtaining unit 142, configured to obtain second watermark size information of the target hidden watermark data;
and a watermark writing unit 143, configured to write the target hidden watermark data into the first channel spectrum image based on the second watermark size information, and generate a channel encrypted spectrum image.
The watermark writing unit 143 includes:
an initial writing subunit 1431, configured to write the target hidden watermark data into the first channel spectral image based on the second watermark size information, and generate initial quadrant image data;
an image transformation subunit 1432, configured to perform symmetric transformation on the initial quadrant image data to generate transformation quadrant image data;
and an image encryption subunit 1433, configured to write the target hidden watermark data into the transform quadrant image data based on the second watermark size information, and generate a channel encrypted spectral image.
The image fusion module 15 includes:
an inverse transform unit 151 configured to perform inverse fourier transform processing on the channel-encrypted spectral image to generate second floating-point channel image data;
and an image fusion unit 152, configured to perform image fusion on the second floating-point channel image data and the original channel image data, and generate a target encrypted image.
Wherein, the image fusion unit 152 includes:
an original complementing subunit 1521, configured to obtain a channel encryption size of the second floating-point channel image data, perform interpolation processing and image information extension on an original channel image based on the channel encryption size, and generate transform channel image data;
an image merging subunit 1522, configured to merge the second floating-point channel image data with the transform channel image data, so as to generate a target encrypted image.
The embodiment of the application provides an image encryption device, which can acquire an initial image, perform channel division on the initial image to acquire N first channel image data, and acquire first target channel image data from the N first channel image data; n is a positive integer; carrying out spectrum conversion on the first target channel image data to generate a first channel spectrum image, writing the hidden watermark data into the first channel spectrum image, and generating a channel encryption spectrum image; carrying out image fusion on the channel encryption frequency spectrum image and the original channel image data to generate a target encryption image; the original channel image data is first channel image data except the first target channel image data in the N first channel image data. The initial image is subjected to channel division, first target channel image data are obtained from each first channel image data obtained after division, and the hidden watermark data are written in the first target channel image data, so that the hidden watermark data are only added into a single channel in the initial image, the influence on the initial image is small, the change of the hidden watermark data on the data of the initial image is reduced as much as possible, and the practicability of image encryption can be improved. Moreover, when the hidden watermark data is added to the first target channel image data, the hidden watermark data is added to the spectrogram corresponding to the first target channel image data, so that hidden encryption of the hidden watermark data is realized, the hidden watermark data in the obtained target encrypted image is almost invisible to naked eyes, and the visual invisibility and the concealment of image encryption are improved. In addition, through the single-channel data processing, the spectrum image encryption and the like, the information integrity of reverse reduction decryption is greatly reserved, and therefore the efficiency and the flexibility of image encryption and decryption can be improved.
Further, please refer to fig. 11, where fig. 11 is a schematic diagram of an image decryption apparatus according to an embodiment of the present application. The image decryption means may be a computer program (including program code, etc.) running on a computer device, for example, the image decryption means may be an application software; the apparatus may be used to perform the corresponding steps in the methods provided by the embodiments of the present application. As shown in fig. 11, the image encryption apparatus 1100 may be used in the computer device in the embodiment corresponding to fig. 6, and specifically, the apparatus may include: a second channel division module 21, a second spectrum conversion module 22 and an amplitude suppression module 23.
The second channel dividing module 21 is configured to obtain an image to be decrypted, perform channel division on the image to be decrypted to obtain N second channel image data, and obtain second target channel image data from the N second channel image data; n is a positive integer; the second target channel image data is obtained by writing hidden watermark data into the first target channel image data, the first target channel image data is obtained by carrying out channel division on the initial image, and the image to be decrypted is generated by carrying out image encryption on the initial image;
the second spectrum conversion module 22 is configured to perform spectrum conversion on the second target channel image data to generate a second channel spectrum image;
the amplitude suppression module 23 is configured to perform amplitude suppression processing on the second channel spectrum image to generate a hidden watermark image; the hidden watermark image includes hidden watermark data.
The second spectrum conversion module 22 includes:
a second image extension unit 221, configured to perform interpolation processing and image information extension on the second target channel image data to generate second completion channel image data;
a second format conversion unit 222, configured to perform data format conversion on the second completion channel image data to generate third floating point channel image data;
and a second spectrum conversion unit 223, configured to perform spectrum conversion on the third floating-point channel image data to generate a second channel spectrum image.
Wherein, the second image extending unit 221 includes:
a second image creating subunit 2211 configured to determine a second image extension size based on a second channel image size of the second target channel image data, and create second interpolation image data based on the second image extension size;
and a second image completion subunit 2212, configured to perform merging processing on the second interpolated image data and the second target channel image data to generate second completion channel image data.
Wherein, the amplitude suppressing module 23 includes:
the data splitting unit 231 is configured to split data of the second channel spectrum image to obtain real part image data and imaginary part image data;
a gradient conversion unit 232, configured to perform gradient conversion on the real part image data and the imaginary part image data to generate gradient image data;
and an amplitude suppression unit 233, configured to perform amplitude suppression processing on the gradient image data to generate a hidden watermark image.
Wherein, the amplitude suppressing unit 233 includes:
a scale conversion subunit 2331, configured to perform numerical scale conversion on the gradient image data to generate scale image data;
an image cropping subunit 2332, configured to crop null image data in the scaled image data to obtain cropped image data;
a quadrant conversion subunit 2333, configured to obtain encryption quadrant information, perform quadrant conversion on the clipped image data based on the encryption quadrant information, and generate watermark quadrant image data;
a normalization processing subunit 2334, configured to perform normalization processing on the watermark quadrant image data to generate a hidden watermark image.
Referring to fig. 12, fig. 12 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 12, the computer device in the embodiment of the present application may include: one or more processors 1201, memory 1202, and input-output interface 1203. The processor 1201, the memory 1202, and the input/output interface 1203 are connected by a bus 1204. The memory 1202 is used for storing a computer program, which includes program instructions, and the input/output interface 1203 is used for receiving data and outputting data, such as data interaction between a computer device and a user device; the processor 1201 is configured to execute program instructions stored by the memory 1202.
When the processor 901 is located in a computer device for image encryption, the following operations may be performed:
acquiring an initial image, performing channel division on the initial image to obtain N first channel image data, and acquiring first target channel image data from the N first channel image data; n is a positive integer;
carrying out spectrum conversion on the first target channel image data to generate a first channel spectrum image, writing the hidden watermark data into the first channel spectrum image, and generating a channel encryption spectrum image;
carrying out image fusion on the channel encryption frequency spectrum image and the original channel image data to generate a target encryption image; the original channel image data is first channel image data except the first target channel image data in the N first channel image data.
When the processor 901 is located in a computer device for image decryption, the following operations may be performed:
acquiring an image to be decrypted, performing channel division on the image to be decrypted to obtain N second channel image data, and acquiring second target channel image data from the N second channel image data; n is a positive integer; the second target channel image data is obtained by writing hidden watermark data into the first target channel image data, the first target channel image data is obtained by carrying out channel division on the initial image, and the image to be decrypted is generated by carrying out image encryption on the initial image;
carrying out spectrum conversion on the second target channel image data to generate a second channel spectrum image;
carrying out amplitude suppression processing on the second channel frequency spectrum image to generate a hidden watermark image; the hidden watermark image includes hidden watermark data.
In some possible embodiments, the processor 1201 may be a Central Processing Unit (CPU), and the processor may be other general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 1202 may include both read-only memory and random access memory, and provides instructions and data to the processor 1201 and the input output interface 1203. A portion of the memory 1202 may also include non-volatile random access memory. For example, memory 1202 may also store device type information.
In a specific implementation, the computer device may execute, through each built-in functional module thereof, the implementation manner provided in each step in fig. 3 or fig. 6, which may be referred to specifically for the implementation manner provided in each step in fig. 3 or fig. 6, and is not described herein again.
The embodiment of the present application provides a computer device, including: the image processing device comprises a processor, an input/output interface and a memory, wherein the processor acquires a computer program in the memory, executes each step of the method shown in the figure 3 to perform image encryption operation, or executes each step of the method shown in the figure 6 to perform image decryption operation. The method and the device for obtaining the target channel image data have the advantages that the initial image is obtained, the channel division is carried out on the initial image to obtain N first channel image data, and the first target channel image data are obtained from the N first channel image data; n is a positive integer; carrying out spectrum conversion on the first target channel image data to generate a first channel spectrum image, writing the hidden watermark data into the first channel spectrum image, and generating a channel encryption spectrum image; carrying out image fusion on the channel encryption frequency spectrum image and the original channel image data to generate a target encryption image; the original channel image data is first channel image data except the first target channel image data in the N first channel image data. The initial image is subjected to channel division, first target channel image data are obtained from each first channel image data obtained after division, and the hidden watermark data are written in the first target channel image data, so that the hidden watermark data are only added into a single channel in the initial image, the influence on the initial image is small, the change of the hidden watermark data on the data of the initial image is reduced as much as possible, and the practicability of image encryption can be improved. Moreover, when the hidden watermark data is added to the first target channel image data, the hidden watermark data is added to the spectrogram corresponding to the first target channel image data, so that hidden encryption of the hidden watermark data is realized, the hidden watermark data in the obtained target encrypted image is almost invisible to naked eyes, and the visual invisibility and the concealment of image encryption are improved. In addition, through the single-channel data processing, the spectrum image encryption and the like, the information integrity of reverse reduction decryption is greatly reserved, and therefore the efficiency and the flexibility of image encryption and decryption can be improved.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored, where the computer program is suitable for being loaded by the processor and executing the image encryption method provided in each step in fig. 3 or the image decryption method provided in each step in fig. 6, which may specifically refer to an implementation manner provided in each step in fig. 3 or fig. 6, and is not described herein again. In addition, the beneficial effects of the same method are not described in detail. For technical details not disclosed in embodiments of the computer-readable storage medium referred to in the present application, reference is made to the description of embodiments of the method of the present application. By way of example, a computer program can be deployed to be executed on one computer device or on multiple computer devices at one site or distributed across multiple sites and interconnected by a communication network.
The computer readable storage medium may be the image encryption apparatus, the image decryption apparatus provided in any of the foregoing embodiments, or an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Memory Card (SMC), a Secure Digital (SD) card, a flash card (flash card), and the like, provided on the computer device. Further, the computer-readable storage medium may also include both an internal storage unit and an external storage device of the computer device. The computer-readable storage medium is used for storing the computer program and other programs and data required by the computer device. The computer readable storage medium may also be used to temporarily store data that has been output or is to be output.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and executes the computer instruction, so that the computer device executes the method provided in the various optional manners in fig. 3 or fig. 6, thereby implementing that the first target channel image data is obtained from each first channel image data obtained after division by performing channel division on the initial image, and the hidden watermark data is written in the first target channel image data, so that the hidden watermark data is only added to a single channel in the initial image, the influence on the initial image is small, the change brought by the hidden watermark data to the data of the initial image is reduced as much as possible, and the practicability of image encryption can be improved. Moreover, when the hidden watermark data is added to the first target channel image data, the hidden watermark data is added to the spectrogram corresponding to the first target channel image data, so that hidden encryption of the hidden watermark data is realized, the hidden watermark data in the obtained target encrypted image is almost invisible to naked eyes, and the visual invisibility and the concealment of image encryption are improved. In addition, through the single-channel data processing, the spectrum image encryption and the like, the information integrity of reverse reduction decryption is greatly reserved, and therefore the efficiency and the flexibility of image encryption and decryption can be improved.
The terms "first," "second," and the like in the description and in the claims and drawings of the embodiments of the present application are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "comprises" and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or apparatus that comprises a list of steps or elements is not limited to the listed steps or modules, but may alternatively include other steps or modules not listed or inherent to such process, method, apparatus, product, or apparatus.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the specification for the purpose of clearly illustrating the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The method and the related apparatus provided by the embodiments of the present application are described with reference to the flowchart and/or the structural diagram of the method provided by the embodiments of the present application, and each flow and/or block of the flowchart and/or the structural diagram of the method, and the combination of the flow and/or block in the flowchart and/or the block diagram can be specifically implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block or blocks of the block diagram. These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block or blocks of the block diagram. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block or blocks.
The steps in the method of the embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs.
The modules in the device can be merged, divided and deleted according to actual needs.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.

Claims (14)

1. An image encryption method, characterized in that the method comprises:
acquiring an image to be encrypted and plaintext watermark data;
carrying out image loading on the image to be encrypted to obtain original image information of the image to be encrypted;
acquiring first watermark size information of the plaintext watermark data, acquiring encryption position information, and drawing a watermark frame in the original image information based on the encryption position information and the first watermark size information;
writing the plaintext watermark data into a watermark frame of the original image information to generate an initial image containing a plaintext watermark, performing channel division on the initial image to obtain N first channel image data, and acquiring first target channel image data from the N first channel image data; n is a positive integer; the plain text watermark is a watermark corresponding to the plain text watermark data;
converting the first target channel image data to generate first floating point channel image data, performing spectrum conversion on the first floating point channel image data to generate a first channel spectrum image, writing hidden watermark data into the first channel spectrum image, and generating a channel encrypted spectrum image; the first channel spectrum image comprises real part spectrum data and imaginary part spectrum data, the real part spectrum data is used for representing position information of a pixel point in the first floating point channel image data, the imaginary part spectrum data is used for representing pixel information of the pixel point, and the pixel information comprises color, brightness, depth and pixel value of the pixel point;
carrying out image fusion on the channel encryption frequency spectrum image and original channel image data to generate a target encryption image; the original channel image data is first channel image data except the first target channel image data in the N first channel image data.
2. The method of claim 1, wherein the converting the first target channel image data to generate first floating point channel image data and the spectrally converting the first floating point channel image data to generate a first channel spectral image comprises:
performing interpolation processing and image information extension on the first target channel image data to generate first completion channel image data;
performing data format conversion on the first completion channel image data to generate first floating point channel image data;
and performing spectrum conversion on the first floating-point channel image data to generate a first channel spectrum image.
3. The method of claim 2, wherein the interpolating the first target channel image data and extending image information to generate first completion channel image data comprises:
determining a first image extension size based on a first channel image size of the first target channel image data, creating first interpolated image data based on the first image extension size;
and merging the first interpolation image data and the first target channel image data to generate first completion channel image data.
4. The method of claim 1, wherein writing hidden watermark data to the first channel spectral image to generate a channel encrypted spectral image comprises:
acquiring a hidden watermark format, and performing data format conversion on the hidden watermark data based on the hidden watermark format to obtain target hidden watermark data;
and acquiring second watermark size information of the target hidden watermark data, writing the target hidden watermark data into the first channel spectrum image based on the second watermark size information, and generating a channel encryption spectrum image.
5. The method of claim 4, wherein the writing the target hidden watermark data to the first channel spectral image based on the second watermark size information to generate a channel encrypted spectral image comprises:
writing the target hidden watermark data into the first channel frequency spectrum image based on the second watermark size information to generate initial quadrant image data;
carrying out symmetrical transformation on the initial quadrant image data to generate transformation quadrant image data;
and writing the target hidden watermark data into the conversion quadrant image data based on the second watermark size information to generate a channel encryption spectrum image.
6. The method of claim 1, wherein the image fusing the channel encrypted spectral image with original channel image data to generate a target encrypted image comprises:
performing inverse Fourier transform processing on the channel encrypted frequency spectrum image to generate second floating point channel image data;
and carrying out image fusion on the second floating point channel image data and the original channel image data to generate a target encrypted image.
7. The method of claim 6, wherein image fusing the second floating-point channel image data with original channel image data to generate a target encrypted image, comprises:
acquiring the channel encryption size of the second floating point channel image data, and performing interpolation processing and image information extension on an original channel image based on the channel encryption size to generate conversion channel image data;
and merging the second floating point channel image data and the conversion channel image data to generate a target encrypted image.
8. An image decryption method, characterized in that the method comprises:
acquiring an image to be decrypted, performing channel division on the image to be decrypted to obtain N second channel image data, and acquiring second target channel image data from the N second channel image data; n is a positive integer; the second target channel image data is obtained by writing hidden watermark data in first target channel image data, the hidden watermark data is obtained by converting the first target channel image data to generate first floating point channel image data, and performing frequency spectrum conversion on the first floating point channel image data to generate a first channel frequency spectrum image, and the hidden watermark data is written in the first channel frequency spectrum image; the first target channel image data is obtained by carrying out channel division on an initial image, and the image to be decrypted is generated after the image encryption is carried out on the initial image; the initial image is obtained by writing plaintext watermark data into an image to be encrypted; the plaintext watermark data is obtained by loading the image to be encrypted to obtain original image information of the image to be encrypted, a watermark frame is drawn in the original image information based on first watermark size information and encryption position information of the plaintext watermark data, and the watermark frame is written in based on the watermark frame; the first channel spectrum image comprises real part spectrum data and imaginary part spectrum data, the real part spectrum data is used for representing position information of a pixel point in the first floating point channel image data, the imaginary part spectrum data is used for representing pixel information of the pixel point, and the pixel information comprises color, brightness, depth and pixel value of the pixel point;
performing spectrum conversion on the second target channel image data to generate a second channel spectrum image;
carrying out amplitude suppression processing on the second channel frequency spectrum image to generate a hidden watermark image; the hidden watermark image includes the hidden watermark data.
9. The method of claim 8, wherein the spectrally converting the second target channel image data to generate a second channel spectral image comprises:
performing interpolation processing and image information extension on the second target channel image data to generate second completion channel image data;
performing data format conversion on the second completion channel image data to generate third floating point channel image data;
and performing spectrum conversion on the third floating point channel image data to generate a second channel spectrum image.
10. The method of claim 9, wherein the interpolating the second target channel image data and extending image information to generate second completion channel image data comprises:
determining a second image extension size based on a second channel image size of the second target channel image data, creating second interpolated image data based on the second image extension size;
and merging the second interpolation image data and the second target channel image data to generate second completion channel image data.
11. The method of claim 8, wherein performing amplitude suppression processing on the second channel spectral image to generate a hidden watermark image comprises:
carrying out data splitting on the second channel frequency spectrum image to obtain real part image data and imaginary part image data;
performing gradient conversion on the real part image data and the imaginary part image data to generate gradient image data;
and carrying out amplitude suppression processing on the gradient image data to generate a hidden watermark image.
12. The method of claim 11, wherein the performing amplitude suppression processing on the gradient image data to generate a hidden watermark image comprises:
carrying out numerical scale transformation on the gradient image data to generate scale image data;
cutting empty image data in the scale image data to obtain cut image data;
acquiring encryption quadrant information, and performing quadrant conversion on the cut image data based on the encryption quadrant information to generate watermark quadrant image data;
and carrying out normalization processing on the watermark quadrant image data to generate a hidden watermark image.
13. A computer device comprising a processor, a memory, an input output interface;
the processor is connected to the memory and the input/output interface, respectively, wherein the input/output interface is configured to receive data and output data, the memory is configured to store a computer program, and the processor is configured to call the computer program to enable the computer device to execute the method according to any one of claims 1 to 7 or execute the method according to any one of claims 8 to 12.
14. A computer-readable storage medium, characterized in that it stores a computer program adapted to be loaded and executed by a processor to cause a computer device having the processor to perform the method of any of claims 1-7 or to perform the method of any of claims 8-12.
CN202110563525.6A 2021-05-24 2021-05-24 Image encryption and decryption method, computer and readable storage medium Active CN113012021B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110563525.6A CN113012021B (en) 2021-05-24 2021-05-24 Image encryption and decryption method, computer and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110563525.6A CN113012021B (en) 2021-05-24 2021-05-24 Image encryption and decryption method, computer and readable storage medium

Publications (2)

Publication Number Publication Date
CN113012021A CN113012021A (en) 2021-06-22
CN113012021B true CN113012021B (en) 2021-09-17

Family

ID=76380740

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110563525.6A Active CN113012021B (en) 2021-05-24 2021-05-24 Image encryption and decryption method, computer and readable storage medium

Country Status (1)

Country Link
CN (1) CN113012021B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114331797A (en) * 2021-12-30 2022-04-12 北京百度网讯科技有限公司 Image data encryption method, image data decryption device and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3654263B2 (en) * 1999-01-25 2005-06-02 日本電信電話株式会社 Digital watermark embedding method and apparatus, and storage medium storing digital watermark embedding program
CN101246587A (en) * 2008-02-28 2008-08-20 复旦大学 Significant digital watermarking algorithm of hypercomplex number frequency domain
CN102841880A (en) * 2012-09-06 2012-12-26 天津市德力电子仪器有限公司 Quick frequency spectrum fining method based on digital signal processor

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103615996B (en) * 2013-11-14 2017-02-01 大连理工大学 Method for measuring thickness of coatings through ultrasonic signal spectrum filter technology in nondestructive mode
WO2016153936A1 (en) * 2015-03-20 2016-09-29 Digimarc Corporation Digital watermarking and data hiding with narrow-band absorption materials
AU2017254859A1 (en) * 2017-10-31 2019-05-16 Canon Kabushiki Kaisha Method, system and apparatus for stabilising frames of a captured video sequence
CN107911698B (en) * 2017-11-03 2019-07-05 清华大学深圳研究生院 The embedding grammar and detection method of video digital watermark information
CN108632369A (en) * 2018-04-28 2018-10-09 杰思敏(上海)信息科技有限公司 A kind of safe display management method of ship electronic drawing
US10757292B1 (en) * 2019-04-10 2020-08-25 Beyontech, Inc Method of embedding and extracting watermark data from original image adjusted with noise based image converted using watermark

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3654263B2 (en) * 1999-01-25 2005-06-02 日本電信電話株式会社 Digital watermark embedding method and apparatus, and storage medium storing digital watermark embedding program
CN101246587A (en) * 2008-02-28 2008-08-20 复旦大学 Significant digital watermarking algorithm of hypercomplex number frequency domain
CN102841880A (en) * 2012-09-06 2012-12-26 天津市德力电子仪器有限公司 Quick frequency spectrum fining method based on digital signal processor

Also Published As

Publication number Publication date
CN113012021A (en) 2021-06-22

Similar Documents

Publication Publication Date Title
US10579904B2 (en) Keypoint unwarping for machine vision applications
US9986290B2 (en) Video censoring
US11704764B2 (en) Method and system for generating watermark on the basis of graphic, terminal, and medium
JP5325267B2 (en) Object display device, object display method, and object display program
CN109829269A (en) Method, apparatus and system based on E-seal authenticating electronic documents
CN111402120B (en) Labeling image processing method and device
US20170070342A1 (en) Preventing Pattern Recognition in Electronic Code Book Encryption
CN112330527A (en) Image processing method, image processing apparatus, electronic device, and medium
WO2017026356A1 (en) Image processing device, image restoring device, image processing method, and image restoring method
KR20210121025A (en) Sensor device, encryption method
CN112949545A (en) Method, apparatus, computing device and medium for recognizing face image
CN113012021B (en) Image encryption and decryption method, computer and readable storage medium
CN115527101A (en) Image tampering detection method and processor
CN106203141A (en) The data processing method of a kind of application and device
CN113962838A (en) Watermark image embedding/enhancing method, device and computer system
KR20210119982A (en) Sensor device, encryption method
CN111461955A (en) Method and device for automatically increasing digital blind watermark in screenshot, electronic equipment and storage medium
CN102385760A (en) Method and system used for protecting model data
CN113177876A (en) Picture processing method and device and electronic equipment
CN114339282A (en) Method and device for transmitting anchor image picture in live broadcast interaction
CN113506090A (en) Audit data processing method and device, storage medium and electronic equipment
CN113052045A (en) Method, apparatus, computing device and medium for recognizing finger vein image
CN113052044A (en) Method, apparatus, computing device, and medium for recognizing iris image
CN113658321B (en) Three-dimensional reconstruction method, system and related equipment
CN114339256B (en) Real-time video encryption method and device based on OpenCL, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40046420

Country of ref document: HK