Summary of the invention
For the problem cannot being carried out behavior monitoring in correlation technique by video, the invention provides a kind of behavior monitoring method and device, at least to solve this problem.
According to an aspect of the present invention, provide a kind of behavior monitoring method, comprising: use frame difference method to extract foreground image from the color RGB image of monitoring; The region that monitored people is corresponding in described foreground image is determined in described foreground image; In this region, the image outline of described monitored people is searched; The judgment threshold of external matrix corresponding to described image outline and default behavior of hanging oneself is used to judge that monitored people there occurs the behavior of hanging oneself.
Preferably, use frame difference method to extract foreground image from the color RGB image of monitoring to comprise: by the N two field picture image as a setting gathered; N+1 frame is started, present image and described background image are carried out subtraction on three passages of colour; The absolute value of the result of described subtraction is carried out difference image that binaryzation obtains as described foreground image;
Wherein, N be greater than 1 positive integer.
Preferably, in described foreground image, determine that the region of monitored people correspondence in described foreground image comprises: described foreground image is carried out erosion operation; The image obtained after described erosion operation removes isolated point, noise, burr and foot bridge and obtain the first image; Dilation operation is carried out to described first image in the vertical direction and obtains the second image; Described second image determines described region.
Preferably, in this region, the image outline searching described monitored people comprises: carry out described second image to search for according to preset order the point obtaining white; With the point of described white for starting point, all frontier points in the described region at described white point place are carried out mark and obtains one or more described image outline.
Preferably, using before external matrix corresponding to described image outline and the judgment threshold of behavior of hanging oneself preset judge whether monitored people there occurs the behavior of hanging oneself, also comprise the external matrix determining that described image outline is corresponding in the following way: the point sequence corresponding to described image outline scans; Determine that the minimum value in the horizontal direction of the point sequence after described scanning is the X value of described external matrix; Point sequence after described scanning maximal value is in the horizontal direction deducted the minimum value of described horizontal direction difference and 1 and as the width of described external matrix; Determine that the point sequence after described scanning is the Y value of described external matrix in the minimum value of vertical direction; Point sequence after described scanning is deducted in the maximal value of vertical direction the minimum value of described vertical direction difference and 1 and as the length of described external matrix.
Preferably, use the judgment threshold of external matrix corresponding to described image outline and default behavior of hanging oneself to judge that monitored people there occurs the behavior of hanging oneself and comprises: in described external matrix, use SVM monitor head to take on, obtain the height and yardstick takeed on to the end; Judge the height that described head is takeed on and the first judgment threshold that the whether satisfied behavior of hanging oneself preset of yardstick is takeed at head; If judged result is satisfied, then determine to there occurs the behavior of hanging oneself; And/or
Height and the yardstick of face is monitored in described external matrix; Judge whether height and the yardstick of described face meet second judgment threshold of default behavior of hanging oneself at face; If judged result is satisfied, then determine to there occurs the behavior of hanging oneself.
Preferably, said method also comprises: upgrade described foreground image.
Preferably, renewal is carried out to described foreground image and comprises: the pixel value of the pixel value of the non-foreground area of N frame and described foreground image same position is weighted summation, as the foreground image after renewal.
According to a further aspect in the invention, providing a kind of behavior monitoring device, comprising: extraction module, from the color RGB image of monitoring, extracting foreground image for using frame difference method; Determination module, for determining the region that monitored people is corresponding in described foreground image in described foreground image; Search module, in this region, search the image outline of described monitored people; For using the judgment threshold of external matrix corresponding to described image outline and default behavior of hanging oneself, judge module, judges that monitored people there occurs the behavior of hanging oneself.
Preferably, described extraction module comprises: the first processing module, for the N two field picture image as a setting that will gather; Computing module, for being started by N+1 frame, carries out subtraction by present image and described background image on three passages of colour; Second processing module, the absolute value for the result using described subtraction carries out difference image that binaryzation obtains as described foreground image; Wherein, N be greater than 1 positive integer.
By the present invention, adopt and use frame difference method to extract foreground image from the color RGB image of monitoring; The region that monitored people is corresponding in foreground image is determined in foreground image; In the zone, the image outline of monitored people is searched; The judgment threshold of external matrix corresponding to image outline and default behavior of hanging oneself is used to judge that monitored people there occurs the behavior of hanging oneself, solve the problem cannot being carried out behavior monitoring in correlation technique by video, and then reach the effect of the accuracy improving monitoring of hanging oneself.
Embodiment
Hereinafter also describe the present invention in detail with reference to accompanying drawing in conjunction with the embodiments.It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.
Present embodiments provide a kind of behavior monitoring method, Fig. 1 is the process flow diagram of the behavior monitoring method according to the embodiment of the present invention, and the method comprises following step S102 to step S108.
Step S102: use frame difference method to extract foreground image from the color RGB image of monitoring.
Step S104: determine the region that monitored people is corresponding in this foreground image in this foreground image.
Step S106: in this region, searches the image outline of this monitored people.
Step S108: use the judgment threshold of external matrix corresponding to this image outline and default behavior of hanging oneself to judge that monitored people there occurs the behavior of hanging oneself.
Preferably, use frame difference method to extract foreground image from the color RGB image of monitoring to comprise: by the N two field picture image as a setting gathered; N+1 frame is started, present image and described background image are carried out subtraction on three passages of colour; The absolute value of the result of described subtraction is carried out difference image that binaryzation obtains as described foreground image; Wherein, N be greater than 1 positive integer.
Preferably, in described foreground image, determine that the region of monitored people correspondence in described foreground image comprises: described foreground image is carried out erosion operation; The image obtained after described erosion operation removes isolated point, noise, burr and foot bridge and obtain the first image; Dilation operation is carried out to described first image in the vertical direction and obtains the second image; Described second image determines described region.
Preferably, in this region, the image outline searching described monitored people comprises: carry out described second image to search for according to preset order the point obtaining white; With the point of described white for starting point, all frontier points in the described region at described white point place are carried out mark and obtains one or more described image outline.
Preferably, using before external matrix corresponding to described image outline and the judgment threshold of behavior of hanging oneself preset judge whether monitored people there occurs the behavior of hanging oneself, also comprise the external matrix determining that described image outline is corresponding in the following way: the point sequence corresponding to described image outline scans; Determine that the minimum value in the horizontal direction of the point sequence after described scanning is the X value of described external matrix; Point sequence after described scanning maximal value is in the horizontal direction deducted the minimum value of described horizontal direction difference and 1 and as the width of described external matrix; Determine that the point sequence after described scanning is the Y value of described external matrix in the minimum value of vertical direction; Point sequence after described scanning is deducted in the maximal value of vertical direction the minimum value of described vertical direction difference and 1 and as the length of described external matrix.
Preferably, use the judgment threshold of external matrix corresponding to described image outline and default behavior of hanging oneself to judge that monitored people there occurs the behavior of hanging oneself and comprises: in described external matrix, use SVM monitor head to take on, obtain the height and yardstick takeed on to the end; Judge the height that described head is takeed on and the first judgment threshold that the whether satisfied behavior of hanging oneself preset of yardstick is takeed at head; If judged result is satisfied, then determine to there occurs the behavior of hanging oneself; And/or
Height and the yardstick of face is monitored in described external matrix; Judge whether height and the yardstick of described face meet second judgment threshold of default behavior of hanging oneself at face; If judged result is satisfied, then determine to there occurs the behavior of hanging oneself.
Preferably, said method also comprises: upgrade described foreground image.
Preferably, renewal is carried out to described foreground image and comprises: the pixel value of the pixel value of the non-foreground area of N frame and described foreground image same position is weighted summation, as the foreground image after renewal.
It should be noted that, can perform in the computer system of such as one group of computer executable instructions in the step shown in the process flow diagram of accompanying drawing, and, although show logical order in flow charts, but in some cases, can be different from the step shown or described by order execution herein.
In another embodiment, additionally provide a kind of behavior monitoring software, this software is for performing the technical scheme described in above-described embodiment and preferred embodiment.
In another embodiment, additionally provide a kind of storage medium, store above-mentioned behavior monitoring software in this storage medium, this storage medium includes but not limited to: CD, floppy disk, hard disk, scratch pad memory etc.
The embodiment of the present invention additionally provides a kind of behavior monitoring device, the behavior, monitoring device may be used for realizing above-mentioned behavior monitoring method and preferred implementation, to carry out explanation, repeated no more, below the module related in behavior monitoring device had been described.As used below, term " module " can realize the software of predetermined function and/or the combination of hardware.Although the system and method described by following examples preferably realizes with software, hardware, or the realization of the combination of software and hardware also may and conceived.
Fig. 2 is the structured flowchart of the behavior monitoring device according to the embodiment of the present invention, and as shown in Figure 2, this device comprises: extraction module 22, determination module 24, search module 26 and judge module 28, is described in detail below to said structure.
Extraction module 22, extracts foreground image for using frame difference method from the color RGB image of monitoring; Determination module 24, for determining the region that monitored people is corresponding in this foreground image in this foreground image; Search module 26, in this region, search the image outline of this monitored people; For using the judgment threshold of external matrix corresponding to this image outline and default behavior of hanging oneself, judge module 28, judges that monitored people there occurs the behavior of hanging oneself.
Fig. 3 is the preferred structured flowchart of the behavior monitoring device according to the embodiment of the present invention, and extraction module 22 comprises: the first processing module 222, for the N two field picture image as a setting that will gather; Computing module 224, for being started by N+1 frame, carries out subtraction by present image and this background image on three passages of colour; Second processing module 226, the absolute value for the result using this subtraction carries out difference image that binaryzation obtains as this foreground image; Wherein, N be greater than 1 positive integer.
Be described below in conjunction with preferred embodiment, following preferred embodiment combines above-described embodiment and preferred implementation.
Preferred embodiment one
This preferred embodiment provides a kind of method that identification is hung oneself, and the method comprises the steps that S202 is to step S208.
Step S202: on RGB image, utilizes frame difference method to extract prospect.
Step S204: for the prospect morphological method process extracted.Remove isolated point, burr and unwanted foot bridge (being namely communicated with the point in two pieces of regions), and fill and lead up lakelet (i.e. aperture), make gap up, by the joint area at the place of people total position and shape invariance together.
Step S206: for the region at people place, searches its profile.Its boundary rectangle is calculated for profile.
Step S208: use svm head to take in boundary rectangle and detect sub-detection head shoulder, use the cascade adaboos detection of classifier face based on Haarg feature simultaneously.Finally according to height and the yardstick of head shoulder, the height of face and yardstick, and the height of boundary rectangle lower limb, whether comprehensive descision there occurs the behavior of hanging oneself.Preferably, wherein any one detects son and detects to hang oneself and all report to the police.
Preferably, for the background used in foreground detection, adjustable threshold value is used to upgrade the background of non-foreground area.
As a preferably embodiment, this frame difference method also comprises: after camera collection image stabilization, use the first two field picture image as a setting.From the second two field picture, each two field picture and background do difference on three passages of colour.To each pixel, if the maximal value of the difference result on these three passages is greater than a certain threshold value, then the value assignment on gray level image this put is 255.Otherwise assignment is 0.
As another preferably embodiment, this morphological method also comprises: first carry out erosion operation to the bianry image that frame difference method generates, remove isolated point, burr, and foot bridge.Because the image in the vertical direction obtained is very easy to produce fracture, so use larger structure on vertical direction to carry out dilation operation to image afterwards, make gap up, and fill and lead up lakelet, by the joint area at people place together.
In order to improve the precision of searching, when implementing, searching of profile can be carried out in the following way: by the bianry image after handled by above-mentioned waveforms method from top to bottom, from left to right carry out automatic search, until find first white point.With this point as starting point, all frontier points of the foreground area at this place are marked.After having marked a profile, preserve each gauge point found, and continued search from last gauge point, find next profile.
When implementing, boundary rectangle can be calculated in the following way: the point sequence representing a certain profile is scanned, get the x value of minimum value as boundary rectangle of wherein horizontal direction, the maximal value of getting horizontal direction deducts horizontal direction minimum value and adds one as the width of rectangle.Vertical direction is similar.
When implementing, in order to improve the accuracy of head shoulder monitoring, head shoulder can be carried out in the following way and detect: what off-line used size identical comprises the positive samples pictures of head shoulder and do not comprise head and bear samples pictures, trains svm sorter.The sorter that online use trains, carries out head shoulder to circumscribed rectangular region and detects.
When implementing, in order to improve the accuracy of face monitoring, the monitoring of face can be carried out in the following way: off-line uses the adaboost sorter of the positive samples pictures comprising face and the positive samples pictures training cascade not comprising face.The facial image of the detection of classifier circumscribed rectangular region that online use trains.
When implementing, in order to improve the precision of warning, comprehensive descision can be carried out in the following way and whether there occurs the behavior of hanging oneself: going out many lines of stumbling according to the location position that floor in video is sitting in.Boundary rectangle length and width size and ratio being met to human body calculates, and under some special screnes, when this boundary rectangle appears at the top certain distance of line of stumbling completely, being then likely hanging is on the implementation.After some frames, the state of this rectangle is still hung oneself state, then produce warning at once.The height simultaneously detecting shoulder or face to the end under different yardsticks, higher than a certain threshold value, also produces warning at once.
When implementing, the renewal of background can be carried out in several ways, such as: background image is divided into two parts, foreground area and non-foreground area.Only non-foreground area is done and upgrade.The way upgraded be the pixel value of the non-foreground area using previous frame image in the pixel value weighted sum of background same position, as the pixel value of relevant position in new background.
By the scheme of above-described embodiment, first background subtraction is utilized to extract the moving region of human body in the foreground detection stage, then by searching profile and calculating the rectangular area that the means such as boundary rectangle calculate human body place.Position calculation human body finally by boundary rectangle departs from the time on ground, produce corresponding warning, and remove other abnormal interference by the characteristic information of boundary rectangle, adopt svm head shoulder to detect son and detect son based on the cascade adaboost of haar feature simultaneously and detect face.When the head shoulder height degree detected or face height are higher than also trigger alarm during a certain threshold value.Effectively can realize the monitoring to the behavior of hanging oneself.
Preferred embodiment two
This preferred embodiment provides a kind of method of behavior of hanging oneself based on the multiple monitoring detecting son, and the method comprises the steps that S302 is to step S306.
Step S302: adopt multiple detection sub-portfolio to detect behavior of hanging oneself.
Step S304: use head shoulder to detect son, Face datection.This step can promote Detection results.
Step S306: merge foreground detection, contours extract, calculates the position residing for judgement human body of the technology effective such as boundary rectangle.
This step, by the line of stumbling set in advance, sets trigger mechanism flexibly, solves the behavioural analysis problem of the behavioral value of hanging oneself of people.
Preferably, can upgrade by preset weights background, effectively can solve the hole problem of prospect and to the light of slowly change, there is certain robustness.
Preferred embodiment three
This preferred embodiment provides a kind of method of behavior of hanging oneself based on the multiple monitoring detecting son, and the method comprises the steps that S402 is to step S416.
Step S402: foreground detection.
In this step, after video camera gathers image stabilization, get the first two field picture image as a setting, from the second frame, by present image in background image simple subtraction take absolute value and binaryzation obtain difference image--d (i, j).
Step S404: Morphological scale-space.
In this step, morphology opening operation is first carried out for difference image and get rid of isolated point, noise, burr and foot bridge.Made up the human region of fracture again by closing operation of mathematical morphology.Then export bianry image as subsequent treatment, because Morphological scale-space is not emphasis of the present invention, therefore to describe not in detail here.
Step S406: search profile.
In this step, adopt the edge following algorithm based on connectedness, obtain the profile extracting pedestrian in whole image sequence.Profile is stored with the form of point sequence.
Step S408: calculate boundary rectangle.
In this step, for the point sequence of an outline found out, to calculate in this sequence minimum value a little in the horizontal and vertical directions and maximal value Xmax, Ymin, Xmax, Ymax.Then the top left co-ordinate of boundary rectangle and wide height are (Xmin, Ymin), width=Xmax-Xmin+1, height=Ymax-Xmin+1.
Step S410: according to pre-set line of stumbling, judges behavior of hanging oneself.
In this step, first a part of undesirable rectangle is filtered according to the size of boundary rectangle calculated and the ratio of width to height.Then judge the lower frame of boundary rectangle whether complete on pre-set line of stumbling or above line of stumbling certain distance.Rule of judgment is then assert in video and be there occurs the behavior of hanging oneself, and reports to the police.
Step S412: hung oneself by the detection of detection head shoulder.In this step, support vector machine method can be used to carry out head shoulder detect.
This step can be realized by following sub-step:
(1) train: choose suitable kernel function, k(xi, xj).
(2) minimize || w||, at ω
i(wx
i-b)>=1-ξ
icondition under.
(3) α of non-zero is only stored
iwith corresponding x
i(they are support vectors).
(4) image is zoomed to different scale by a certain percentage, under each yardstick, use the window scan image of 8*16 size.And then the image under each window is classified.
(5) classify: for pattern X, use support vector x
iwith corresponding weight α
icomputational discrimination functional expression
the symbol of this function determines that this region is head shoulder.
What the head that last basis detects was takeed on has judged whether that behavior of hanging oneself occurs, and height can by using this according to scene sets itself.
Step S414: detected by Face datection and hang oneself.
In this step, tester is according to scene or use face location in the sub-detected image of Face datection that trained.Wherein Face datection carries out under each multiple dimensioned yardstick.Use high 20 pixels, the window of wide 20 pixels to the image under current scale from left to right, falls down to carry out Face datection from above.The face fusion close to distance under multiple yardstick is the face of a position.When the face detected is higher than a certain threshold value, then there is trigger alarm., wherein threshold value can by user according to scene settings, also can default setting.Owing to can adopt the implementation in correlation technique based on the cascade Adaboost detection face method of HAAR feature, do not repeat them here.
Step S416: context update.
In this step, after carrying out method of difference detection prospect, according to present frame and the foreground area that detects, summation is weighted to the present frame of non-foreground area and background, upgrades background.
It should be noted that, by technique scheme, the technical scheme of the present embodiment is not by the impact of slow illumination variation, and strong for abnormal behaviour antijamming capability, real-time is good, according to scene manual shift parameter, very accurately can detect the behavior of hanging oneself.
Preferred embodiment
Present embodiments provide the process flow diagram that a kind of Fig. 4 is the monitoring method of hanging oneself according to the embodiment of the present invention, as shown in Figure 4, the method comprises following step S502 to step S518.
Step S502: input picture.
Step S504: foreground detection.This step can adopt the embodiment of above preferred embodiment.
Step S506: search profile.
Step S508: calculate boundary rectangle.
Step S510: Face datection.
The monitoring of step S512:SVM head shoulder.
Step S514: judge whether to detect son higher than respective threshold, if judged result is yes, perform step S516, otherwise perform step S518.
Step S516: alert trigger.
Step S518: not alert trigger.
By above-described embodiment, providing a kind of behavior monitoring method and device, by using the mode of Multiple detection sub-portfolio, the behavior of hanging oneself being monitored.Substantially increase the accuracy rate of detection.It should be noted that, these technique effects are not that above-mentioned all embodiments have, and some technique effect is that some preferred implementation just can obtain.
Obviously, those skilled in the art should be understood that, above-mentioned of the present invention each module or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on network that multiple calculation element forms, alternatively, they can realize with the executable program code of calculation element, thus they storages can be performed by calculation element in the storage device, or they are made into each integrated circuit modules respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the present invention is not restricted to any specific hardware and software combination.
These are only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.