Summary of the invention
Present invention aim to address the problems of the prior art, a kind of algorithm being provided and realizes simple, computation complexity is low,
The fast fire-fighting road occupying exception object detecting method based on frame differential method of the speed of service.
The technical scheme is that
Fire-fighting road occupying exception object detecting method based on frame differential method, comprising the following steps: S1, examined in fire-fighting road occupying
When survey region is normal, the video frame frame of a frame monitoring image is obtained;S2, gray proces are carried out to video frame frame and are obtained
Detection zone video frame unit_frame;Define base map image I0=unit_frame;S3, circulation obtain the video of monitoring image
Frame frame_update extracts detection zone image I in the video framet;Pass through difference algorithm formulaCalculate I0With ItDifference image Dt, carry out fire-fighting road occupying and examine extremely
It surveys, wherein T is the pixel frame value threshold value of difference image binaryzation constantly.
As a kind of perferred technical scheme, the implementation method of the step S3 is the following steps are included: S3a, acquisition monitoring
One frame video frame frame_update of image;S3b, the t moment fire-fighting road occupying extracted in video frame frame_update are examined
The video frame detection_frame for surveying region, defines t moment fire-fighting road occupying detection zone image It=detection_
frame;S3c, pass through inter-frame difference algorithmic formulaOne by one to pixel
(x, y) carries out binary conversion treatment, and carries out connectivity analysis, finally obtains I0With ItBetween difference image Dt, wherein Dt(x,
It y)=255 is white pixel point, Dt(x, y)=0 is black pixel point;S3d, to the difference image D after binary conversion treatmenttIt carries out
Contour of object minimum circumscribed rectangle;If white point proportion is greater than threshold value obj_ in contour of object minimum circumscribed rectangle
Threshold and matrix area are greater than smallest object threshold value Smin, then it is assumed that before the contour of object minimum circumscribed rectangle is target
Scenery body can get contour of object coordinate [[Xmin, Ymin], [Xmax, Ymax]];Otherwise, profile framework is noise spot, will
It is excluded, and can finally get contour of object coordinate set Rectangle_set;S3e, successively in Rectangle_set
Contour of object and detection zone carry out registration judgement;If registration reaches lowest threshold registration threshold value coincide_
Threshold then has object road occupying in fire-fighting road occupying detection zone, otherwise, does not have object road occupying in fire-fighting road occupying detection zone;
S3f, judge whether to continue to test, if so, step S3a is gone to, if it is not, terminating detection.
As a kind of further preferred technical solution, in the step S3, definition accumulation road occupying time sum, initial shape
State sum=0;When " registration reaches lowest threshold registration threshold value coincide_threshold " in the step S3e,
Sum=sum+1.
As a kind of technical solution still more preferably, in the step S3, define that continue road occupying time threshold be Δ t
Road occupying time T_last was found with last time;When " registration reaches lowest threshold registration threshold value in the step S3e
When coincide_threshold ", after sum=sum+1, the relationship of sum Yu Δ t are judged, if sum >=Δ t and current time T_
Now and last time are found between road occupying time T_last interval time and are less than time interval Δ T, then report fire-fighting road occupying anomalies
Otherwise body road occupying event and sum=0, T_last=T_now are not reported, sum=0, T_last=T_now.
As a kind of technical solution still further preferably, time interval Δ T is 60 seconds.
As another further preferred technical solution, when " not having in fire-fighting road occupying detection zone in the step S3e
When object road occupying ", base map image I is updated0For I0=detection_frame.
As also a kind of further preferred technical solution, when threshold value obj_threshold is in the step S3d
80%.
The technical solution further preferred as another, the step S3b " are extracted in video frame frame_update
Fire-fighting road occupying detection zone video frame detection_frame " described in fire-fighting road occupying detection zone video frame
Detection_frame is the video frame after gray proces.
As a kind of perferred technical scheme, the threshold value T chosen when the difference image binaryzation is integer value.
Fire-fighting road occupying exception object detecting method based on frame differential method of the invention, by obtaining under normal condition
Then the grayscale image of picture in fire-fighting road occupying detection zone successively obtains camera video frame and base map figure as base map image
As comparison, foreground object body is obtained using frame differential method, object minimum outsourcing frame coordinate is being obtained according to morphology, according to
Acquired minimum outsourcing frame and fire-fighting road occupying detection information library carry out fire-fighting road occupying detection zone exception object detection and exception
Situation reports judgement.Fire-fighting road occupying exception object detecting method based on frame differential method of the invention, abnormal object is carried out
Form picture frame demarcates object minimum circumscribed rectangle frame, as the shared region area of the object, as the doubtful exception of fire-fighting road occupying
The judgment criteria of object, not only algorithm realizes simple that program computation complexity is low, and the speed of service is fast, and becomes to scene light
Change insensitive, moreover it is possible to improve Detection accuracy.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
The term used in embodiments of the present invention is only to be not intended to be limiting merely for for the purpose of describing particular embodiments
The present invention.In the embodiment of the present invention and the "an" of singular used in the attached claims, " described " and "the"
It is also intended to including most forms, unless the context clearly indicates other meaning, " a variety of " generally comprise at least two, but not
It excludes to include at least one situation.
It should be appreciated that term "and/or" used herein is only a kind of incidence relation for describing affiliated partner, indicate
There may be three kinds of relationships, for example, A and/or B, can indicate: individualism A, exist simultaneously A and B, individualism B these three
Situation.In addition, character "/" herein, typicallys represent the relationship that forward-backward correlation object is a kind of "or".
Depending on context, word as used in this " if ", " if " can be construed to " ... when " or
" when ... " or " in response to determination " or " in response to detection ".Similarly, context is depended on, phrase " if it is determined that " or " such as
Fruit detection (condition or event of statement) " can be construed to " when determining " or " in response to determination " or " when detection (statement
Condition or event) when " or " in response to detection (condition or event of statement) ".
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
Include, so that commodity or system including a series of elements not only include those elements, but also including not clear
The other element listed, or further include for this commodity or the intrinsic element of system.In the feelings not limited more
Under condition, the element that is limited by sentence "including a ...", it is not excluded that in the commodity or system for including the element also
There are other identical elements.
As shown in Figure 1, a kind of fire-fighting road occupying exception object detecting method based on frame differential method of the invention, feature
It is: the following steps are included:
S1, when fire-fighting road occupying detection zone is normal, obtain a frame monitoring image video frame frame;
S2, gray proces are carried out to video frame frame and obtain detection zone video frame unit_frame;Define base map figure
As I0=unit_frame;
S3, circulation obtain the video frame frame_update of monitoring image, extract detection zone image I in the video framet;
Pass through difference algorithm formulaCalculate I0With ItDifference image Dt, into
Row fire-fighting road occupying abnormality detection, wherein T is the pixel frame value threshold value of difference image binaryzation constantly.
It is to be understood that in the present invention, the monitoring image in step S1 not merely refers in particular to conventional monitoring camera and obtains
Image, also refer to the image/video for needing to check comparison, namely need to carry out the video image of foreign bodies detection, can be special for setting
The video or image of the monitoring camera shooting of door, or the video or image that other photographic devices obtain.
Difference algorithm formulaIn, ItIt is the figure of t moment video frame
As pixel, I0Pixel frame value threshold value when image pixel, the T for being base map video frame are difference image binaryzations.ItWith I0Two frames
Image corresponding pixel points (x, y) are done absolute value of the difference and are judged with T, and difference image D can be obtainedt(x, y), wherein gray value is
255 point is white point, and the point that gray value is 0 is black color dots.
Fire-fighting road occupying exception object detecting method based on frame differential method of the invention, by obtaining under normal condition
Then the grayscale image of picture in fire-fighting road occupying detection zone successively obtains camera video frame and base map figure as base map image
As comparison, foreground object body is obtained using frame differential method, object minimum outsourcing frame coordinate is being obtained according to morphology, according to
Acquired minimum outsourcing frame and fire-fighting road occupying detection information library carry out fire-fighting road occupying detection zone exception object detection and exception
Situation reports judgement.
In practical applications, " circulation obtains the video frame frame_update of monitoring image to step S3, extracts the video frame
Interior detection zone image It;Pass through difference algorithm formulaCalculate I0With
ItDifference image Dt, carry out fire-fighting road occupying abnormality detection " concrete methods of realizing it is as follows:
S3a, the frame video frame frame_update for obtaining monitoring image;
S3b, the video frame detection_ for extracting fire-fighting road occupying detection zone in video frame frame_update
Frame defines moment fire-fighting road occupying detection zone image It=detection_frame;
S3c, pass through inter-frame difference algorithmic formulaOne by one to pixel
Point (x, y) carries out binary conversion treatment, and carries out connectivity analysis, finally obtains I0With ItBetween difference image Dt, wherein Dt
(x, y)=255 is white pixel point, Dt(x, y)=0 is black pixel point;
S3d, to the difference image D after binary conversion treatmenttCarry out contour of object minimum circumscribed rectangle;If contour of object is minimum
White point proportion is greater than threshold value obj_threshold in boundary rectangle and matrix area is greater than smallest object threshold value Smin,
Then think the contour of object minimum circumscribed rectangle be target prospect object, can get contour of object coordinate [[Xmin, Ymin],
[Xmax,Ymax]];Otherwise, profile framework is noise spot, is excluded, can finally get contour of object coordinate set
Rectangle_set;
S3e, successively in Rectangle_set contour of object and detection zone carry out registration judgement;If registration
Reach lowest threshold registration threshold value coincide_threshold, then has object road occupying in fire-fighting road occupying detection zone, otherwise,
There is no object road occupying in fire-fighting road occupying detection zone;
S3f, judge whether to continue to test, if so, step S3a is gone to, if it is not, terminating detection.
In the present embodiment, in the step S3, definition accumulation road occupying time sum, original state sum=0;When the step
In S3e when " registration reaches lowest threshold registration threshold value coincide_threshold ", sum=sum+1.
Also, in the step S3, defining lasting road occupying time threshold is Δ t and last time to be found road occupying time T_
last;When " registration reaches lowest threshold registration threshold value coincide_threshold " in the step S3e, sum=
After sum+1, the relationship of sum Yu Δ t are judged, if sum >=Δ t and current time T_now and last time are found road occupying time T_
Interval time is less than time interval Δ T between last, then reports fire-fighting road occupying exception object road occupying event and sum=0, T_last
Otherwise=T_now is not reported, sum=0, T_last=T_now.Time interval Δ T can be set as the case may be,
In the present embodiment, time interval Δ T is 60 seconds.That is, working as sum >=△ t, if T_now-T_last > 60s at this time, reports alert
Time and sum=0, T_last=T_now are not reported if T_now-T_last < 60s, sum=0, T_last=T_now.
The present embodiment is by continuously detecting the frequency threshold value for having object road occupying in fire-fighting road occupying detection zone and front and back twice
It was found that the time interval of fire-fighting road occupying reports judgement to carry out alert, time signal machine is reasonable on alert, certainly, in practical applications,
It can also be carried out using persistently having the beginning and ending time of object road occupying in such as simple calculating fire-fighting road occupying detection zone of other modes
The calculating of fire-fighting road occupying time.After thering is the time of object road occupying to reach interval delta T in fire-fighting road occupying detection zone, reported
Alert.Otherwise, it does not report.
It is to be understood that when " registration reaches lowest threshold registration threshold value coincide_threshold " in the present embodiment
When, namely find after having object road occupying in fire-fighting road occupying detection zone, whether alert reports or not, fire-fighting road occupying event handling is complete
Bi Hou adds up road occupying time sum meeting return-to-zero, and last time, which is found road occupying time T_last, can be reset as T_now, avoid missing
Report.
In order to avoid light changes interference to base map image, when " not having in fire-fighting road occupying detection zone in the step S3e
Have object road occupying " when, update base map image I0For I0=detection_frame.
In the present embodiment, threshold value obj_threshold is 80% in step S3d
In order to improve base map image I0And between detection zone image I (t) Difference Calculation accuracy, the step S3b
Disappear described in " the video frame detection_frame for extracting the fire-fighting road occupying detection zone in video frame frame_update "
The video frame detection_frame of anti-road occupying detection zone is the video frame after gray proces.
In practical applications, the threshold value T chosen when difference image binaryzation is a certain suitable integer value.
Fire-fighting road occupying exception object detecting method based on frame differential method of the invention, by obtaining under normal condition
Then the grayscale image of picture in fire-fighting road occupying detection zone successively obtains camera video frame and base map figure as base map image
As comparison, foreground object body is obtained using frame differential method, object minimum outsourcing frame coordinate is being obtained according to morphology, according to
Acquired minimum outsourcing frame and fire-fighting road occupying detection information library carry out fire-fighting road occupying detection zone exception object detection and exception
Situation reports judgement.Fire-fighting road occupying exception object detecting method based on frame differential method of the invention, abnormal object is carried out
Form picture frame demarcates object minimum circumscribed rectangle frame, as the shared region area of the object, as the doubtful exception of fire-fighting road occupying
The judgment criteria of object, not only algorithm realizes simple that program computation complexity is low, and the speed of service is fast, and becomes to scene light
Change insensitive, moreover it is possible to improve Detection accuracy.
It is in summary only preferred embodiments of the present invention, practical range not for the purpose of limiting the invention.That is Fan Yiben
Equivalence changes made by the content of patent application the scope of the patents and modification all should belong to technology scope of the invention.