CN113723286B - Sector search vehicle speed detection method based on video - Google Patents

Sector search vehicle speed detection method based on video Download PDF

Info

Publication number
CN113723286B
CN113723286B CN202111006501.7A CN202111006501A CN113723286B CN 113723286 B CN113723286 B CN 113723286B CN 202111006501 A CN202111006501 A CN 202111006501A CN 113723286 B CN113723286 B CN 113723286B
Authority
CN
China
Prior art keywords
moving vehicle
vehicle
moving
frame
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111006501.7A
Other languages
Chinese (zh)
Other versions
CN113723286A (en
Inventor
周文举
何钰
王海宽
顾小刚
蔡胜强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Taizhou Chuangshi Technology Co ltd
University of Shanghai for Science and Technology
Original Assignee
Taizhou Chuangshi Technology Co ltd
University of Shanghai for Science and Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Taizhou Chuangshi Technology Co ltd, University of Shanghai for Science and Technology filed Critical Taizhou Chuangshi Technology Co ltd
Priority to CN202111006501.7A priority Critical patent/CN113723286B/en
Publication of CN113723286A publication Critical patent/CN113723286A/en
Application granted granted Critical
Publication of CN113723286B publication Critical patent/CN113723286B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence

Abstract

The invention discloses a sector search vehicle speed detection method based on video. The method comprises the following steps: acquiring an image containing a moving vehicle; extracting a moving vehicle diagram from the image; calculating multi-feature information of the moving vehicle; continuously collecting and storing multi-feature information of a moving vehicle in N frames of images; setting a sector estimated search area of a moving vehicle of a frame to be detected according to the movement angle of the moving vehicle in the current frame image; calculating multi-feature information of the moving vehicle in the sector pre-estimated search area of the frame to be detected; matching the multi-feature information of the frame moving vehicle to be detected with the stored multi-feature information of the N frame moving vehicles; calculating the distance between the moving vehicles of the successfully matched frames to form a distance set; and calculating the movement speed of the moving vehicle according to the distance set and the frame rate. Therefore, the invention not only can rapidly locate the area where the moving vehicle is located, but also can efficiently measure the vehicle speed, and provides effective information for realizing intelligent traffic decision.

Description

Sector search vehicle speed detection method based on video
Technical Field
The invention relates to the technical field of image processing, in particular to the technical field of video monitoring, and specifically relates to a sector search vehicle speed detection method based on video.
Background
In recent years, traffic intersections have long waiting time, traffic congestion and frequent traffic accidents become pain points which affect the development of economy and society and prevent people from improving happiness and obtaining sense. Therefore, the establishment of the intelligent traffic system has important significance for establishing the intelligent city and improving the social operation efficiency. And intelligent movement speed detection is the key of an intelligent traffic system. The vehicle speed detection method is mainly divided into two types, namely by means of auxiliary equipment such as a ground induction coil and a laser radar, and the vehicle speed detection method is mainly carried out in a video monitoring mode by means of an image processing technology.
Disclosure of Invention
The invention aims to overcome the defects of the prior art, and provides a sector search vehicle speed detection method based on video, which not only can rapidly locate the area where a moving vehicle is located, but also can efficiently measure the vehicle speed, thereby providing effective information for realizing intelligent traffic decision.
To achieve the above object, the present invention is conceived as follows: firstly, a foreground image of a moving vehicle is obtained by adopting a moving vehicle detection method, the image is preprocessed so that each moving vehicle can be clearly and completely segmented into a whole, then, multi-feature information of the moving vehicle in each communication area in a single frame image is calculated, and multi-feature information of the moving vehicle in continuous N frames of images is stored; and then a sector pre-estimated search area is adaptively set for the moving vehicle of the frame to be detected, then the moving vehicle in the sector pre-estimated search area in the frame to be detected is matched with the moving vehicle with the same ID in the previous N frames, and finally, if the matching is successful, the average distance between the moving vehicle to be detected and the moving vehicle successfully matched is calculated, and the average speed of the moving vehicle to be detected and the moving vehicle successfully matched is obtained.
The method is characterized in that a fan-shaped estimated search area is arranged in the target search, the search area can be adaptively adjusted according to the motion angle variation of the moving vehicle, the accuracy and the speed of the target search can be improved, and a plurality of characteristics such as area, color and edge are fused when the targets are matched, so that the matching is more accurate, compared with the traditional algorithm, the characteristics are extracted and matched more quickly, the requirement of real-time detection can be met, the method utilizes continuous N frames of data to calculate, the influence of inter-frame noise on speed calculation can be effectively avoided, and the robustness of vehicle speed detection is greatly increased.
In order to achieve the purpose, the technical scheme is realized by adopting the following technical scheme:
(1) The intelligent camera is erected on a traffic signal lamp post, and images including driving-in moving vehicles are collected.
(2) A background model is built in the image, and a binarized moving vehicle foreground image is obtained, and the specific steps are as follows:
preprocessing a foreground image, and sequentially adopting a 3 multiplied by 3 template to perform median filtering to remove salt and pepper noise in the foreground image; realizing image connected domain blurring by adopting Gaussian filtering, taking 3 as the mean value of a Gaussian filtering template and 2.5 as the variance; performing morphological filtering by using a 3×3 template to remove burrs of the image and clearly and completely dividing the foreground image into moving vehicles; and finally, setting a number i for each connected region by adopting a connected region marking method, wherein i epsilon (0, n) and n are the total number of marks.
(3) Calculating multi-feature information of each communication area moving vehicle, specifically:
establishing a moving vehicle class containing multi-feature information, wherein the multi-feature information comprises area features, color features and edge features of the moving vehicle; the moving vehicles comprise a moving vehicle region area S and an HSV color histogram H of the moving vehicle region color Edge direction histogram H edge A moving vehicle region centroid coordinate P (x, y), a moving vehicle number ID, a moving vehicle movement angle θ, and a moving vehicle speed V;
(4) Calculating the area of a moving vehicle, an HSV color histogram, an edge direction histogram, a centroid coordinate, an ID of the moving vehicle and a moving angle of the moving vehicle, wherein the method comprises the following specific steps of:
(4-1) calculating an area S of the moving vehicle i The calculation formula is as follows:
S i =∑i
wherein i represents the number of the connected domain, S i Is the area of the connected domain i;
(4-2) calculating an HSV color histogram of the moving vehicle, wherein the coordinate of the central point of the circumscribed rectangle of the moving vehicle is x= (x) 0 ,y 0 ) The probability density calculation formula of the u-th histogram feature in the target area is as follows:
wherein xi For the ith pixel point in the circumscribed rectangular frame of the moving vehicle, u represents the index of the histogram color level, b (x i ) Is x i Corresponding color histogram bar, |x i -x 0 II represents x i To x 0 Is used for the distance of (a), respectively the length and width of the rectangular frame, N s Representing the total number of pixels in the target area, C color Representation normalization the coefficient of the,δ[·]delta function, k (·) is kernel function, +.>
(4-3) calculating a moving vehicle edge direction histogram, and adopting a Sobel operator to perform edge detection, wherein the specific calculation formula is as follows:
G x (x,y)=f(x+1,y-1)+2f(x+1,y)+f(x+1,y+1)-f(x-1,y-1)-2f(x-1,y)-f(x-1,y+1)G y the size G (x, y) and direction θ of the edges of (x, y) =f (x-1, y-1) +2f (x, y-1) +f (x+1, y-1) -f (x-1, y+1) -2f (x, y+1) -f (x+1, y+1) are respectively:
G=|G x (x,y)|+|G y (x,y)|
θ=arctan(G x (x,y)/G y (x,y))
θ∈[0,2π]θ was divided into m=16 θ per portion j Pi/8 (j=1, 2,.., 16), calculating edge values in each angle bin, creating an edge histogram, and in the target region, the θ j The individual edge direction histogram features are expressed as:
(4-4) calculating the moving vehicle centroid P i (x pi ,y pi ) The calculation formula is as follows:
wherein Si For the area of the connected domain i,f(x i ,y i ) Is (x) i ,y i ) T is a set threshold, taking t=50;
(4-5) setting the number ID of the moving vehicle, which comprises the following specific steps:
establishing a set for preserving a moving vehicle number
Setting a virtual detection line y1 at the position of the moving vehicle entering the image, setting a new ID for the moving vehicle when the mass center of the moving vehicle passes over y1, and storing the ID in a collectionIn (a) and (b);
a virtual detection line y2 is arranged at the position of the moving vehicle which exits from the image, and when the mass center of the moving vehicle passes over y2, the collection is deletedIs set, the ID of the moving vehicle.
(4-6) calculating the angle of the moving vehicle, which comprises the following specific steps:
taking an included angle between the motion direction of the moving vehicle and the y-axis direction of the pixel coordinate system as the motion angle of the moving vehicle;
if the current frame is the first frame of the camera acquired image, setting the motion angle of each motion vehicle to 0;
if the current frame is not the first frame acquired by the camera, the calculation formula of the motion angle of the motion vehicle to be detected is as follows:
wherein Xcurr 、X curr Respectively the abscissa and the ordinate of the mass center of the moving vehicle to be detected in the current frame, X pre 、Y pre The abscissa and the ordinate of the centroid of the successfully matched moving vehicle in the previous frame are respectively.
(5) Continuously collecting and storing multi-feature information of a moving vehicle in N frames of images, and specifically comprising the following steps:
(5-1) creating an image class, wherein the image class comprises: current image frame number, set of moving vehiclesThe set of sports vehicles +.>Comprising individual moving vehicle objects established according to the moving vehicle class of step (3);
and (5-2) respectively establishing the instantiation objects of the image class in the step (5-1) for the images of the continuous N frames, storing the continuous N instantiation objects in a queue q, wherein the size of the queue is N, and when the queue is full, adding one object to the tail part of the queue, and deleting one object from the head part of the queue.
(6) Taking the N-th frame image as a current frame, taking the (n+1) -th frame image as a frame to be detected, and setting a sector estimated search area of the moving vehicle of the frame to be detected according to the movement angle of the moving vehicle in the current frame image, wherein the specific steps are as follows:
(6-1) traversing the moving vehicle in the current frame image wherein />A moving vehicle with an ID j in an image with a frame number i;
(6-2) acquisitionCenter of mass P of moving vehicle ij (x ij ,y ij 0, movement angle θ ij
(6-3) isSet to P ij (x ij ,y ij ) The angle range is [ theta ] as the center of a circle ijij ,θ ijij ]Radius r ij Sector-shaped predictive search area a of (2) ij M ij B ij The motion angle theta ij As A ij M ij B ij In the direction of the angular bisector of (A), i.e. A ij M ij B ij Angle of angular bisector of theta ij Let A ij M ij B ij Angle size of 2 alpha ij The angles of the two radii of the fan shape are respectively theta ijij and θijij
If there is no frameIf the IDs of the moving vehicles are identical, then alpha ij Set to 30 °; otherwise, set the sum +_in the previous frame>The sports vehicle with the same ID is +.>The angular size of the sector-shaped estimated search area of (2) is 2α i-1j ,α ij The specific calculation formula of (2) is as follows:
α ij =α i-1j +Δθ ij k 1
wherein Δθij =θ iji-1j Representation ofAnd->And the variation of the motion angle of θ ij Is->And (a) the movement angle, theta i-1j Is->The motion angle k of (a) 1 Is a parameter, said->The meaning of the formula is that the current fan angle +.>The variation delta theta of the motion angle ij The influence of the motion angle variation Δθ ij When the number is positive, the sector angle is +>Self-adaptive enlargement, fan angle ++when the motion angle variation is negative>The self-adaption is reduced, so that the self-adaption adjustment of the search angle along with the change of the motion angle is realized.
(6-4) if there is no frame in the previous frameIf the ID of the moving vehicles are identical, the radius r ij Set to 15; otherwise, set the sum +_in the previous frame>The sports vehicle with the same ID is +.>The radius of the sector-shaped estimated search area of (2) is r i-1j ,r ij The specific calculation formula of (2) is as follows:
r ij =r i-1j +Δd ij k 2
wherein Represents M ij And M is as follows i-1j D ij Is->Is used for controlling the motion distance of the vehicle,is->Distance of movement k 2 Is a parameter, said->The motion distance d is the distance between the centroids of the moving vehicles with the same ID in the adjacent frames. The meaning of the formula is that the radius r of the current sector ij The moved distance variation Δd ij Influence, if the movement distance change amount Deltad ij Fan radius r for positive number ij Becomes larger, if the movement distance change amount Δd ij Sector radius r for negative numbers ij Becomes smaller, thereby realizing the search radius r ij And the motion distance is adaptively adjusted along with the change of the motion distance.
(7) Matching the multi-feature information of the moving vehicle in the frame to be detected with the multi-feature information of the N frames of moving vehicles stored in the step (5), wherein the steps are as follows:
(7-1) acquiring the next frame image F i+1 F is to F i+1 As a frame to be measured;
(7-2) acquisition of F i+1 The j-th moving vehicle M of (a) i+1j
(7-3) if M i+1j Centroid coordinates of (c)At the estimated search area A described in (6-3) ij M ij B ij In, go to (7-4), otherwise go to (7-7);
(7-4) traversing the instantiation object q of the image class in the store queue q of (5-2) k If q k Number ID of middle-motion vehicleIf the numbers ID of the moving vehicles are equal, the moving vehicles are stored in the set +.>In (a) and (b);
(7-5) mixing M i+1j And (3) withMatching, if matching is successful, turning to (7-6), otherwise turning to (7-7);
(7-6) order M i+1j ID of (2)Is equal to the ID of (a);
(7-7) let j=j+1 if j < n, go to (7-2) if not, wherein n is the total number of moving vehicles for the current frame.
(8) The matching method of the step (7-5) comprises the following specific steps:
(8-1) calculation of M i+1j And (3) withThe area similarity degree of the moving vehicles in the (2) is calculated as follows:
wherein si+1 For the i+1st frame of moving vehicle area, s k Is thatA kth moving vehicle area;
calculating the average value of the area similarity
(8-2) calculation of M i+1j And (3) withHSV color feature similarity of a moving vehicle:
calculate M i+1j HSV color histogram modelAnd->HSV color histogram model of medium motion vehicle>The formula is as follows:
wherein m is the quantization level number of the histogram, and u is the color level index in the histogram;
calculating the average value of the similarity of the color features
(8-3) calculation of M i+1j And (3) withEdge feature similarity of a moving vehicle:
calculating M of edge features i+1j Histogram model and Mi+1j Histogram model of a medium-motion vehicle->Similarity d between edge The formula is as follows:
wherein m is the number of quantization steps of the histogram, θ u Index for edge direction level
Computing edge feature similarity mean
(8-4) fusing the area features, the color features and the edge features, thereby obtaining M i+1j And (3) withIn a moving vehicle M kj The similarity is as follows:
if d > epsilon is satisfied, epsilon is a similarity threshold parameter, epsilon=0.5 is taken, M is i+1j And (3) withThe moving vehicles in the model are the same target, and the matching is successful;
(9) The distance between the frame to be detected and the moving vehicle matched with the successful frame is calculated, and the specific steps are as follows:
(9-1) obtaining centroid coordinates P of a moving vehicle in a frame to be measured i+1j (x i+1j ,y i+1j );
(9-2) obtaining the AND P i+1j (x i+1j ,y i+1j ) Matched set of moving vehicles and />Centroid coordinates P of each moving vehicle kj (x kj ,y kk );
(9-3) calculation of P i+1j (x i+1j ,y i+1j ) And P kj (x kj ,y kj ) The specific calculation formula of the distance is as follows:
(10) Calculating the movement speed of the moving vehicle according to the distance set and the frame rate in the step (9), wherein the specific steps are as follows:
(10-1) calculating the average speed of the moving vehicle for N continuous frames in the image coordinate system according to the frame rate, wherein the specific calculation formula is as follows:
wherein ,disk For the vehicle to be tested and q k Distance of corresponding vehicle, q k The k frame image in the image storage queue is stored, and f is the frame rate.
(10-2) updating the moving speed of the moving vehicle according to the average speed of the step (10-1);
(10-3) establishing a mapping of an image coordinate system and a real world coordinate system according to camera calibration, and converting the average speed in the image in the step (10-1) into the vehicle motion speed in the real world.
By adopting the fan-shaped search vehicle speed detection method based on the video, the fan-shaped estimated search area is arranged between the continuous frames of the video, and the vehicle is matched in the search area, so that the vehicle position can be accurately positioned, the high-efficiency and accurate measurement of the vehicle speed can be realized, and compared with the prior art, the use cost is lower, the installation is simple, the maintenance is convenient, and the intelligent detection mode can provide effective information for realizing intelligent traffic decision.
Drawings
Fig. 1 is a flow chart of a video-based sector search vehicle speed detection method of the present invention.
FIG. 2 is a schematic diagram of the present invention for adaptively setting a predictive search area for a moving vehicle of a current frame.
Fig. 3 is a flowchart for matching the frame motion vehicle information to be detected with the previous N frame motion vehicle information according to the present invention.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The invention provides a fan-shaped search vehicle speed detection method based on video, which can be realized through a flow shown in fig. 1, and comprises the following steps:
step S111, an intelligent camera is erected on a traffic signal lamp post, and images of the running moving vehicles are collected.
Step S112, a background model is built in the image, and a binarized moving vehicle foreground image is obtained, wherein the specific steps are as follows: preprocessing a foreground image, and sequentially adopting a 3 multiplied by 3 template to perform median filtering to remove salt and pepper noise in the foreground image; realizing image connected domain blurring by adopting Gaussian filtering, taking 3 as the mean value of a Gaussian filtering template and 2.5 as the variance; performing morphological filtering by using a 3×3 template to remove burrs of the image and clearly and completely dividing the foreground image into moving vehicles; and finally, setting a number i for each connected region by adopting a connected region marking method, wherein i epsilon (0, n) and n are the total number of marks.
Step S113, calculating multi-feature information of each moving vehicle, which specifically includes the following steps:
(3-1) creating a class of moving vehicles containing multi-feature information including area features, color features, edge features of the moving vehicles; the moving vehicles comprise a moving vehicle region area S and an HSV color histogram H of the moving vehicle region color Edge direction histogram H edge A moving vehicle region centroid coordinate P (x, y), a moving vehicle number ID, a moving vehicle movement angle θ, and a moving vehicle speed V;
(3-2) calculating the area of the moving vehicle, HSV color histogram, edge direction histogram, centroid coordinates, ID of the moving vehicle, and the moving angle of the moving vehicle, specifically comprising the following steps:
(3-2-1) calculating an area S of the moving vehicle i The calculation formula is as follows:
S i =∑i
wherein i represents the number of the connected domain, S i Is the area of the connected domain i;
(3-2-2) calculating an HSV color histogram of the moving vehicle, wherein the coordinate of the central point of the circumscribed rectangle of the moving vehicle is x= (x) 0 ,y 0 ) The probability density calculation formula of the u-th histogram feature in the target area is as follows:
wherein xi For the ith pixel point in the circumscribed rectangular frame of the moving vehicle, u represents the index of the histogram color level, b (x i ) Is x i Corresponding color histogram bar, |x i -x 0 II represents x i To x 0 Is used for the distance of (a), respectively the length and width of the rectangular frame, N s Representing the total number of pixels in the target area, C color Representation normalization the coefficient of the,δ[·]delta function, k (·) is kernel function, +.>
(3-2-3) calculating a moving vehicle edge direction histogram, and adopting a Sobel operator to perform edge detection, wherein the specific calculation formula is as follows:
G x (x,y)=f(x+1,y-1)+2f(x+1,y)+f(x+1,y+1)-f(x-1,y-1)-2f(x-1,y)-f(x-1,y+1)G y (x,y)=f(x-1,y-1)+2f(x,y-1)+f(x+the size G (x, y) and direction θ of the 1, y-1) -f (x-1, y+1) -2f (x, y+1) -f (x+1, y+1) edges are:
G=|G x (x,y)|+|G y (x,y)|
θ=arctan(G x (x,y)/G y (x,y))
θ∈[0,2π]θ was divided into m=16 θ per portion j Pi/8 (j=1, 2,.., 16), calculating edge values in each angle bin, creating an edge histogram, and in the target region, the θ j The individual edge direction histogram features are expressed as:
(3-2-4) calculating a moving vehicle centroidThe calculation formula is as follows:
wherein Si For the area of the connected domain i,f(x i ,y i ) Is (x) i ,y i ) T is a set threshold, taking t=50;
(3-2-5) setting the number ID of the moving vehicle, which comprises the following specific steps:
establishing a set for preserving a moving vehicle number
Setting a virtual detection line y1 at the position of the moving vehicle entering the image, setting a new ID for the moving vehicle when the mass center of the moving vehicle passes over y1, and storing the ID in a collectionIn (a) and (b);
at the position of the moving vehicle driving out of the imageA virtual detection line y2 is arranged at the position, and when the mass center of the moving vehicle passes over y2, the collection is deletedIs set, the ID of the moving vehicle.
(3-2-6) calculating the angle of the moving vehicle, which comprises the following specific steps:
taking an included angle between the motion direction of the moving vehicle and the y-axis direction of the pixel coordinate system as the motion angle of the moving vehicle;
if the current frame is the first frame of the camera acquired image, setting the motion angle of each motion vehicle to 0;
if the current frame is not the first frame acquired by the camera, the calculation formula of the motion angle of the motion vehicle to be detected is as follows:
wherein Xcurr 、X curr Respectively the abscissa and the ordinate of the mass center of the moving vehicle to be detected in the current frame, X pre 、Y pre The abscissa and the ordinate of the centroid of the successfully matched moving vehicle in the previous frame are respectively.
Step S114, continuously collecting and storing multi-feature information of a moving vehicle in N frames of images, wherein the steps are as follows:
(4-1) creating an image class, wherein the image class comprises: current image frame number, set of moving vehiclesThe set of sports vehicles +.>Comprising individual moving vehicle objects established according to the moving vehicle class of step (3);
(4-2) respectively establishing the instantiation objects of the image class in the step (4-1) for the images of the continuous N frames, storing the continuous N instantiation objects in a queue q, wherein the size of the queue is N, and when the queue is full, adding one object to the tail part of the queue, and deleting one object from the head part of the queue.
Step S115, taking the Nth frame image as the current frame, taking the (n+1) th frame image as the frame to be detected, setting a sector estimated search area of the moving vehicle of the frame to be detected according to the movement angle of the moving vehicle in the current frame image, and calculating a schematic diagram as shown in FIG. 2, wherein the specific steps are as follows:
(5-1) traversing the moving vehicle in the current frame image wherein />A moving vehicle with an ID j in an image with a frame number i;
(5-2) acquisitionCenter of mass P of moving vehicle ij (x ij ,y ij ) Angle of motion theta ij
(5-3) isSet to P ij (x ij ,y ij ) The angle range is [ theta ] as the center of a circle ijij ,θ ijij ]Radius r ij Sector-shaped predictive search area a of (2) ij M ij B ij The motion angle theta ij As A ij M ij B ij In the direction of the angular bisector of (A), i.e. A ij M ij B ij Angle of angular bisector of theta ij Let A ij M ij B ij Angle size of 2 alpha ij The angles of the two radii of the fan shape are respectively theta ijij and θijij
If there is no frameIf the IDs of the moving vehicles are identical, then alpha ij Set to 30 °; otherwise, set the sum +_in the previous frame>The sports vehicle with the same ID is +.>The angular size of the sector-shaped estimated search area of (2) is 2α i-1j ,α ij The specific calculation formula of (2) is as follows:
wherein Δθij =θ iji-1j Representation ofAnd->And the variation of the motion angle of θ ij Is->And (a) the movement angle, theta i-1j Is->The motion angle k of (a) 1 Is a parameter, said->The meaning of the formula is that the current fan angle +.>The variation delta theta of the motion angle ij The influence of the motion angle variation Δθ ij When the number is positive, the sector angle is +>Self-adaptive enlargement, fan angle ++when the motion angle variation is negative>The self-adaption is reduced, so that the self-adaption adjustment of the search angle along with the change of the motion angle is realized.
(5-4) if there is no frame in the previous frameIf the ID of the moving vehicles are identical, the radius r ij Set to 15; otherwise, set the sum +_in the previous frame>The sports vehicle with the same ID is +.>The radius of the sector-shaped estimated search area of (2) is r i-1j ,r ij The specific calculation formula of (2) is as follows:
r ij =r i - 1j +Δd ij k 2
wherein Representation->And->D ij Is->Is used for controlling the motion distance of the vehicle,is->Distance of movement k 2 Is a parameter, said->The motion distance d is the distance between the centroids of the moving vehicles with the same ID in the adjacent frames. The meaning of the formula is that the radius r of the current sector ij The moved distance variation Δd ij Influence, if the movement distance change amount Deltad ij Fan radius r for positive number ij Become larger if it is transportedDistance change Δd ij Sector radius r for negative numbers ij Becomes smaller, thereby realizing the search radius r ij And the motion distance is adaptively adjusted along with the change of the motion distance.
Step S116, calculating the sector estimated search area A in the frame to be measured in S115 ij M ij B ij Multi-feature information of the moving vehicle.
Step S117, the multi-feature information of the moving vehicle in the frame to be detected is matched with the multi-feature information of the N frames of moving vehicles stored in step S114, and the specific flow is as shown in fig. 3, and the specific steps are as follows:
(7-1) acquiring the next frame image F i+1 F is to F i+1 As a frame to be measured;
(7-2) acquisition of F i+1 The j-th moving vehicle M of (a) i+1j
(7-3) if M i+1j Centroid coordinates of (c)At the estimated search area A described in (5-3) ij M ij B ij In, go to (7-4), otherwise go to (7-7);
(7-4) traversing the instantiated object q of the image class in the store queue q of (4-2) k If q k Number ID of middle-motion vehicleIf the numbers ID of the moving vehicles are equal, the moving vehicles are stored in the set +.>In (a) and (b);
(7-5) mixing M i+1j And (3) withIf the matching is successfully carried out, the matching is carried out to (7-6), otherwise, the matching is carried out to (7-7), and the specific steps of the matching method are as follows:
(7-5-1) calculation of M i+1j And (3) withThe area similarity degree of the moving vehicles in the (2) is calculated as follows:
wherein si+1 For the i+1st frame of moving vehicle area, s k Is thatA kth moving vehicle area;
calculating the average value of the area similarity
(7-5-2) calculation of M i+1j And (3) withHSV color feature similarity of a moving vehicle:
calculate M i+1j HSV color histogram modelAnd->HSV color histogram model of medium motion vehicle>The formula is as follows:
wherein m is the quantization level number of the histogram, and u is the color level index in the histogram;
calculating the average value of the similarity of the color features
(7-5-3) calculation of M i+1j And (3) withEdge feature similarity of a moving vehicle:
calculating M of edge features i+1j Histogram model and Mi+1j Histogram model of a medium-motion vehicle->Similarity d between edge The formula is as follows:
wherein m is the number of quantization steps of the histogram, θ u For the edge direction level index,
computing edge feature similarity mean
(7-5-4) fusing the area features, the color features and the edge features, thereby obtaining M i+1j And (3) withIn a moving vehicle M kj The similarity is as follows:
if d > epsilon is satisfied, epsilon is a similarity threshold parameter, epsilon=0.5 is taken, M is i+1j And (3) withThe moving vehicles in the model are the same target, and the matching is successful;
(7-6) order M i+1j ID and M of (C) ij Is equal to the ID of (a);
(7-7) let j=j+1 if j < n, go to (7-2) if not, wherein n is the total number of moving vehicles for the current frame.
Step S118, calculating the distance between the frame to be detected and the moving vehicle of the frame successfully matched to form a distance set, wherein the specific steps are as follows:
(8-1) obtaining centroid coordinates P of a moving vehicle in a frame to be measured i+1j (x i+1j ,y i+1j );
(8-2) obtaining the AND P i+1j (x i+1j ,y i+1j ) Matched set of moving vehicles and />Centroid coordinates P of each moving vehicle kj (x kj ,y kj );
(8-3) calculation of P i+1j (x i+1j ,y i+1j ) And P ki (x kj ,y kj ) The specific calculation formula of the distance is as follows:
step S119, calculating the movement speed of the moving vehicle according to the distance set and the frame rate in step S118, wherein the specific steps are as follows:
(9-1) calculating the average speed of the moving vehicle for N continuous frames in the image coordinate system according to the frame rate, wherein the specific calculation formula is as follows:
wherein ,disk For the vehicle to be tested and q k Distance of corresponding vehicle, q k The k frame image in the image storage queue is stored, and f is the frame rate.
(9-2) updating the moving speed of the moving vehicle according to the average speed of the step (9-1);
(9-3) establishing a mapping of an image coordinate system and a real world coordinate system according to camera calibration, and converting the average speed in the image in the step (9-1) into the vehicle motion speed in the real world.
The above description is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above examples, and all technical solutions belonging to the concept of the present invention belong to the protection scope of the present invention.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and further implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
While embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the invention, and that variations, modifications, alternatives and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the invention.
By adopting the fan-shaped search vehicle speed detection method based on the video, the fan-shaped estimated search area is arranged between the continuous frames of the video, and the vehicle is matched in the search area, so that the vehicle position can be accurately positioned, the high-efficiency and accurate measurement of the vehicle speed can be realized, and compared with the prior art, the use cost is lower, the installation is simple, the maintenance is convenient, and the intelligent detection mode can provide effective information for realizing intelligent traffic decision.
In this specification, the invention has been described with reference to specific embodiments thereof. It will be apparent, however, that various modifications and changes may be made without departing from the spirit and scope of the invention. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.

