Embodiment
To make the object, technical solutions and advantages of the present invention clearer, the present invention is made below in conjunction with the accompanying drawings further
Detailed description.
Fig. 1 is a kind of flow chart of the method for detection image flicker striped provided in an embodiment of the present invention.As shown in Figure 1,
This method comprises the following steps:
Step 101:Obtain the row mean vector of two field pictures in the video sequence to be detected;Wherein, the row average
Each element in vector is the average of the pixel value of one-row pixels in current frame image.
In an embodiment of the present invention, pixel value is set as flicker striped functional value and the product of background function value.Wherein,
Flicker striped function can be with flicker the space periodic of striped (being represented hereinafter with Flicker), flicker striped initial phase and
The function for being biased to parameter of striped is flickered, which can be the trigonometric function for including SIN function or cosine function.
In an embodiment of the present invention, flicker striped function F is represented by:
Wherein ω is the space periodic of Flicker stripeds, and d is the inclined of Flicker stripeds
Put,The initial phase of Flicker stripeds respectively in two field pictures.
Since the image with Flicker stripeds can be broken down into two parts of Flicker stripeds and background image,
Pixel value in one two field picture is represented by:
Wherein B is background function, is m * n matrix, and m and n are respectively to work as
The line number and columns of prior image frame pixel.
Since the frame output time (inverse of frame per second) of video image is not that (brightness under alternating current 50Hz became in 1/100 second
Change the cycle) or 1/120 second (the brightness period of change under alternating current 60Hz) integral multiple, cause the Flicker of the two field pictures
The phase of striped is different.The pixel value of the two field pictures in step 101 is represented by this time:
Wherein, dI is the biasing of two field pictures Flicker stripeds,WithRespectively two field pictures Flicker stripeds
Initial phase, B1And B2The background function value of pixel respectively in two field pictures.
Then the row mean vector for trying to achieve two field pictures is respectively mean (I1) and mean (I2)。
In an embodiment of the present invention, which is adjacent two field pictures;Or the flicker bar when adjacent two field pictures
When the phase difference of line curve is smaller, which can also be spaced a frame or multiple image.In an alternative embodiment of the invention, when
When known to the flicker stripe rolling speed of the video sequence to be detected, can also according to it is described flicker striped rolling speed,
If when calculating the two field pictures and there is flicker striped, the flicker striped curves of the two field pictures reaches phase during certain phase difference
Every frame number;And the two field pictures for being separated by frame number with this are subsequently calculated.
, can be with it will be understood by those skilled in the art that in order to further improve the accuracy of subsequent detection Flicker stripeds
Be calculate two field pictures flicker striped curve reach maximum phase difference when minimum be separated by frame number;And frame is separated by with the minimum
Several two field pictures are subsequently calculated.
Step 102:Obtain the ratio vector of the row mean vector of the two field pictures.
Ratio vector div detailed processes are obtained to be represented by:
Since the background image of two field pictures respective pixel is static image, i.e. B1=B2=B, tries to achieve ratio vector
During background function value can be removed, therefore the ratio vector is only related with the Flicker striped functional values of two images.
In an embodiment of the present invention, occur the situation of div=" 0/0 " in order to prevent, doing two frame line mean vector phases
Except before, first adding a correction value (offset) for every corresponding two elements in the row mean vector of two field pictures.When this
Offset relative to the element value in row mean vector it is sufficiently small when, not only avoided the situation of appearance " 0/0 ", but also will not reduced value
Produce large effect.
Detailed process represents:
Wherein, offset=max (max (mean (I1)), max (mean (I2)))/8, max represents maximizing.Repair
On the occasion of the row mean vector mean (I that offset is two field pictures1) and mean (I2) all elements in maximum 1/8.
In an embodiment of the present invention, can be to the row of two field pictures in order to reduce the calculation amount of follow-up Fourier transformation
Element in mean vector is sampled, and obtain the two field pictures it is sampled after row mean vector ratio vector.This
Field technology personnel are appreciated that the number of sampled point can be smaller when the Flicker cycles depending on the size by the Flicker cycles
When it is necessary to suitably increase the number of sampled point, the present invention does not limit the number of sampled point.
Step 103:Ratio vector is subjected to Fourier transformation and obtains spectrum information, is removed straight in the spectrum information
The spectrum information of flow component.
Since the ratio vector obtained by step 102 has certain periodicity, its cycle is by Flicker bars in two field pictures
The cycle of line determines that its phase is determined that its fluctuating range is by two field pictures by the phase difference of Flicker stripeds in two field pictures
Phase difference and biasing d are determined.Therefore Fourier transformation can be carried out using ratio vector, and frequency is done for the curve of conversion gained
Spectrum analysis, the Flicker in video sequence to be detected is detected according to frequency spectrum characteristic.
After ratio vector is carried out Fourier transformation, the frequency spectrum letter of the maximum of spectrum information necessarily DC component
Breath, and the spectrum information of the DC component can not reflect the cyclically-varying of Flicker fringe values, therefore the direct current is divided
The spectrum information of amount removes.Otherwise the spectrum position of later use spectrum information maximum and number can go out during threshold decision
Existing error.
Step 104:Flicker striped in the video sequence to be detected is detected according to the spectrum information.
In an embodiment of the present invention, in order to further improve the accuracy rate of detection, no longer for single ratio vector
Fourier transformation (FFT) frequency spectrum performs an analysis, but obtains the FFT spectrum letter for the multiple ratios vector being calculated by multiple image
The average of breath, then threshold decision is made to the spectrum mean.At this time, step 104 may include:First, by the frequency in a default frame number
Spectrum information averages to obtain mean spectrum information;Secondly, the flicker in mean spectrum infomation detection video sequence to be detected is utilized
Striped.
In an embodiment of the present invention, can be when time for detecting appearance flicker striped in the video sequence to be detected
When number reaches a predetermined threshold value, then export testing result.
It will be understood by those skilled in the art that since the space periodic and frame per second of the flicker striped of video sequence to be detected can
Can be known, it is also possible to unknown.Therefore in both cases, the detection image flicker that the embodiment of the present invention is provided
The detailed process of striping methods will be different.
When the space periodic and frame per second of the flicker striped of known video sequence to be detected, step 104 specifically may include two
A step:First, there is peak in the spectrum information for predicting the ratio vector according to the space periodic of the flicker striped
Prediction spectrum position.Secondly, judge spectrum information occur peak spectrum position whether with prediction spectrum position it is consistent, and
Whether the absolute value of peak and the ratio of all spectrum information average values are more than or equal to a predetermined threshold value;It is if returning the result
It is then to illustrate occur flicker striped in video sequence to be detected.
Fig. 2 is a kind of space periodic for flicker striped for working as known video sequence to be detected that one embodiment of the invention provides
With the flow chart of the method for detection image flicker striped during frame per second.As shown in Fig. 2, the idiographic flow of this method is:
Input parameter num, fd and T first, wherein num are accumulative frame number when seeking multiple ratio vector FFT spectrum averages,
Fd is represented as exporting one-time detection every fd frames as a result, T is the minimum alarm value of the frame number of the Flicker occurred in fd frames
(S21);Three counters count1, count2 and count3 are initialized to 0 (S22);Then chosen from video sequence
Two field pictures (S23), and try to achieve the row mean vector (S24) of the two field pictures;Seek the ratio of the row mean vector of the two field pictures
Value vector, and FFT transform is carried out to ratio vector, the result of FFT transform is added up (S25);Counter count3 is added 1
(S26), then judge whether count3 has reached num (S27);S23 is returned if not up to and reads two field pictures progress again
Calculate, to continue the result of cumulative FFT transform;If reached, average, will count to the result of the FFT transform after adding up
Number device count2 adds 1, and count3 is reset (S28), and starts the follow-up threshold value of the average progress to the FFT transform result and sentence
It is disconnected;First determine whether the ratio of maximum spectrum and all spectrum means in addition to DC component is more than a predetermined threshold value, and most
High spectrum appears in expected position (S29);If S29 judging results are Y, illustrate flicker striped occurred, at this time will meter
Number device count1 adds 1 (S210), then judges whether count2 reaches fd (S211);If S29 judging results are N, also to connect
And judge whether count2 reaches fd (S211);If S211 judging results are N, illustrate also to be not reaching to output testing result
Threshold value, returns to S23 and reads two field pictures again and calculated at this time;If S211 judging results are Y, then whether count1 is judged
T (S212) is reached;If the judging result of S212 is N, illustrate not occurring T flicker striped in fd frames, this makees nothing
Flicker prompts (S213);If the judging result of S212 is Y, illustrate to have reached the alarm for occurring T flicker striped in fd frames
Threshold value, this alarm (S214);Counter count1 and count2 are finally reset into (S215), and returns to S23 and reads two frames again
Image is calculated.
When the space periodic and frame per second of the flicker striped of the unknown video sequence to be detected, step 104 can specifically wrap
Include:Judge that the spectrum information peak is located at the frame number of a fixed frequency spectrum position and whether is more than N/2 in a default frame number N,
And whether the absolute value of the peak and the ratio of all spectrum information average values are more than or equal to a predetermined threshold value;Or, one
Judge whether respectively N/2 peak at least occur on two neighboring spectrum position in default frame number N.If any of the above one
Kind judging result is yes, then illustrates flicker striped occur in the video sequence to be detected.
Fig. 3 is a kind of space periodic for flicker striped for working as unknown video sequence to be detected that one embodiment of the invention provides
With the flow chart of the method for detection image flicker striped during frame per second.As shown in figure 3, the idiographic flow of this method is:
Input parameter fd and T first, wherein fd are represented as (namely foregoing default every fd frames output one-time detection result
Frame number N), T is the minimum alarm value (S31) of the frame number of the flicker striped occurred in fd frames;Counter count is initialized as 0
(S32);Then two field pictures (S33) are chosen from video sequence, and try to achieve the row mean vector (S34) of the two field pictures;Ask
The ratio vector of row average, and reduced value vector does FFT transform, after DC component frequency spectrum is removed, stores the FFT transform frequency spectrum
(S35);Counter count is added into 1 (S36), then judges whether count has reached fd (S37);Returned if not up to
S33 reads the calculating that two field pictures carry out next round FFT transform frequency spectrum again;If reached, illustrate to have reached output detection
As a result threshold value, at this time resets counter count, and flicker striated state value Flicker is initialized as 0 (S38);Then
In this fd frame exports testing result, the position of maximum spectrum appearance is counted, records other positions in addition to first spectrum position
Put the number (S39) for maximum spectrum occur;Whether the number for then judging spectrum information peak occur in a fixed position is big
In equal to T (S310);If S310's returns the result as Y, the flat of the peak that occurs in the fixed position is and then calculated
Average and the ratio r atio (S311) of all spectrum means;Then judge whether ratio is more than or equal to a predetermined threshold value
(S312);If S312's returns the result as Y, Flicker is assigned a value of 1 (S313), S316 is then entered if N to Flicker
Value whether be 1 to be judged;If S310's returns the result as N, judge whether respectively to go out on two neighboring spectrum position
Fd/2 maximum (S314) is showed;If S314's returns the result as Y, Flicker is assigned a value of 1 (S313), if N then into
Whether enter S316 is 1 to judge to the value of Flicker;If the judging result of S316 is Y, prove flicker striped occurred,
This alarm (S318);If the judging result of S316 is N, the prompting (S317) for not occurring flickering striped is done.
A kind of method of detection image flicker striped provided in an embodiment of the present invention, based on Fourier transformation, will treat
The flicker striped function information for detecting different two field pictures in video sequence is converted for spectrum information by Fourier transformation.And energy
The flicker striped being accurately judged to according to the frequency spectrum characteristic of spectrum information in video sequence to be detected, when detection process is from exposure
Between and the limitation of single-frame images output time, filled up the technological gap for the flicker striped that the exposure of current detection row produces.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention
Within god and principle, any modification for being made, equivalent substitution etc., should all be included in the protection scope of the present invention.