CN104700405A - Foreground detection method and system - Google Patents

Foreground detection method and system Download PDF

Info

Publication number
CN104700405A
CN104700405A CN201510098306.XA CN201510098306A CN104700405A CN 104700405 A CN104700405 A CN 104700405A CN 201510098306 A CN201510098306 A CN 201510098306A CN 104700405 A CN104700405 A CN 104700405A
Authority
CN
China
Prior art keywords
current frame
frame image
image
described current
pixel
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.)
Granted
Application number
CN201510098306.XA
Other languages
Chinese (zh)
Other versions
CN104700405B (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.)
Suzhou Keda Technology Co Ltd
Original Assignee
Suzhou Keda 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 Suzhou Keda Technology Co Ltd filed Critical Suzhou Keda Technology Co Ltd
Priority to CN201510098306.XA priority Critical patent/CN104700405B/en
Publication of CN104700405A publication Critical patent/CN104700405A/en
Application granted granted Critical
Publication of CN104700405B publication Critical patent/CN104700405B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a foreground detection method and a foreground detection system. The method comprises the following steps: obtaining the current frame image; calculating the partial contrast ratio of the current frame image; establishing a multi-gaussian background model based on the partial contrast ratio; detecting a portion of foreground image in the current frame image as foreground image sample according to the multi-gaussian background model; learning the background image according to the foreground image sample and the current frame image; performing foreground target detection for the current frame image according to the background image. The technical problem that most foreground detection methods cannot be realized due to that the calculating capability of the camera processor is limited can be solved. The foreground object with small size and weak contrast ratio can be completely detected at real time by adopting limited calculating capability by the foreground detection method and the foreground detection system.

Description