Claims (9)

1. The fan-shaped search vehicle speed detection method based on the video is characterized by comprising the following steps of:
(1) Acquiring an image containing a moving vehicle;
(2) Extracting a moving vehicle diagram from the image;
(3) Calculating multi-feature information of the moving vehicle, wherein the multi-feature information comprises area features, color features and edge features;
(4) Continuously collecting and storing multi-feature information of a moving vehicle in N frames of images;
(5) Taking the Nth frame image as a current frame, taking the (n+1) th frame image as a frame to be detected, and setting a sector estimated search area of the moving vehicle of the frame to be detected according to the movement angle of the moving vehicle in the current frame image;
(6) Calculating multi-feature information of the moving vehicle in the sector estimated search area in the frame to be detected;
(7) Matching the multi-feature information of the moving vehicle in the frame to be detected with the multi-feature information of the N frames of moving vehicles stored in the step (4);
(8) Calculating the distance between the moving vehicles of the successfully matched frames to form a distance set;
(9) Calculating the movement speed of the moving vehicle according to the distance set and the frame rate;
the step (5) specifically comprises the following steps:
(5-1) traversing the moving vehicle in the current frame image wherein />A moving vehicle with an ID j in an image with a frame number i;
(5-2) acquisitionCenter of mass P of moving vehicle ij (x ij ,y ij ) Angle of motion theta ij
(5-3) isSet to P ij (x ij ,y ij ) The angle range is [ theta ] as the center of a circle ijij ,θ ijij ]Radius r ij Sector-shaped predictive search area a of (2) ij M ij B ij The motion angle theta ij As A ij M ij B ij In the direction of the angular bisector of (A), i.e. A ij M ij B ij Angle of angular bisector of theta ij Let A ij M ij B ij Angle size of 2 alpha ij The angles of the two radii of the fan shape are respectively theta ijij and θijij
If there is no frameIf the IDs of the moving vehicles are identical, then alpha ij Set to 30 °; otherwise, set the sum +_in the previous frame>The sports vehicle with the same ID is +.>The angular size of the sector of the estimated search area is +.>α ij The specific calculation formula of (2) is as follows:
wherein ,Δθij =θ iji-1j RepresentingAnd->And the variation of the motion angle of θ ij Is->Is (are) movement angle>Is->The motion angle k of (a) 1 Is a parameter, said->
(5-4) if there is no frame in the previous frameIf the ID of the moving vehicles are identical, the radius r ij Set to 15; otherwise, set the sum +_in the previous frame>The sports vehicle with the same ID is +.>The radius of the sector-shaped estimated search area of (2) isr ij The specific calculation formula of (2) is as follows:
r ij =r i-1j +Δd ij k 2
wherein ,representation->And->D ij Is->Is used for controlling the motion distance of the vehicle,is->Distance of movement k 2 Is a parameter, said->
The motion distance is the distance between the centroids of the moving vehicles with the same ID in the adjacent frames.
2. The method for detecting a vehicle speed based on a sector search of video according to claim 1, wherein the step (3) calculates multi-feature information of the moving vehicle, comprising the steps of:
(3-1) creating a moving vehicle class containing multi-feature information, said moving vehicle class containing an area S of the moving vehicle, a color H of the moving vehicle color Edge H of a moving vehicle edge The centroid coordinates P (x, y) of the moving vehicle, the number ID of the moving vehicle, the movement angle theta of the moving vehicle and the speed y of the moving vehicle;
(3-2) calculating the area S of the moving vehicle, the color H of the moving vehicle color Edge H of a moving vehicle edge The centroid coordinates P (x, y) of the moving vehicle, the number ID of the moving vehicle, and the movement angle θ of the moving vehicle;
specifically, the area S of the moving vehicle is calculated using the following formula:
S i =∑i;
wherein i represents the number of the connected domain, S i Is the area of the connected domain i;
calculating the color H of the moving vehicle using the following formula color
Wherein the coordinates of the central point of the circumscribed rectangle of the moving vehicle are set as x= (x) 0 ,y 0 ),x i For the ith pixel point in the circumscribed rectangular frame of the moving vehicle, u represents the index of the histogram color level, b (x i ) Is x i Corresponding color histogram bar, ||x i -x 0 I represents x i To x 0 Is used for the distance of (a),respectively the length and width of the rectangular frame, N s Representing the total number of pixels in the target area, C color Representing normalized coefficient,/->δ[·]For the Delta function, k (·) is the kernel function,>
3. the video-based fan search vehicle speed detection method according to claim 2, wherein the edge direction histogram of the moving vehicle is calculated, and the Sobel operator is adopted for edge detection, specifically: calculating the edge H of the moving vehicle using the following formula edge
G x (x,y)=f(x+1,y-1)+2f(x+1,y)+f(x+1,y+1)-f(x-1,y-1)-2f(x-1,y)-f(x-1,y+1)
G y (x, y) =f (x-1, y-1) +2f (x, y-1) +f (x+1, y-1) -f (x-1, y+1) -2f (x, y+1) -f (x+1, y+1), wherein the size G (x, y) and direction θ of the edges are:
G=|G x (x,y)|+|G y (x,y)|;
θ=arctan(G x (x,y)/G y (x,y));
θ∈[0,2π]θ was divided into m=16 θ per portion j Pi/8 (j=1, 2,.., 16), calculating edge values in each angle bin, creating an edge histogram, and in the target region, the θ j The individual edge direction histogram features are expressed as:
4. the video-based sector search vehicle speed detection method according to claim 2, wherein the centroid coordinates P (x, y) of the moving vehicle are calculated using the following formula
wherein ,Si For the area of the connected domain i,f(x i ,y i ) Is (x) i ,y i ) T is a set threshold, taking t=50.
5. The video-based sector search vehicle speed detection method according to claim 2, wherein the calculating of the number ID of the moving vehicle specifically comprises the steps of:
(a1) Set up for preservation and shippingSet of motor vehicle numbers
(b1) Setting a virtual detection line y1 at the position of the moving vehicle entering the image, setting a new ID for the moving vehicle when the mass center of the moving vehicle passes over y1, and storing the ID in a collectionIn (a) and (b);
(c1) A virtual detection line y2 is arranged at the position of the moving vehicle which exits from the image, and when the mass center of the moving vehicle passes over y2, the collection is deletedIs set, the ID of the moving vehicle.
6. The method for detecting a fan search vehicle speed based on video according to claim 2, wherein the calculating of the motion angle θ of the moving vehicle comprises the steps of:
(b1) Let the moving vehicle of the current frame beA moving vehicle with an ID j in an image with a frame number i;
(b2) If there is no frameFor sports vehicles with the same ID +.>Is set to 0; otherwise, set the sum +_in the previous frame>The sports vehicle with the same ID is +.>Then move vehicle in the current frame +.>The specific calculation formula of the motion angle of the device is as follows:
wherein ,Xcurr Is thatThe abscissa of the centroid, Y curr Is->The ordinate, X, of the centroid of (2) pre Is->Barycenter abscissa, Y pre Is->Is defined by the centroid ordinate of (c).
7. The method for detecting a video-based sector search vehicle speed according to claim 2, wherein the step (4) specifically comprises the steps of:
(4-1) creating an image class, wherein the image class comprises: current image frame number, set of moving vehiclesThe set of sports vehicles +.>Comprising the movement according to step (3-1)Each moving vehicle object established by the vehicle class;
(4-2) respectively establishing the instantiation objects of the image class in the step (4-1) for the images of the continuous N frames, storing the continuous N instantiation objects in a queue q, wherein the size of the queue q is N, and when the queue is full, adding one object to the tail part of the queue, and deleting one object from the head part of the queue.
8. The method for detecting a video-based sector search vehicle speed according to claim 7, wherein said step (7) specifically comprises the steps of:
(7-1) acquiring the next frame image F i+1 F is to F i+1 As a frame to be measured;
(7-2) acquisition of F i+1 The j-th moving vehicle M of (a) i+1j
(7-3) if M i+1j Centroid coordinates of (c)The estimated search area A described in the step (5-3) ij M ij B ij If yes, jumping to the step (7-4), otherwise jumping to the step (7-7);
(7-4) traversing the instantiated objects q of the image class in the store queue q described in step (4-2) k If q k Number ID and M of medium-motion vehicle ij If the numbers ID of the moving vehicles are equal, the moving vehicles are stored in a collectionIn (a) and (b);
(7-5) mixing M i+1j And (3) withIf the matching is successful, jumping to the step (7-6), otherwise jumping to the step (7-7);
(7-6) order M i+1j ID and M of (C) ij Is equal to the ID of (a);
(7-7) letting j=j+1 if j < n, jump to (7-2) if not end, where n is the total number of moving vehicles for the current frame.
9. The method for detecting a video-based sector search vehicle speed according to claim 8, wherein said step (7-5) further comprises the steps of:
(7-5-1) calculation of M i+1j And (3) withAverage value +.about.of the degree of similarity of the area characteristics of each moving vehicle in (a)>
(7-5-2) calculation of M i+1j And (3) withAverage value +.about.of the degree of similarity of the color characteristics of the respective moving vehicles in (a)>
(7-5-3) calculation of M i+1j And (3) withAverage value +.about.of the degree of similarity of the edge characteristics of each moving vehicle in (a)>
(7-5-4) fusing the area feature, the color feature, and the edge feature to obtain M i+1j And (3) withIn a moving vehicle M kj The similarity is as follows:
λ 123 =1
if d < epsilon is satisfied, epsilon is a similarity threshold parameter, M i+1j And (3) withThe moving vehicles in (a) are the same target, and the matching is successful.
CN202111006501.7A 2021-08-30 2021-08-30 Sector search vehicle speed detection method based on video Active CN113723286B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111006501.7A CN113723286B (en) 2021-08-30 2021-08-30 Sector search vehicle speed detection method based on video

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111006501.7A CN113723286B (en) 2021-08-30 2021-08-30 Sector search vehicle speed detection method based on video

