Summary of the invention
In view of this, fundamental purpose of the present invention is the crowd's of realizing accurate counting.
For achieving the above object, according to first aspect of the present invention, provide a kind of crowd's method of counting based on head identification, this method comprises:
First step is according to video frame images foundation, background image updating;
Second step is extracted the head detection zone from video frame images;
Third step is followed the tracks of the head surveyed area, obtains the movement locus in head detection zone;
The 4th step, the movement locus in optimization head detection zone; And
The 5th step is obtained number according to the movement locus of optimizing.
Described first step: suppose
Represent that k(k is an 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, the horizontal ordinate and the ordinate of x, y difference remarked pixel point.
Described second step may further comprise the steps:
Step 1021 is done the poor foreground image that obtains with current frame image and background image;
Step 1022 is carried out rim detection to foreground image and is obtained marginal point;
Step 1023 is carried out the hough ballot to each marginal point and is obtained the ballot matrix;
Step 1024 is obtained in the ballot matrix greater than the point of first threshold T1, and generates the ternary number of this point;
Step 1025, calculate the ternary number the gradient inner product and;
Step 1026, according to gradient inner product and obtain the local maximum point, this local maximum point is the head detection point;
Step 1027 is obtained the head detection zone according to the head detection point.
Described
step 1023 is to each marginal point
Around carry out hough ballot, formula is as follows:
The three-dimensional matrice that forms is
(
And be integer).Wherein, vn ∈ [9,36] and be integer, R is a standard radius, sets head size according to the image concrete condition, △ is the head variation range, can elect R/3 as.
Described
step 1024 is obtained the point of ballot matrix greater than first threshold T1
, and generate the ternary number of this point
, wherein
Wherein, T1 ∈
Described step 1025: at first with point
Be the center of circle,
Be radius, the point on the sampling ellipse
, calculate the gradient of each point in image
And corresponding normal vector
Then according to gradient and normal vector compute gradient inner product and
Wherein,
Described the 4th step comprises:
Step 1041, deletion traces into the movement locus in non-foreground detection zone: if promptly the movement locus point of following the tracks of in the current frame image belongs to non-foreground detection zone, then delete this movement locus;
Step 1042, deletion is static movement locus obviously: promptly calculate the average displacement of current frame image and preceding N two field picture on the movement locus, if this average displacement<the 3rd threshold value T3 then deletes this movement locus.Wherein, N and T3 can be provided with according to practical application request;
Step 1043, deletion do not satisfy the conforming movement locus of motion;
Step 1044 merges the movement locus that overlaps or intersect.
Described
step 1043 operation is as follows: the speed of calculating movement locus
, movement locus direction
If
(wherein,
The expression former frame arrives the motion vector of current frame image,
The expression present frame is to the motion vector of next frame image;
), think that then this track satisfies the motion consistance and keeps this movement locus, otherwise think and do not satisfy the motion consistance and delete this movement locus.
Described step 1044: the Euclidean distance that calculates the trace point of two movement locus; If Euclidean distance<the 4th threshold value T4(T4 ∈ [5,15] and be integer), then calculate the analog quantity of these two movement locus respectively
,
, wherein,
The gray-scale value in expression article one track head detection zone in current frame image,
The gray-scale value in expression second track head detection zone in current frame image,
The head detection provincial characteristics that the expression present frame upgrades,
(
The expression prior image frame, the average gray in head detection zone in the expression prior image frame
,
Expression back two field picture,
The average gray in head detection zone in the two field picture of expression back); If
, then delete the second track, otherwise deletion article one track.
Described the 5th step comprises following any one or two steps:
Step 1051, specify the number of xsect according to the statistics of the movement locus after optimizing: promptly when the xsect of movement locus and appointment is crossing, by adding up the number of crossing movement locus, this number is the number of statistics;
Step 1052 is according to the number in the statistics of the movement locus after the optimizing appointed area: number (the T5 ∈ that promptly adds up the movement locus of course length in the appointed area>the 5th threshold value T5
), this number is the number of statistics.
According to another aspect of the present invention, a kind of crowd's counting assembly based on head identification is provided, this device comprises:
Background is set up updating block, according to video frame images foundation, background image updating;
Head detection extracted region unit extracts the head detection zone from video frame images;
The movement locus acquiring unit is followed the tracks of the head surveyed area, obtains the movement locus in head detection zone;
Movement locus is optimized the unit, optimizes the movement locus in head detection zone; And
The demographics unit obtains number according to the movement locus of optimizing.
Described head detection extracted region unit comprises:
The foreground image acquisition module is done the poor foreground image that obtains with current frame image and background image;
The marginal point acquisition module carries out rim detection to foreground image and obtains marginal point;
Ballot matrix acquisition module carries out the hough ballot to each marginal point and obtains the ballot matrix;
Ternary is counted acquisition module, obtains in the ballot matrix greater than the point of first threshold T1, and generates the ternary number of this point;
Gradient inner product and computing module, calculate the ternary number the gradient inner product and;
Head detection point acquisition module, according to gradient inner product and obtain the local maximum point, this local maximum point is the head detection point;
Head detection zone acquisition module obtains the head detection zone according to the head detection point.
Described movement locus is optimized the unit and is comprised:
Non-foreground detection zone track filtering module, deletion traces into the movement locus in non-foreground detection zone;
Obvious static track filtering module, deletion is static movement locus obviously;
Non-motion consistance track filtering module, deletion do not satisfy the conforming movement locus of motion;
Overlap or crossover track merging module, merge the movement locus that overlaps or intersect.
Compared with prior art, crowd's method of counting and device based on head identification of the present invention can be realized crowd's counting exactly.
Compare with common non-demographic method based on number of people identification, crowd's method of counting and device based on head identification of the present invention, energy filtering false target is realized crowd's counting exactly.With publication number is that the method based on the people flow rate statistical of number of people statistics of CN101872414A is compared, the present invention adopts hough ballot matrix, ternary to count detection heads such as inner product, and by non-foreground detection zone track filtering module, obvious static track filtering module, non-motion consistance track filtering module and coincidence or crossover track merging module filtering false target, thereby obtain number accurately.
Embodiment
For making your auditor can further understand structure of the present invention, feature and other purposes, now be described in detail as follows in conjunction with appended preferred embodiment, illustrated preferred embodiment only is used to technical scheme of the present invention is described, and non-limiting the present invention.
Fig. 1 represents the process flow diagram according to the crowd's method of counting based on head identification of the present invention.As shown in Figure 1, comprise according to the crowd's method of counting based on head identification of the present invention:
First step 101 is according to video frame images foundation, background image updating;
Second step 102 is extracted the head detection zone from video frame images;
Third step 103 is followed the tracks of the head surveyed area, obtains the movement locus in head detection zone;
The 4th step 104, the movement locus in optimization head detection zone;
The 5th step 105 is obtained number according to the movement locus of optimizing.
First step:
Preferably, described first step 101: suppose
Represent that k(k is an 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, the horizontal ordinate and the ordinate of x, y difference remarked pixel point.
Second step:
Fig. 2 shows the process flow diagram according to second step 102 of the present invention.As shown in Figure 2, preferably, described second step 102 may further comprise the steps:
Step 1021 is done the poor foreground image that obtains with current frame image and background image;
Step 1022 is carried out rim detection to foreground image and is obtained marginal point;
Step 1023 is carried out the hough ballot to each marginal point and is obtained the ballot matrix;
Step 1024 is obtained in the ballot matrix greater than the point of first threshold T1, and generates the ternary number of this point;
Step 1025, calculate the ternary number the gradient inner product and;
Step 1026, according to gradient inner product and obtain the local maximum point, this local maximum point is the head detection point;
Step 1027 is obtained the head detection zone according to the head detection point.
Preferably, described
step 1022 is at first carried out smothing filtering to foreground image, utilizes ADM operator extraction marginal point then.The ADM operator (Figure 3 shows that the structural drawing of ADM operator, but it is as follows concrete list of references: " Fahad Alzahrani; Tom Chen. A Real_Time High Performance Edge Detector for Computer Vision Applications. 1997 Proceedings of the Asia and South Pacific Design Automation Conference, 671~672 ") to extract marginal point: the edge strength that calculates the foreground point
, wherein
,
,
,
Choosing edge strength is candidate point greater than the foreground point of the second threshold value T2; Along candidate point
The counterparty promptly compares to carrying out non-very big inhibition
With
The make progress size of adjacent two point values of counterparty, if
>adjacent 2 value thinks that then this point is a marginal point.Wherein, the second threshold value T2 ∈ [10,40] and be integer.
Preferably, described
step 1023 is to each marginal point
Around carry out hough ballot, formula is as follows:
The three-dimensional matrice that forms is
(
And be integer).Wherein, vn ∈ [9,36] and be integer, R is a standard radius, sets head size according to the image concrete condition, △ is the head variation range, can elect R/3 as.
Preferably, described
step 1024 is obtained the point of ballot matrix greater than first threshold T1
, and generate the ternary number of this point
, wherein
Wherein, T1 ∈
Preferably, described step 1025: at first with point
Be the center of circle,
Be radius, the point on the sampling ellipse
, calculate the gradient of each point in image
And corresponding normal vector
Then according to gradient and normal vector compute gradient inner product and
Wherein,
Third step:
Preferably, described third step 103 adopts the tracking (referring to list of references: " David A. Ross; Jongwoo Lim; Ruei-Sung Lin; Ming-Hsuan Yang. Incremental Learning for Robust Visual Tracking. IJCV ") of PCA particle filters, and its step is as follows:
Step 1031 is extracted the feature in head detection zone, initialization feature space according to PCA
(n is the initialized dimension of feature space, n ∈ [5,15] and be integer), and A is carried out svd obtain
Step 1032 all projects to feature space with each particle, calculates the weight of particle, and the heavy maximum particle of weighting is real tracking results, and the weight calculation formula of particle is as follows:
Wherein, k ∈ [1, Max] and be integer, Max is the maximum number of particle;
Step 1033 is updated to feature space with new tracking results characteristic of correspondence: establish
(m represents to upgrade the required characteristic number of feature space, is preferably m=n/2), calculate
(orth represents orthogonalization),
, R is carried out svd obtains
, the feature space after the renewal is
,
Step 1034 connects all tracking results to form the movement locus in head detection zone.
The 4th step:
Fig. 4 shows the process flow diagram according to the 4th step of the present invention.As shown in Figure 4, preferably, described the 4th step 104 step is as follows:
Step 1041, deletion traces into the movement locus in non-foreground detection zone;
Step 1042, deletion is static movement locus obviously;
Step 1043, deletion do not satisfy the conforming movement locus of motion;
Step 1044 merges the movement locus that overlaps or intersect.
Preferably, described step 1041:, then delete this movement locus if the movement locus of following the tracks of in current frame image point belongs to non-foreground detection zone.
Preferably, described step 1042: the average displacement of current frame image and preceding N two field picture on the calculating movement locus, if this average displacement<the 3rd threshold value T3 then deletes this movement locus.Wherein, N and T3 can be provided with according to practical application request.
Preferably, described
step 1043 operation is as follows: the speed of calculating movement locus
, movement locus direction
If
(wherein,
The expression former frame arrives the motion vector of current frame image,
The expression present frame is to the motion vector of next frame image;
), think that then this track satisfies the motion consistance and keeps this movement locus, otherwise think and do not satisfy the motion consistance and delete this movement locus.
Preferably, described step 1044: the Euclidean distance that calculates the trace point of two movement locus; If Euclidean distance<the 4th threshold value T4(T4 ∈ [5,15] and be integer), then calculate the analog quantity of these two movement locus respectively
,
, wherein,
The gray-scale value in expression article one track head detection zone in current frame image,
The gray-scale value in expression second track head detection zone in current frame image,
The head detection provincial characteristics that the expression present frame upgrades,
(
The expression prior image frame, the average gray in head detection zone in the expression prior image frame
,
Expression back two field picture,
The average gray in head detection zone in the two field picture of expression back); If
, then delete the second track, otherwise deletion article one track.
The 5th step:
Preferably, described the 5th step 105 comprises following any one or two steps:
Step 1051 is according to the number of the movement locus statistics appointment xsect after optimizing;
Step 1052 is according to the number in the movement locus statistics appointed area after optimizing.
Preferably, described step 1051: when the xsect of movement locus and appointment intersected, by adding up the number of crossing movement locus, this number was the number of statistics.
Preferably, described step 1052: number (the T5 ∈ of the movement locus of course length>the 5th threshold value T5 in the statistics appointed area
), this number is the number of statistics.
Fig. 5 shows the frame diagram according to the crowd's counting assembly based on head identification of the present invention.As shown in Figure 5, the crowd's counting assembly based on head identification comprises:
Background is set up updating block 1, according to video frame images foundation, background image updating;
Head detection extracted region unit 2 extracts the head detection zone from video frame images;
Movement locus acquiring unit 3 is followed the tracks of the head surveyed area, obtains the movement locus in head detection zone;
Movement locus is optimized unit 4, optimizes the movement locus in head detection zone;
Demographics unit 5 obtains number according to the movement locus of optimizing.
Fig. 6 shows the structural drawing according to head detection extracted region of the present invention unit 2.As shown in Figure 6, comprise according to head detection extracted region of the present invention unit 2:
Foreground image acquisition module 21 is done the poor foreground image that obtains with current frame image and background image;
Marginal point acquisition module 22 carries out rim detection to foreground image and obtains marginal point;
Ballot matrix acquisition module 23 carries out the hough ballot to each marginal point and obtains the ballot matrix;
Ternary is counted acquisition module 24, obtains in the ballot matrix greater than the point of first threshold T1, and generates the ternary number of this point;
Gradient inner product and computing module 25, calculate the ternary number the gradient inner product and;
Head detection point acquisition module 26, according to gradient inner product and obtain the local maximum point, this local maximum point is the head detection point;
Head detection zone acquisition module 27 obtains the head detection zone according to the head detection point.
Fig. 7 shows the structural drawing of optimizing unit 4 according to movement locus of the present invention.As shown in Figure 7, optimizing unit 4 according to movement locus of the present invention comprises:
Non-foreground detection zone track filtering module 41, deletion traces into the movement locus in non-foreground detection zone;
Obvious static track filtering module 42, deletion is static movement locus obviously;
Non-motion consistance track filtering module 43, deletion do not satisfy the conforming movement locus of motion;
Overlap or crossover track merging module 44, merge the movement locus that overlaps or intersect.
Compare with common non-demographic method based on number of people identification, crowd's method of counting and device based on head identification of the present invention, energy filtering false target is realized crowd's counting exactly.With publication number is that the method based on the people flow rate statistical of number of people statistics of CN101872414A is compared, the present invention adopts hough ballot matrix, ternary to count detection heads such as inner product, and by non-foreground detection zone track filtering module, obvious static track filtering module, non-motion consistance track filtering module and coincidence or crossover track merging module filtering false target, thereby obtain number accurately.
What need statement is that 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 the qualification to protection domain of the present invention.Those skilled in the art are in spirit of the present invention and principle, when doing various modifications, being equal to and replacing or improve.Protection scope of the present invention is as the criterion with appended claims.