Embodiment
Below with reference to the accompanying drawings and in conjunction with the embodiments, describe the present invention in detail.
Referring to Fig. 1, the step among the embodiment comprises:
S11: detect the human body contour outline in every two field picture;
S12: determine in the image distance between any two human body contour outlines less than first threshold, then the skin color of everyone face in the detected image respectively;
First threshold can be set according to the quantity of pixel.Also can proportionally determine, for example: distance lives in the 1.3-1.7 times of the minimum rectangle width of human body contour outline for frame
S13: be not less than Second Threshold if silt green grass or young crops or purple and area appear in one of them people's skin of face color, then determine to occur the behavior of fighting.
Method among the embodiment, the color of the skin of face by the distance between any two human body contour outlines and human body is determined the process of fighting, and does not need the user to use eye detection, has reduced the situation that the phenomenon of fighting can not in time be found.
Preferably, referring to Fig. 2, the process of the described detection among the embodiment comprises:
S21: the image binaryzation with present frame obtains difference image;
Get as a setting image of colored previous frame image shown in Figure 3, from the second color image frame shown in Figure 4, present image and background image simple subtraction taken absolute value and binaryzation obtains difference image shown in Figure 5--d (i, j).Each two field picture and background image are done difference at three passages of colour.To each pixel, if the maximal value of the difference result on these three passages greater than a certain threshold value, then the value assignment on gray level image with this point is 255.Otherwise assignment is 0.
S22: the pixel in the described difference image of lining by line scan if the pixel that scans is the white pixel point, then according to the gray scale of neighbor pixel, traverses the profile of the closed region that is made of a plurality of white pixel points;
Can adopt the edge following algorithm based on connectedness, obtain to extract the profile of pedestrian in the whole image sequence.The form storage of profile with point sequence.
Point on the outline line, the gray-scale value that is adjacent a little has certain jump, therefore the contrast by gray-scale value just can extract these points.Referring to Fig. 6, for simply, removed all picture elements on the framing mask, the picture element A that each is extracted makes comparisons with 8 points around it, and when 8 reference point around certain point have one when identical not all with it, this point is exactly point.
Edge following algorithm is selected first a starting point s ∈ S
c, then along utilizing connective lock-on boundary until get back to starting point clockwise or counterclockwise.
Known pixels p, q ∈ S, if there is a path from p to q, and the whole pixels on the path are included among the S, then claim p to be communicated with q.The pixel that obtains at difference image as shown in Figure 7.
Connective (connectivity) is relation of equivalence. to belonging to any three pixel p, q and the r of S, following character is arranged:
1) pixel p is communicated with (reflexivity) with p itself.
2) if p is communicated with q, then q is communicated with (interchangeability) with p.
3) if p is communicated with q and q is communicated with r, then p is communicated with (transitivity) with r.
S23: the minimum boundary rectangle of boundary pixel point of determining to comprise the profile of described closed region;
For the point sequence of an outline that finds out, calculate the minimum value and the maximal value X that have a few in this sequence in the horizontal and vertical directions
Max, Y
Min, X
Max, Y
MaxThen the upper left corner coordinate of boundary rectangle and wide height are (X
Min, Y
Min), width=X
Max-X
Min+ 1, height=Y
Max-Y
Min+ 1.
S24: adopt training set to identify the interior human body contour outline of described minimum boundary rectangle.
Circumscribed rectangular region is carried out human body contour outline based on the sorter SVM of the support vector machine of histogram of gradients feature HOG to be detected.
This sorter can train a classification plane, as shown in Figure 8, the human body image in the input picture and non-human body image can be distinguished.
The process that use support vector machine method is carried out human detection is as follows:
1) training: choose suitable kernel function, k(xi, xj).
2) minimize || w||, at ω
i(wx
i-b) 〉=1-ξ
iCondition under.
3) only store the α of non-zero
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 64*128 size.And then the image under each window classified.
5) classification: for pattern X, use support vector x
iWith corresponding weight α
iThe computational discrimination functional expression
The symbol of this function determines that this zone is human body.
6) wherein pattern X is the input human region.
7) the detection strategy for the treatment of surveyed area is from top to bottom, from left to right, to each 64*128 size window classify.
8) again image is dwindled, classify again, until zone to be detected is less than 64*128.
Preferably, in above-described embodiment, also comprise: the difference image among Fig. 5 is carried out morphology operations, the result of computing is carried out subsequent operation.
Carry out first the morphology opening operation for difference image and get rid of isolated point, noise, burr and foot bridge.Make again the human region of fracture up by closing operation of mathematical morphology.Then export bianry image as subsequent treatment.
The corrosion concept of general significance can referring to Fig. 9, be defined as: X corrodes with B, is expressed as:
Expansion can be regarded as the dual operations of corrosion, and referring to Figure 10, its definition is: the bar structure element B is done the mapping about initial point, obtains (B behind the translation a again
V)
aIf, (B
V)
aWith the common factor of X be not empty, we write down this B
V aInitial point a, all satisfy set that a point of above-mentioned condition forms and are called the result that X is expanded by B.
Corrosion and expansion are not reciprocal computings, so can cascade use.Corrode first the process that expands afterwards and be called opening operation.
The morphology opening operation is used for eliminating wisp, when very thin some place separates the border of object, level and smooth larger object and its area of not obvious change.
X opens with B and is expressed as:
The process of post-etching of expanding first is called closed operation.Be used for filling tiny cavity in the object, connect adjacent object, smoothly when its border and its area of not obvious change.X comes closed with B, be expressed as:
Preferably, in above-described embodiment, detect everyone process of skin of face color and comprise:
Use detects based on the adaboost cascade classifier of the haar feature color to the skin of face of people in the image, obtains the rectangular area of each facial feature;
With the pixel projection of each rectangular area to the HSV space; Wherein, described rectangular area comprises:
Mx-0.2Mwidth, My, 0.2*Mwidth, Mheight and Mx+Mwidth, My, 0.2*Mwidth, Mheight;
Mx, My are the upper left corner coordinate of each rectangle, and Mwidth is that width, the Mheight of rectangle is the height of rectangle;
Add up the pixel that belongs to the predetermined color classification in each zone.
Preferably, among the embodiment, describedly determine that the process that the behavior of fighting occurs comprises:
Determine that value is between 340-360 on the H direction in each rectangular area, the number num of the pixel between 0-20 and the 160-200 is if any num/ (2*0.2Mwidth*Mheight)>thr1 then determines to occur the behavior of fighting; The chromatic value of pixel can be divided into 360 five equilibriums, distinguish different colors.
Thr1 is Second Threshold, and span is 0.28-0.40;
Or, if after the described num weighted sum in each rectangular area>thr1, then determine to occur the behavior of fighting;
Also comprise: trigger alarm.The inventor finds through after a large amount of testing processes, if Thr1 is lower than 0.28, reports by mistake more; If Thr1 is greater than 0.4 then be easy to can't detect.Therefore, when 0.28-0.40, effect is optimum.
Preferably, in above-described embodiment, for the human body contour outline in the difference image, because the adjacent two two field picture life periods in front and back are poor, in the mistiming, in the rear two field picture of taking, may there be the people who newly enters shooting area, be in the tracking image everyone, can be each human body contour outline of identifying in the image and set up a chained list, be used for its track at every two field picture of storage, such as the position record.
Preferably, among the embodiment, after each human body contour outline in the every two field picture of described detection, also comprise: the human body contour outline nearest with adjacent previous frame image middle distance compares, and determines whether to be same human body profile;
If so, then upgrade the motion track of this human body contour outline;
If not, then set up corresponding motion track for this human body contour outline.Can be according to each human body contour outline in the center of image as motion track.
Preferably, described determining whether comprises for the process of same human body profile:
If the area S that interweaves of definite two human body contour outlines in difference image
CrossMin (S
Pre, S
Temp) * R then thinks same human body profile;
S wherein
Cross=Width
Cross* Height
Cross,
Width
cross=min(right
pre,right
temp)-max(left
pre,left
temp)
Height
cross=min(Bottom
pre,Bottom
temp)-max(Top
pre,Top
temp);
Width
CrossFor projecting to the length of the cross section on the horizontal direction;
Height
CrossFor projecting to the length of the cross section on the vertical direction;
Right
PreValue for the right margin of former frame profile;
Right
TempValue for the right margin of present frame profile;
Left
PreValue for the left margin of former frame profile;
Left
TempValue for the left margin of present frame profile;
Bottom
PreValue for the lower boundary of former frame profile;
Bottom
TempValue for the lower boundary of present frame profile;
Top
PreValue for the coboundary of former frame profile;
Top
TempValue for the coboundary of present frame profile;
R=0.4, described R are cross-ratio.
Preferably, the process of the motion track of described this human body contour outline of renewal comprises:
The position coordinates of human body contour outline image in the present frame position coordinates with adjacent previous frame image is existed;
Described process for motion track corresponding to this human body contour outline foundation comprises:
Give ID for this human body contour outline, record the position coordinates of this human body contour outline image in present frame.
Preferably, in above-described embodiment, by following the trail of the mode of each human body contour outline, the number that exists in the document image, and can be after the situation of fighting occurring, in present image or history image with the obvious color marking personnel that fight, for example, with the colored rectangle receptacle frame personnel that firmly fight, owing to having recorded the position of human body contour outline in image, can in history image before, follow the trail of the personnel's that fight position.The facility that provides for follow-up search procedure.
Obviously, those skilled in the art should be understood that, above-mentioned each module of the present invention or each step can realize with general calculation element, they can concentrate on the single calculation element, perhaps be distributed on the network that a plurality of calculation elements form, alternatively, they can be realized with the executable program code of calculation element, thereby, they can be stored in the memory storage and be carried out by calculation element, perhaps they are made into respectively each integrated circuit modules, perhaps a plurality of modules in them or step are made into the single integrated circuit module and realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The above is the preferred embodiments of the present invention only, is not limited to the present invention, and 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 modification of doing, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.