Publications (2)

Publication Number Publication Date
CN113723286A CN113723286A (en) 2021-11-30
CN113723286B true CN113723286B (en) 2023-08-11

Family

ID=78679274

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111006501.7A Active CN113723286B (en) 2021-08-30 2021-08-30 Sector search vehicle speed detection method based on video

Country Status (1)

Country Link
CN (1) CN113723286B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2528019A1 (en) * 2011-05-26 2012-11-28 Axis AB Apparatus and method for detecting objects in moving images
CN110519690A (en) * 2019-09-05 2019-11-29 浙江大华技术股份有限公司 The determination method and device in candidate search region, storage medium, electronic device
CN111723769A (en) * 2020-06-30 2020-09-29 北京百度网讯科技有限公司 Method, apparatus, device and storage medium for processing image
CN112104846A (en) * 2020-11-03 2020-12-18 成都零壹众科技有限公司 Moving target real-time video tracking method, system, terminal, medium and processor

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109325967B (en) * 2018-09-14 2023-04-07 腾讯科技(深圳)有限公司 Target tracking method, device, medium, and apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2528019A1 (en) * 2011-05-26 2012-11-28 Axis AB Apparatus and method for detecting objects in moving images
CN110519690A (en) * 2019-09-05 2019-11-29 浙江大华技术股份有限公司 The determination method and device in candidate search region, storage medium, electronic device
CN111723769A (en) * 2020-06-30 2020-09-29 北京百度网讯科技有限公司 Method, apparatus, device and storage medium for processing image
CN112104846A (en) * 2020-11-03 2020-12-18 成都零壹众科技有限公司 Moving target real-time video tracking method, system, terminal, medium and processor

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于机器视觉的在线高速检测与精确控制研究及应用;周文举;中国博士学位论文全文数据库 信息科技辑(第02期);全文 *

