CN102622763A - Method for detecting and eliminating shadow - Google Patents
Method for detecting and eliminating shadow Download PDFInfo
- Publication number
- CN102622763A CN102622763A CN201210039706XA CN201210039706A CN102622763A CN 102622763 A CN102622763 A CN 102622763A CN 201210039706X A CN201210039706X A CN 201210039706XA CN 201210039706 A CN201210039706 A CN 201210039706A CN 102622763 A CN102622763 A CN 102622763A
- Authority
- CN
- China
- Prior art keywords
- sub
- gray
- piece
- shadow
- background
- 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.)
- Pending
Links
Abstract
The invention relates to a method for detecting and eliminating shadow in monitored videos. The method includes setting up a background model; performing foreground/background segmentation for a current frame and obtaining an objective region; transforming an RGB (red, green, blue) color space of the objective region into an HSV (hue, saturation and value) color space; using three components including hue H, saturation S and value V as shadow detecting operators, and preliminarily eliminating parts of shadows; using gray levels of a background of the current frame as features and dividing the objective region into a plurality of feature sub-blocks; describing gray level distribution probability by a Gaussian model and determining objective sub-blocks; and eliminating isolated objective sub-blocks, filling discontinuous objective sub-blocks and finishing objective detection and shadow elimination. The shadow detecting and eliminating method excellently resolves the problem that a threshold value cannot be adaptively adjusted along environments, shadow false detecting rate is reduced, both shadow detection completeness and accuracy are good, cavities and breakages of a moving object are obviously reduced, and shadow detecting rate is improved.
Description
Technical field
The present invention relates to digital video and image processing field, particularly, relate to a kind of shadow Detection and removing method.
Background technology
The existence of shade has caused the degeneration of image in detection process of moving target; Follow-up graphical analysis and understanding are brought great interference; Therefore the detection of shade is the prerequisite of graphical analysis and understanding with eliminating, and the shadow Detection of moving target has important application in intelligent video monitoring.
Existing shadow Detection algorithm roughly can be divided three classes: based on the method for model, based on the method for texture with based on the method for shade attribute.These methods are used separately and are all had shortcoming separately: based on time of position, direction and the shade generation of the real-time detection light source of method needs of model etc.; But these conditions all be difficult to confirm and change with different application environments, and be difficult to satisfy the needs that detect in real time; Method based on texture is to compare analysis to image texture characteristic with the background texture characteristic, if the not obvious mistake that causes easily of some textural characteristics is surveyed; Usually need define the threshold value of some attributes based on the method for shade attribute, and these threshold values usually and environment certain relation is arranged, and alter a great deal and be difficult to confirm.
Summary of the invention
The object of the present invention is to provide a kind of shadow Detection and removing method based on color space and the associating of gray scale ratio; Adopt the hsv color model tentatively to judge the shadow region to the foreground target that extracts, through Gauss model gray scale is described the shade that accurately detects target than characteristic again.Method of the present invention has solved threshold value can not reduce the shade false drop rate with the problem of environment self-adaption adjustment, has improved shadow Detection integrality and accuracy.
According to a main aspect of the present invention, a kind of shadow Detection and removing method are provided, it may further comprise the steps:
(a) set up background model;
(b) whether satisfy background model according to current frame pixel, present frame is carried out foreground/background segmentation, obtain to have the target of shade thus;
(c) with this target area that has a shade by the RGB color space conversion to the hsv color space;
(d) with tone H, saturation degree S and the brightness V three-component in hsv color space as the shadow Detection operator, tentatively eliminate the part shade;
(e) be converted into gray scale and represent eliminating target area behind the part shade, and to liken to the gray scale of itself and background model respective pixel be characteristic, and this target area is divided into the sub-piece of a plurality of characteristics;
(f) with each characteristic sub-block as a sequence of random variables, and gray scale described with Gauss model than distribution probability, thereby obtains the average and the variance of the Gaussian distribution of each block of pixels, calculate average and the variance of each gray scale than characteristic sub-block; If the variance of Gauss model is greater than setting threshold, then this sub-piece is the sub-piece of target, otherwise is the sub-piece of shade;
(g) eliminate the isolated sub-piece of target, fill the sub-piece of discontinuous target, accomplish target detection and shade and eliminate.
According to an aspect of the present invention, in step (a), utilize the Density Estimator background modeling method that background is described, with sequence of frames of video according to the modeling of Density Estimator background model.
According to an aspect of the present invention, in step (a), sequence of frames of video comprises the 30-50 frame.
According to an aspect of the present invention, in step (a), constantly upgrade the Density Estimator background model, and the prospect part is not participated in the renewal of background model, thereby obtain background model accurately.
According to an aspect of the present invention, in step (d), utilize formula tentatively to eliminate the part shade:
In the formula, I representes present frame, and B representes background frames, and α, β are the threshold value of brightness ratio, T
HAnd T
SBe respectively tone threshold value and saturation degree threshold value.
According to an aspect of the present invention, in step (e), this target area is divided into m * n the sub-piece of characteristic; And the size of each sub-piece is 12 * 12, if certain sub-block size is then cast out this sub-piece less than 12 * 12; Perhaps replenish the row or the row of this sub-piece, satisfy 12 * 12 up to its size.
According to an aspect of the present invention, in step (f), calculate each gray scale and be than the average of the sub-piece of characteristic and the formula of variance:
D wherein
iBe the i block of pixels, E (gray)
i, D (gray)
iBe respectively the average and the variance of i block of pixels.
Based on one aspect of the present invention, in step (g), utilize morphological operator to eliminate the isolated sub-piece of target.
Will be appreciated that the characteristic in the above each side of the present invention is independent assortment within the scope of the invention, and do not receive the restriction of its order---as long as the technical scheme after the combination drops in the connotation of the present invention.
Description of drawings
In order to be illustrated more clearly in the technical scheme among the present invention, will do to introduce simply to accompanying drawing of the present invention below, wherein:
Fig. 1 has shown the process flow diagram of the inventive method;
Embodiment
Hereinafter will combine the preferred embodiments of the present invention that technical scheme of the present invention is elaborated.
Need to understand that the description of hereinafter (comprising accompanying drawing) only is exemplary, but not the description of limitation of the present invention property.Can relate to the concrete quantity of parts in the following description, yet also need should be appreciated that, these quantity also only are exemplary, and those skilled in the art can choose the parts of right quantity with reference to the present invention arbitrarily.And,, only make the difference name of parts and be referred to as to use in the present invention if wordings such as mentioned " first ", " second " are not the ordering of expression to parts importance.
Referring to Fig. 1, the flow process of the inventive method has been described wherein.
In one embodiment of the invention, comprise that key step is following:
(a) establish background model, so that from present frame, be partitioned into foreground target.Cuclear density background modeling method according to present embodiment adopted obtains background image, and Density Estimator is estimated unknown Density Distribution through the local function that the weighted mean central point is positioned at sampled value.A sample set S={x in given certain pixel characteristic space
1, x
2..., x
N, observed reading x
tDensity Distribution with p (x
t) estimate:
Weights α in the formula (1)
i=1/N; K
h=(1/h) K (t/h) is a kernel function; H is the width of kernel function.A pixel is considered m characteristic, kernel function K
hSelect Gaussian function, σ
mThe kernel function bandwidth of representing each characteristic, formula (1) can further be expressed as:
Suppose x
iNormal Distribution N (μ, σ
2), (x then
i-x
I+1) Normal Distribution N (0,2 σ
2), m is the absolute value intermediate value of adjacent two frame pixel characteristic value differences, promptly m=median (| x
i-x
I+1|), obtain by the symmetry and the MEAN VALUE PROPERTY of normal distribution:
P[N(0,2σ
2>m]=0.25 (3)
Know by normal distribution:
In other embodiments of the invention,, calculate the time of the intermediate value of sample frame sequence pixel,, also can the intermediate value of sample sequence be used mean approximation in order to improve real-time with labor if it is longer to be used for carrying out the sample frame sequence of Density Estimator.
(b) with prospect and background segment such as moving targets.If certain pixel of current frame image does not satisfy the background model that formula (2) is described, then this pixel is foreground target pixel (possibly contain shade), otherwise is background pixel.Accomplish the target area that the back obtains to have shade of cutting apart according to this to present frame;
(c) color space conversion, the foreground area after step (b) cut apart from the RGB color space conversion to the hsv color space.Formula is following:
Wherein
(d) carrying out the hsv color model detects with preliminary elimination dash area., as the shadow Detection operator each pixel of image is detected according to tone H, saturation degree S and the brightness V in hsv color space.
(i) because background is reduced by the pixel intensity of shade occlusion area,, compare the V color component of the component of the V color of each pixel in the target image that has shade that obtains and same position background pixel so can reduce in the V in hsv color space channel value.
In the formula, I representes present frame, and B representes background frames, and α, β are the threshold value of brightness ratio, and they are all less than 1, and α reflects intensity of illumination, and β then is for fear of being shade with the background disturbance treatment, reduces the shadow Detection scope through formula (7).
(ii),, in the hsv color space, the image utilization shadow Detection operator that obtains in (i) is detected at H, S passage so must further handle because the brightness of object pixel also maybe be lower than the brightness of background pixel.
|I
H(x,y)-B
H(x,y)|≤T
H (8)
|I
S(x,y)-B
S(x,y)|≤T
S (9)
In the formula, I representes present frame, and B representes background frames, T
HAnd T
SBe the threshold value of color harmony saturation degree, its interval is (0.01,0.02), and this expression color component can have little variation, is the pixel assignment that satisfies following formula simultaneously 0, tentatively eliminates dash area.
(e) carrying out gray scale detects than model.Under certain brightness conditions, same object is in the shadow region with not in the shadow region, and its tone is almost constant, and the gray scale and the gray scale of the original that promptly are positioned at the object of shadow region have differed a coefficient k, and following mathematic(al) representation is then arranged:
With the preliminary area dividing of eliminating dash area in the step (d) is m * n the sub-piece of characteristic, and the size of each sub-piece is 12 * 12.If certain sub-block size is then cast out this sub-piece less than 12 * 12.In other embodiments, also can replenish the row or the row of this sub-piece, satisfy 12 * 12 up to its size.
(f) utilize Gauss model to judge the sub-piece of target.The gray scale of utilizing Gauss model to describe the sub-piece of characteristic compares characteristic; Thereby obtain the average and the variance of the sub-piece Gaussian distribution of each characteristic; The variance of gray scale ratio that its respective pixel piece is described if Gaussian distribution has precipitous crest is very little, otherwise explains that then the variance of corresponding blocks gray scale ratio is bigger.When the variance of certain sub-piece during less than threshold value, this sub-piece is a shade, otherwise then is foreground target.It is that robustness has been improved in shadow region or target area that the piecemeal in suspected target zone is handled differentiation, and each gray scale is calculated through formula than the average and the variance of characteristic block:
D wherein
iBe the i block of pixels, E (gray)
i, D (gray)
iBe respectively the average and the variance of i block of pixels.
(g) utilize morphological operator, earlier image is carried out " expansion " computing, and then carry out " corrosion " computing; In order to eliminate " cavity " that possibly exist in institute's acquisition prospect; Thereby eliminate the isolated sub-piece of target, fill the sub-piece of discontinuous target, accomplish target detection and shade and eliminate.
Above basis has preferred embodiment been done detailed description to the present invention; But it will be appreciated that; Scope of the present invention is not limited to these concrete embodiments, but comprises that those skilled in the art are according to any change and the change that openly can make of the present invention.
Claims (8)
1. shadow Detection and removing method, it may further comprise the steps:
(a) set up background model;
(b) whether satisfy background model according to current frame pixel, present frame is carried out foreground/background segmentation, obtain to have the target of shade thus;
(c) with this target area that has a shade by the RGB color space conversion to the hsv color space;
(d) with tone H, saturation degree S and the brightness V three-component in hsv color space as the shadow Detection operator, tentatively eliminate the part shade;
(e) be converted into gray scale and represent eliminating target area behind the part shade, and to liken to the gray scale of itself and background model respective pixel be characteristic, and this target area is divided into the sub-piece of a plurality of characteristics;
(f) with each characteristic sub-block as a sequence of random variables, and gray scale described with Gauss model than distribution probability, thereby obtains the average and the variance of the Gaussian distribution of each block of pixels, calculate average and the variance of each gray scale than characteristic sub-block; If the variance of Gauss model is greater than setting threshold, then this sub-piece is the sub-piece of target, otherwise is the sub-piece of shade;
(g) eliminate the isolated sub-piece of target, fill the sub-piece of discontinuous target, accomplish target detection and shade and eliminate.
2. shadow Detection according to claim 1 and removing method is characterized in that, in step (a), utilize the Density Estimator background modeling method that background is described, with sequence of frames of video according to the modeling of Density Estimator background model.
3. shadow Detection according to claim 2 and removing method is characterized in that, in step (a), sequence of frames of video comprises the 30-50 frame.
4. shadow Detection according to claim 2 and removing method is characterized in that, in step (a), constantly upgrade the Density Estimator background model, and the prospect part is not participated in the renewal of background model, thereby obtain background model accurately.
5. shadow Detection according to claim 1 and removing method is characterized in that, in step (d), utilize formula tentatively to eliminate the part shade:
In the formula, I representes present frame, and B representes background frames, and α, β are the threshold value of brightness ratio, T
HAnd T
SBe respectively tone threshold value and saturation degree threshold value.
6. shadow Detection according to claim 1 and removing method is characterized in that, in step (e); This target area is divided into m * n the sub-piece of characteristic; And the size of each sub-piece is 12 * 12, if certain sub-block size is then cast out this sub-piece less than 12 * 12; Perhaps replenish the row or the row of this sub-piece, satisfy 12 * 12 up to its size.
7. shadow Detection according to claim 1 and removing method is characterized in that, in step (f), calculate each gray scale and than the average of the sub-piece of characteristic and the formula of variance are:
D wherein
iBe the i block of pixels, E (gray)
i, D (gray)
iBe respectively the average and the variance of i block of pixels.
8. shadow Detection according to claim 1 and removing method is characterized in that, in step (g), utilize morphological operator to eliminate the isolated sub-piece of target.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210039706XA CN102622763A (en) | 2012-02-21 | 2012-02-21 | Method for detecting and eliminating shadow |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210039706XA CN102622763A (en) | 2012-02-21 | 2012-02-21 | Method for detecting and eliminating shadow |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102622763A true CN102622763A (en) | 2012-08-01 |
Family
ID=46562664
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210039706XA Pending CN102622763A (en) | 2012-02-21 | 2012-02-21 | Method for detecting and eliminating shadow |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102622763A (en) |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103440628A (en) * | 2013-08-27 | 2013-12-11 | 宁波海视智能系统有限公司 | Method for removing shadow interference of moving object in video |
CN103971347A (en) * | 2014-06-04 | 2014-08-06 | 深圳市赛为智能股份有限公司 | Method and device for treating shadow in video image |
CN104636497A (en) * | 2015-03-05 | 2015-05-20 | 四川智羽软件有限公司 | Intelligent video data retrieval method |
CN104657490A (en) * | 2015-03-05 | 2015-05-27 | 四川智羽软件有限公司 | Information retrieval method |
CN105701844A (en) * | 2016-01-15 | 2016-06-22 | 苏州大学 | Method for detecting obstacle or shadow on the basis of color characteristics |
CN106407895A (en) * | 2016-08-30 | 2017-02-15 | 天津天地伟业数码科技有限公司 | Vehicle shadow detection algorithm based on image gray and Lab color space |
CN106651824A (en) * | 2015-10-28 | 2017-05-10 | 富士通株式会社 | Shadow detection device and shadow detection method |
CN107230188A (en) * | 2017-04-19 | 2017-10-03 | 湖北工业大学 | A kind of method of video motion shadow removing |
CN110099192A (en) * | 2018-01-29 | 2019-08-06 | 佳能株式会社 | Image forming apparatus, its control method and the storage medium for storing its control program |
CN110428439A (en) * | 2019-07-18 | 2019-11-08 | 浙江树人学院(浙江树人大学) | A kind of shadow detection method based on shadow region color saturation property |
CN110428465A (en) * | 2019-07-12 | 2019-11-08 | 中国科学院自动化研究所 | View-based access control model and the mechanical arm grasping means of tactile, system, device |
CN110807404A (en) * | 2019-10-29 | 2020-02-18 | 上海眼控科技股份有限公司 | Form line detection method, device, terminal and storage medium based on deep learning |
CN111192263A (en) * | 2020-01-09 | 2020-05-22 | 夏叶 | Intelligent energy-saving indoor people counting method based on machine vision |
CN117422757A (en) * | 2023-10-31 | 2024-01-19 | 安徽唯嵩光电科技有限公司 | Fruit and vegetable size sorting method and device, computer equipment and storage medium |
CN117422757B (en) * | 2023-10-31 | 2024-05-03 | 安徽唯嵩光电科技有限公司 | Fruit and vegetable size sorting method and device, computer equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060262959A1 (en) * | 2005-05-20 | 2006-11-23 | Oncel Tuzel | Modeling low frame rate videos with bayesian estimation |
CN101141633A (en) * | 2007-08-28 | 2008-03-12 | 湖南大学 | Moving object detecting and tracing method in complex scene |
CN101447082A (en) * | 2008-12-05 | 2009-06-03 | 华中科技大学 | Detection method of moving target on a real-time basis |
-
2012
- 2012-02-21 CN CN201210039706XA patent/CN102622763A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060262959A1 (en) * | 2005-05-20 | 2006-11-23 | Oncel Tuzel | Modeling low frame rate videos with bayesian estimation |
CN101141633A (en) * | 2007-08-28 | 2008-03-12 | 湖南大学 | Moving object detecting and tracing method in complex scene |
CN101447082A (en) * | 2008-12-05 | 2009-06-03 | 华中科技大学 | Detection method of moving target on a real-time basis |
Non-Patent Citations (1)
Title |
---|
王典: "基于混合高斯模型的运动阴影抑制算法", 《计算机应用》 * |
Cited By (20)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103440628B (en) * | 2013-08-27 | 2016-05-11 | 宁波海视智能系统有限公司 | A kind of method of removing video frequency motion target shadow interference |
CN103440628A (en) * | 2013-08-27 | 2013-12-11 | 宁波海视智能系统有限公司 | Method for removing shadow interference of moving object in video |
CN103971347A (en) * | 2014-06-04 | 2014-08-06 | 深圳市赛为智能股份有限公司 | Method and device for treating shadow in video image |
CN104636497A (en) * | 2015-03-05 | 2015-05-20 | 四川智羽软件有限公司 | Intelligent video data retrieval method |
CN104657490A (en) * | 2015-03-05 | 2015-05-27 | 四川智羽软件有限公司 | Information retrieval method |
CN106651824A (en) * | 2015-10-28 | 2017-05-10 | 富士通株式会社 | Shadow detection device and shadow detection method |
CN105701844A (en) * | 2016-01-15 | 2016-06-22 | 苏州大学 | Method for detecting obstacle or shadow on the basis of color characteristics |
CN105701844B (en) * | 2016-01-15 | 2018-11-27 | 苏州大学 | Barrier or shadow detection method based on color characteristic |
CN106407895A (en) * | 2016-08-30 | 2017-02-15 | 天津天地伟业数码科技有限公司 | Vehicle shadow detection algorithm based on image gray and Lab color space |
CN107230188B (en) * | 2017-04-19 | 2019-12-24 | 湖北工业大学 | Method for eliminating video motion shadow |
CN107230188A (en) * | 2017-04-19 | 2017-10-03 | 湖北工业大学 | A kind of method of video motion shadow removing |
CN110099192A (en) * | 2018-01-29 | 2019-08-06 | 佳能株式会社 | Image forming apparatus, its control method and the storage medium for storing its control program |
CN110099192B (en) * | 2018-01-29 | 2022-03-25 | 佳能株式会社 | Image forming apparatus, control method thereof, and storage medium storing control program thereof |
CN110428465A (en) * | 2019-07-12 | 2019-11-08 | 中国科学院自动化研究所 | View-based access control model and the mechanical arm grasping means of tactile, system, device |
CN110428439A (en) * | 2019-07-18 | 2019-11-08 | 浙江树人学院(浙江树人大学) | A kind of shadow detection method based on shadow region color saturation property |
CN110807404A (en) * | 2019-10-29 | 2020-02-18 | 上海眼控科技股份有限公司 | Form line detection method, device, terminal and storage medium based on deep learning |
CN111192263A (en) * | 2020-01-09 | 2020-05-22 | 夏叶 | Intelligent energy-saving indoor people counting method based on machine vision |
CN111192263B (en) * | 2020-01-09 | 2023-08-22 | 夏叶 | Intelligent energy-saving indoor people counting method based on machine vision |
CN117422757A (en) * | 2023-10-31 | 2024-01-19 | 安徽唯嵩光电科技有限公司 | Fruit and vegetable size sorting method and device, computer equipment and storage medium |
CN117422757B (en) * | 2023-10-31 | 2024-05-03 | 安徽唯嵩光电科技有限公司 | Fruit and vegetable size sorting method and device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102622763A (en) | Method for detecting and eliminating shadow | |
CN104732227B (en) | A kind of Location Method of Vehicle License Plate based on definition and luminance evaluation | |
EP2959454B1 (en) | Method, system and software module for foreground extraction | |
CN103063167B (en) | A kind of method of automatic decision laser cleaning effect | |
Li et al. | Automatic pavement crack recognition based on BP neural network | |
CN105868722A (en) | Identification method and system of abnormal power equipment images | |
CN103065334B (en) | A kind of color cast detection based on hsv color space, bearing calibration and device | |
CN102609723B (en) | Image classification based method and device for automatically segmenting videos | |
CN107767390B (en) | The shadow detection method and its system of monitor video image, shadow removal method | |
CN108682039B (en) | Binocular stereo vision measuring method | |
CN103456021B (en) | A kind of Fabric Defect detection method based on morphological analysis | |
CN108550159B (en) | Flue gas concentration identification method based on image three-color segmentation | |
CN103093458B (en) | The detection method of key frame and device | |
CN109685760A (en) | A kind of SLM powder bed powder laying image convex closure depression defect detection method based on MATLAB | |
CN103020924B (en) | Low-illumination monitored image enhancement method based on similar scenes | |
CN110288618B (en) | Multi-target segmentation method for uneven-illumination image | |
CN103489187A (en) | Quality test based segmenting method of cell nucleuses in cervical LCT image | |
CN103310201A (en) | Identification method for mixed colors of targets | |
CN115018765A (en) | Powder metallurgy part finished product detection method based on gray level gradient co-occurrence matrix | |
CN103500451B (en) | A kind of independent floating ice extracting method for satellite data | |
CN100469138C (en) | Power transformer draught fan state recognizing method based on video monitoring and image recognition | |
GB2563142A (en) | Image background subtraction for dynamic lighting scenarios | |
CN105869148A (en) | Target detection method and device | |
CN112560574A (en) | River black water discharge detection method and recognition system applying same | |
CN105335981A (en) | Image-based goods monitoring method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20120801 |