A kind of foreground detection method and system
Technical field
The present invention relates to image and the technical field of video processing of video monitoring.Specifically, a kind of real-time foreground detection method and the system that adapt to Weak target is related to.
Background technology
In visual monitor system, often need to detect moving target, follow the tracks of, classify and analysis etc., and the accuracy of moving object detection directly affects follow-up process and operation.In order to adapt to scene changes complicated and changeable, the most frequently used method is exactly to background modeling, then utilizes background model to detect foreground target.Existing background modeling method mainly contains median method, averaging method, Density Estimator method, code book model, mixed Gauss model etc.
Gauss model uses Gaussian probability-density function (normal distribution curve) accurately to quantize things exactly, a things is decomposed into several models formed based on Gaussian probability-density function (normal distribution curve).Many Gauss models (i.e. mixed Gauss model) use K (being substantially 3 to 5) individual Gauss model to carry out the feature of each pixel in token image, mixed Gauss model is upgraded after a new two field picture obtains, mate with mixed Gauss model with each pixel in present image, if success, judges that this point is as background dot, otherwise is foreground point.
But mixed Gauss model upgrades background model according to the pixel-recursive of present frame, and this mistake making previous frame occur when modeling can cause long impact to background image.And, traditional mixed Gaussian background modeling can not eliminate because of illumination variation very fast time the false-alarm that causes, noise effect during low-light imaging can not be resisted, intactly can't detect the target that size is less, contrast is more weak.In addition, intelligent front end video camera needs to detect moving target round-the-clockly, higher to the requirement of algorithm, and the processor computing power of front-end camera is limited, makes the conventional background modeling algorithm of major part be difficult to real time execution.
Summary of the invention
For this reason, technical matters to be solved by this invention is that the computing power because of camera processes device is limited and causes most of foreground target detection method to be difficult to real time execution, thus propose a kind of can not only complete in real time under limited computing power foreground target detect and also completely can detect that size is less, contrast is compared with the foreground detection method of weak signal target and system.
For solving the problems of the technologies described above, the invention provides following technical scheme:
A kind of foreground detection method, comprises the following steps:
Obtain current frame image;
Calculate the local contrast of current frame image;
Set up the many Gaussian Background model based on local contrast;
Part foreground image in current frame image is gone out as foreground image sample according to many Gaussian Background model inspection;
According to foreground image sample and current frame image study background image;
According to background image, foreground target detection is carried out to current frame image.
Preferably, the step calculating the local contrast of current frame image comprises:
Current frame image is divided into the block of pixels of several m*n, wherein, m, n be greater than 0 positive integer;
Add up gray average and the gray variance of each block of pixels;
Obtain the local contrast of each block of pixels, local contrast is the business of gray variance divided by gray average gained of each block of pixels.
Preferably, according to background image, the step of current frame image being carried out to foreground target detection comprises:
Distinguish the gradient vector of each pixel in background extraction image and current frame image;
Obtain according to the gradient vector of background image and each pixel in current frame image whether the texture at each pixel place in current frame image is abundant and whether background image is consistent with the texture of current frame image;
Inconsistent at the texture of this pixel place current frame image and background image when the texture-rich at certain pixel place in current frame image, namely judge that this pixel is foreground point.
Preferably, in current frame image the texture at each pixel place whether abundant and background image consistent with the texture of current frame image is obtained by following formulae discovery:
Flat ( x , y ) = 1 v 0 2 + v 1 2 > T g 2 0 v 0 2 + v 1 2 ≤ T g 2
Diff ( x , y ) = 1 v 0 u 0 + v 1 u 1 < ( v 0 + v 1 + u 0 + u 1 ) 2 &CenterDot; T s / 2 0 v 0 u 0 + v 1 u 0 &GreaterEqual; ( v 0 + v 1 + u 0 + u 1 ) 2 &CenterDot; T s / 2
Flat (x, y) represents the texture-rich of current frame image at pixel (x, y) place, and Diff (x, y) represents the using texture homogeneity at pixel (x, y) place background image and current frame image, T gand T sfor the threshold value preset, (u 0, u 1), (v 0, v 1) represent that background image is at pixel (x respectively, y) gradient vector at place, current frame image are at pixel (x, y) gradient vector at place, Flat (x, y)=0 represents the texture-rich of current frame image at pixel (x, y) place, Diff (x, y)=1 represents inconsistent at the texture of pixel (x, y) place current frame image and background image.
Preferably, also comprise before calculating the step of the local contrast of current frame image and adaptive noise process carried out to current frame image, specifically comprise:
Obtain the noise intensity of current frame image;
When noise intensity is greater than default threshold value, then noise reduction process is carried out to current frame image.
Preferably, the step obtaining the noise intensity of current frame image comprises:
Current frame image is divided into the image block that several pixel numbers are identical;
Noise spot number in statistics current frame image in each image block;
Obtain the initial noisc intensity of current frame image, initial noisc intensity is the pixel number of intermediate value divided by image block of noise spot number in current frame image in each image block;
The noise intensity of current frame image is obtained according to the initial noisc intensity of current frame image.
Preferably, the step of the noise spot number of adding up in current frame image in each image block comprises:
Calculate the absolute value of current frame image and previous frame image gray scale difference;
According to the noise spot number in each image block in the absolute value statistics current frame image of gray scale difference, wherein, then judge that when the absolute value of the gray scale difference of certain pixel in image block is in default threshold range this pixel is noise spot.
Preferably, according to following formula to the smoothing filtration of initial noisc intensity of current frame image to obtain the noise intensity of current frame image:
N i = N i = 0 &alpha; N i - 1 + ( 1 - &alpha; ) N i > 0 ,
Wherein, α is smoothing factor, and N is the initial noisc intensity of current frame image, N ifor the noise intensity of current frame image, N i-1for the noise intensity of previous frame image, 0<N<1,0<N i<1,0<N i-1<1, i=0 represent that current frame image is the second two field picture of video.
Preferably, background image is learnt by following formula:
B ( x , y ) = B ( x , y ) &CenterDot; ( 1 - &beta; ) + I ( x , y ) &CenterDot; &beta; F 1 ( x , y ) = 0 B ( x , y ) F 1 ( x , y ) > 0 ,
Wherein, B (x, y) is background image, and I (x, y) is current frame image, F 1(x, y) foreground image sample for going out according to many Gaussian Background model inspection, F 1(x, y)=0 represents that pixel (x, y) is background dot, F 1(x, y) >0 then represents that pixel (x, y) is for foreground point, and β represents Background learning rate.
A kind of foreground detection system, comprising:
Acquisition module, obtains current frame image;
Computing module, calculates the local contrast of current frame image;
Set up module, set up the many Gaussian Background model based on local contrast;
Pattern detection module, goes out part foreground image in current frame image as foreground image sample according to many Gaussian Background model inspection;
Background image study module, according to foreground image sample and current frame image study background image;
Foreground target detection module, according to background image, carries out foreground target detection to current frame image.
Preferably, computing module comprises:
Piecemeal submodule, is divided into the block of pixels of several m*n by current frame image, wherein, m, n be greater than 0 positive integer;
Statistics submodule, adds up gray average and the gray variance of each block of pixels;
Local contrast obtains submodule, and obtain the local contrast of each block of pixels, local contrast is the business of gray variance divided by gray average gained of each block of pixels.
Preferably, foreground target detection module comprises:
Gradient vector obtains submodule, distinguishes the gradient vector of each pixel in background extraction image and current frame image;
Foreground target detects according to obtaining submodule, obtains whether the texture at each pixel place in current frame image is abundant and whether background image is consistent with the texture of current frame image according to the gradient vector of background image and each pixel in current frame image;
Foreground target judges submodule, inconsistent at the texture of this pixel place current frame image and background image when the texture-rich at certain pixel place in current frame image, namely judges that this pixel is foreground point.
Preferably, also comprise adaptive noise processing module, comprising:
Noise intensity obtains submodule, before the local contrast calculating current frame image, obtains the noise intensity of current frame image;
Noise reduction process submodule, when noise intensity is greater than default threshold value, then carries out noise reduction process to current frame image.
Preferably, noise intensity acquisition submodule comprises:
Image block division unit, is divided into the image block that several pixel numbers are identical by current frame image;
Noise spot statistic unit, the noise spot number in statistics current frame image in each image block;
Initial noisc intensity acquiring unit, obtains the initial noisc intensity of current frame image, and initial noisc intensity is the pixel number of intermediate value divided by image block of noise spot number in current frame image in each image block;
Noise intensity acquiring unit, obtains the noise intensity of current frame image according to the initial noisc intensity of current frame image.
Preferably, noise spot statistic unit comprises:
Gray scale difference absolute value computation subunit, calculates the absolute value of current frame image and previous frame image gray scale difference;
Noise spot judges and statistics subelement, according to the noise spot number in each image block in the absolute value statistics current frame image of gray scale difference, wherein, then judge that when the absolute value of the gray scale difference of certain pixel in image block is in default threshold range this pixel is noise spot.
Technique scheme of the present invention has the following advantages compared to existing technology:
1. foreground detection method provided by the invention and system, by based on many Gaussian Background modeling of local contrast and the step of background image study, can prevent the background contamination that illuminance abrupt variation causes, improve the accuracy of foreground detection.Meanwhile, Gaussian Background modeling can be carried out on the image reduced, and effectively improves efficiency of algorithm.
2. foreground detection method provided by the invention and system, gradient vector is used to carry out token image texture, utilize texture comparison's algorithm to carry out foreground target detection, intactly can detect the target that size is less, contrast is more weak, also can eliminate simultaneously because of light change very fast time the false-alarm that causes.
3. foreground detection method provided by the invention and system, can carry out adaptive noise reduction process according to the noise intensity of current frame image.When the noise of image is stronger, carry out noise reduction process can noise decrease to the interference of foreground detection; And when the noise of image is more weak, noise reduction process is not carried out to it, the calculated amount of camera processes device can be reduced.
4. foreground detection method provided by the invention and system, through reality erection test, energy real time execution steady in a long-term, in outdoor monitoring point, effectively resists Changes in weather and illumination variation.
Accompanying drawing explanation
Fig. 1 is a kind of foreground detection method process flow diagram according to the embodiment of the present invention 1;
Fig. 2 is the method flow diagram in the foreground detection method provided according to the embodiment of the present invention 2, current frame image being carried out to noise processed;
Fig. 3 is a kind of foreground detection method process flow diagram according to the embodiment of the present invention 3;
Fig. 4 is according to a kind of foreground detection system chart of the present invention.
Embodiment
In order to make those skilled in the art person understand content of the present invention better, below in conjunction with drawings and Examples, technical scheme provided by the present invention is described in further detail.
Embodiment 1
As shown in Figure 1, present embodiments provide a kind of foreground detection method, specifically comprise the following steps:
S11: obtain current frame image.
S12: the local contrast calculating current frame image.Particularly, the local contrast of current frame image can be calculated in the following manner:
First, current frame image is divided into the block of pixels of several m*n, wherein, m, n be greater than 0 positive integer;
Then, gray average and the gray variance of each block of pixels is added up;
Finally, obtain the local contrast of each block of pixels, local contrast is the business of gray variance divided by gray average gained of each block of pixels.
Except utilizing said method to be outside one's consideration to calculate local contrast, also this local contrast can be calculated by additive method of the prior art.
S13: with reference to the relevant information of previous frame image, set up the many Gaussian Background model based on local contrast.The modeling of many Gaussian Background is carried out as the attribute of block by the local contrast calculated in step S12.
S14: go out part foreground image in current frame image as foreground image sample according to many Gaussian Background model inspection.The part foreground image detected in this step is comparatively large, the significant target of contrast of size mainly.
S15: according to foreground image sample and current frame image study background image.Specifically can learn background image by following formula:
B ( x , y ) = B ( x , y ) &CenterDot; ( 1 - &beta; ) + I ( x , y ) &CenterDot; &beta; F 1 ( x , y ) = 0 B ( x , y ) F 1 ( x , y ) > 0 ,
Wherein, B (x, y) is background image, and I (x, y) is current frame image, F 1(x, y) foreground image sample for going out according to many Gaussian Background model inspection, F 1(x, y)=0 represents that pixel (x, y) is background dot, F 1(x, y) >0 then represents that pixel (x, y) is for foreground point, and β represents Background learning rate.β can choose reasonable according to actual needs.
S16: according to background image, carries out foreground target detection to current frame image.Preferably, utilize texture comparison's algorithm to carry out foreground target detection, detailed process comprises the following steps:
First, distinguish the gradient vector of each pixel in background extraction image and current frame image, adopt Sobel gradient operator in the present embodiment to obtain;
Then, obtain according to the gradient vector of background image and each pixel in current frame image whether the texture at each pixel place in current frame image is abundant and whether background image is consistent with the texture of current frame image, obtain especially by following formulae discovery:
Flat ( x , y ) = 1 v 0 2 + v 1 2 > T g 2 0 v 0 2 + v 1 2 &le; T g 2
Diff ( x , y ) = 1 v 0 u 0 + v 1 u 1 < ( v 0 + v 1 + u 0 + u 1 ) 2 &CenterDot; T s / 2 0 v 0 u 0 + v 1 u 0 &GreaterEqual; ( v 0 + v 1 + u 0 + u 1 ) 2 &CenterDot; T s / 2
Flat (x, y) represents the texture-rich of current frame image at pixel (x, y) place, and Diff (x, y) represents the using texture homogeneity at pixel (x, y) place background image and current frame image, T gand T sfor the threshold value preset, (u 0, u 1), (v 0, v 1) represent that background image is at pixel (x respectively, y) gradient vector at place, current frame image are at pixel (x, y) gradient vector at place, Flat (x, y)=0 represents the texture-rich of current frame image at pixel (x, y) place, Diff (x, y)=1 represents inconsistent at the texture of pixel (x, y) place current frame image and background image;
Finally, inconsistent at the texture of this pixel place current frame image and background image when the texture-rich at certain pixel place in current frame image, namely judge that this pixel is foreground point.The image that all foreground points are formed is foreground image.
The foreground detection method that the present embodiment provides, the background contamination that can prevent illuminance abrupt variation from causing, namely can prevent target or other non-background element to be updated in background, improves the accuracy of foreground detection.Meanwhile, Gaussian Background modeling can be carried out on the image reduced, and effectively improves efficiency of algorithm, and the method that therefore the present embodiment provides goes for the limited front-end camera of processor computing power, can complete the foreground detection of every two field picture in real time.
In addition, utilize texture comparison's algorithm to carry out foreground target detection, accurately can detect the target that size is less, contrast is more weak, also can remove because of the false-alarm that reason causes such as light change is very fast.In addition, add up according to a large amount of actual video, target itself generally has abundant texture (otherwise human eye just can not pick out this target), and the texture on most of ground is then more smooth, therefore uses the rich of texture to get rid of the less ground of texture; Use using texture homogeneity then effectively can distinguish the background of target and texture-rich, and general of illuminance abrupt variation can change brightness of image and can not change image texture, therefore use texture this feature whether consistent to carry out foreground detection, to illuminance abrupt variation, also there is good resistivity.
Embodiment 2
As shown in Figure 2, present embodiments provide another kind of foreground detection method, compared with above-described embodiment 1, the process of current frame image being carried out to adaptive noise process is also comprised after the step obtaining current frame image, before the local contrast calculating current frame image, with noise when eliminating imaging on the impact of foreground detection, concrete steps are as follows:
S101: the noise intensity obtaining current frame image;
S102: when noise intensity is greater than default threshold value, then carry out noise reduction process to current frame image, specifically can adopt low-pass filter to carry out noise reduction process, preferably can carry out noise reduction by Mean Filtering Algorithm further.
In the foreground detection method that the present embodiment provides, when being greater than default threshold value when the noise intensity of current frame image is stronger, just carry out noise reduction process, with removal of images noise, accuracy in detection is improved to the interference of foreground detection.If when the noise intensity of present image is less, then do not need to carry out noise reduction process to reduce the workload of camera processes device to it.
Particularly, the process obtaining the noise intensity of present image in step S101 is:
S1011: current frame image is divided into the image block that several pixel numbers are identical, specifically can be divided into the image block of several 8*8;
S1012: the noise spot number in statistics current frame image in each image block;
S1013: obtain the initial noisc intensity of current frame image, initial noisc intensity is the pixel number of intermediate value divided by image block of noise spot number in current frame image in each image block, and getting intermediate value is also workload in order to reduce camera processes device;
S1014: the noise intensity obtaining current frame image according to the initial noisc intensity of current frame image.
Compared with other image noise intensity methods of estimation in prior art, the method that the present embodiment provides can prevent the big ups and downs of image noise intensity from causing denoising module repeatedly to open and close, and algorithm principle is simple and practical, and operational efficiency is very high.
Particularly, the detailed process of adding up the noise spot number in current frame image in each image block in step S1012 is:
First, the absolute value of current frame image and previous frame image gray scale difference is calculated;
Then, according to the noise spot number in each image block in the absolute value statistics current frame image of gray scale difference, wherein, then judge that when the absolute value of the gray scale difference of certain pixel in image block is in default threshold range this pixel is noise spot.
In the foreground detection method that the present embodiment provides, just judge when being in default threshold range by the absolute value of the gray scale difference of certain pixel that this pixel is noise spot, because when the absolute value of its gray scale difference is too small, pixel gray-scale value belongs to normal fluctuation, can not have a negative impact to foreground detection, and time excessive, this pixel is likely the pixel of foreground image.
Because the change of picture noise be need certain processes, therefore in step S1014 can according to following formula to the smoothing filtration of initial noisc intensity of current frame image to obtain the noise intensity of current frame image:
N i = N i = 0 &alpha; N i - 1 + ( 1 - &alpha; ) N i > 0 ,
Wherein, α is smoothing factor, and N is the initial noisc intensity of current frame image, N ifor the noise intensity of current frame image, N i-1for the noise intensity of previous frame image, 0<N<1,0<N i<1,0<N i-1<1, i=0 represents that current frame image is the second two field picture of video, because every two field picture needs and previous frame image relatively asks gray scale difference, does not have image before the first frame, therefore the image of noise intensity can be asked to be from the second frame, and N during i=0 i=N, represent when current frame image is the second two field picture of video sequence, its initial noisc intensity is its noise intensity.
Embodiment 3
As shown in Figure 3, present embodiments provide a kind of foreground detection method, comprise the following steps:
S21: obtain current frame image.Because video camera carries out foreground target detection in real time, therefore it can get every two field picture of Real-time Collection, and all carry out foreground detection with the real-time follow-up of realize target to each two field picture.
S22: the noise intensity calculating current frame image.Often obtain a frame video image, the noise intensity of this two field picture will be calculated.Concrete computation process is as follows:
First, calculate this two field picture and previous frame image at the absolute value of the gray scale difference at each pixel place, be designated as D (x, y), if T0≤D (x, y)≤T1, then pixel (x, y) be noise spot, otherwise be not noise spot, wherein T0 and T1 is predetermined threshold value, T0 < T1, in the present embodiment, get 8 and 16 respectively;
Then, this two field picture being divided into K nonoverlapping pixel is the image block of 8*8, and adds up the noise spot number in each image block, and the noise spot number in i-th image block is designated as M i, ask M i(i=1,2,3 ..., K) intermediate value be designated as then the initial noisc intensity N of this current frame image is:
N = M &OverBar; 64 ,
Here M is asked i(i=1,2,3 ..., K) intermediate value histogramming algorithm can be used to carry out rapid solving.Meanwhile, in order to save calculated amount further, during actual computation can image progressive is down-sampled by column after carry out initial noisc Strength co-mputation again;
Finally, the change due to picture noise needs certain process, can use below formula to the smoothing filtration of initial noisc intensity to obtain the noise intensity of current frame image:
N i = N i = 0 &alpha; N i - 1 + ( 1 - &alpha; ) N i > 0
Wherein, α is smoothing factor, gets 0.9, N in the present embodiment ifor the final noise intensity of current frame image, N i-1for the noise intensity of previous frame image, N is the initial noisc intensity of current frame image.Noise intensity is a value between 0 and 1, and its value shows that more greatly noise in image is stronger.I=0 represents that current frame image is the second two field picture of video, because noise intensity calculates according to the gray scale difference of current frame image and previous frame image, there is no image before first two field picture of this video, therefore can only ask the noise intensity of the second frame and subsequent frames image, and N during i=0 i=N, represent when current frame image is the second two field picture of video sequence, its initial noisc intensity is its noise intensity.
Compared with other image noise intensity methods of estimation in prior art, the method that the present embodiment provides can prevent the big ups and downs of image noise intensity from causing denoising module repeatedly to open and close.
S23: the noise intensity according to current frame image carries out adaptive noise process.When the noise intensity of current frame image is greater than default threshold value L1, then opens noise reduction module and noise reduction process is carried out to current frame image.To need certain process during change due to noise, be namely generally gradual change, therefore when continuous print multiple image all just closes noise reduction module lower than during threshold value L0, constantly open and close noise reduction module in the short time can be avoided like this.Threshold value L1 and threshold value L0 is respectively 0.9 and 0.5.Noise reduction module can be low-pass filter, for raising operation efficiency and noise reduction preferably adopt the Mean Filtering Algorithm of 3 × 3 further in the present embodiment.
In the foreground detection method that the present embodiment provides, when being greater than default threshold value when the noise intensity of current frame image is stronger, just carry out noise reduction process, with removal of images noise, accuracy in detection is improved to the interference of foreground detection.If when the noise intensity of present image is less, then do not need to carry out noise reduction process to reduce the workload of camera processes device to it.
S24: the local contrast calculating current frame image.First, the not overlaid pixel block of 16*16 will be divided in step S23 through the current frame image of adaptive noise reduction process; Then add up the gray average in each block of pixels and gray variance, in order to reduce calculated amount, the pixel value quadratic sum in block of pixels can be used to deduct and square mode calculate gray variance; Finally by the gray variance in each block of pixels divided by gray average, the business of gained is local contrast.
S25: set up many Gaussian Background model based on local contrast.The attribute of the local contrast calculating gained in step S24 as block is carried out the modeling of many Gaussian Background thus obtain many Gaussian Background model.
S26: utilize many Gaussian Background model inspection to go out part foreground image as foreground image sample.By the many Gaussian parameters of choose reasonable, can detect that size in current frame image is comparatively large, the significant target of contrast as foreground image sample, be designated as F 1.
S27: study background image.The foreground image sample F detected in step S26 1can be used for according to current frame image study background image, concrete study formula is as follows:
B ( x , y ) = B ( x , y ) &CenterDot; ( 1 - &beta; ) + I ( x , y ) &CenterDot; &beta; F 1 ( x , y ) = 0 B ( x , y ) F 1 ( x , y ) > 0
Wherein, B (x, y) is background image, and I (x, y) is current frame image, F 1(x, y) foreground image sample for going out according to many Gaussian Background model inspection, F 1(x, y)=0 represents that pixel (x, y) belongs to background image, F 1(x, y) >0 then represents that pixel (x, y) belongs to foreground image, and β represents Background learning rate, and in the present embodiment, β gets 0.008.
The foreground detection method that the present embodiment provides, by based on many Gaussian Background modeling of local contrast and the step of background image study, can prevent the background contamination that illuminance abrupt variation causes, improve the accuracy of foreground detection.
S28: foreground target detection is carried out to current frame image.Specifically to utilize texture comparison's algorithm to carry out foreground detection in the present embodiment, this texture comparison's algorithm refers to rationally is expressing on the basis of image texture, certain measure is used to carry out the method for the similarity of evaluate image two kinds of textures, in the present embodiment, image texture adopts gradient vector to express, and detailed process is as follows:
First, utilize the background image B (x, y) after Sobel gradient operator calculation procedure S27 learning and the gradient vector of current frame image at each pixel place, the gradient vector of background image at pixel (x, y) place is (u 0, u 1), the gradient vector of current frame image at pixel (x, y) place is (v 0, v 1);
Then, obtain whether the texture at each pixel place in current frame image is abundant and whether background image is consistent with the texture of current frame image, obtain especially by following formulae discovery:
Flat ( x , y ) = 1 v 0 2 + v 1 2 > T g 2 0 v 0 2 + v 1 2 &le; T g 2
Diff ( x , y ) = 1 v 0 u 0 + v 1 u 1 < ( v 0 + v 1 + u 0 + u 1 ) 2 &CenterDot; T s / 2 0 v 0 u 0 + v 1 u 0 &GreaterEqual; ( v 0 + v 1 + u 0 + u 1 ) 2 &CenterDot; T s / 2
Flat (x, y) represent that current frame image is at pixel (x, y) texture-rich at place, Diff (x, y) represent at pixel (x, y) using texture homogeneity of place's background image and current frame image, Flat (x, y)=0 represents that current frame image is at pixel (x, y) texture-rich at place, Diff (x, y)=1 represents at pixel (x, y) texture of place's current frame image and background image is inconsistent, T gand T sfor the threshold value preset, be through the scene that a large amount of difference comprises weak signal target and noise and regulate test to determine, in the present embodiment, get 25,0.4 respectively;
Finally, obtain the foreground picture E of current frame image,
E(x,y)=Diff(x,y)AND(NOT Flat(x,y))
That is, when pixel (x, the y) place in current frame image texture-rich and when the texture of this pixel place current frame image and background image is inconsistent, this pixel is exactly foreground point.And the image that all foreground points are formed is foreground image.
The foreground detection method that the present embodiment provides, gradient vector is used to carry out token image texture, utilize texture comparison's algorithm to carry out foreground target detection, intactly can detect the target that size is less, contrast is more weak, also can eliminate simultaneously because of light change very fast time the false-alarm that causes.
Embodiment 4
As shown in Figure 4, present embodiments provide a kind of foreground detection system, comprising:
Acquisition module M1, obtains current frame image;
Computing module M2, calculates the local contrast of current frame image;
Set up module M3, set up the many Gaussian Background model based on local contrast;
Pattern detection module M4, goes out part foreground image in current frame image as foreground image sample according to many Gaussian Background model inspection;
Background image study module M5, according to foreground image sample and current frame image study background image;
Foreground target detection module M6, according to background image, carries out foreground target detection to current frame image.
The foreground detection system that the present embodiment provides, can prevent the background contamination that illuminance abrupt variation causes, and improves the accuracy of foreground detection.Meanwhile, Gaussian Background modeling can be carried out on the image reduced, and effectively improves efficiency of algorithm.
Particularly, computing module M2 comprises:
Piecemeal submodule, is divided into the block of pixels of several m*n by current frame image, wherein, m, n be greater than 0 positive integer;
Statistics submodule, adds up gray average and the gray variance of each block of pixels;
Local contrast obtains submodule, and obtain the local contrast of each block of pixels, local contrast is the business of gray variance divided by gray average gained of each block of pixels.
Preferably, foreground target detection module M6 comprises:
Gradient vector obtains submodule, distinguishes the gradient vector of each pixel in background extraction image and current frame image;
Foreground target detects according to obtaining submodule, obtains whether the texture at each pixel place in current frame image is abundant and whether background image is consistent with the texture of current frame image according to the gradient vector of background image and each pixel in current frame image;
Foreground target judges submodule, inconsistent at the texture of this pixel place current frame image and background image when the texture-rich at certain pixel place in current frame image, namely judges that this pixel is foreground point.
The foreground detection system that the present embodiment provides, gradient vector is used to carry out token image texture, utilize texture comparison's algorithm to carry out foreground target detection, intactly can detect the target that size is less, contrast is more weak, also can eliminate simultaneously because of light change very fast time the false-alarm that causes.
Preferably, also comprise adaptive noise processing module, comprising:
Noise intensity obtains submodule M01, before the local contrast calculating current frame image, obtains the noise intensity of current frame image;
Noise reduction process submodule M02, when noise intensity is greater than default threshold value, then carries out noise reduction process to current frame image.
In the foreground detection system that the present embodiment provides, when being greater than noise processed threshold value when the noise intensity of current frame image is stronger, just carry out noise reduction process, with removal of images noise, accuracy in detection is improved to the interference of foreground detection.If when the noise intensity of present image is less, then do not need to carry out noise reduction process to reduce the workload of camera processes device to it.
Particularly, noise intensity acquisition submodule M01 comprises:
Image block division unit, is divided into the image block that several pixel numbers are identical by current frame image;
Noise spot statistic unit, the noise spot number in statistics current frame image in each image block;
Initial noisc intensity acquiring unit, obtains the initial noisc intensity of current frame image, and initial noisc intensity is the pixel number of intermediate value divided by image block of noise spot number in current frame image in each image block;
Noise intensity acquiring unit, obtains the noise intensity of current frame image according to the initial noisc intensity of current frame image.
Particularly, noise spot statistic unit comprises:
Gray scale difference absolute value computation subunit, calculates the absolute value of current frame image and previous frame image gray scale difference;
Noise spot judges and statistics subelement, according to the noise spot number in each image block in the absolute value statistics current frame image of gray scale difference, wherein, then judge that when the absolute value of the gray scale difference of certain pixel in image block is in default threshold range this pixel is noise spot.
In the foreground detection system that the present embodiment provides, just judge when being in default threshold range by the absolute value of the gray scale difference of certain pixel that this pixel is noise spot, because when the absolute value of its gray scale difference is too small, pixel gray-scale value belongs to normal fluctuation, can not have a negative impact to foreground detection, and time excessive, this pixel is likely the pixel of foreground image.
Obviously, above-described embodiment is only for clearly example being described, and the restriction not to embodiment.For those of ordinary skill in the field, can also make other changes in different forms on the basis of the above description.Here exhaustive without the need to also giving all embodiments.And thus the apparent change of extending out or variation be still among the protection domain of the invention.

Claims (15)

1. a foreground detection method, is characterized in that comprising the following steps:
Obtain current frame image;
Calculate the local contrast of described current frame image;
Set up the many Gaussian Background model based on described local contrast;
Part foreground image in described current frame image is gone out as foreground image sample according to described many Gaussian Background model inspection;
According to described foreground image sample and described current frame image study background image;
According to described background image, foreground target detection is carried out to described current frame image.
2. the method for claim 1, is characterized in that, the step of the local contrast of the described current frame image of described calculating comprises:
Described current frame image is divided into the block of pixels of several m*n, wherein, m, n be greater than 0 positive integer;
Add up gray average and the gray variance of each block of pixels;
Obtain the local contrast of each block of pixels, described local contrast is the business of described gray variance divided by described gray average gained of each block of pixels.
3. method as claimed in claim 1 or 2, it is characterized in that, described according to described background image, the step of described current frame image being carried out to foreground target detection comprises:
Obtain the gradient vector of each pixel in described background image and described current frame image respectively;
Whether the texture obtaining each pixel place in described current frame image according to described background image and the gradient vector of each pixel in described current frame image is abundant and whether described background image is consistent with the texture of described current frame image;
When certain pixel place in described current frame image texture-rich and described in this pixel place the texture of current frame image and described background image inconsistent, namely judge that this pixel is foreground point.
4. method as claimed in claim 3, is characterized in that, in described current frame image, whether whether abundant the and described background image of the texture at each pixel place is consistent with the texture of described current frame image is obtained by following formulae discovery:
Flat ( x , y ) = 1 v 0 2 + v 1 2 > T g 2 0 v 0 2 + v 1 2 &le; T g 2
Diff ( x , y ) = 1 v 0 u 0 + v 1 u 1 < ( v 0 + v 1 + u 0 + u 1 ) 2 &CenterDot; T s / 2 0 v 0 u 0 + v 1 u 1 &GreaterEqual; ( v 0 + v 1 + u 0 + u 1 ) 2 &CenterDot; T s / 2
Flat (x, y) represents the texture-rich of described current frame image at pixel (x, y) place, Diff (x, y) using texture homogeneity of background image and described current frame image described in pixel (x, y) place is represented, T gand T sfor the threshold value preset, (u 0, u 1), (v 0, v 1) represent that described background image is at pixel (x respectively, y) gradient vector at place, described current frame image are at pixel (x, y) gradient vector at place, Flat (x, y)=0 represents the texture-rich of described current frame image at pixel (x, y) place, Diff (x, y)=1 represents that the texture of current frame image and described background image is inconsistent described in pixel (x, y) place.
5. the method according to any one of claim 1-4, is characterized in that, also comprises and carries out adaptive noise process to described current frame image, specifically comprise before the step of the local contrast of the described current frame image of described calculating:
Obtain the noise intensity of described current frame image;
When described noise intensity is greater than default threshold value, then noise reduction process is carried out to described current frame image.
6. described method as claimed in claim 5, it is characterized in that, the step of the noise intensity of the described current frame image of described acquisition comprises:
Described current frame image is divided into the identical image block of several pixel numbers;
Add up the noise spot number in described current frame image in each image block;
Obtain the initial noisc intensity of described current frame image, described initial noisc intensity is the pixel number of intermediate value divided by image block of noise spot number in described current frame image in each image block;
The noise intensity of described current frame image is obtained according to the initial noisc intensity of described current frame image.
7. method as claimed in claim 6, it is characterized in that, the step of the noise spot number in the described current frame image of described statistics in each image block comprises:
Calculate the absolute value of described current frame image and previous frame image gray scale difference;
The noise spot number in described current frame image in each image block is added up according to the absolute value of described gray scale difference, wherein, then judge that when the absolute value of the described gray scale difference of certain pixel in image block is in default threshold range this pixel is noise spot.
8. method as claimed in claims 6 or 7, is characterized in that, according to following formula to the smoothing filtration of initial noisc intensity of described current frame image to obtain the noise intensity of described current frame image:
N i = N i = 0 &alpha;N i - 1 + ( 1 - &alpha; ) N i > 0 ,
Wherein, α is smoothing factor, and N is the initial noisc intensity of described current frame image, N ifor the noise intensity of described current frame image, N i-1for the noise intensity of previous frame image, 0<N<1,0<N i<1,0<N i-1<1, i=0 represent that described current frame image is the second two field picture of video.
9. the method according to any one of claim 1-8, is characterized in that, learns background image by following formula:
B ( x , y ) = B ( x , y ) &CenterDot; ( 1 - &beta; ) + I ( x , y ) &CenterDot; &beta; F 1 ( x , y ) = 0 B ( x , y ) F 1 ( x , y ) > 0 ,
Wherein, B (x, y) is background image, and I (x, y) is described current frame image, F 1(x, y) foreground image sample for going out according to described many Gaussian Background model inspection, F 1(x, y)=0 represents that pixel (x, y) is background dot, F 1(x, y) >0 then represents that pixel (x, y) is for foreground point, and β represents Background learning rate.
10. a foreground detection system, is characterized in that comprising:
Acquisition module, obtains current frame image;
Computing module, calculates the local contrast of described current frame image;
Set up module, set up the many Gaussian Background model based on described local contrast;
Pattern detection module, goes out part foreground image in described current frame image as foreground image sample according to described many Gaussian Background model inspection;
Background image study module, according to described foreground image sample and described current frame image study background image;
Foreground target detection module, according to described background image, carries out foreground target detection to described current frame image.
11. systems as claimed in claim 10, it is characterized in that, described computing module comprises:
Piecemeal submodule, is divided into the block of pixels of several m*n by described current frame image, wherein, m, n be greater than 0 positive integer;
Statistics submodule, adds up gray average and the gray variance of each block of pixels;
Local contrast obtains submodule, and obtain the local contrast of each block of pixels, described local contrast is the business of described gray variance divided by described gray average gained of each block of pixels.
12. systems as claimed in claim 10, it is characterized in that, described foreground target detection module comprises:
Gradient vector obtains submodule, obtains the gradient vector of each pixel in described background image and described current frame image respectively;
Foreground target detects according to obtaining submodule, and whether the texture obtaining each pixel place in described current frame image according to described background image and the gradient vector of each pixel in described current frame image is abundant and whether described background image is consistent with the texture of described current frame image;
Foreground target judges submodule, when certain pixel place in described current frame image texture-rich and described in this pixel place the texture of current frame image and described background image inconsistent, namely judge that this pixel is foreground point.
13. systems as claimed in claim 10, characterized by further comprising adaptive noise processing module, comprising:
Noise intensity obtains submodule, before the local contrast calculating described current frame image, obtains the noise intensity of described current frame image;
Noise reduction process submodule, when described noise intensity is greater than default threshold value, then carries out noise reduction process to described current frame image.
14. systems as claimed in claim 13, is characterized in that described noise intensity obtains submodule and comprises:
Image block division unit, is divided into the identical image block of several pixel numbers by described current frame image;
Noise spot statistic unit, adds up the noise spot number in described current frame image in each image block;
Initial noisc intensity acquiring unit, obtains the initial noisc intensity of described current frame image, and described initial noisc intensity is the pixel number of intermediate value divided by image block of noise spot number in described current frame image in each image block;
Noise intensity acquiring unit, obtains the noise intensity of described current frame image according to the initial noisc intensity of described current frame image.
15. systems as claimed in claim 14, it is characterized in that, described noise spot statistic unit comprises:
Gray scale difference absolute value computation subunit, calculates the absolute value of described current frame image and previous frame image gray scale difference;
Noise spot judges and statistics subelement, the noise spot number in described current frame image in each image block is added up according to the absolute value of described gray scale difference, wherein, then judge that when the absolute value of the described gray scale difference of certain pixel in image block is in default threshold range this pixel is noise spot.
CN201510098306.XA 2015-03-05 2015-03-05 A kind of foreground detection method and system Active CN104700405B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510098306.XA CN104700405B (en) 2015-03-05 2015-03-05 A kind of foreground detection method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510098306.XA CN104700405B (en) 2015-03-05 2015-03-05 A kind of foreground detection method and system

