Based on when inclined feature the homologous Copy-Move detection method of video
Technical field
The present invention relates to altering detecting methods in video frame, and in particular, to it is a kind of based on when inclined feature video it is homologous
Copy-Move detection method.
Background technique
With the progress of video processing technique, the technical costs that video is distorted also is reduced therewith, causes to distort video now
It is seen everywhere.It can be used as the monitor video of judicial expertise evidence always in the past, not as nowadays apparently also becoming before
It is credible.Meanwhile the maturation of Internet technology, also allow the social effectiveness for distorting video to ramp, video distorts illegal criminal
Guilty cost decline.In this case, on the one hand need to improve Web content supervision, on the other hand need to distort video into
The effective detection of row.
It is distorted currently, video is distorted to be broadly divided into distort in frame with interframe, it is that interpolater is other to view in frame level that interframe, which is distorted,
Frequency carries out including the atomic operations such as frame deletion, frame insertion.Distorted in frame be in video frame some object or some part
(such as removing some object occurred in video) is distorted, specifically distorting operation may include insertion, covering, repairs
Deng.Such operation object distorted is some region of video frame, is similar to distorted image, and interpolater needs to carry out to distorting area
The processing at domain edge visible distorts trace to avoid leaving.Since object can continue a period of time occur in video, cause
The work distorted may need to carry out in continuous multiframe.Briefly, it is to distort behaviour as unit of video frame that interframe, which is distorted,
Make, and distorted in frame, be with pixel is to distort unit substantially.
It is found by the retrieval to Copy-Move tampering detection technology in existing frame, Publication No. CN103945228A, it is public
It opens the Chinese patent that day is on July 23rd, 2014 and describes that a kind of " copy-move is distorted in the video frame based on space-time relationship
Detection method ", this method determine that video is two-by-two between frame using whole frame phase correlation and the detection method of Block- matching
It is no that there are copy-move to distort.But this method is directed to the copy-move behavior of moving target, and have ignored background or
The copy-move tampering of stationary object, this has some limitations this method in tampering detection in frame.Pass through
Retrieval discovery to existing literature, Singapore scholar Subramanyam carry out detection copy-move using HOG feature, Italy
Scholar uses cross-correlation then to detect the block of copy-move in video, and no matter above which kind of mode, it is special all use space substantially
Matched mode is levied to be detected and have ignored time domain characteristic.
Summary of the invention
For the defects in the prior art, the object of the present invention is to provide it is a kind of based on when inclined feature video it is homologous
Copy-Move detection method.
There is provided according to the present invention based on when inclined feature the homologous Copy-Move detection method of video, include the following steps:
Step 1: space-time partitioning pretreatment being carried out to test video, obtains piecemeal video, and calculate and divide using LK optical flow method
The light stream sequence of block video obtains the region light stream matrix of the video;
Step 2: the region light stream matrix according to obtained in step 1 deviates square by the time domain in phase relevant calculation region
Gust, the value in each space is the space-time position coordinate most suspicious with corresponding position, including spatial position and place in excursion matrix
Frame number;
Step 3: piecemeal being carried out to test video, and calculates each piece of histograms of oriented gradients Histogram of
Oriented Gradient feature, abbreviation HOG feature generate HOG eigenmatrix;
Step 4: by step 2 can calculated every each space coordinate block of frame suspicious piece of position, calculation block with suspicious piece
HOG feature difference, generate judgement matrix, the judgement matrix and true value compared into generation accuracy rate.
Preferably, the step 1 includes the following steps:
Step 1.1: space domain partitioning is carried out to each frame of test video;
Step 1.2: the light stream of each pixel of each frame of video is calculated using LK optical flow method;
Step 1.3: the piecemeal obtained according to step 1.1, using the summation of light stream value in each piece as the light stream value of the block,
And be put in light stream matrix, obtain light stream matrixCalculation formula is as follows:
In formula: bx, by indicate block space X, Y coordinates, t0For the start frame where the light stream,Indicate t0Frame (bx,
By) the light stream value at block, (x, y) in (bx, by) indicate that all pixels in block (bx, by), of (x, y) indicate pixel
Light stream vectors at (x, y).
Preferably, space domain partitioning is carried out to each frame of test video in the step 1.1;Specifically, block size is selected
For 16 × 16 pixel sizes block and make institute's piecemeal have overlapping between each other, it is 50% that the area covered mutually, which is arranged, then weighs
Folded block area is the block of 8 × 16 pixel sizes.
Preferably, the step 1.2 includes the following steps:
Step 1.2.1: gaussian filtering is carried out to video frame, obtains smoothed image;
Step 1.2.2: the pyramid model image of the different scale of smoothed image is extracted, and to each layer of pyramid calculation
Light stream;
Step 1.2.3: each layer of light stream value is merged into complete optical flow field.
Preferably, the step 2 includes the following steps:
Step 2.1: time-domain fragment being carried out to test video, so that each fragment covers 25% frame number between each other, it may be assumed that
If overlay length is 2 frames with 8 frames for a fragment size;
Step 2.2: the block light stream after fragment being taken out as sample from light stream matrix, calculate sample and remaining space
The phase of the complete light stream sequence of block of locations is related, offset is judged whether there is, if it is present in the position of excursion matrixWrite down the offset parameter (x ', y ', t ') in place, wherein bx, by, t0Respectively the space transverse and longitudinal coordinate of sample and its place
Frame number, x ', y ', t ' are respectively that there are the space transverse and longitudinal coordinates and place frame number of the relevant offset blocks of phase to sample;It calculates every
The fragment light stream of one frame is related to the phase of light stream matrix sequence O, if there is offset parameter, then position in excursion matrix
For the offset parameter, it is otherwise set to 0.
Preferably, the phase related definition in the step 2.2 is as follows:
Using the time series of light stream size as signal, it is the sequence of N that, which just there is a length in each spatial position, and N is
Video frame number, if O is to calculate resulting light stream sequence, then
Wherein, t is frame number, and (x, y) is the block space position for calculating light stream, and F is totalframes, and W, H are respectively video frame
The number of abscissa and ordinate block, of is calculated light stream size, by space coordinate (x0, y0), time coordinate t0Locate Δ t
The light stream sequence of length is as signal templates g (t0);
Using complete light stream sequence O as original signal, g (t0) it is used as measured signal, calculate power spectrum δ (tm) it is as follows:
Wherein, Ox,y(ω)、G*(ω) is respectively Ox,y、g(t0) Fourier transformation,Indicate inverse Fourier transform,
Ox,yFor the light stream sequence for the region unit that space coordinate is (x, y), V indicates any piece.It is maximum due to there is the case where comparing certainly
Always the migration result with itself light stream alignment, another max are to take Second Largest Value to value;By acquiring and g (t0) identical light
Flow the time offset t where sequencem, tampered region is in the presence of because copy and identical sequence, and non-tampered region is then because looking for not
Original area is judged as to same sequence;
Due to by replicating the light stream sequence for pasting tampered region there are another matched light stream sequence, by will be certain
The light stream sequence of time span carries out phase relevant calculation as input and the complete light stream sequence of space coordinate, searches out possibility
Offset find and potentially distort a little, excursion matrixCalculation formula is as follows:
In formula: δ (tm) indicate in a frame light stream sequence of Δ t time span and all full times at the position bx, by
The phase relevant calculation of light stream sequence, tmIndicate the frame position that the second largest similarity is obtained in phase relevant calculation, t0Expression is worked as
The frame number of previous frame;If current block (bx, by, t0) and every other piece all do not find offset and be just set to 0, obtain each frame
Block excursion matrix P.
Preferably, the step 3 includes the following steps:
Step 3.1: video is carried out piecemeal processing by the spatial domain method of partition according to used by step 1;
Step 3.2: calculating the HOG Feature Descriptor of the block in video, be placed in spacetime coordinate locating for the block (x, y, t)
Place generates HOG matrix, is expressed as H, calculation formula is as follows:
In formula: BW, BH are respectively the sum of x, y-axis block, and hog is the function for calculating HOG.
Preferably, the step 4 includes the following steps:
Step 4.1: according to the resulting time domain excursion matrix of step 2, extracting the sequence pair that there is offset;
Step 4.2: calculating the difference of HOG description of sequence pair in 4.1, otherness is described using Euclidean distance;Its
In, decision process will generate trip current G,
In formula: ED indicates the Euclidean distance of two block HOG of calculating, and T is preset threshold value, if two block B, B' distances are less than
Threshold value T, then the judgement matrix value at the block moment is 1, is otherwise set to 0.
Compared with prior art, the present invention have it is following the utility model has the advantages that
1, it is provided by the invention based on when inclined feature the homologous Copy-Move detection method of video being capable of mode against tampering
It is limited, the region foreground and background part distorted is detected, accuracy rate is high.
2, it is provided by the invention based on when inclined feature the homologous Copy-Move detection method of video take full advantage of video
Time domain specification compensates for the deficiency of the matched mode of space characteristics, is capable of detecting when ignored background or stationary object
Copy-move tampering.
Detailed description of the invention
Upon reading the detailed description of non-limiting embodiments with reference to the following drawings, other feature of the invention,
Objects and advantages will become more apparent upon:
Fig. 1 is calculating excursion matrix flow chart provided by the invention;
Fig. 2 is model framework figure provided by the invention.
Specific embodiment
The present invention is described in detail combined with specific embodiments below.Following embodiment will be helpful to the technology of this field
Personnel further understand the present invention, but the invention is not limited in any way.It should be pointed out that the ordinary skill of this field
For personnel, without departing from the inventive concept of the premise, various modifications and improvements can be made.These belong to the present invention
Protection scope.
The invention proposes copy-move altering detecting methods in a kind of frame based on time domain offset characteristic.This method is first
The block region light stream sequence of test video is first calculated using LK optical flow method, then by the way that light stream sequence in each region is carried out phase
Correlometer calculates their offset parameter building excursion matrix, this excursion matrix describes each piece, and there may be copy-move
The space-time position of the pairing block of suspicion finally detects the Euclidean distance of the spatial texture feature between suspicion block using HOG feature,
If distance is more than threshold value, determining the two blocks, there are copy-move to distort operation.
Since such mode of distorting will certainly bring whole section translation of the area pixel across the time, it is inclined also just to produce time domain
It moves, and this property will bring the relevant detection possibility of phase in a frequency domain, so the present invention utilizes the characteristic, in conjunction with light stream
Progress tampering detection related to phase.Compared with prior art, what this method was innovative has used video time domain characteristic, while
It is that front and back scape is detected, and improves the Detection accuracy of pixel scale that tampered region, which can be ignored,.
Specifically, as shown in Fig. 2, provide according to the present invention based on when inclined feature the homologous copy-move detection of video
Method includes the following steps:
Step 1: space-time partitioning pretreatment being carried out to test video, and its light stream sequence is calculated using LK optical flow method, is obtained
The region light stream matrix of the video;
Step 2: the region light stream matrix according to obtained in step 1 is deviated by the time domain of phase correlation zoning
Matrix;
Step 3: piecemeal being carried out to test video, and calculates each piece of histograms of oriented gradients (Histogram of
Oriented Gradient, HOG) feature, generate HOG eigenmatrix;
Step 4: comparing the HOG characteristic similarity of two panel regions using excursion matrix obtained in step 2, generate judgement square
The judgement matrix and Ground Truth are compared generation accuracy rate by battle array.
The step 1 includes the following steps:
Step 1.1: space domain partitioning being carried out to each frame of test video, selects block size for 16 × 16 pixel sizes herein
Block.Meanwhile guarantee institute's piecemeal have overlapping between each other, herein selection mutually covering 50% area, then overlapping block area be 8 ×
The block of 16 pixel sizes;
Step 1.2: calculating the light stream of each each pixel of frame of video using LK optical flow method, video frame is carried out first high
This filtering, obtains smoothed image, then extract the pyramid model image of the different scale of smoothed image, and to each layer of pyramid
Light stream is calculated, complete optical flow field is finally merged into;
Step 1.3: according to the method for partition in step 1.1, calculating for convenience, ignore light stream direction attribute, statistics is every
Light stream value of the light stream value size summation as the block in a block, and be put in light stream matrix, obtain light stream matrixIt calculates public
Formula is as follows:
In formula: bx, by indicate block space X, Y coordinates, t0For the start frame where the light stream,Indicate t0Frame
Light stream value at (bx, by) block, (x, y) in (bx, by) indicate that all pixels in block (bx, by), of (x, y) indicate picture
Light stream vectors at vegetarian refreshments (x, y).
The step 2 includes the following steps:
Step 2.1: time-domain fragment being carried out to test video, and guarantees that fragment covers 25% frame number between each other, herein
According to feasibility Experiment, clip size is determined as 8 frames, is laminated in 2 frames, i.e., it is 8 frames that step-length, which is 6, clip sizes,;According to
Fragment length, the block light stream sequence extracted is region light stream, characterizes the temporal signatures in this time of the block;
Step 2.2: the block light stream after fragment being taken out as sample from light stream matrix, calculate sample and remaining space
The phase of the complete light stream sequence of block of locations is related, offset is judged whether there is, if it is present in excursion matrixPosition
Write down the offset parameter (x ', y ', t ') in the place of setting, wherein bx, by, t0The respectively space transverse and longitudinal coordinate and place frame number of sample,
X ', y ', t ' are respectively that there are the space transverse and longitudinal coordinates and place frame number of the relevant offset blocks of phase to sample;And so on, meter
The fragment light stream for calculating each frame is related to the phase of light stream matrix O ', if there is offset parameter, then position in excursion matrix
It is set to the offset parameter, is otherwise set to 0.
Phase related definition in the step 2.2 is as follows:
Using the time series of light stream size as signal, it is the sequence of N that, which just there is a length in each spatial position, and N is
Video frame number, if O is to calculate resulting light stream sequence,
Wherein, t is frame number, and (x, y) is the block space position for calculating light stream, and F is totalframes, and W, H are respectively video frame
The number of abscissa and ordinate block, of is calculated light stream size, by space coordinate (x0, y0), time coordinate t0Locate Δ t
The light stream sequence of length is as signal templates;
Using complete light stream sequence O as original signal, g (t0) it is used as measured signal, it is as follows to calculate power spectrum:
Wherein, Ox,y(ω)、G*(ω) is respectively Ox,y、g(t0) Fourier transformation,Indicate inverse Fourier transform, by
In existing from the case where comparison, always the migration result with itself light stream alignment, another max are to take Second Largest Value to maximum value;
By acquiring and g (t0) time offset t where identical light stream sequencem, tampered region in video memory in same sequence
It arranges and finds offset coordinates, non-tampered region is then judged as original area due to can not find same sequence;
Since the light stream sequence in the region Copy-Move is there are another matched light stream sequence, by will certain time it is long
The light stream sequence of degree carries out phase relevant calculation as input and the complete light stream sequence of space coordinate, can search out possibility
Offset find and potentially distort a little, excursion matrix calculation formula is as follows:
In formula: δ (tm) indicate t0The light stream of the light stream sequence of the position bx, by Δ t time span and all full times in frame
The phase relevant calculation of sequence, tmIndicate the frame position that the second largest similarity is obtained in phase relevant calculation;If current block
(bx,by,t0) and every other piece all do not find offset and be just set to zero, obtain the block excursion matrix P of each frame.
Specifically, as shown in Figure 1, being the extraction process of excursion matrix in figure:
Step 1: extracting light stream sequence from light stream matrix according to the block position of present frame;
Step 2: according to before to illustrate to calculate phase related, judge whether the peak value of energy frequency spectrum is more than threshold value, if
It is more than that the offset parameter is then write down in excursion matrix --- offset frame number, offset space coordinate;If being not above the peak of threshold value
Value, then excursion matrix position is set as 0,;
Step 3: judging that present frame whether there are also uncalculated piece, then repeats the first step if it exists, otherwise calculates next
Frame.
The step 3 includes the following steps:
Step 3.1: video is carried out piecemeal processing by the spatial domain method of partition according to used by step 1;
Step 3.2: its HOG Feature Descriptor being calculated to the block in video, is placed in spacetime coordinate locating for the block (x, y, t)
Place generates HOG matrix, is expressed as H, calculation formula is as follows:
In formula: BW, BH are respectively x, y-axis sum, and hog is to calculate hog process.
The step 4 includes the following steps:
Step 4.1: space domain partitioning being carried out to each frame of test video, selects block size for 16 × 16 pixel sizes
Block.Meanwhile guaranteeing that institute's piecemeal has overlapping between each other, 50% area of covering mutually is selected, then overlapping block area is 8 × 16 pixels
The block of size;
Step 4.2: calculating the difference of HOG description of sequence pair in 4.1, otherness is described using Euclidean distance;Its
In, decision process will generate trip current G,
In formula: ED indicates the Euclidean distance of two block HOG of calculating, and T is preset threshold value, if two block B, B' distances are less than
Threshold value T, then the judgement matrix value at the block moment is 1, is otherwise set to 0.Herein, according to feasibility test, T is set as 0.5.
Specific embodiments of the present invention are described above.It is to be appreciated that the invention is not limited to above-mentioned
Particular implementation, those skilled in the art can make various deformations or amendments within the scope of the claims, this not shadow
Ring substantive content of the invention.