Method and device that strenuous exercise based on characteristic point analysis is detected
Technical field
The present invention relates to image processing, video monitoring, particularly strenuous exercise's detection method and device.
Background technology
In order to ensure stablizing of social security and stabilizing of people's lives, video monitoring apparatus has been installed in each large-and-medium size cities successively by China.These video monitoring apparatus, according to the place of application, need to possess different measuring abilities.Wherein, in the important public place of such as station, airport, supermarket, business block, sports ground etc., strenuous exercise detects and seems very important, and it can effectively reduce the probability of the sexual behavior part of causing danger.
International Patent Application WO 2007/064559A1 discloses a kind of detection method of abnormal crowd behaviour, and first the method detects the crowd's agglomerate in scene, then analyzes crowd's behavior (as fighting) by calculating the entropy of agglomerate.But for complicated actual scene, said method can not detect crowd's abnormal behaviour exactly, therefore can not be applied widely.
In sum, the method and the device that detect in the urgent need to proposing a kind of strenuous exercise at present.
Summary of the invention
In view of this, fundamental purpose of the present invention is to realize the detection of strenuous exercise.
For achieving the above object, according to first aspect of the present invention, provide a kind of strenuous exercise's detection method based on characteristic point analysis, the method comprises:
First step, sets up and upgrades background image, and extracts the foreground image of current frame image according to background image;
Second step, obtains the gradient image of foreground image, and according to gradient image extract minutiae;
Third step, tracking characteristics point, obtains the side-play amount of unique point;
The 4th step, the unique point that filtering side-play amount is little, carries out cluster analysis to unique point, obtains critical area, calculates strenuous exercise's coefficient of critical area;
The 5th step, judges whether to exist strenuous exercise.
Wherein, preferably, described first step comprises: suppose
represent that k(k is integer) two field picture,
represent that (wherein the initial value of background image is k frame background image
), the more new formula of background image is as follows:
Wherein, x, y represent respectively horizontal ordinate and the ordinate of pixel;
Current frame image and background image are done to difference to obtain the foreground image of current frame image.
Preferably, described second step comprises: the gradient image that calculates foreground image; Calculate autocorrelation matrix according to gradient image; The eigenwert of calculating autocorrelation matrix, the point that selected characteristic value is large is unique point.
Preferably, described third step further comprises:
A) side-play amount of hypothesis unique point in next frame image is dis, and the initial value of dis is 0;
B) upgrade dis according to following formula:
,
,
,
the gradient of presentation video x direction,
the gradient of presentation video y direction,
represent the gray scale of next frame image,
represent the gray scale of current frame image;
C) when meeting
time, proceed to the 4th step, otherwise continue execution step b).
Preferably, described the 4th step further comprises: filtering side-play amount is less than 1 or equal 1 unique point; Utilize clustering method that unique point is classified, and using classes maximum unique point as critical area; Calculate strenuous exercise's coefficient of critical area.
Preferably, clustering method adopts MeanShift clustering methodology, and its step is as follows:
1) initialization: establish initial classes
, i=0, class radius r, determine the basic side-play amount formula of MeanShift:
, wherein
, enter 2);
2) empty
, choose arbitrfary point
if,
, x so, r generates S, enters 3); Otherwise enter 8);
3) find a little
, use side-play amount formula to calculate side-play amount Mh,, enter 4);
4) if side-play amount
, enter 5); Otherwise drift generates new some x=x+Mh, and according to x, r generates S, enters 3);
5) by a little
put into
, generate so a new class, calculate
(Euclidean distance at d (*, *) representation class center), if
, make
, enter 6); Otherwise enter 7);
6) merge two classes
, enter 2);
7) carry out i=i+1, enter 2);
8) output
, be classification results.
Wherein r ∈ [5,10],
.
Preferably, strenuous exercise's coefficient step of described calculating critical area is as follows: the direction of motion of extracting unique point in critical area, direction of motion is projected in 8 directions, forms the histogram of 8bin, calculate this histogrammic variance, average using the strenuous exercise's coefficient as this critical area.
Preferably, described the 5th step further comprises: when the coefficient ∈ of strenuous exercise [th1, th2) time, start to accumulate the time t1 of this strenuous exercise, when strenuous exercise's coefficient
[th1, th2) time, finish this accumulated time, when occur again the coefficient ∈ of strenuous exercise [th1, th2) time, then start to accumulate the time t2 of this strenuous exercise, before and after calculating, twice strenuous exercise's accumulated time is poor, if | t1-t2|≤△ t, thinks and has strenuous exercise, otherwise think and do not have strenuous exercise.Wherein, th1=0, th2 ∈ [0.02,0.08], △ t ∈ [30,80] and be integer.
According to another aspect of the present invention, a kind of strenuous exercise's pick-up unit based on characteristic point analysis is provided, this device comprises:
Background image is set up and is upgraded and foreground image acquisition module, for setting up and upgrading background image, and extracts the foreground image of current frame image according to background image;
Feature point extraction module, for obtaining the gradient image of foreground image, and according to gradient image extract minutiae;
The side-play amount acquisition module of unique point, for tracking characteristics point, obtains the side-play amount of unique point;
Strenuous exercise's coefficient acquisition module, for the little unique point of filtering side-play amount, carries out cluster analysis to unique point, obtains critical area, calculates strenuous exercise's coefficient of critical area;
Strenuous exercise's judge module, for judging whether to exist strenuous exercise.
Wherein, preferably, described background image is set up renewal and foreground image acquisition module is used for realizing following operation: suppose
represent that k(k is integer) two field picture,
represent that (wherein the initial value of background image is k frame background image
), the more new formula of background image is as follows:
Wherein, x, y represent respectively horizontal ordinate and the ordinate of pixel;
Current frame image and background image are done to difference to obtain the foreground image of current frame image.
Preferably, described feature point extraction module is used for realizing following operation: the gradient image that calculates foreground image; Calculate autocorrelation matrix according to gradient image; The eigenwert of calculating autocorrelation matrix, the point that selected characteristic value is large is unique point.
Preferably, the side-play amount acquisition module of described unique point is used for realizing following operation:
A) side-play amount of hypothesis unique point in next frame image is dis, and the initial value of dis is 0;
B) upgrade dis according to following formula:
,
,
,
the gradient of presentation video x direction,
the gradient of presentation video y direction,
represent the gray scale of next frame image,
represent the gray scale of current frame image;
C) when meeting
time, proceed to the 4th step, otherwise continue execution step b).
Preferably, described strenuous exercise coefficient acquisition module is used for realizing following operation: filtering side-play amount is less than 1 or equal 1 unique point; Utilize clustering method that unique point is classified, and using classes maximum unique point as critical area; Calculate strenuous exercise's coefficient of critical area.
Preferably, clustering method adopts MeanShift clustering methodology, and its step is as follows:
1) initialization: establish initial classes
, i=0, class radius r, determine the basic side-play amount formula of MeanShift:
, wherein
, enter 2);
2) empty
, choose arbitrfary point
if,
, x so, r generates S, enters 3); Otherwise enter 8);
3) find a little
, use side-play amount formula to calculate side-play amount Mh,, enter 4);
4) if side-play amount
, enter 5); Otherwise drift generates new some x=x+Mh, and according to x, r generates S, enters 3);
5) by a little
put into
, generate so a new class, calculate
(Euclidean distance at d (*, *) representation class center), if
, make
, enter 6); Otherwise enter 7);
6) merge two classes
, enter 2);
7) carry out i=i+1, enter 2);
8) output
, be classification results.
Wherein r ∈ [5,10],
.
Preferably, strenuous exercise's coefficient step of described calculating critical area is as follows: the direction of motion of extracting unique point in critical area, direction of motion is projected in 8 directions, forms the histogram of 8bin, calculate this histogrammic variance, average using the strenuous exercise's coefficient as this critical area.
Preferably, described strenuous exercise judge module is used for realizing following operation: when the coefficient ∈ of strenuous exercise [th1, th2) time, start to accumulate the time t1 of this strenuous exercise, when strenuous exercise's coefficient
[th1, th2) time, finish this accumulated time, when occur again the coefficient ∈ of strenuous exercise [th1, th2) time, then start to accumulate the time t2 of this strenuous exercise, before and after calculating, twice strenuous exercise's accumulated time is poor, if | t1-t2|≤△ t, thinks and has strenuous exercise, otherwise think and do not have strenuous exercise.Wherein, th1=0, th2 ∈ [0.02,0.08], △ t ∈ [30,80] and be integer.
Compared with prior art, strenuous exercise's detection method and the device based on characteristic point analysis of the present invention, can realize the detection of strenuous exercise exactly.
Brief description of the drawings
Fig. 1 shows according to the process flow diagram of the strenuous exercise's detection method based on characteristic point analysis of the present invention;
Fig. 2 shows according to the structural drawing of the strenuous exercise's pick-up unit based on characteristic point analysis of the present invention.
Embodiment
For making your auditor can further understand structure of the present invention, feature and other objects, be now described in detail as follows in conjunction with appended preferred embodiment, illustrated preferred embodiment is only for technical scheme of the present invention is described, and non-limiting the present invention.
Fig. 1 represents according to the process flow diagram of the strenuous exercise's detection method based on characteristic point analysis of the present invention.As shown in Figure 1, comprise according to the strenuous exercise's detection method based on characteristic point analysis of the present invention:
First step 101, sets up and upgrades background image, and extracts the foreground image of current frame image according to background image;
Second step 102, obtains the gradient image of foreground image, and according to gradient image extract minutiae;
Third step 103, tracking characteristics point, obtains the side-play amount of unique point;
The 4th step 104, the unique point that filtering side-play amount is little, carries out cluster analysis to unique point, obtains critical area, calculates strenuous exercise's coefficient of critical area;
The 5th step 105, judges whether to exist strenuous exercise.
first step:
Preferably, described first step 101 comprises: suppose
represent that k(k is integer) two field picture,
represent that (wherein the initial value of background image is k frame background image
), the more new formula of background image is as follows:
Wherein, x, y represent respectively horizontal ordinate and the ordinate of pixel;
Current frame image and background image are done to difference to obtain the foreground image of current frame image.
second step:
Preferably, described second step 102: the gradient image that calculates foreground image; Calculate autocorrelation matrix according to gradient image; The eigenwert of calculating autocorrelation matrix, the point that selected characteristic value is large is unique point.
third step:
Preferably, described third step 103 further comprises:
A) side-play amount of hypothesis unique point in next frame image is dis, and the initial value of dis is 0;
B) upgrade dis according to following formula:
,
,
,
the gradient of presentation video x direction,
the gradient of presentation video y direction,
represent the gray scale of next frame image,
represent the gray scale of current frame image;
C) when meeting
time, proceed to the 4th step, otherwise continue execution step b).
the 4th step:
Preferably, described the 4th step 104: filtering side-play amount is less than 1 or equal 1 unique point; Utilize clustering method that unique point is classified, and using classes maximum unique point as critical area; Calculate strenuous exercise's coefficient of critical area.
Preferably, clustering method adopts MeanShift clustering methodology, and its step is as follows:
1) initialization: establish initial classes
, i=0, class radius r, determine the basic side-play amount formula of MeanShift:
, wherein
, enter 2);
2) empty
, choose arbitrfary point
if,
, x so, r generates S, enters 3); Otherwise enter 8);
3) find a little
, use side-play amount formula to calculate side-play amount Mh,, enter 4);
4) if side-play amount
, enter 5); Otherwise drift generates new some x=x+Mh, and according to x, r generates S, enters 3);
5) by a little
put into
, generate so a new class, calculate
(Euclidean distance at d (*, *) representation class center), if
, make
, enter 6); Otherwise enter 7);
6) merge two classes
, enter 2);
7) carry out i=i+1, enter 2);
8) output
, be classification results.
Wherein r ∈ [5,10],
.
Strenuous exercise's coefficient step of described calculating critical area is as follows: the direction of motion of extracting unique point in critical area, direction of motion is projected in 8 directions, the histogram that forms 8bin, calculates this histogrammic variance, average using the strenuous exercise's coefficient as this critical area.
the 5th step:
Preferably, described the 5th step further comprises: when the coefficient ∈ of strenuous exercise [th1, th2) time, start to accumulate the time t1 of this strenuous exercise, when strenuous exercise's coefficient
[th1, th2) time, finish this accumulated time, when occur again the coefficient ∈ of strenuous exercise [th1, th2) time, then start to accumulate the time t2 of this strenuous exercise, before and after calculating, twice strenuous exercise's accumulated time is poor, if | t1-t2|≤△ t, thinks and has strenuous exercise, otherwise think and do not have strenuous exercise.
Wherein, th1=0, th2 ∈ [0.02,0.08], △ t ∈ [30,80] and be integer.For example, can choose th2=0.05, △ t=50.
Fig. 2 shows according to the structural drawing of the strenuous exercise's pick-up unit based on characteristic point analysis of the present invention.As Fig. 2 shows, the strenuous exercise's pick-up unit based on characteristic point analysis comprises:
Background image is set up and is upgraded and foreground image acquisition module 1, for setting up and upgrading background image, and extracts the foreground image of current frame image according to background image;
Feature point extraction module 2, for obtaining the gradient image of foreground image, and according to gradient image extract minutiae;
The side-play amount acquisition module 3 of unique point, for tracking characteristics point, obtains the side-play amount of unique point;
Strenuous exercise's coefficient acquisition module 4, for the little unique point of filtering side-play amount, carries out cluster analysis to unique point, obtains critical area, calculates strenuous exercise's coefficient of critical area;
Strenuous exercise's judge module 5, for judging whether to exist strenuous exercise.
Preferably, described background image foundation renewal and foreground image acquisition module 1 are for realizing following operation: suppose
represent that k(k is integer) two field picture,
represent that (wherein the initial value of background image is k frame background image
), the more new formula of background image is as follows:
Wherein, x, y represent respectively horizontal ordinate and the ordinate of pixel;
Current frame image and background image are done to difference to obtain the foreground image of current frame image.
Preferably, described feature point extraction module 2 is for realizing following operation: the gradient image that calculates foreground image; Calculate autocorrelation matrix according to gradient image; The eigenwert of calculating autocorrelation matrix, the point that selected characteristic value is large is unique point.
Preferably, the side-play amount acquisition module 3 of described unique point is for realizing following operation:
A) side-play amount of hypothesis unique point in next frame image is dis, and the initial value of dis is 0;
B) upgrade dis according to following formula:
,
,
,
the gradient of presentation video x direction,
the gradient of presentation video y direction,
represent the gray scale of next frame image,
represent the gray scale of current frame image;
C) when meeting
time, proceed to the 4th step, otherwise continue execution step b).
Preferably, described strenuous exercise coefficient acquisition module 4 is for realizing following operation: filtering side-play amount is less than 1 or equal 1 unique point; Utilize clustering method that unique point is classified, and using classes maximum unique point as critical area; Calculate strenuous exercise's coefficient of critical area.
Preferably, clustering method adopts MeanShift clustering methodology, and its step is as follows:
1) initialization: establish initial classes
, i=0, class radius r, determine the basic side-play amount formula of MeanShift:
, wherein
, enter 2);
2) empty
, choose arbitrfary point
if,
, x so, r generates S, enters 3); Otherwise enter 8);
3) find a little
, use side-play amount formula to calculate side-play amount Mh,, enter 4);
4) if side-play amount
, enter 5); Otherwise drift generates new some x=x+Mh, and according to x, r generates S, enters 3);
5) by a little
put into
, generate so a new class, calculate
(Euclidean distance at d (*, *) representation class center), if
, make
, enter 6); Otherwise enter 7);
6) merge two classes
, enter 2);
7) carry out i=i+1, enter 2);
8) output
, be classification results.
Wherein r ∈ [5,10],
.
Strenuous exercise's coefficient step of described calculating critical area is as follows: the direction of motion of extracting unique point in critical area, direction of motion is projected in 8 directions, the histogram that forms 8bin, calculates this histogrammic variance, average using the strenuous exercise's coefficient as this critical area.
Preferably, described strenuous exercise judge module 5 is for realizing following operation: when the coefficient ∈ of strenuous exercise [th1, th2) time, start to accumulate the time t1 of this strenuous exercise, when strenuous exercise's coefficient
[th1, th2) time, finish this accumulated time, when occur again the coefficient ∈ of strenuous exercise [th1, th2) time, then start to accumulate the time t2 of this strenuous exercise, before and after calculating, twice strenuous exercise's accumulated time is poor, if | t1-t2|≤△ t, thinks and has strenuous exercise, otherwise think and do not have strenuous exercise.Wherein, th1=0, th2 ∈ [0.02,0.08], △ t ∈ [30,80] and be integer.For example, can choose th2=0.05, △ t=50.
Compared with prior art, strenuous exercise's detection method and the device based on characteristic point analysis of the present invention, can realize the detection of strenuous exercise exactly.
Need statement, foregoing invention content and embodiment are intended to prove the practical application of technical scheme provided by the present invention, should not be construed as limiting the scope of the present invention.Those skilled in the art are in spirit of the present invention and principle, when doing various amendments, be equal to and replace or improve.Protection scope of the present invention is as the criterion with appended claims.