Also Published As

Publication number Publication date
CN113723286A (en) 2021-11-30

Similar Documents

Publication Publication Date Title
CN108596129B (en) Vehicle line-crossing detection method based on intelligent video analysis technology
CN108320510B (en) Traffic information statistical method and system based on aerial video shot by unmanned aerial vehicle
CN103824066B (en) A kind of licence plate recognition method based on video flowing
CN111178236B (en) Parking space detection method based on deep learning
TWI452540B (en) Image based detecting system and method for traffic parameters and computer program product thereof
CN111563469A (en) Method and device for identifying irregular parking behaviors
WO2017156772A1 (en) Method of computing passenger crowdedness and system applying same
CN111753797B (en) Vehicle speed measuring method based on video analysis
CN110379168B (en) Traffic vehicle information acquisition method based on Mask R-CNN
CN104318258A (en) Time domain fuzzy and kalman filter-based lane detection method
CN108364466A (en) A kind of statistical method of traffic flow based on unmanned plane traffic video
CN110348332B (en) Method for extracting multi-target real-time trajectories of non-human machines in traffic video scene
CN109948552B (en) Method for detecting lane line in complex traffic environment
CN112069944A (en) Road congestion level determination method
CN110658539B (en) Vehicle positioning method, device, vehicle and computer readable storage medium
CN110458050B (en) Vehicle cut-in detection method and device based on vehicle-mounted video
Liu et al. Vision-based real-time lane marking detection and tracking
EP2813973B1 (en) Method and system for processing video image
CN111915883A (en) Road traffic condition detection method based on vehicle-mounted camera shooting
CN111597905A (en) Highway tunnel parking detection method based on video technology
CN115717894A (en) Vehicle high-precision positioning method based on GPS and common navigation map
Poggenhans et al. A universal approach to detect and classify road surface markings
CN108520528B (en) Mobile vehicle tracking method based on improved difference threshold and displacement matching model
Liu et al. Lane line detection based on mask R-CNN
Khan et al. Lane detection using lane boundary marker network with road geometry constraints

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant