CN112437205B - Video encryption method and device - Google Patents

Video encryption method and device Download PDF

Info

Publication number
CN112437205B
CN112437205B CN202011292629.XA CN202011292629A CN112437205B CN 112437205 B CN112437205 B CN 112437205B CN 202011292629 A CN202011292629 A CN 202011292629A CN 112437205 B CN112437205 B CN 112437205B
Authority
CN
China
Prior art keywords
image
video
sequence
spot
grid
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
CN202011292629.XA
Other languages
Chinese (zh)
Other versions
CN112437205A (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.)
Optical Valley Technology Co ltd
Original Assignee
Optical Valley Technology 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 Optical Valley Technology Co ltd filed Critical Optical Valley Technology Co ltd
Priority to CN202011292629.XA priority Critical patent/CN112437205B/en
Publication of CN112437205A publication Critical patent/CN112437205A/en
Application granted granted Critical
Publication of CN112437205B publication Critical patent/CN112437205B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/44Secrecy systems
    • H04N1/4446Hiding of documents or document information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/44Secrecy systems
    • H04N1/4446Hiding of documents or document information
    • H04N1/4453Covering, i.e. concealing from above, or folding

Abstract

The invention is suitable for the technical field of image encryption, and provides a video encryption method and a video encryption device, wherein the method comprises the following steps: the method comprises the steps of image receiving, mesh division and numbering, mask pattern spot generation, pattern spot superposition, sine adjustment, data packaging and data sending. The invention divides the image into grids, then superposes a pattern spot on each grid, the superposition pattern of the pattern spot corresponds to the random number sequence, and then multiplies the grid pixel by the sine coefficient to perform sine adjustment, so that the image pixel is subjected to two pixel adjustments, and the encryption of the video image can be improved.

Description

Video encryption method and device
Technical Field
The invention belongs to the technical field of image encryption, and particularly relates to a video encryption method and device.
Background
The image transmission has wide application occasions, the image transmission is divided into plaintext transmission and ciphertext transmission, and the video images which need to ensure the safety are encrypted and then transmitted. Video encryption algorithms are numerous, but consistent in nature, and both shuffle (i.e., shuffle) pixels of an image and/or adjust (or replace) pixel values. For example, the chaotic image encryption method is to perform substitution encryption on image values through two sequences; the method for scrambling the row and column pixel points is to rearrange-scramble the pixel information in the original image, and restore the original image through a one-to-one correspondence relationship, wherein the secret key is a mapping vector of the row and column transformation. At present, the encryption method for image adjustment generally adjusts pixels only once, so that the encryption is not high.
Disclosure of Invention
In view of the above problems, the present invention provides a video encryption method and apparatus, and aims to solve the technical problem of low encryption type of the existing image encryption method.
The invention adopts the following technical scheme:
the video encryption method comprises the following steps:
step S1, receiving the video images shot by the camera shooting assembly, and then storing the video images to an image cache region according to the receiving time sequence, wherein the length of the video images is M pixels, and the height of the video images is N pixels;
step S2, reading video images frame by frame from the image buffer area, carrying out image grid division on the video images according to the size of 4 multiplied by 4 grids aiming at the video images read each time, dividing the video images into M multiplied by N/16 grids in total, and numbering the video image grids from left to right and from top to bottom in sequence;
step S3, calculating the pixel value mean value of all the pixels at the same position of the grid, and correspondingly storing the pixel value mean value to a 4 multiplied by 4 mask pattern spot;
step S4, generating a random number sequence of 0-3, wherein the sequence length is M multiplied by N/16, wherein, the number 0 corresponds to the mask pattern spot, the number 1 corresponds to the pattern spot of the mask pattern spot rotated by 90 degrees, the number 2 corresponds to the pattern spot of the mask pattern spot rotated by 180 degrees, the number 3 corresponds to the pattern spot of the mask pattern spot rotated by 270 degrees, and the pattern spots corresponding to the numbers in the sequence are correspondingly superposed to the pixels in the grid with the same sequence number one by one according to the sequence of the random number;
step S5, multiplying each pixel in each grid by a sine coefficient, wherein the sine coefficient of the ith row and the jth column in the grid is
Figure GDA0003489502440000021
i and j both have a value in the range of 1-4, kiIs a scaling factor for the ith row of pixels;
step S6, packing the video image multiplied by the sine coefficient, the random number sequence, the mask pattern spot and the four proportionality coefficients to form a data packet;
and step S7, sending the data packet to a background server for storage.
Further, the proportionality coefficient kiIs a random number generated between 0.5 and 1.5.
Further, in step S1, after the video image is received, the video image is first filtered and denoised, and then stored in the image buffer.
In another aspect, the video encryption apparatus comprises:
the image receiving unit is used for receiving the video images shot by the camera shooting assembly and then storing the video images to an image cache region according to a receiving time sequence, wherein the video images are M pixels in length and N pixels in height;
the grid division numbering unit is used for reading the video images from the image cache region frame by frame, carrying out image grid division on the video images according to the grid size of 4 multiplied by 4 aiming at the video images read each time, dividing the video images into M multiplied by N/16 grids in total, and numbering the video image grids from left to right and from top to bottom in sequence;
the mask pattern spot generating unit is used for calculating the pixel value mean value of all pixels at the same position of the grid and correspondingly storing the pixel value mean value to 4 multiplied by 4 mask pattern spots;
the image spot overlapping unit is used for generating a random number sequence of 0-3, the sequence length is M multiplied by N/16, wherein, the number 0 corresponds to the mask image spot, the number 1 corresponds to the image spot of which the mask image spot rotates by 90 degrees, the number 2 corresponds to the image spot of which the mask image spot rotates by 180 degrees, the number 3 corresponds to the image spot of which the mask image spot rotates by 270 degrees, and the image spots corresponding to the numbers in the sequence are overlapped to the pixels in the grids numbered in the same sequence one by one according to the sequence of the random number;
a sine adjusting unit for multiplying each pixel in each grid by a sine coefficient, wherein the sine coefficient of the ith row and the jth column in the grid is
Figure GDA0003489502440000031
i and j both have a value in the range of 1-4, kiIs a scaling factor for the ith row of pixels;
the data packing unit is used for packing the video image multiplied by the sine coefficient, the random number sequence, the mask pattern spot and the four proportionality coefficients to form a data packet;
and the data sending unit is used for sending the data packet to the background server for storage.
Further, the proportionality coefficient kiIs a random number generated between 0.5 and 1.5.
Further, the image receiving unit is further configured to, after receiving the video image, first perform filtering and denoising processing on the video image, and then store the video image in the image buffer area.
The invention has the beneficial effects that: the invention divides the image into grids, then superposes a pattern spot on each grid, the superposition pattern of the pattern spot corresponds to the random number sequence, and then multiplies the grid pixel by the sine coefficient to perform sine adjustment, so that the image pixel is subjected to two pixel adjustments, and the encryption of the video image can be improved.
Drawings
Fig. 1 is a flowchart of a video encryption method according to an embodiment of the present invention.
Figure 2 is a schematic representation of the spots corresponding to the numbers 0-3.
Fig. 3 is a block diagram of a video encryption apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
The first embodiment is as follows:
as shown in fig. 1, the video encryption method provided in this embodiment includes the following steps:
step S1, an image receiving step. The method comprises the steps of receiving video images shot by a camera shooting assembly, and storing the video images to an image cache region according to a receiving time sequence, wherein the video images are M pixels in length and N pixels in height.
The camera shooting assembly is a camera of various types, continuous video images are obtained after image acquisition, in order to avoid image transmission blocking, an image buffer area is set for buffering the received video images, for a full high-definition video image, the resolution is 1980 x 1080, so that the length of the video image is 1980 pixels, the height of the video image is 1080 pixels, and for other resolutions, such as 720P, 360P and the like, M values and N values can be correspondingly taken.
In addition, as a preferable mode, after the video image is received, the video image is firstly subjected to filtering and noise reduction processing, and then is stored in the image buffer area.
And step S2, grid division numbering step. Reading the video images from the image buffer area frame by frame, carrying out image grid division on the video images according to the grid size of 4 multiplied by 4 aiming at the video images read each time, dividing the video images into M multiplied by N/16 grids in total, and numbering the video image grids from left to right and from top to bottom in sequence.
Although the number of the long and wide pixels of the videos with different resolutions is different, as long as the existing standard resolution is adopted, the number of the long and wide pixels is a multiple of 4, according to the characteristic, the video image is divided into grids with the size of 4 multiplied by 4, so that the grids are divided into M multiplied by N/16 in total, and finally the grids are numbered, and the grids are numbered sequentially from left to right and from top to bottom in the embodiment.
Step S3, mask pattern patch generation step. And calculating the pixel value mean value of the pixels at the same position of all grids, and correspondingly storing the pixel value mean value to a 4 multiplied by 4 mask pattern spot.
The object of the invention is to adjust the pixel value of each grid pixel, where a mask pattern patch of the same size as the grid is generated, one mask pattern patch having 16 pixels, corresponding one-to-one to the grid. Each pixel value of the mask patch is the mean of the pixel values of all pixels at the same position of the grid. For example, the pixel value of the upper left pixel of the mask pattern spot is the pixel value mean of M × N/16 grid upper left pixels, and other pixels are similar.
And step S4, a speckle superimposition step. And generating a random number sequence of 0-3, wherein the sequence length is M multiplied by N/16, a number 0 corresponds to the mask pattern spots, a number 1 corresponds to the pattern spots rotated by 90 degrees by the mask pattern spots, a number 2 corresponds to the pattern spots rotated by 180 degrees by the mask pattern spots, a number 3 corresponds to the pattern spots rotated by 270 degrees by the mask pattern spots, and the pattern spots corresponding to the numbers in the sequence are correspondingly superposed to the pixels in the grids numbered in the same sequence one by one according to the sequence of the random number.
Three other pattern spots are derived according to the basic mask pattern spots, as shown in fig. 2, the pixels are p1-p16, the three pattern spots are obtained by rotating the mask pattern spots by 90 degrees, 180 degrees and 270 degrees respectively, the mask pattern spots and the derivative pattern spots are mapped and correspond to each other through 0-3 numbers respectively, specifically, a random number sequence of 0-3 numbers is directly generated, each number corresponds to one pattern spot, the random number sequence and the mask pattern spots are only stored in the follow-up process, one pattern spot does not need to be arranged for each grid, and the data storage capacity is prevented from being overlarge.
And the length of the random number sequence is consistent with the length of the grid serial number, the random number sequence is read in turn one by one, and the pixels of the corresponding pattern spots are superposed to the pixels of the corresponding grid according to the serial number.
Step S5, sine adjustment step. Multiplying each pixel in each grid by a sine coefficient, wherein the sine coefficient of the ith row and the jth column in the grid is
Figure GDA0003489502440000051
i and j both have a value in the range of 1-4, kiIs a scaling factor for the ith row of pixels.
After the pattern spots are superposed, the step adjusts the pixels of the grids, specifically, the pixels are adjusted through sine coefficients, each grid is provided with four rows and four columns of pixels, and the sine coefficient of the ith row and the jth column is
Figure GDA0003489502440000052
i and j are natural numbers in the range of 1-4, and kiIs a scaling factor of different number of lines, the same scaling factor kiIs a random number generated between 0.5 and 1.5.
And step S6, data packaging. And packaging the video image multiplied by the sine coefficient, the random number sequence, the mask pattern spot and the four scale coefficients to form a data packet.
Step S7, data transmission step. And sending the data packet to a background server for storage.
After two adjustments of pattern spot superposition and sine processing, the data confidentiality is enhanced to a certain extent. Finally, after all grid pixels of each frame of video image are adjusted, the grid pixels, the random number sequence, the mask pattern spots and the four scale coefficients k1-k4 are packaged into a data packet and sent to a server. The scale factor of a frame of video image is constant, and the pixels of each grid need to be multiplied by the corresponding scale factor. Four scaling factors also need to be generated again when encrypting the next frame of video image.
When decryption is needed, each data packet corresponds to one frame of video image. Reading the data packets one by one and analyzing, taking out the random number sequence, the mask pattern spots and the four proportionality coefficients, dividing the rest grid pixels by the corresponding proportionality coefficients according to the line number, then performing arcsine, subtracting the pattern spots corresponding to the random number sequence from the obtained grid pixels, and finally obtaining the original grid pixels, wherein all the grid pixels are the original video image data.
Example two:
as shown in fig. 3, the video encryption apparatus provided in this embodiment includes:
the image receiving unit 401 is configured to receive a video image captured by the camera module, and then store the video image into an image buffer according to a receiving time sequence, where the video image is M pixels long and N pixels high; the image receiving unit is also used for firstly carrying out filtering and noise reduction processing on the video image after receiving the video image and then storing the video image in the image buffer area.
And a grid division numbering unit 402, configured to read video images from the image buffer area frame by frame, perform image grid division on the video images according to a grid size of 4 × 4 for each read video image, divide the video images into M × N/16 grids in total, and number the video image grids from left to right in order from top to bottom.
The mask pattern generating unit 403 is configured to calculate a pixel value average of pixels at the same position in all grids, and store the pixel value average to a mask pattern of 4 × 4.
The pattern spot overlapping unit 404 is configured to generate a random number sequence of 0 to 3, where the sequence length is mxn/16, where a number 0 corresponds to the mask pattern spot, a number 1 corresponds to a pattern spot of the mask pattern spot rotated by 90 degrees, a number 2 corresponds to a pattern spot of the mask pattern spot rotated by 180 degrees, and a number 3 corresponds to a pattern spot of the mask pattern spot rotated by 270 degrees, and the pattern spots corresponding to the numbers in the sequence are overlapped to the pixels in the grid with the same sequence number in a one-to-one correspondence manner according to the sequence order of the random number sequence.
A sine adjusting unit 405 for multiplying each pixel in each grid by a sine coefficient, wherein the sine coefficient of the ith row and the jth column in the grid is
Figure GDA0003489502440000061
i and j both have a value in the range of 1-4, kiIs a scaling factor for the ith row of pixels; in this embodiment, the proportionality coefficient kiIs a random number generated between 0.5 and 1.5.
And a data packing unit 406, configured to pack the video image multiplied by the sine coefficient, together with the random number sequence, the mask pattern patch, and the four scaling coefficients, into a data packet.
And the data sending unit 407 is configured to send the data packet to the background server for storage.
The functional unit 401 and 407 correspondingly implement steps S1-S7 in the first embodiment, after the image receiving unit receives the video image, the mesh division numbering unit performs mesh division and numbering, then the mask pattern spots are generated by the mask pattern spot generating unit, the pattern spot superimposing unit sets four types of pattern spots, the four types of pattern spots are correspondingly superimposed into the mesh by one-to-one correspondence of random number sequences, the sine adjusting unit performs sine adjustment on the mesh pixels, and finally the image is packed and sent.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (6)

1. A method for video encryption, the method comprising the steps of:
step S1, receiving the video images shot by the camera shooting assembly, and then storing the video images to an image cache region according to the receiving time sequence, wherein the length of the video images is M pixels, and the height of the video images is N pixels;
step S2, reading video images frame by frame from the image buffer area, carrying out image grid division on the video images according to the size of 4 multiplied by 4 grids aiming at the video images read each time, dividing the video images into M multiplied by N/16 grids in total, and numbering the video image grids from left to right and from top to bottom in sequence;
step S3, calculating the pixel value mean value of all the pixels at the same position of the grid, and correspondingly storing the pixel value mean value to a 4 multiplied by 4 mask pattern spot;
step S4, generating a random number sequence of 0-3, wherein the sequence length is M multiplied by N/16, wherein, the number 0 corresponds to the mask pattern spot, the number 1 corresponds to the pattern spot of the mask pattern spot rotated by 90 degrees, the number 2 corresponds to the pattern spot of the mask pattern spot rotated by 180 degrees, the number 3 corresponds to the pattern spot of the mask pattern spot rotated by 270 degrees, and the pattern spots corresponding to the numbers in the sequence are correspondingly superposed to the pixels in the grid with the same sequence number one by one according to the sequence of the random number;
step S5, multiplying each pixel in each grid by a sine coefficient, wherein the sine coefficient of the ith row and the jth column in the grid is
Figure FDA0003489502430000011
i and j both have a value in the range of 1-4, kiIs a scaling factor for the ith row of pixels;
step S6, packing the video image multiplied by the sine coefficient, the random number sequence, the mask pattern spot and the four proportionality coefficients to form a data packet;
and step S7, sending the data packet to a background server for storage.
2. The video encryption method of claim 1, wherein said scaling factor k isiIs a random number generated between 0.5 and 1.5.
3. The video encryption method according to claim 2, wherein in step S1, after the video image is received, the video image is first filtered and denoised and then stored in the image buffer.
4. A video encryption apparatus, characterized in that the apparatus comprises:
the image receiving unit is used for receiving the video images shot by the camera shooting assembly and then storing the video images to an image cache region according to a receiving time sequence, wherein the video images are M pixels in length and N pixels in height;
the grid division numbering unit is used for reading the video images from the image cache region frame by frame, carrying out image grid division on the video images according to the grid size of 4 multiplied by 4 aiming at the video images read each time, dividing the video images into M multiplied by N/16 grids in total, and numbering the video image grids from left to right and from top to bottom in sequence;
the mask pattern spot generating unit is used for calculating the pixel value mean value of all pixels at the same position of the grid and correspondingly storing the pixel value mean value to 4 multiplied by 4 mask pattern spots;
the image spot overlapping unit is used for generating a random number sequence of 0-3, the sequence length is M multiplied by N/16, wherein, the number 0 corresponds to the mask image spot, the number 1 corresponds to the image spot of which the mask image spot rotates by 90 degrees, the number 2 corresponds to the image spot of which the mask image spot rotates by 180 degrees, the number 3 corresponds to the image spot of which the mask image spot rotates by 270 degrees, and the image spots corresponding to the numbers in the sequence are overlapped to the pixels in the grids numbered in the same sequence one by one according to the sequence of the random number;
a sine adjusting unit for multiplying each pixel in each grid by a sine coefficient, wherein the sine coefficient of the ith row and the jth column in the grid is
Figure FDA0003489502430000021
i and j both have a value in the range of 1-4, kiIs a scaling factor for the ith row of pixels;
the data packing unit is used for packing the video image multiplied by the sine coefficient, the random number sequence, the mask pattern spot and the four proportionality coefficients to form a data packet;
and the data sending unit is used for sending the data packet to the background server for storage.
5. The video encryption apparatus of claim 4, wherein the scaling factor k isiIs a random number generated between 0.5 and 1.5.
6. The video encryption apparatus according to claim 5, wherein the image receiving unit is further configured to, after receiving the video image, first perform filtering and denoising processing on the video image, and then store the video image in the image buffer.
CN202011292629.XA 2020-11-18 2020-11-18 Video encryption method and device Active CN112437205B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011292629.XA CN112437205B (en) 2020-11-18 2020-11-18 Video encryption method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011292629.XA CN112437205B (en) 2020-11-18 2020-11-18 Video encryption method and device

Publications (2)

Publication Number Publication Date
CN112437205A CN112437205A (en) 2021-03-02
CN112437205B true CN112437205B (en) 2022-03-15

Family

ID=74693170

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011292629.XA Active CN112437205B (en) 2020-11-18 2020-11-18 Video encryption method and device

Country Status (1)

Country Link
CN (1) CN112437205B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015170954A (en) * 2014-03-06 2015-09-28 学校法人立命館 Encryption device, decryption device, security system comprising encryption device and decryption device, program executed in encryption device and decryption device, and computer readable recording medium in which program is recorded
CN109068021A (en) * 2018-08-27 2018-12-21 优信数享(北京)信息技术有限公司 A kind of encryption and decryption method and system
CN109803142A (en) * 2019-01-08 2019-05-24 宁波工程学院 A kind of encryption area image reversible data concealing method based on adjacency prediction

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015170954A (en) * 2014-03-06 2015-09-28 学校法人立命館 Encryption device, decryption device, security system comprising encryption device and decryption device, program executed in encryption device and decryption device, and computer readable recording medium in which program is recorded
CN109068021A (en) * 2018-08-27 2018-12-21 优信数享(北京)信息技术有限公司 A kind of encryption and decryption method and system
CN109803142A (en) * 2019-01-08 2019-05-24 宁波工程学院 A kind of encryption area image reversible data concealing method based on adjacency prediction

Also Published As

Publication number Publication date
CN112437205A (en) 2021-03-02

Similar Documents

Publication Publication Date Title
TWI423659B (en) Image corretion method and related image corretion system thereof
CN108090880B (en) Image anti-distortion processing method and device
US20210174471A1 (en) Image Stitching Method, Electronic Apparatus, and Storage Medium
US9196022B2 (en) Image transformation and multi-view output systems and methods
US6327381B1 (en) Image transformation and synthesis methods
US7525541B2 (en) Data processing for three-dimensional displays
GB2578769A (en) Data processing systems
US9007391B2 (en) Image color correction for an image by a graphical processing unit looking up color corrections in a lookup table
KR101600681B1 (en) Depth convertion method of 3D images interal imaging system
Li et al. High security and robust optical image encryption approach based on computer-generated integral imaging pickup and iterative back-projection techniques
CN112437205B (en) Video encryption method and device
KR20180106549A (en) 360 degree panorama multimedia contents processing apparatus and control method thereof
US11252452B2 (en) Video encryption method and apparatus, image capture device and readable storage medium
CN103428449B (en) Apparatus and method for correction of distortion in digital image data
US20190385277A1 (en) Hardware optimisation for generating 360° images
US20160189350A1 (en) System and method for remapping of image to correct optical distortions
Joshi et al. A new method of multi color image encryption
CN107645634A (en) A kind of undistorted wide angle network video camera and safety defense monitoring system
US20090262181A1 (en) Real-time video signal interweaving for autostereoscopic display
US9681115B2 (en) In-painting method for 3D stereoscopic views generation using left and right images and a depth map
CN115438357A (en) 3D encryption method based on monocular depth rendering
KR20150019192A (en) Apparatus and method for composition image for avm system
CN109741465B (en) Image processing method and device and display device
US7760938B1 (en) Algorithm to enhance the contrast of a monochrome image
WO2009069997A2 (en) Method for image geometric transformation

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