Publications (2)

Publication Number Publication Date
CN104700405A true CN104700405A (en) 2015-06-10
CN104700405B CN104700405B (en) 2017-11-28

Family

ID=53347487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510098306.XA Active CN104700405B (en) 2015-03-05 2015-03-05 A kind of foreground detection method and system

Country Status (1)

Country Link
CN (1) CN104700405B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105405138A (en) * 2015-11-10 2016-03-16 上海交通大学 Water surface target tracking method based on saliency detection
CN106327488A (en) * 2016-08-19 2017-01-11 云赛智联股份有限公司 Adaptive foreground detection method and detection device
CN107992873A (en) * 2017-10-12 2018-05-04 西安天和防务技术股份有限公司 Object detection method and device, storage medium, electronic equipment
CN108961304A (en) * 2017-05-23 2018-12-07 阿里巴巴集团控股有限公司 Identify the method for sport foreground and the method for determining target position in video in video
CN109697725A (en) * 2018-12-03 2019-04-30 浙江大华技术股份有限公司 A kind of filtering background method, apparatus and computer readable storage medium
CN109907555A (en) * 2018-07-26 2019-06-21 永康市巴九灵科技有限公司 Solar power supply type cabinet
WO2021114868A1 (en) * 2019-12-09 2021-06-17 Oppo广东移动通信有限公司 Denoising method, terminal, and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103208123A (en) * 2013-04-19 2013-07-17 广东图图搜网络科技有限公司 Image segmentation method and system
CN103530886A (en) * 2013-10-22 2014-01-22 上海安奎拉信息技术有限公司 Low-calculation background removing method for video analysis
TWI425446B (en) * 2010-10-29 2014-02-01 Univ Nat Chiao Tung A method for object detection system in day-and-night environment
KR20140045854A (en) * 2012-10-09 2014-04-17 에스케이텔레콤 주식회사 Method and apparatus for monitoring video for estimating gradient of single object
CN103810722A (en) * 2014-02-27 2014-05-21 云南大学 Moving target detection method combining improved LBP (Local Binary Pattern) texture and chrominance information
CN103903278A (en) * 2012-12-28 2014-07-02 重庆凯泽科技有限公司 Moving target detection and tracking system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI425446B (en) * 2010-10-29 2014-02-01 Univ Nat Chiao Tung A method for object detection system in day-and-night environment
KR20140045854A (en) * 2012-10-09 2014-04-17 에스케이텔레콤 주식회사 Method and apparatus for monitoring video for estimating gradient of single object
CN103903278A (en) * 2012-12-28 2014-07-02 重庆凯泽科技有限公司 Moving target detection and tracking system
CN103208123A (en) * 2013-04-19 2013-07-17 广东图图搜网络科技有限公司 Image segmentation method and system
CN103530886A (en) * 2013-10-22 2014-01-22 上海安奎拉信息技术有限公司 Low-calculation background removing method for video analysis
CN103810722A (en) * 2014-02-27 2014-05-21 云南大学 Moving target detection method combining improved LBP (Local Binary Pattern) texture and chrominance information

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
CHRIS STAUFFER 等: "Adaptive background mixture models for real-time tracking", 《COMPUTER VISION AND PATTERN RECOGNITION》 *
KYUNGNAM KIM 等: "Real-time foreground–background segmentation using codebook model", 《REAL-TIME IMAGING》 *
姜永林 等: "基于纹理及统计特征的视频背景提取", 《光学精密工程》 *
张燕平 等: "应用改进混合高斯模型的运动目标检测", 《计算机工程与应用》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105405138A (en) * 2015-11-10 2016-03-16 上海交通大学 Water surface target tracking method based on saliency detection
CN105405138B (en) * 2015-11-10 2018-05-29 上海交通大学 Waterborne target tracking based on conspicuousness detection
CN106327488A (en) * 2016-08-19 2017-01-11 云赛智联股份有限公司 Adaptive foreground detection method and detection device
CN106327488B (en) * 2016-08-19 2020-04-21 云赛智联股份有限公司 Self-adaptive foreground detection method and detection device thereof
CN108961304A (en) * 2017-05-23 2018-12-07 阿里巴巴集团控股有限公司 Identify the method for sport foreground and the method for determining target position in video in video
CN107992873A (en) * 2017-10-12 2018-05-04 西安天和防务技术股份有限公司 Object detection method and device, storage medium, electronic equipment
CN109907555A (en) * 2018-07-26 2019-06-21 永康市巴九灵科技有限公司 Solar power supply type cabinet
CN109697725A (en) * 2018-12-03 2019-04-30 浙江大华技术股份有限公司 A kind of filtering background method, apparatus and computer readable storage medium
CN109697725B (en) * 2018-12-03 2020-10-02 浙江大华技术股份有限公司 Background filtering method and device and computer readable storage medium
WO2021114868A1 (en) * 2019-12-09 2021-06-17 Oppo广东移动通信有限公司 Denoising method, terminal, and storage medium

Also Published As

Publication number Publication date
CN104700405B (en) 2017-11-28

Similar Documents

Publication Publication Date Title
CN104700405A (en) Foreground detection method and system
CN104112370B (en) Parking lot based on monitoring image intelligent car position recognition methods and system
CN103400150B (en) A kind of method and device that road edge identification is carried out based on mobile platform
CN102855617B (en) Method and system for processing adaptive images
CN103136766B (en) A kind of object conspicuousness detection method based on color contrast and color distribution
CN102768760B (en) Quick image dehazing method on basis of image textures
CN105791774A (en) Surveillance video transmission method based on video content analysis
CN103729858B (en) A kind of video monitoring system is left over the detection method of article
CN103208185A (en) Method and system for nighttime vehicle detection on basis of vehicle light identification
CN106682665B (en) Seven-segment type digital display instrument number identification method based on computer vision
CN104318266B (en) A kind of image intelligent analyzes and processes method for early warning
CN101179713A (en) Method of detecting single moving target under complex background
CN106709903B (en) PM2.5 concentration prediction method based on image quality
CN101860664A (en) Moving target detection method robust to illumination variation
CN103093198A (en) Crowd density monitoring method and device
CN108205891A (en) A kind of vehicle monitoring method of monitoring area
CN104574381A (en) Full reference image quality evaluation method based on LBP (local binary pattern)
CN101411190B (en) Spurious motion filter
CN103337175A (en) Vehicle type recognition system based on real-time video steam
CN104021527A (en) Rain and snow removal method in image
CN103489012A (en) Crowd density detecting method and system based on support vector machine
Wang et al. Haze removal algorithm based on single-images with chromatic properties
CN105405153A (en) Intelligent mobile terminal anti-noise interference motion target extraction method
CN103106663B (en) Realize the method for SIM card defects detection based on image procossing in computer system
CN104574363A (en) Full reference image quality assessment method in consideration of gradient direction difference

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant