WO2023124383A1 - 一种车辆速度检测、撞车预警方法及电子设备 - Google Patents

一种车辆速度检测、撞车预警方法及电子设备 Download PDF

Info

Publication number
WO2023124383A1
WO2023124383A1 PCT/CN2022/124912 CN2022124912W WO2023124383A1 WO 2023124383 A1 WO2023124383 A1 WO 2023124383A1 CN 2022124912 W CN2022124912 W CN 2022124912W WO 2023124383 A1 WO2023124383 A1 WO 2023124383A1
Authority
WO
WIPO (PCT)
Prior art keywords
target vehicle
image
speed
target
frame
Prior art date
Application number
PCT/CN2022/124912
Other languages
English (en)
French (fr)
Inventor
王镜茹
孔繁昊
Original Assignee
京东方科技集团股份有限公司
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 京东方科技集团股份有限公司 filed Critical 京东方科技集团股份有限公司
Publication of WO2023124383A1 publication Critical patent/WO2023124383A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/20Analysis of motion
    • G06T7/207Analysis of motion for motion estimation over a hierarchy of resolutions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/20Analysis of motion
    • G06T7/246Analysis of motion using feature-based methods, e.g. the tracking of corners or segments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/01Detecting movement of traffic to be counted or controlled
    • G08G1/04Detecting movement of traffic to be counted or controlled using optical or ultrasonic detectors
    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/01Detecting movement of traffic to be counted or controlled
    • G08G1/052Detecting movement of traffic to be counted or controlled with provision for determining speed or overspeed
    • G08G1/054Detecting movement of traffic to be counted or controlled with provision for determining speed or overspeed photographing overspeeding vehicles
    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/16Anti-collision systems

Definitions

  • the present disclosure relates to the field of computer vision, in particular to a vehicle speed detection, a collision warning method, electronic equipment and a vehicle warning system.
  • Interval speed measurement is to arrange two adjacent monitoring points on the same road section, calculate the average driving speed of the target vehicle on the road section based on the time when the target vehicle passes through the two monitoring points before and after, and calculate the average driving speed based on the average driving speed and the reference speed. Compare to determine whether it is overspeeding.
  • Radar speed measurement mainly uses the Doppler Effect (Doppler Effect) principle: when the target approaches the radar antenna, the reflected signal frequency will be higher than the transmitter frequency; conversely, when the target moves away from the antenna, the reflected signal frequency will be lower than the transmitted signal frequency. machine frequency. Radar speed measurement can detect the real-time speed of the target vehicle.
  • Doppler Effect Doppler Effect
  • the present disclosure provides a vehicle speed detection method, including: acquiring a surveillance video of a road, and extracting continuous multi-frame images in the surveillance video. Identify vehicles in multiple frames of images, and establish the driving trajectory of the target vehicle. Get the image position coordinates of the target vehicle in each frame of image. According to the image position coordinates, the world position coordinates of the target vehicle in the real world are obtained. According to the world position coordinates, calculate the moving distance of the target vehicle in the real world in every two adjacent frames of images in the multi-frame images. According to the driving distance of the target vehicle in the real world and the frame rate of the surveillance video, the speed of the target vehicle in the current frame is calculated, wherein the driving distance is obtained according to the moving distance.
  • calculating the speed of the target vehicle in the current frame according to the distance traveled by the target vehicle in the real world and the frame rate of the surveillance video includes: calculating the current frame image and N frame images before the current frame image In , the sum of the moving distances of the target vehicle in the real world in every two adjacent frames of images, and the sum of the moving distances is taken as the driving distance. According to the frame rate of the surveillance video, the time difference between the current frame image and the Nth frame image before the current frame image is obtained. The calculated speed of the target vehicle in the current frame is obtained according to the traveling distance and the time difference, and the calculated speed of the target vehicle in the current frame is taken as the speed of the target vehicle in the current frame.
  • the sum of the moving distances of the target vehicle in the real world in every two adjacent frames of images is calculated, and the sum of the moving distances is used as the driving distance .
  • the frame rate of the surveillance video the time difference between the current frame image and the Nth frame image before the current frame image is obtained.
  • the calculated speed of the target vehicle in the current frame is obtained.
  • it before calculating the moving distance of the target vehicle in the real world in the two adjacent frames of images in the multi-frame images according to the world position coordinates, it also includes: calculating the two adjacent frames of images in the multi-frame images , the moving distance of the target vehicle in the image. Determine whether the moving distance of the target vehicle in the image is greater than a distance threshold. Based on the moving distance of the target vehicle in the image is greater than the distance threshold, calculate the moving distance of the target vehicle in the real world; based on the moving distance of the target vehicle in the image is less than or equal to the distance threshold, continue to track the target vehicle's driving trajectory.
  • the method before calculating the speed of the target vehicle in the current frame, the method further includes: calculating the number of image moving distances greater than a distance threshold among multiple image moving distances in multiple frames of images before the current frame image.
  • the moving distance of each image is the moving distance of the target vehicle in the image in every two adjacent frames of images. It is judged whether the number of image movement distances greater than the distance threshold is greater than the set threshold.
  • the speed of the target vehicle in the current frame is calculated based on the number of image movement distances greater than the distance threshold greater than the set threshold; based on the number of image movement distances greater than the distance threshold is less than or equal to the set threshold, the target vehicle is tracked.
  • the vehicle speed detection method further includes: judging whether the speed of each frame of the target vehicle in the continuous L frames of images is outside the speed limit range of the road on which the target vehicle is traveling. Based on the speed of each frame of the target vehicle in consecutive L frames of images is outside the speed limit of the road the target vehicle is driving on, perform an early warning operation; Within the range of the driving speed limit, the pre-warning operation will not be performed. After the target vehicle triggers an early warning when performing speed detection in multiple surveillance videos, when the target vehicle triggers an early warning when performing speed detection again, the alarm intensity is increased.
  • the vehicle speed detection method further includes, before identifying the target vehicle in the multiple frames of images and establishing the driving track of the target vehicle, marking detection areas on the multiple frames of images.
  • the detection area is a closed figure, located in the driving area of the road in the image, and the image position coordinates of the boundary of the detection area on each frame of image are fixed.
  • calculate the moving distance of the target vehicle in the real world in the two adjacent frames of images in the multi-frame images including: according to the world position coordinates, calculate the distance between the two adjacent frames of images in the multi-frame images, which is located in the detection How far the target vehicle in the area moves in the real world.
  • Calculating the speed of the target vehicle in the current frame includes: calculating the speed of the target vehicle in the detection area in the current frame.
  • identifying the target vehicle in the multi-frame images and establishing the driving trajectory of the target vehicle includes: detecting the multi-frame images, determining the target vehicle and establishing a target detection frame, and detecting the target vehicle based on the target detection frame Tracking to get the trajectory of the target vehicle.
  • the image position coordinates of the target vehicle in each frame of image are the image position coordinates of the center point of the target detection frame of the target vehicle in the frame of image.
  • the vehicle speed detection method further includes: after establishing the driving track of the target vehicle, establishing an identity information list of the target vehicle.
  • the identity information list of the target vehicle is established, including: using the re-identification model to extract the feature vector of the target vehicle. Calculate the cosine of the angle between the eigenvectors of the target vehicle in every two adjacent frames of images. It is judged whether the value of the cosine of the included angle is greater than the similarity threshold for G consecutive times. Based on the value of the included angle cosine being greater than the similarity threshold for G consecutive times, an identity information list corresponding to the target vehicle is established in the vehicle information retrieval database, and the feature vector of the target vehicle is stored in the corresponding identity information list of the target vehicle.
  • the identity information list of the target vehicle includes the identity information of the target vehicle.
  • the target vehicle when the target vehicle is lost in tracking, it is determined whether the target detection frame of the target vehicle is located in the detection area in the previous frame image where the target vehicle is lost in tracking. Based on the target detection frame of the target vehicle is located in the detection area, the feature vector of the lost target vehicle will be tracked, matched with the feature vector of the newly acquired target vehicle after the tracking loss, and the feature vector will be matched with the newly acquired target vehicle.
  • the identity information of the track is built in the identity information list of the lost target vehicle. Based on the target detection frame of the target vehicle being located outside the detection area, the retrieval of the target vehicle is stopped.
  • multiple frames of images are detected, the target vehicle is determined and a target detection frame is established, and the target vehicle is tracked based on the target detection frame to obtain the trajectory of the target vehicle.
  • the feature vectors of the target vehicles corresponding to the overlapped target detection frames are extracted.
  • the target vehicles whose cosine value of the angle between the feature vectors in two adjacent frames of images is greater than the similarity threshold are established in the same identity information list.
  • the target vehicle in the real world before obtaining the world position coordinates of the target vehicle in the real world according to the image position coordinates, it further includes: calculating internal parameters and external parameters of the image acquisition device used to shoot the surveillance video.
  • the internal parameters and external parameters are used to convert the image position coordinates of the multi-frame images and their corresponding world position coordinates.
  • Calculating the internal parameters and external parameters of the image acquisition device used to shoot the surveillance video includes: marking the first vanishing point and the second vanishing point on the marked images in the multi-frame images.
  • the labeled image is any frame in the multi-frame images. The image position coordinates of the first vanishing point and the second vanishing point in the labeled image are obtained.
  • the center of the labeled image is coincident with the principal point, and the initial internal parameters and initial external parameters of the image acquisition device are calculated according to the linear equation.
  • Select at least one calibration reference on the labeled image is a marker with a known distance between the two ends in the real world.
  • the calibration reference includes a line segment of a dotted lane line, the interval between adjacent dotted lane lines, the same The spacer between two connected segments in a dashed lane line. Get the image position coordinates of the two endpoints of the calibration reference in the labeled image.
  • N is the number of calibration references
  • P K is the world position coordinates of one end of the kth calibration reference in the real world
  • Q K is the world position coordinates of the other end of the kth calibration reference in the real world
  • P K is the world position coordinates of the kth calibration reference
  • the image position coordinates of one end of k calibration references in the marked image the world position coordinates of the real world calculated by using the initial internal parameters and initial external parameters
  • Q K is the image position of the other end of the kth calibration reference in the marked image Coordinates, the world position coordinates of the real world calculated by using the initial internal parameters and initial external parameters
  • cp represents the constraint parameters of the image acquisition device, including internal parameters and external parameters.
  • the present disclosure provides a collision warning method, wherein the collision warning method includes adopting the vehicle speed detection method according to any one of the above-mentioned embodiments, acquiring road monitoring video and extracting continuous multiple frames in the monitoring video image. Perform target detection and tracking, and speed detection on the target vehicle.
  • the collision warning method also includes: establishing the motion tracks of multiple target vehicles in the monitoring video of the road. It is judged whether the movement trajectories of at least two adjacent target vehicles among the plurality of target vehicles are the same movement trajectories.
  • the motion trajectories of two adjacent target vehicles are the same running trajectory, detect the speed of each frame of the two adjacent target vehicles in the multi-frame image, and judge that within the preset duration, among the two adjacent target vehicles, the rear Whether the speed of the target vehicle is consistently greater than the speed of the target vehicle ahead. Based on the fact that among two adjacent target vehicles, the speed of the rear target vehicle is continuously greater than the speed of the front target vehicle within a preset duration, the operation of collision warning is performed. Based on the fact that among the two adjacent target vehicles, the speed of the rear target vehicle is less than or equal to the speed of the front target vehicle within a preset duration, the collision warning operation is not performed.
  • the collision warning method further includes: if the motion trajectories of the W adjacent target vehicles are the same motion trajectory, acquiring the vehicle types of the W adjacent target vehicles, where W is greater than or equal to 3. Determine whether the vehicle types of the W adjacent target vehicles are at least one small car or a medium-sized car located between two large cars. Based on the existence of at least one small car or medium-sized car in the middle of two large cars, the operation of collision warning is performed; based on the absence of at least one small car or medium-sized car in the middle of two large cars, detection of adjacent W The speed of the target vehicle in each frame of multiple frames of images, and determine whether the speed of the rear target vehicle is continuously greater than the speed of the front target vehicle among the W adjacent target vehicles within a preset duration.
  • the collision warning operation is triggered; based on the speed of the rear target vehicle in the adjacent W target vehicles If the speed of the target vehicle ahead is less than or equal to the speed within the preset duration, the collision warning operation is not performed.
  • the method for judging whether the motion trajectories of at least two target vehicles are the same motion trajectory includes: obtaining a set of image position coordinates of each target vehicle in multiple frames of images, and performing a straight line equation fitting, Obtain the motion line equation of each target vehicle in the image coordinate system, where the origin of the image coordinate system coincides with the center of each frame image. Judging whether the slope difference of at least two motion line equations of each target vehicle is smaller than the slope threshold, and whether the intercept difference of at least two motion line equations is smaller than the intercept threshold.
  • the warning intensity is increased.
  • the present disclosure provides an electronic device, including: a processor and a memory.
  • the processor is configured to perform the following steps: acquiring road monitoring video and storing the monitoring video in a memory; extracting continuous multiple frames of images in the monitoring video. Identify the target vehicle in the multi-frame images, and establish the driving track of the target vehicle. Get the image position coordinates of the target vehicle in each frame of image. According to the image position coordinates, the world position coordinates of the target vehicle in the real world are obtained. Calculate the moving distance of the target vehicle in the real world in two adjacent frames of the surveillance video of the road. According to the driving distance of the target vehicle in the real world and the frame rate of the surveillance video, the speed of the target vehicle in the current frame is calculated, wherein the driving distance is obtained according to the moving distance.
  • the processor is further configured to perform the following step: calculating the distance between the moving distances of the target vehicle in the real world in every two adjacent frames of images in the current frame image and the N frame images before the current frame image and, the sum of the moving distances is taken as the driving distance.
  • the frame rate of the surveillance video the time difference between the current frame image and the Nth frame image before the current frame image is obtained.
  • the calculated speed of the target vehicle in the current frame is obtained according to the traveling distance and the time difference, and the calculated speed of the target vehicle in the current frame is taken as the speed of the target vehicle in the current frame.
  • the processor is further configured to perform the following steps: calculating the moving distance of the target vehicle in the real world in every two adjacent frames of images in the current frame image and the N frame images before the current frame image The sum of the moving distances is taken as the driving distance.
  • the frame rate of the surveillance video the time difference between the current frame image and the Nth frame image before the current frame image is obtained.
  • the calculated speed of the target vehicle in the current frame is obtained.
  • the processor before the processor is configured to calculate the moving distance of the target vehicle in the real world in two adjacent frames of images in the multi-frame images according to the world position coordinates, it is further configured to perform the following steps: calculating The moving distance of the target vehicle in the two adjacent frames of the surveillance video of the road. Determine whether the moving distance of the target vehicle in the image is greater than a distance threshold. Based on the moving distance of the target vehicle in the image is greater than the distance threshold, calculate the moving distance of the target vehicle in the real world; based on the moving distance of the target vehicle in the image is less than or equal to the distance threshold, continue to track the target vehicle's driving trajectory.
  • the processor before the processor is configured to calculate the speed of the current frame of the target vehicle, it is also configured to perform the following step: calculating the movement distance of the multiple images in the multiple frames of images before the current frame image is greater than the distance The number of image moving distances of the threshold; wherein, the moving distance of each image is the moving distance of the target vehicle in the image in every two adjacent frames of images. It is judged whether the number of image movement distances greater than the distance threshold is greater than the set threshold. The speed of the target vehicle in the current frame is calculated based on the number of image movement distances greater than the distance threshold greater than the set threshold; based on the number of image movement distances greater than the distance threshold is less than or equal to the set threshold, the target vehicle is tracked.
  • the processor is further configured to perform the following step: judging whether the speed of each frame of the target vehicle in the continuous L frames of images is outside the speed limit range of the road on which the target vehicle is traveling. Based on the fact that the speed of each frame of the target vehicle in the continuous L frames of images is outside the speed limit range of the road on which the target vehicle is traveling, an early warning operation is performed. Based on the fact that the speed of the target vehicle in at least one frame in the consecutive L frames of images is within the speed limit range of the road the target vehicle is traveling on, no warning operation is performed. After the target vehicle triggers an early warning when performing speed detection in multiple surveillance videos, when the target vehicle triggers an early warning when performing speed detection again, the alarm intensity is increased.
  • the processor is further configured to perform the following step: Obtain the movement trajectories of multiple target vehicles from the surveillance video of the road. It is judged whether the movement trajectories of at least two adjacent target vehicles among the plurality of target vehicles are the same movement trajectories. If the motion trajectories of two adjacent target vehicles are the same running trajectory, detect the speed of the current frame in the multi-frame image of the two adjacent target vehicles, and judge the rear target among the two adjacent target vehicles within the preset duration Whether the speed of the vehicle is consistently greater than the speed of the target vehicle ahead.
  • the operation of the collision warning is performed; Assuming that the speed of the vehicle ahead is less than or equal to the speed of the target vehicle in the duration, the collision warning operation will not be performed.
  • the processor is further configured to perform the following steps: obtain the vehicle types of the adjacent W target vehicles, and determine the relative Whether the models of the adjacent W target vehicles are at least one small car or a medium-sized car located between two large cars.
  • the operation of collision warning is performed; based on the absence of at least one small car or medium-sized car in the middle of two large cars, detection of adjacent W The speed of the target vehicle in each frame of multiple frames of images, and determine whether the speed of the rear target vehicle is continuously greater than the speed of the front target vehicle among the W adjacent target vehicles within a preset duration.
  • the collision warning operation is triggered; based on the speed of the rear target vehicle in the adjacent W target vehicles If the speed of the target vehicle ahead is less than or equal to the speed within the preset duration, the collision warning operation is not performed.
  • Yet another aspect provides a vehicle early warning system, including: the electronic device in the above-mentioned yet another aspect.
  • a plurality of image acquisition devices electrically connected to the electronic equipment are installed near the road, and the plurality of image acquisition devices are used to shoot surveillance video of the road and upload the data of the surveillance video to the electronic equipment.
  • several image acquisition devices are electrically connected with the processor in the electronic equipment, and the processor stores the received surveillance video into the memory in the electronic equipment.
  • Non-transitory computer-readable storage medium including: a computer program product stored on a non-transitory computer-readable storage medium; the computer program product includes computer program instructions, and is executed on a computer.
  • the computer program instructions When the program instructions are used, the computer program instructions cause the computer to execute the vehicle speed detection method provided in any one of the above-mentioned embodiments and execute the collision warning method provided in any one of the above-mentioned embodiments.
  • a computer program product includes computer program instructions.
  • the computer program instructions When the computer program instructions are executed on a computer (for example, a display device, a terminal device), the computer program instructions cause the computer to execute the vehicle speed detection method provided in any one embodiment of the above-mentioned aspect and execute such as The collision warning method provided by any one of the above embodiments.
  • a computer program is provided.
  • the computer program When the computer program is executed on a computer (for example, a display device, a terminal device), the computer program enables the computer to execute the vehicle speed detection method provided by any one of the above-mentioned embodiments and perform any one of the above-mentioned other embodiments.
  • the collision warning method provided.
  • FIG. 1 is a first flow chart of a vehicle speed detection method according to some embodiments of the present disclosure
  • FIG. 2 is a second flowchart of a vehicle speed detection method according to some embodiments of the present disclosure
  • FIG. 3 is a third flowchart of a vehicle speed detection method according to some embodiments of the present disclosure.
  • FIG. 4 is a fourth flowchart of a vehicle speed detection method according to some embodiments of the present disclosure.
  • FIG. 5 is a fifth flowchart of a vehicle speed detection method according to some embodiments of the present disclosure.
  • Fig. 6 is a sixth flow chart of a vehicle speed detection method according to some embodiments of the present disclosure.
  • FIG. 7 is a seventh flowchart of a vehicle speed detection method according to some embodiments of the present disclosure.
  • FIG. 8 is an eighth flowchart of a vehicle speed detection method according to some embodiments of the present disclosure.
  • FIG. 9 is a flowchart of a method for establishing an identity encoding method of a target vehicle according to some embodiments of the present disclosure.
  • Fig. 10 is a ninth flow chart of a vehicle speed detection method according to some embodiments of the present disclosure.
  • Fig. 11 is a tenth flowchart of a vehicle speed detection method according to some embodiments of the present disclosure.
  • FIG. 12 is a state diagram of overlapping target detection frames of a target vehicle according to some embodiments of the present disclosure.
  • Fig. 13 is an eleventh flowchart of a vehicle speed detection method according to some embodiments of the present disclosure.
  • Fig. 14 is a flowchart of a method for calculating constraint parameters of an image acquisition device according to some embodiments of the present disclosure
  • Fig. 15 is an auxiliary diagram for calculating internal parameters of an image capture device in a frame of image according to some embodiments of the present disclosure
  • 16 is an auxiliary diagram for calculating internal parameters of an image capture device according to some embodiments of the present disclosure.
  • Fig. 17 is an auxiliary diagram for calculating external parameters of an image capture device according to some embodiments of the present disclosure.
  • Fig. 18 is a flowchart of a collision warning method according to some embodiments of the present disclosure.
  • Fig. 19 is a certain frame image of a marked detection area in a surveillance video according to some embodiments of the present disclosure.
  • Fig. 20 is a flow chart of judging whether the motion trajectories of the target vehicle are the same motion trajectories according to some embodiments of the present disclosure
  • Fig. 21 is a structural diagram of an electronic device according to some embodiments of the present disclosure.
  • Fig. 22 is a structural diagram of a vehicle early warning system according to some embodiments of the present disclosure.
  • first and second are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features. Thus, a feature defined as “first” and “second” may explicitly or implicitly include one or more of these features. In the description of the embodiments of the present disclosure, unless otherwise specified, "plurality” means two or more.
  • radar speed measurement and interval speed measurement are generally used for vehicle speed measurement.
  • the radar speed measurement mainly uses the Doppler Effect (Doppler Effect) principle: when the target is close to the radar, the reflected signal frequency will be higher than the transmitter frequency; conversely, when the target is away from the radar, the reflected signal frequency will be lower than Transmitter frequency.
  • Radar speed measurement can detect the real-time speed of the vehicle.
  • Interval speed measurement is to arrange two adjacent monitoring points on the same road section, and calculate the average driving speed of the vehicle on the road section based on the time when the vehicle passes through the two monitoring points before and after.
  • Radar speed measurement can only detect the speed of the vehicle at the moment when the vehicle is close to the radar, and cannot measure the real-time speed of the vehicle on a long-distance road section; while the interval speed measurement has a certain lag, it can only know the average speed of the vehicle on a certain road section, but cannot know the speed of the vehicle on a certain road section.
  • the real-time speed of vehicles on a certain road section can only detect the speed of the vehicle at the moment when the vehicle is close to the radar, and cannot measure the real-time speed of the vehicle on a long-distance road section; while the interval speed measurement has a certain lag, it can only know the average speed of the vehicle on a certain road section, but cannot know the speed of the vehicle on a certain road section.
  • the real-time speed of vehicles on a certain road section can only detect the speed of the vehicle at the moment when the vehicle is close to the radar, and cannot measure the real-time speed of the vehicle on a long-distance road section; while the interval speed measurement has
  • the vehicle speed detection method is based on video surveillance, and the method includes: S110-S160.
  • the acquired surveillance video of roads includes surveillance videos of urban roads, rural arterial roads, and expressways.
  • Use video processing software to process the frame of the surveillance video such as Open-cv software, to process the frame of the surveillance video, extract each frame image of the surveillance video, and obtain continuous multi-frame images of the surveillance video.
  • FIG. 15 and FIG. 19 are images of a certain frame among the multiple frames of images of the surveillance video of the road. It can be seen that the image includes the road and multiple vehicles.
  • the algorithm of target detection and tracking is used to detect multi-frame images, the target vehicle is determined and the target detection frame Bx (bounding box, bbox) is established, and the target vehicle is detected based on the target detection frame Bx Tracking to get the trajectory of the target vehicle.
  • the target detection frame Bx bounding box, bbox
  • a corresponding target detection frame Bx is established for each target vehicle, and each target vehicle For the corresponding motion trajectory, a tracking algorithm is used to track multiple target vehicles.
  • the target detection algorithm model uses the yolov5 algorithm to identify the target vehicle in the multi-frame images extracted in S110, and marks the target vehicle with the target detection frame Bx.
  • the tracking algorithm model adopts the sort algorithm, and the sort algorithm works with the yolov5 algorithm.
  • the yolov5 algorithm provides a detection target, such as a target vehicle, and the sort algorithm realizes tracking of the target vehicle in multiple frames of images.
  • an image coordinate system is established on each frame of image, and the origin of the image coordinate system coincides with the center of each frame of image, and then the computer obtains the target detection frame data according to the yolov5 algorithm of S120, according to the target detection frame data provided by the Image coordinate position, to obtain the image position coordinates of the target vehicle in the corresponding image coordinate system.
  • the image position coordinates of the target detection frame in the image are the image position coordinates of the corresponding target vehicle.
  • image position coordinates of the target detection frame are the position coordinates of the center point Bo of the target detection frame.
  • the parameter matrix of the image acquisition device for monitoring video for example, the image acquisition device can be a camera or a video camera, and the parameter matrix of the image acquisition device can reflect the relationship between the image position coordinates in the image and the corresponding real world world position coordinates of the image conversion relationship.
  • the image position coordinates of a certain point in the multi-frame images can be converted into the world position coordinates of the point in the real world.
  • a world coordinate system in the real world is established, wherein the origin of the world coordinate system can be set according to the situation.
  • the X axis of the world coordinate system is parallel to the X axis of the image coordinate system.
  • the Y axis of the world coordinate system is parallel to the Y axis of the image coordinate system.
  • the parameter matrix obtained by pre-calculation is used to calculate the position of the target vehicle in the world coordinate system in each frame of image The corresponding world coordinate position in .
  • the vector of the same target vehicle in the world coordinate system in two adjacent frames of images is established, and the length of the vector is calculated as the target vehicle in the real world The moving distance Ly.
  • the method of calculating the velocity Vd of the target vehicle in the current frame according to the travel distance L of the target vehicle in the real world and the frame rate of the surveillance video in S160 includes:
  • the moving distance Ly N is the N-1th frame image before the current frame image and the target vehicle in the Nth frame image before the current frame image in the real world
  • the moving distance, that is, the driving distance L includes the sum of N moving distances and involves N+1 frames of images.
  • the time t between two adjacent frames of images can be obtained. For example, if the frame rate of the surveillance video is 10fps, the time t between two adjacent frames of images is 100ms. The time difference between the Nth frame of images before the current frame of images is N ⁇ 100ms.
  • the calculated speed Vs of the target vehicle in the current frame is the average speed of the travel distance L of the target vehicle within the time of the travel distance.
  • the time of the traveling distance L is the time t between N two adjacent frames of images.
  • N 8 ⁇ N ⁇ 12, for example, N can be 8, 10 or 12.
  • the sum L of the N moving distances of the target vehicle before the 100th frame image is, starting from the (100-N)th frame, that is, from the 90th frame Start by calculating the moving distance Ly 1 of the target vehicle in the real world in the 90th frame image and the 91st frame image, and calculate the moving distance Ly 2 of the target vehicle in the real world in the 91st frame image and the 92nd frame image...
  • the calculated velocity Vs of the target vehicle in the current frame of the 100th frame is the ratio of the sum L of the 10 moving distances obtained above to the time difference (10 ⁇ 100ms) between the 90th frame image and the 100th frame image.
  • the calculation speed Vs of the target vehicle in the current frame, and the calculation speed Vs of each frame image of the target vehicle in the M frame images before the current frame image are subjected to data smoothing processing, and obtained after data smoothing processing
  • the result of is the speed Vd of the target vehicle in the current frame, where 3 ⁇ M ⁇ 5, for example, M can be 3, 4 or 5.
  • the calculated speed Vs of multiple current frames of the same target vehicle includes, the calculated speed Vs 100 of the target vehicle in the 100th frame, and the calculated speed Vs 100 of the target vehicle in the 99th frame
  • the calculation speed Vs 99 , the calculation speed Vs 98 of the target vehicle at the 98th frame and the calculation speed Vs 97 of the target vehicle at the 97th frame, the calculation speed Vs of each frame image of the target vehicle in the M frame images before the current frame image are all adopted Calculated by the method mentioned above, for example, taking N as 10 as an example, the calculated speed Vs 99 of the target vehicle at the 99th frame is, from the 89th frame to the 99th frame, the target vehicle is in
  • the present disclosure uses a moving average method to perform data smoothing on the calculation speed Vs of the current frame, according to the formula:
  • the current frame is the mth frame
  • Vd m is the speed of the target vehicle in the mth frame
  • Vs mi is the calculated speed of the target vehicle in the mi frame
  • Vs m+i is the calculated speed of the target vehicle in the m+i frame
  • Vs m is the calculated speed of the target vehicle at frame m.
  • M is 1
  • the current frame velocity Vd 100 of the target vehicle in the 100th frame image is the current frame calculation velocity Vs 101 of the target vehicle in the 99th frame image from the current frame calculation velocity Vs 99 to the 101st frame image average of.
  • the vehicle speed detection method provided by the present disclosure can continuously detect the target vehicle on the road through the camera or the camera, and convert the image position coordinates of the target vehicle on the image into the world position coordinates of the real world, so as to realize the calculation of the target vehicle's speed in the real world.
  • the moving distance in the real world and the instantaneous speed of the target vehicle on a section of the road, the computer vision technology is applied to the vehicle speed detection method to realize the real-time detection of the vehicle speed, and the speed of the vehicle in a specific frame can be detected, which improves the speed detection timeliness and accuracy.
  • the vehicle speed detection method takes into account the advantages of existing interval speed measurement and radar speed measurement.
  • the vehicle speed of a certain section of road can be measured as a whole, and at the same time, a certain instantaneous vehicle speed on this section of road can be obtained. It can supplement or assist the speed measurement of the existing target vehicle; on the other hand, the current road monitoring system and the interval speed measurement system can be directly used, for example, the monitoring device of the existing interval speed measurement system can be used to capture the images taken by the monitoring of the interval speed measurement system Carry out the method as above-mentioned embodiment to process. Or use the existing monitoring system, such as the sky eye system, to obtain the speed of the target vehicle without large-scale capital investment.
  • the vehicle speed detection method before calculating the moving distance Ly of the target vehicle in the real world in two adjacent frames of the monitoring video of the road, the vehicle speed detection method further includes S141 and S142 .
  • the target vehicle in each frame of image After obtaining the image position coordinates of the target vehicle in each frame of image, establish the vector of the same target vehicle in the image coordinate system in two adjacent frames of images, and calculate the length of the vector in the image coordinate system.
  • the length of the vector in the image coordinate system is the moving distance Lp of the target vehicle in two adjacent frames of images. Compare the moving distance Lp of the target vehicle in two adjacent frames of images with the distance threshold Q, and when the moving distance Lp of the target vehicle in two adjacent frames of images is greater than the distance threshold Q, proceed to S150 to obtain the current frame of the target vehicle Velocity Vd; when the displacement distance Lp is less than or equal to the distance threshold Q, return to S120 to perform target detection on the target vehicle.
  • the distance threshold Q is 1/10 of the length of the detection frame Bx of the target vehicle.
  • the target vehicle with a very low moving distance and a very low running speed of the target vehicle in the real world can be excluded.
  • the speed of the target vehicle is approximately zero, and There is no calculation meaning, which can reduce the calculation amount occupied by such target vehicles on hardware equipment, thereby improving the operating efficiency of the speed measurement system.
  • the vehicle speed detection method before calculating the current frame speed Vd of the target vehicle, the vehicle speed detection method further includes S151 and S152 .
  • S152 Determine whether the number of image movement distances greater than the distance threshold Q is greater than the set threshold X. If yes, proceed to S160 to acquire the current frame velocity Vd of the target vehicle, if not, return to S120 to perform target detection on the target vehicle.
  • the speed of the target vehicle at the current frame is calculated based on the number of image movement distances greater than the distance threshold Q greater than the set threshold X; based on the number of image movement distances greater than the distance threshold Q is less than or equal to the set threshold X , track the driving trajectory of the target vehicle.
  • the image movement distance is defined as the moving distance Lp of the target vehicle in the image in every two adjacent frames of images, for example, there are M1 frame images before the current frame image, and the target vehicle has traveled a total of M1 to the current frame Image moving distances, obtain M1 image moving distances (the moving distance Lp of the target vehicle in the image of every two adjacent frames of images) is greater than the number of image moving distances of the distance threshold Q, for example, the number is M2.
  • the number M2 is greater than the set threshold X, that is, the target vehicle has traveled a sufficient distance within the field of view of the image acquisition device, the calculated speed Vs of the target vehicle in the current frame can be calculated.
  • the vehicle returns to S120 to perform the calculation on the vehicles in the multi-frame images. Identify and establish the driving trajectory of the target vehicle.
  • the set threshold X is 9-11, for example, the set threshold may be 9, 10 or 11.
  • the vehicle speed detection method further includes S170.
  • S170 Determine whether the speed of each frame of the target vehicle in the continuous L frames of images is outside the speed limit range of the road the target vehicle is traveling on.
  • 3 ⁇ L ⁇ 7 for example: L can be 3, 5 or 7.
  • the target vehicle speed detection method also includes S180'.
  • L may be 5.
  • the driving speed limit range of the highway may be 0-40Km/h, 0-60Km/h or 0-80Km/h, and the driving speed limit range of the expressway may be 100Km/h-120Km/h or 80Km/h-100Km/h, If it indicates that the target vehicle is speeding or driving at a low speed, an early warning operation will be performed, indicating that the target vehicle is not driving properly.
  • the driving speed of the target vehicle on the driving road is within the driving speed limit range, or part of the current frame speed Vd is outside the driving speed limit range of the target vehicle driving road, but when the number of consecutive frames is less than 5, it means that the target vehicle According to the driving specification, there is no need to perform early warning operations, and the target vehicle can continue to track the driving trajectory.
  • the target vehicle When the target vehicle triggers an early warning in the surveillance videos of multiple image acquisition devices or in multiple surveillance videos of the same image acquisition device, for example, the target vehicle is in the surveillance videos of two image acquisition devices or in two surveillance videos of the same image acquisition device An early warning is triggered in the video, and when the target vehicle triggers the early warning again, the intensity of the warning can be increased.
  • Triggering an early warning or performing an early warning operation can be a hardware device that runs the vehicle speed detection method provided by this disclosure, and transmits information such as the location information of the violating vehicle in the image, screenshots taken, etc. to the data center, and the data center decides to send it to the client.
  • the form of the alarm the specific form can be designed according to the customized requirements of the user end.
  • the user end may be a traffic management platform system, and the traffic management platform system may draw an alarm picture and save an alarm record for use by management personnel.
  • the method for detecting the speed of the target vehicle further includes S111 before identifying the vehicle in the multi-frame images and establishing the driving track of the target vehicle.
  • S111 mark the detection area QE on multiple frames of images, wherein the detection area QE is a closed figure, located in the driving area of the road in the image, and the image position of the boundary of the detection area QE on each frame of image The coordinates are fixed.
  • calculate the moving distance Ly of the target vehicle in the real world in the two adjacent frames of images in the multi-frame images including: according to the world position coordinates, calculate the adjacent two frames of images in the multi-frame images, located at The moving distance Ly of the target vehicle in the detection area QE in the real world.
  • Acquiring the velocity Vd of the target vehicle in the current frame includes: calculating the velocity Vd of the target vehicle in the current frame within the detection area QE.
  • the detection area QE is a closed area, and the length and width of the detection area QE on the image are greater than or equal to 80 pixels.
  • the area in the real world corresponding to the detection area QE is located in the driving area of the road in the image, such as the first lane, the second lane, and the third lane of the road, and the target vehicle running in the detection area QE is the target vehicle to be The target vehicle whose vehicle speed is to be detected, and the target vehicle stopped at the peripheral part of the detection area QE (for example, a parking space on both sides or one side of the lane) do not belong to the target vehicle whose vehicle speed is to be detected.
  • the detection area QE is used to calibrate the speed measurement range of the target vehicle. On the one hand, the target vehicle in the detection area QE is clearly photographed, and the speed detection accuracy is high. System computing usage.
  • the vehicle speed detection method further includes S121.
  • an identity information list corresponding to the target vehicle is established in the target vehicle information retrieval library, and the feature vector of the target vehicle is stored in the corresponding In the identity information list of the target vehicle; wherein, the identity information list of the target vehicle includes the identity information of the target vehicle.
  • the re-identification model adopts the multiple granularity network (Multiple Granularity Network, MGN) model of resnet50, which can extract global and local features of the detection target and improve the recognition accuracy.
  • MGN Multiple Granularity Network
  • feature extraction is performed on the target vehicle, and a feature vector of the target vehicle is obtained. Compare multiple eigenvectors in adjacent frame images, and calculate the cosine of the included angle of the eigenvectors. If there is a continuous value G of the cosine of the included angle, this is greater than the similarity threshold, for example, G can be 3, 5 or 7; the similarity threshold is 0.42, 0.45 or 0.48; then the identity information list of the target vehicle is established, and the latest The characteristic vector is stored under the identity information list of the target vehicle, and the identity information lists of multiple target vehicles are set in the vehicle information retrieval library.
  • G can be 3, 5 or 7
  • the similarity threshold is 0.42, 0.45 or 0.48
  • the vehicle information retrieval database is a database pre-set in the system, which contains multiple vehicle identity information lists, and each vehicle identity information list contains information that can indicate the identity characteristics of the vehicle.
  • the identity information list includes : The latest frame of vehicle feature vector, vehicle appearance time, vehicle movement direction, shooting camera serial number and other information. If there is no continuous value of the cosine of the included angle G that is greater than the similarity threshold, continue to track and extract the feature vector of the target vehicle.
  • the target vehicle which is convenient to establish the characteristic information of the target vehicle, the detection speed in the continuous tracking process and other information under the corresponding target vehicle identity information list, which is beneficial to identify and identify multiple target vehicles.
  • Each vehicle corresponds to a tracking ID (Identity document).
  • the target vehicle in the surveillance video corresponds to the target vehicle in the real world.
  • the object detection and tracking of the target vehicle in the surveillance video also includes some special cases, such as the target vehicle tracking loss, or the target vehicle in the surveillance video has multiple and two target vehicle detection frames overlapping situations.
  • target vehicle tracking loss for example, the number of target detection boxes Bx in the current frame image is reduced from the number of target detection boxes Bx in the previous frame image, or during the tracking process of the sort algorithm, there is a certain tracking A situation where the target's information suddenly disappears. As shown in FIG. 10 , when the target vehicle is lost in tracking, go to S122.
  • the feature vector of the lost target vehicle will be tracked, matched with the feature vector of the target vehicle newly acquired after the tracking loss, and the feature vectors will be matched consistently
  • the newly acquired identity information of the target vehicle is established in the identity information list of the lost target vehicle.
  • the retrieval of the target vehicle is stopped.
  • the feature vector of the new target vehicle can be matched with the feature vector of the lost target vehicle.
  • the matching rule is to calculate the feature vector of the new target vehicle and the feature vector of the lost tracking target vehicle.
  • the target vehicle leaves the detection area QE.
  • the target detection frame Bx of the target vehicle is not in the detection area QE.
  • the target vehicle drives out of the detection area QE and then quickly leaves the field of view of the image acquisition device. Therefore, when the previous frame image of the target vehicle tracking loss is not in the detection area QE, there is no need to search for the target vehicle. back.
  • the multi-frame images are detected, the target vehicle is determined and a target detection frame is established, and the target vehicle is tracked based on the target detection frame , to obtain the motion trajectory of the target vehicle, after more than two detection frames of the monitoring video overlap and do not completely overlap, further including S123.
  • the target detection frames Bx overlap, during the target tracking process, it is easy to cause wrong exchange of the target vehicle identity information list corresponding to the target detection frame Bx.
  • the A target detection frame Bx and B target detection frame Bx in the figure represent two overlapping target detection frames in the Jth frame image
  • the C target detection frame Bx and D target detection frame Bx represent the Jth frame image +1 for two overlapping object detection boxes in the frame image.
  • the A target detection frame Bx and the D target detection frame Bx correspond to the same vehicle
  • the B target detection frame Bx and the C target detection frame Bx in the figure correspond to the same vehicle.
  • the tracking process causes confusion, which may cause the A target detection frame Bx in the J-th frame image and the C target detection frame Bx in the J+1-th frame image to be recorded as the same target vehicle.
  • the B target detection frame Bx in the J frame image and the D target detection frame Bx in the J+1th frame image are recorded as the same target vehicle. Therefore, the feature extraction of the target vehicle, as a supplement to the target detection and tracking process, can ensure that the identity information list of the target vehicle is accurately associated with the corresponding target vehicle in the real world, and at the same time, tracking loss and target detection frame overlap occur during the target detection and tracking process. When necessary, make supplementary supplements.
  • S100 is further included.
  • S100 Calculate internal parameters and external parameters of an image acquisition device used to shoot surveillance video.
  • the internal parameters and the external parameters are used to convert the image position coordinates of the multi-frame images and their corresponding world position coordinates.
  • the image acquisition device is a pointer hole camera or a pinhole camera.
  • S100 calculating the internal parameters and the external parameters of the image acquisition device used to shoot the surveillance video includes:
  • S101 mark a first vanishing point N1 and a second vanishing point N2 on marked images in multiple frames of images.
  • the labeled image is any frame in the multiple frames of images.
  • At least two first disappearing lines XL1 and at least two second disappearing lines XL2 are marked on the marked image, one first disappearing line XL1 is parallel to a lane boundary, and the other first disappearing line XL1' is parallel to another
  • the lane dividing lines are parallel, a second disappearing line XL2 is perpendicular to one said lane dividing line, and another second disappearing line XL2' is perpendicular to another said lane dividing line; wherein, the intersection point of the two first disappearing lines XL1 is The intersection of the first vanishing point N1 and the two second vanishing lines XL2 is the second vanishing point N2.
  • an image coordinate system is established on the marked image.
  • the origin O of the image coordinate system coincides with the center of a certain frame of pictures, and the coordinates of the first vanishing point N1 and the second vanishing point N2 are obtained.
  • the center O' of each labeled image coincides with the principal point.
  • the principal point is the intersection of the imaging plane (the plane of each labeled image) and the camera optical axis.
  • the initial internal parameter K of the image acquisition device is:
  • the initial external parameters of the image acquisition device include a rotation matrix and a translation matrix.
  • R is the rotation matrix between the world coordinate system and the camera coordinate system
  • T is the translation vector between the world coordinate system and the camera coordinate system.
  • N1x is The component vector in the X-axis direction of the camera coordinate system
  • N1y is Component vector in the Y-axis direction of the camera coordinate system
  • f is the focal length vector
  • the Z axis of the camera coordinate system is on the optical axis of the camera
  • the first vanishing point N1 and the second vanishing point N2 are on the marked image
  • the length of is the focal length f
  • the direction is the positive direction of the Z axis of the camera coordinate system.
  • N2x is a vector The component vector in the X-axis direction of the camera coordinate system
  • N2y is the vector The component vector in the Y-axis direction of the camera coordinate system, where the origin of the camera coordinate system is the camera focus, that is, the Oc point in Figure 16, the X-axis of the camera coordinate system is parallel to the Xt-axis of the image coordinate system, and the Y of the camera coordinate system is axis is parallel to the Yt axis of the image coordinate system, the Xt axis of the image coordinate system can coincide with the first disappearing line XL1, and the Yt axis of the image coordinate system can coincide with the second disappearing line XL2.
  • Zzx is the deflection angle between the Zz axis of the world coordinate axis and the Zt axis of the camera coordinate system in the direction of the Xt axis
  • Zzy is the deflection angle between the Zz axis of the world coordinate axis and the Zt axis of the camera coordinate system in the direction of the Yt axis
  • Zzz It is the deflection angle between the Zz axis of the world coordinate axis and the Zt axis of the camera coordinate system in the direction of the Zt axis.
  • a length of a lane line L1 is 6m, and one end of the lane line L1 is located at the origin of the world coordinate system, therefore, the two endpoints of the lane line L1 are in the world
  • the coordinate positions of the two endpoints of the lane line L1 in the image coordinate system are P1' and P2', and have the following relationship:
  • the origin of the image coordinate system coincides with the principal point, so one end (P1') of the line segment P1'P2' in the image coordinate system is translated to the origin of the image coordinate system, and the intersection point of the line segment P1'P2' and OcP2 is Q, Get the Q coordinate and calculate the length of P1'Q.
  • the values of the initial internal parameter K and the initial external parameter are obtained, wherein the initial external parameter includes the rotation moment R and the translation matrix T. Due to the stability problem of the image acquisition device in the process of acquiring the surveillance video and the accuracy of the acquired coordinates Sex and other issues, resulting in large errors in the initial internal parameters K and initial external parameters.
  • the calibration reference is a marker whose distance between both ends is known in the real world, and the calibration reference includes a line segment Cr1 of a dotted lane line, adjacent dotted lines The interval line Cr2 between lane lines, and the interval line Cr3 between two connected line segments in the same dashed lane line.
  • the number of calibration reference Cr is 8-10, for example: the number of calibration reference Cr can be 8, 9 or 10, taking the number of calibration reference Cr as 9 as an example, the nine calibration reference The distance between both ends of Cr is known.
  • the image position coordinates of the two ends of a calibration reference are P K ′ or Q K ′.
  • N is the number of calibration reference Cr
  • P K is the world position coordinates of one end of the k-th calibration reference Cr in the real world
  • Q K is the world position coordinates of the other end of the k-th calibration reference Cr in the real world
  • P K is the image position coordinates of one end of the kth calibration reference Cr in the labeled image, the world position coordinates of the real world calculated by using the initial internal parameters and the initial external parameters
  • Q K is the kth calibration reference
  • the other end of Cr is the image position coordinates in the labeled image, the world position coordinates of the real world calculated by using the initial internal parameters and initial external parameters
  • cp represents the constraint parameters of the image acquisition device, including internal parameters and external parameters.
  • the number of calibration parameters Cr is 9, that is, P K 1, P K 2, P K 3, P K 4, P K 5, P K 6, P K 7, P K 8, P K 9. QK 1, QK 2, QK 3, QK 4, QK 5, QK 6 , QK 7, QK 8, and QK 9.
  • the process of iterating the initial internal parameters and the initial external parameters according to the constraint formula in S107 is: in order to partially derive the constraint formula, and then use the gradient descent method to iteratively update the constraint parameters, wherein the gradient descent method is used to During the iterative update process of the constraint parameters, the number of adjustments or updates may be 100 times, and the range of each adjustment or update may be 0.01.
  • the initial internal parameters K and initial external parameters calculated in S104 have large errors in different shooting scenarios. Therefore, after S105-S107, in the camera calibration process Adding constraints, the final constraint parameter cp is a more accurate internal parameter K of the image acquisition device, the rotation matrix R of the external parameters and the translation matrix T of the external parameters, which can improve the image position coordinates of multiple frames of images and their corresponding The accuracy with which world position coordinates are converted.
  • the calibration reference of the present disclosure adopts the dotted lane line L1 (for example, the length of a line segment Cr1 of the dotted lane line is 6 meters, and the length of the interval line Cr2 between the dotted lane lines is 8 meters), and the same dotted lane line connects two
  • the interval line Cr3 between the line segments, the width line Cr4 and length line Cr5 of the target vehicle, etc., and the calibration reference spacing are all known values in the real world, and there is no need for on-site measurement by staff, which improves efficiency and saves manpower.
  • the present disclosure also provides a collision warning method.
  • the collision warning method includes adopting the vehicle speed detection method provided in the above-mentioned embodiments, acquiring road monitoring video and extracting continuous multi-frame images in the monitoring video, and detecting vehicles in the multi-frame images. Identify, establish the driving track of the target vehicle, and detect the speed of the target vehicle.
  • the collision warning method further includes: S210, S220 and S230.
  • the judgment results of S220 include three types, the first one is that among the multiple target vehicles, the motion trajectories of two adjacent target vehicles are the same motion trajectory, and the second is that among the multiple target vehicles, there are more than two adjacent The trajectory of the target vehicle is the same trajectory. The second is that there are no adjacent two or more target vehicles whose trajectory is the same trajectory.
  • This disclosure discusses the first and second cases .
  • S230' Determine whether the speed of the rear target vehicle is continuously greater than the speed of the front target vehicle among the two adjacent target vehicles within the preset duration.
  • the speed of the rear target vehicle is continuously greater than the speed of the front target vehicle within the preset duration, and the operation of collision warning is performed. Based on the fact that among the two adjacent target vehicles, the speed of the rear target vehicle is less than or equal to the speed of the front target vehicle within the preset duration, the collision warning operation is not performed, and the speed detection of the two target vehicles on the same running track can be continued .
  • Triggering or executing a collision warning can be a hardware device that runs the collision warning method provided by this disclosure, and transmits information such as the position information of the violating vehicle in the image, screenshots taken, etc. to the data center, and the data center decides to send it to the client
  • the form of the alarm the specific form can be designed according to the customized requirements of the user end.
  • the user end may be a traffic management platform system, and the traffic management platform system may draw an alarm picture and save an alarm record for use by management personnel.
  • the rear target vehicle is a target vehicle with a shorter motion track
  • the front target vehicle is a target vehicle with a longer motion track.
  • the trajectory of the target vehicle C1 is Lc1
  • the trajectory of the target vehicle C2 is Lc2, where the length of Lc1 is greater than the length of Lc2, it can be determined that the target vehicle C1 is the front vehicle, and the target vehicle C2 is the rear vehicle.
  • the collision warning method can match the movement trajectory of the target vehicle entering the shooting area of the image acquisition device within the same time range, compare the driving speed of the target vehicle on the same movement trajectory, and judge whether there is a risk of collision. It can improve the speed of emergency response to accidents, improve the safety risk awareness of car owners, and reduce the probability of accidents.
  • the collision warning method further includes S240, S241 and S242.
  • S241. Determine whether the vehicle types of W adjacent target vehicles are at least one small or medium-sized vehicle located between two large vehicles.
  • the operation of collision warning is performed; based on the fact that there is no small car or medium-sized car between the two large cars, the speeds of adjacent W target vehicles are calculated.
  • S242. Determine whether, among the W adjacent target vehicles, the speed of the rear target vehicle is continuously greater than the speed of the front target vehicle within the preset duration.
  • the method for judging the vehicle type of the target vehicle is based on the target detection frame Bx provided in S120, by calculating the two world positions corresponding to the image position coordinates of the two endpoints in the width direction of the target detection frame Bx through the image position coordinates coordinates, the width of the target vehicle in the target detection frame Bx can be calculated, and whether the target vehicle is a large car, a small car or a medium-sized car can be directly obtained through the width of the target vehicle.
  • a calculated target vehicle with a width of 1.5 meters to 1.8 meters is a small car
  • a calculated target vehicle with a width of 1.8 meters to 2.0 meters is a medium-sized car
  • a calculated target vehicle with a width of more than 2.0 meters is a large car.
  • the same trajectory can be the same lane, for example, target vehicles C1 and The target vehicles C2 are all on the same lane. Judging the vehicle type on the same trajectory, if there are two large target vehicles with a small target vehicle or a medium target vehicle in the middle of the vehicle type on the same trajectory, a collision warning can be issued. If the vehicles on the same trajectory are small car fleets or medium-sized car fleets or mixed fleets of small and medium-sized cars or large-scale continuous fleets mixed into the above-mentioned various types of fleets and large-scale fleets, etc., the speed of the target vehicle is determined. Detecting and judging that within a preset duration, for example, the preset duration can be 30 seconds, 60 seconds or 120 seconds, and the speed of the rear target vehicle is always greater than the speed of the front target vehicle, a collision warning will be executed.
  • the method of judging the length of the motion trajectory of the target vehicle on the same motion trajectory at the same time can be The length between the image position coordinates of the target vehicle in the current frame image and the image position coordinates of the same target vehicle in the first frame image of the surveillance video.
  • S220 a method for judging whether the motion trajectories of at least two target vehicles are the same motion trajectory, including: S2201 and S2202.
  • S2202. Determine whether the difference between the slopes of at least two linear motion equations of each target vehicle is smaller than the slope threshold, and whether the intercept difference between at least two linear motion equations is smaller than the intercept threshold.
  • the motion trajectories of at least two target vehicles corresponding to the at least linear motion equation are the same motion trajectory, wherein the range of the slope threshold is 3-7, and the range of the intercept threshold is 15-25.
  • the at least two motion line equations correspond to The motion trajectories of at least two target vehicles are the same motion trajectory.
  • the target vehicle in the surveillance video is detected and tracked by S120, the movement track of the target vehicle is established, and the identity information list of the target vehicle is established by S121.
  • a collection of image position coordinates of the same target vehicle in each frame of images in the surveillance video is obtained, and a motion trajectory of the target vehicle in the image coordinate system is established in the image coordinate system through the collection of image position coordinates.
  • Fit the linear equation to the trajectory of each target vehicle For example, the least square method can be used to fit the linear equation.
  • the difference between the slopes of any two of the multiple linear equations is less than the range of the slope threshold, and multiple When the difference between the intercepts of any two of the straight line equations is smaller than the range of the intercept threshold, it can be determined that the two target vehicles corresponding to the two straight line equations are on the same trajectory.
  • the slope threshold can be 3, 4 or 7.
  • the intercept threshold can be 15, 20 or 25.
  • the target vehicle increases the warning intensity when the collision warning operation is triggered again in the collision warning.
  • the target vehicle when the target vehicle triggers a collision warning in the surveillance videos of multiple image acquisition devices or in multiple surveillance videos of the same image acquisition device, for example, the target vehicle is in the surveillance videos of two image acquisition devices or the same image acquisition
  • the two monitoring videos of the device trigger the collision warning, and after the target vehicle triggers the collision warning again, the warning intensity can be increased.
  • the present disclosure also provides an electronic device 10 , as shown in FIG. 21 , the electronic device 10 includes: a processor 1 and a memory 2 .
  • the processor 1 is configured to perform the following steps: acquire the monitoring video of the road, and store the monitoring video in the memory 2; extract continuous multi-frame images in the monitoring video. Identify vehicles in multiple frames of images, and establish the driving trajectory of the target vehicle. Get the image position coordinates of the target vehicle in each frame of image. According to the image position coordinates, the world position coordinates of the target vehicle in the real world are obtained. Calculate the moving distance Ly of the target vehicle in the real world in two adjacent frames of the surveillance video of the road. According to the traveling distance L of the target vehicle in the real world and the frame rate of the surveillance video, the velocity Vd of the target vehicle in the current frame is calculated, wherein the traveling distance L is obtained according to the moving distance Ly.
  • the processor 1 can be a central processing unit (Central Processing Unit, referred to as CPU), and can also be other general processors, digital signal processors (DSP), application specific integrated circuits (ASICs), field programmable gate arrays ( FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • CPU Central Processing Unit
  • DSP digital signal processors
  • ASICs application specific integrated circuits
  • FPGA field programmable gate arrays
  • the general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory 2 may be a read-only memory (Read-Only Memory, ROM) or other types of static storage devices that can store static information and instructions, a random access memory (Random Access Memory, RAM) or other types that can store information and instructions It can also be an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a compact disc (Compact Disc Read-Only Memory, CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be programmed by a computer Any other medium accessed, but not limited to.
  • the memory 2 may exist independently and be connected to the processor through a communication bus.
  • the memory 2 can also be integrated with the processor 1.
  • Computer programs stored on the memory 2 and executable on the processor 1 implement implementations such as procedures or functions, which may be implemented with separate software modules that allow at least one function or operation to be performed.
  • Software codes may be implemented by a software application (or program) written in any suitable programming language, stored in memory and executed by a processor unit.
  • An electronic device 10 has the function of performing target vehicle speed detection in the embodiment of the above aspect, and has the same beneficial effect as the above vehicle speed detection method.
  • the processor 1 is further configured to perform the following steps, calculating the position of the target vehicle in the real world in every two adjacent frames of images in the current frame image and the N frame images before the current frame image
  • the sum of the moving distances Ly, the sum of the moving distances Ly is taken as the traveling distance L.
  • the time difference between the current frame image and the Nth frame image before the current frame image is obtained.
  • the calculated speed Vs of the target vehicle in the current frame is obtained according to the travel distance L and the time difference Tt, and the calculated speed Vs of the target vehicle in the current frame is used as the speed Vd of the target vehicle in the current frame.
  • the processor 1 is further configured to execute the following steps, calculating the speed of the target vehicle at the current frame according to the traveling distance L of the target vehicle in the real world and the frame rate of the monitoring video, including: calculating In the current frame image and the N frame images before the current frame image, the sum of the moving distance Ly of the target vehicle in the real world in every two adjacent frame images, the sum of the moving distance Ly is taken as the driving distance L. According to the frame rate of the surveillance video, the time difference between the current frame image and the Nth frame image before the current frame image is obtained.
  • the calculated speed Vs of the target vehicle in the current frame is obtained; the calculated speed Vs of the target vehicle in the current frame, and the calculated speed of each frame image of the target vehicle in the M frame images before the current frame image are calculated. smoothing process, and obtain the result of the data smoothing process as the velocity Vd of the current frame of the target vehicle.
  • the processor 1 before the processor 1 is configured to calculate the moving distance Ly of the target vehicle in the real world in two adjacent frames of images of the surveillance video of the road, the processor 1 is further configured to perform the following Steps: Calculate the moving distance Lp of the target vehicle in the image in two adjacent frames of the monitoring video of the road; judge whether the moving distance Lp in the image is greater than the distance threshold Q, based on the moving distance Lp of the target vehicle in the image is greater than the distance Threshold Q, calculate the moving distance Ly of the target vehicle in the real world; based on the moving distance Lp of the target vehicle in the image is less than or equal to the distance threshold Q, continue to track the driving trajectory of the target vehicle.
  • the processor 1 before the processor 1 is configured to calculate the velocity Vd of the current frame of the target vehicle, it is also configured to perform the following steps: calculating the movement distance of multiple images in the multiple frame images before the current frame image The amount of image movement distance greater than the distance threshold Q. Wherein, the moving distance of each image is the moving distance Lp of the target vehicle in the image in every two adjacent frames of images. It is judged whether the number of image movement distances greater than the distance threshold Q is greater than the set threshold X.
  • the processor 1 is further configured to perform the following step: judging whether the speed of each frame of the target vehicle in the continuous L frames of images is outside the speed limit of the road on which the target vehicle is traveling. Based on the speed of each frame of the target vehicle in consecutive L frames of images is outside the speed limit of the road the target vehicle is driving on, perform an early warning operation; Within the range of the driving speed limit, the pre-warning operation will not be performed. After the target vehicle triggers an early warning when performing speed detection in multiple surveillance videos, when the target vehicle triggers an early warning when performing speed detection again, the alarm intensity is increased.
  • the processor 1 is further configured to perform the following steps: Obtain the movement trajectories of multiple target vehicles from the monitoring video of the road.
  • the processor 1 is further configured to execute judging whether the movement trajectories of at least two adjacent target vehicles among the plurality of target vehicles are the same. Based on the fact that the motion trajectories of two adjacent target vehicles are the same trajectory, detect the speed of the current frame in the multi-frame image of two adjacent target vehicles, and judge the rear target among the two adjacent target vehicles within the preset duration. Whether the speed of the vehicle is consistently greater than the speed of the target vehicle ahead.
  • the operation of collision warning is performed. Based on the fact that among two adjacent target vehicles, the speed of the rear target vehicle is less than or equal to the speed of the front target vehicle within a preset duration, the collision warning operation is not performed.
  • the processor 1 is further configured to perform the following steps: acquire the vehicle types of the adjacent W target vehicles , judging whether the vehicle types of the adjacent W target vehicles are at least one small car or a medium-sized car located between two large cars. The operation of the collision warning is performed based on the fact that there is at least one small car or medium-sized car located between the two large cars.
  • the present disclosure also provides a vehicle early warning system 100.
  • the collection device 20 is installed near the road, and several image collection devices 20 are used to take surveillance video of the road and upload the data of the surveillance video to the electronic device 10 .
  • several image acquisition devices 20 are electrically connected to the processor 1 in the electronic device 10 , and the processor 1 stores the received monitoring video in the memory 2 in the electronic device 10 .
  • a vehicle early warning system 100 adopts the above-mentioned electronic device 10 and has the same beneficial effects as the vehicle speed detection method and the collision warning method in the above embodiments.
  • the present disclosure also provides a non-transitory computer-readable storage medium, including: a computer program product stored on the non-transitory computer-readable storage medium.
  • the computer program product includes computer program instructions.
  • the computer program instructions When the computer program instructions are executed on the computer (for example, display device, terminal equipment), the computer program instructions cause the computer to execute the vehicle speed detection method provided by the above-mentioned embodiments and execute the vehicle speed detection method provided by the above-mentioned embodiments. Collision warning method.
  • the present disclosure also provides a computer program product.
  • the computer program product includes computer program instructions.
  • the computer program instructions When the computer program instructions are executed on the computer (for example, display device, terminal equipment), the computer program instructions cause the computer to execute the vehicle speed detection method provided by the above-mentioned embodiments and execute the vehicle speed detection method provided by the above-mentioned embodiments. Collision warning method.
  • the present disclosure also provides a computer program.
  • a computer for example, a display device, a terminal device
  • the computer program enables the computer to execute the vehicle speed detection method and the collision warning method provided by the above embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Traffic Control Systems (AREA)
  • Image Analysis (AREA)

Abstract

提供一种车辆速度检测方法,包括:获取道路的监控视频,提取监控视频中连续的多帧图像。对多帧图像中的车辆进行识别,建立目标车辆的行车轨迹。获取目标车辆在每帧图像中的图像位置坐标。根据图像位置坐标,得到目标车辆在现实世界中的世界位置坐标。根据世界位置坐标,计算多帧图像中的每相邻两帧图像中,目标车辆在现实世界中的移动距离。根据目标车辆在现实世界中的行驶距离,以及监控视频的帧率,计算目标车辆在当前帧的速度,其中,行驶距离根据移动距离得到。

Description

一种车辆速度检测、撞车预警方法及电子设备
本申请要求于2021年12月28日提交的、申请号为202111629420.2的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本公开涉及计算机视觉领域,尤其涉及一种车辆速度检测、撞车预警方法及电子设备和车辆预警系统。
背景技术
对路面行驶的目标车辆采用区间测速和雷达测速等方式。区间测速是在同一路段上布设两个相邻的监控点,基于目标车辆通过前后两个监控点的时间来计算目标车辆在该路段上的平均行驶速度,并基于该平均行驶速度和基准速度的对比来判断是否超速。
雷达测速主要是利用多普勒效应(Doppler Effect)原理:当目标向雷达天线靠近时,反射信号频率将高于发射机频率;反之,当目标远离天线而去时,反射信号频率将低于发射机频率。雷达测速可对目标车辆即时车速进行检测。
发明内容
一方面,本公开提供一种车辆速度检测方法,包括:获取道路的监控视频,提取监控视频中连续的多帧图像。对多帧图像中的车辆进行识别,建立目标车辆的行车轨迹。获取目标车辆在每帧图像中的图像位置坐标。根据图像位置坐标,得到目标车辆在现实世界中的世界位置坐标。根据世界位置坐标,计算多帧图像中的每相邻两帧图像中,目标车辆在现实世界中的移动距离。根据目标车辆在现实世界中的行驶距离,以及监控视频的帧率,计算目标车辆在当前帧的速度,其中,行驶距离根据移动距离得到。
在一些实施例中,根据目标车辆在现实世界中的行驶距离,以及监控视频的帧率,计算目标车辆在当前帧的速度,包括:计算在当前帧图像以及在当前帧图像之前的N帧图像中,每相邻两帧图像中目标车辆在现实世界中的移动距离之和,移动距离之和作为行驶距离。根据监控视频的帧率,得到当前帧图像和在当前帧图像之前的第N帧图像之间的时间差。根据行驶距离以及时间差得到目标车辆在当前帧的计算速度,将目标车辆在当前帧的计算速度作为目标车辆在当前帧的速度。
在另一些实施例中,计算在当前帧图像以及在当前帧图像之前的N帧图像中,每相邻两帧图像中目标车辆在现实世界中的移动距离之和,移动距离之和作为行驶距离。根据监控视频的帧率,得到当前帧图像和在当前帧图像 之前的第N帧图像之间的时间差。根据行驶距离以及时间差得到目标车辆在当前帧的计算速度。对目标车辆在当前帧的计算速度,和目标车辆在当前帧图像之前的M帧图像中每帧图像的计算速度进行数据平滑处理,并获取经数据平滑处理的结果作为目标车辆在当前帧的速度。
在一些实施例中,在根据世界位置坐标,计算多帧图像中的相邻两帧图像中,目标车辆在现实世界中的移动距离之前,还包括:计算多帧图像中的相邻两帧图像中,目标车辆在图像中的移动距离。判断目标车辆在图像中的移动距离是否大于距离阈值。基于目标车辆在图像中的移动距离大于距离阈值,计算目标车辆在现实世界中的移动距离;基于目标车辆在图像中的移动距离小于或等于距离阈值,继续对目标车辆进行行车轨迹跟踪。
在一些实施例中,在计算目标车辆在当前帧的速度之前,还包括:计算当前帧图像之前的多帧图像中,多个图像移动距离中大于距离阈值的图像移动距离的数量。其中,每个图像移动距离为,每相邻两帧图像中目标车辆在图像中的移动距离。判断大于距离阈值的图像移动距离的数量是否大于设定阈值。基于大于距离阈值的图像移动距离的数量大于设定阈值,计算目标车辆在当前帧的速度;基于大于距离阈值的图像移动距离的数量小于或等于设定阈值,对目标车辆进行行车轨迹跟踪。
在一些实施例中,车辆速度检测方法还包括:判断目标车辆在连续L帧图像中每帧的速度是否均在目标车辆行驶道路的行车速度限制范围外。基于目标车辆在连续L帧图像中每帧的速度均在目标车辆行驶道路的行车速度限制范围外,执行预警操作;基于目标车辆在连续L帧图像中有至少一帧的速度在目标车辆行驶道路的行车速度限制范围内,不执行预警操作。目标车辆在多个监控视频中进行速度检测时均触发预警后,目标车辆再次进行速度检测时触发预警的情况下,提高告警强度。
在一些实施例中,车辆速度检测方法还包括,在对多帧图像中的目标车辆进行识别,建立目标车辆的行车轨迹之前,在多帧图像上均标注检测区域。其中,检测区域为封闭图形,位于图像中道路的行驶区域内,检测区域的边界在每帧图像上的图像位置坐标固定。根据世界位置坐标,计算多帧图像中的相邻两帧图像中,目标车辆在现实世界中的移动距离,包括:根据世界位置坐标,计算多帧图像中的相邻两帧图像中,位于检测区域内的目标车辆在现实世界中的移动距离。计算目标车辆在当前帧的速度,包括:计算位于检测区域内的目标车辆在当前帧的速度。
在一些实施例中,对多帧图像中的目标车辆进行识别,建立目标车辆的 行车轨迹,包括:对多帧图像进行检测,确定目标车辆并建立目标检测框,基于目标检测框对目标车辆进行跟踪,得到目标车辆的运动轨迹。目标车辆在每帧图像中的图像位置坐标为,在该帧图像中,目标车辆的目标检测框的中心点的图像位置坐标。
在一些实施例中,车辆速度检测方法还包括:在建立目标车辆的行车轨迹之后,建立目标车辆的身份信息列表。建立目标车辆的身份信息列表,包括:采用重识别模型提取目标车辆的特征向量。计算每相邻两帧图像中目标车辆的特征向量的夹角余弦。判断夹角余弦的值是否连续G次大于相似度阈值。基于夹角余弦的值连续G次大于相似度阈值,在车辆信息检索库中建立对应目标车辆的身份信息列表,并将目标车辆的特征向量存储至对应的目标车辆的身份信息列表中。其中,目标车辆的身份信息列表包括目标车辆的身份信息。
在一些实施例中,在目标车辆跟踪丢失的情况下,判断在目标车辆跟踪丢失的前一帧图像中,目标车辆的目标检测框是否位于检测区域内。基于目标车辆的目标检测框位于检测区域内,将跟踪丢失的目标车辆的特征向量,与在跟踪丢失之后新获取的目标车辆的特征向量进行匹配,并将特征向量匹配一致的新获取的目标车辆的身份信息建立于跟踪丢失的目标车辆的身份信息列表中。基于目标车辆的目标检测框位于检测区域外,停止对目标车辆找回。
在一些实施例中,对多帧图像进行检测,确定目标车辆并建立目标检测框,基于目标检测框对目标车辆进行跟踪,得到目标车辆的运动轨迹,还包括:目标检测框有多个,在两个以上的目标检测框重叠的情况下,提取重叠的目标检测框对应的目标车辆的特征向量。将相邻两帧图像中特征向量的夹角余弦值大于相似度阈值的目标车辆,建立于同一身份信息列表中。
在一些实施例中,在根据图像位置坐标,得到目标车辆在现实世界中的世界位置坐标之前,还包括:计算用于拍摄监控视频的图像采集装置的内部参数和外部参数。内部参数和外部参数用于将多帧图像的图像位置坐标和其对应的世界位置坐标进行换算。计算用于拍摄监控视频的图像采集装置的内部参数和外部参数,包括:在多帧图像中的标注图像上标注第一消失点和第二消失点。其中,标注图像为多帧图像中的任一帧。获取第一消失点和第二消失点在标注图像中的图像位置坐标。建立经过第一消失点和第二消失点的直线方程式。将标注图像的中心与主点重合,根据直线方程式,计算图像采集装置的初始内部参数和初始外部参数。在标注图像上选取至少一个标定参 考,标定参考为在现实世界中两端的间距为已知距离的标志物,标定参考包括虚线车道线的一个线段、相邻虚线车道线之间的间隔线、同一虚线车道线中相连两个线段之间的间隔线。获取标注图像中标定参考的两端端点的图像位置坐标。将至少一个标定参考作为约束条件,构造约束公式,根据约束公式对初始内部参数和初始外部参数进行迭代,根据约束公式的最优解得到图像采集装置的内部参数和外部参数。
其中,约束公式为:
Figure PCTCN2022124912-appb-000001
其中,N为标定参考的数量,P K为第k个标定参考的一端在现实世界的世界位置坐标,Q K为第k个标定参考的另一端在现实世界的世界位置坐标;P K为第k个标定参考的一端在标注图像中的图像位置坐标,采用初始内部参数和初始外部参数计算得到的现实世界的世界位置坐标,Q K为第k个标定参考的另一端在标注图像中图像位置坐标,采用初始内部参数和初始外部参数计算的现实世界的世界位置坐标;cp表示图像采集装置的约束参数,包括内部参数和外部参数。
另一方面,本公开提供一种撞车预警方法,其中,撞车预警方法包括采用如上述一方面中任一项实施例的车辆速度检测方法,获取道路的监控视频并提取监控视频中连续的多帧图像。对目标车辆进行目标检测和跟踪、以及速度检测。撞车预警方法还包括:在道路的监控视频中,建立多个目标车辆的运动轨迹。判断多个目标车辆中,是否有相邻的至少两个目标车辆的运动轨迹为同一运动轨迹。若相邻两个目标车辆的运动轨迹为同一运行轨迹,检测相邻两个目标车辆在多帧图像中每帧的速度,并判断在预设持续时间内,相邻两个目标车辆中,后方目标车辆的速度是否持续大于前方目标车辆的速度。基于相邻两个目标车辆中,后方目标车辆的速度在预设持续时间内持续大于前方目标车辆的速度,执行撞车预警的操作。基于相邻两个目标车辆中,后方目标车辆的速度在预设持续时间内存在小于或等于前方目标车辆的速度,不执行撞车预警的操作。
在一些实施例中,撞车预警方法还包括:若相邻W个目标车辆的运动轨迹为同一运动轨迹,则获取相邻W个目标车辆的车型,W大于或等于3。判断相邻W个目标车辆的车型是否为至少一辆小型车或中型车位于两辆大型车中间。基于存在至少一辆小型车或中型车位于两辆大型车中间的情况,执行撞车预警的操作;基于不存在至少一辆小型车或中型车位于两辆大型车中间 的情况,检测相邻W个目标车辆在多帧图像中每帧的速度,并判断在预设持续时间内,相邻W个目标车辆中,后方目标车辆的速度是否持续大于前方目标车辆的速度。基于相邻W个目标车辆中存在后方目标车辆的速度在预设持续时间内持续大于前方目标车辆的速度的情况,执行触发撞车预警操作;基于相邻W个目标车辆中存在后方目标车辆的速度在预设持续时间内小于或等于前方目标车辆的速度的情况,不执行撞车预警的操作。
在一些实施例中,判断是否有至少两个目标车辆的运动轨迹是否为同一运动轨迹的方法,包括:获取每个目标车辆在多帧图像中的图像位置坐标集合,进行直线方程的拟合,获得每个目标车辆在图像坐标系中的运动直线方程,其中,图像坐标系的原点与每帧图像的中心重合。判断各目标车辆的运动直线方程中,是否有至少两条运动直线方程的斜率之差小于斜率阈值,且至少两条运动直线方程的截距之差小于截距阈值。基于有至少两条运动直线方程的斜率之差小于斜率阈值,且至少两条运动直线方程的截距之差小于截距阈值,判定至少两条运动直线方程对应的至少两个目标车辆的运动轨迹为同一运动轨迹。
在一些实施例中,同一目标车辆在多个监控视频的撞车预警中均触发撞车预警后,目标车辆在撞车预警中再次触发撞车预警时,提高告警强度。
再一方面,本公开提供一种电子设备,包括:处理器和存储器。处理器被配置为执行如下步骤:获取道路的监控视频,并将监控视频存储至存储器;提取监控视频中连续的多帧图像。对多帧图像中的目标车辆进行识别,建立目标车辆的行车轨迹目标车辆。获取目标车辆在每帧图像中的图像位置坐标。根据图像位置坐标,得到目标车辆在现实世界中的世界位置坐标。计算道路的监控视频的相邻两帧图像中,目标车辆在现实世界中的移动距离。根据目标车辆在现实世界中的行驶距离,以及监控视频的帧率,计算目标车辆在当前帧的速度,其中,行驶距离根据移动距离得到。
在一些实施例中,处理器还被配置为执行如下步骤:计算在当前帧图像以及在当前帧图像之前的N帧图像中,每相邻两帧图像中目标车辆在现实世界中的移动距离之和,移动距离之和作为行驶距离。根据监控视频的帧率,得到当前帧图像和在当前帧图像之前的第N帧图像之间的时间差。根据行驶距离以及时间差得到目标车辆在当前帧的计算速度,将目标车辆在当前帧的计算速度作为目标车辆在当前帧的速度。
在另一些实施例中,处理器还被配置为执行如下步骤:计算在当前帧图像以及在当前帧图像之前的N帧图像中,每相邻两帧图像中目标车辆在现实 世界中的移动距离之和,移动距离之和作为行驶距离。根据监控视频的帧率,得到当前帧图像和在当前帧图像之前的第N帧图像之间的时间差。根据行驶距离以及时间差得到目标车辆在当前帧的计算速度。对目标车辆在当前帧的计算速度,和目标车辆在当前帧图像之前的M帧图像中,每帧图像的计算速度进行数据平滑处理,并获取经数据平滑处理的结果作为目标车辆的当前帧的速度。
在一些实施例中,在处理器被配置为根据世界位置坐标,计算多帧图像中的相邻两帧图像中,目标车辆在现实世界中的移动距离之前,还被配置为执行如下步骤:计算道路的监控视频的相邻两帧图像中,目标车辆在图像中的移动距离。判断目标车辆在图像中的移动距离是否大于距离阈值。基于目标车辆在图像中的移动距离大于距离阈值,计算目标车辆在现实世界中的移动距离;基于目标车辆在图像中的移动距离小于或等于距离阈值,继续对目标车辆进行行车轨迹跟踪。
在一些实施例中,在处理器被配置为执行计算目标车辆的当前帧的速度之前,还被配置为执行如下步骤:计算当前帧图像之前的多帧图像中,多个图像移动距离中大于距离阈值的图像移动距离的数量;其中,每个图像移动距离为,每相邻两帧图像中目标车辆在图像中的移动距离。判断大于距离阈值的图像移动距离的数量是否大于设定阈值。基于大于距离阈值的图像移动距离的数量大于设定阈值,计算目标车辆在当前帧的速度;基于大于距离阈值的图像移动距离的数量小于或等于设定阈值,对目标车辆进行行车轨迹跟踪。
在一些实施例中,处理器还被配置为执行如下步骤:判断目标车辆在连续L帧图像中每帧的速度是否均在目标车辆行驶道路的行车速度限制范围外。基于目标车辆在连续L帧图像中每帧的速度均在目标车辆行驶道路的行车速度限制范围外,执行预警操作。基于目标车辆在连续L帧图像中有至少一帧的速度在目标车辆行驶道路的行车速度限制范围内,不执行预警操作。目标车辆在多个监控视频中进行速度检测时均触发预警后,目标车辆再次进行速度检测时触发预警的情况下,提高告警强度。
在一些实施例中,处理器还被配置为执行如下步骤:在道路的监控视频中,得到多个目标车辆的运动轨迹。判断多个目标车辆中,是否有相邻的至少两个目标车辆的运动轨迹为同一运动轨迹。若相邻两个目标车辆的运动轨迹为同一运行轨迹,检测相邻两个目标车辆多帧图像中当前帧的速度,并判断在预设持续时间内,相邻两个目标车辆中,后方目标车辆的速度是否持续 大于前方目标车辆的速度。基于相邻两个目标车辆中,后方目标车辆的速度在预设持续时间内持续大于前方目标车辆的速度,执行撞车预警的操作;基于相邻两个目标车辆中,后方目标车辆的速度在预设持续时间内存在小于或等于前方目标车辆的速度的情况,不执行撞车预警的操作。
在一些实施例中,若相邻W个目标车辆的运动轨迹为同一运动轨迹,W大于或等于3,则处理器还被配置为执行如下步骤:获取相邻W个目标车辆的车型,判断相邻W个目标车辆的车型是否为至少一辆小型车或中型车位于两辆大型车中间。基于存在至少一辆小型车或中型车位于两辆大型车中间的情况,执行撞车预警的操作;基于不存在至少一辆小型车或中型车位于两辆大型车中间的情况,检测相邻W个目标车辆在多帧图像中每帧的速度,并判断在预设持续时间内,相邻W个目标车辆中,后方目标车辆的速度是否持续大于前方目标车辆的速度。基于相邻W个目标车辆中存在后方目标车辆的速度在预设持续时间内持续大于前方目标车辆的速度的情况,执行触发撞车预警操作;基于相邻W个目标车辆中存在后方目标车辆的速度在预设持续时间内小于或等于前方目标车辆的速度的情况,不执行撞车预警的操作。
又一方面提供一种车辆预警系统,包括:如上述再一方面中的电子设备。与电子设备电连接的若干图像采集装置,若干图像采集装置安装于道路附近,若干图像采集装置用于拍摄道路的监控视频,并将监控视频的数据上传至电子设备。其中,若干图像采集装置与电子设备中的处理器电连接,且处理器将接收的监控视频存储至电子设备中的存储器。
再一方面提供一种非暂态的计算机可读存储介质,包括:一种计算机程序产品,存储在非瞬时性的计算机可读存储介质上;计算机程序产品包括计算机程序指令,在计算机上执行计算机程序指令时,计算机程序指令使计算机执行如上述一方面任一项实施例提供的车辆速度检测方法和执行如上述另一方面任一项实施例提供的撞车预警方法。
又一方面,提供一种计算机程序产品。计算机程序产品包括计算机程序指令,在计算机(例如,显示装置,终端设备)上执行计算机程序指令时,计算机程序指令使计算机执行如上述一方面任一项实施例提供的车辆速度检测方法和执行如上述另一方面任一项实施例提供的撞车预警方法。
又一方面,提供一种计算机程序。当计算机程序在计算机(例如,显示装置,终端设备)上执行时,计算机程序使计算机执行如上述一方面任一项实施例提供的车辆速度检测方法和执行如上述另一方面任一项实施例提供的撞车预警方法。
附图说明
为了更清楚地说明本公开中的技术方案,下面将对本公开一些实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例的附图,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。此外,以下描述中的附图可以视作示意图,并非对本公开实施例所涉及的产品的实际尺寸、方法的实际流程、信号的实际时序等的限制。
图1为根据本公开的一些实施例的车辆速度检测方法的第一种流程图;
图2为根据本公开的一些实施例的车辆速度检测方法的第二种流程图;
图3为根据本公开的一些实施例的车辆速度检测方法的第三种流程图;
图4为根据本公开的一些实施例的车辆速度检测方法的第四种流程图;
图5为根据本公开的一些实施例的车辆速度检测方法的第五种流程图;
图6为根据本公开的一些实施例的车辆速度检测方法的第六种流程图;
图7为根据本公开的一些实施例的车辆速度检测方法的第七种流程图;
图8为根据本公开的一些实施例的车辆速度检测方法的第八种流程图;
图9为根据本公开的一些实施例的建立目标车辆的身份编码方法的一种流程图;
图10为根据本公开的一些实施例的车辆速度检测方法的第九种流程图;
图11为根据本公开的一些实施例的车辆速度检测方法的第十种流程图;
图12为根据本公开的一些实施例的目标车辆的目标检测框重叠的状态图;
图13为根据本公开的一些实施例的车辆速度检测方法的第十一种流程图;
图14为根据本公开的一些实施例的计算图像采集装置的约束参数方法的一种流程图;
图15为根据本公开的一些实施例的在一帧图像中计算图像采集装置的内部参数的辅助图;
图16为根据本公开的一些实施例的计算图像采集装置的内部参数的辅助图;
图17为根据本公开的一些实施例的计算图像采集装置的外部参数的辅助图;
图18为根据本公开的一些实施例的撞车预警方法的一种流程图;
图19为根据本公开的一些实施例的监控视频中标注检测区域的某一帧图像;
图20为根据本公开的一些实施例的判断目标车辆的运动轨迹是否为同一运动轨迹的流程图;
图21为根据本公开的一些实施例的电子设备的结构图;
图22为根据本公开的一些实施例的车辆预警系统的结构图。
具体实施方式
下面将结合附图,对本公开一些实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。基于本公开所提供的实施例,本领域普通技术人员所获得的所有其他实施例,都属于本公开保护的范围。
除非上下文另有要求,否则,在整个说明书和权利要求书中,术语“包括(comprise)”及其其他形式例如第三人称单数形式“包括(comprises)”和现在分词形式“包括(comprising)”被解释为开放、包含的意思,即为“包含,但不限于”。在说明书的描述中,术语“一个实施例(one embodiment)”、“一些实施例(some embodiments)”、“示例性实施例(exemplary embodiments)”、“示例(example)”、“特定示例(specific example)”或“一些示例(some examples)”等旨在表明与该实施例或示例相关的特定特征、结构、材料或特性包括在本公开的至少一个实施例或示例中。上述术语的示意性表示不一定是指同一实施例或示例。此外,所述的特定特征、结构、材料或特点可以以任何适当方式包括在任何一个或多个实施例或示例中。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本公开实施例 的描述中,除非另有说明,“多个”的含义是两个或两个以上。
本文中“适用于”或“被配置为”的使用意味着开放和包容性的语言,其不排除适用于或被配置为执行额外任务或步骤的设备。
另外,“基于”的使用意味着开放和包容性,因为“基于”一个或多个所述条件或值的过程、步骤、计算或其他动作在实践中可以基于额外条件或超出所述的值。
随着经济快速发展,我国居民汽车保有量逐年上涨,交通事故已经成为威胁人们生命安全的重要因素之一。对汽车限速是有效防止事故发生以及恶性事故发生的有效手段之一。
目前,对车辆测速一般采用雷达测速和区间测速。其中,雷达测速主要是利用多普勒效应(Doppler Effect)原理:当目标向雷达靠近时,反射信号频率将高于发射机频率;反之,当目标远离雷达而去时,反射信号频率将低于发射机频率。雷达测速可对车辆即时车速进行检测。区间测速是在同一路段上布设两个相邻的监控点,基于车辆通过前后两个监控点的时间来计算车辆在该路段上的平均行驶速度。
雷达测速仅能对车辆靠近雷达的瞬间检测车速,无法对长距离路段的车辆实时速度进行测量;而区间测速存在一定的滞后性,仅能获知车辆在某个路段的平均车速,而无法获知在某路段车辆的实时车速。
基于此,本公开的一些实施例提供了一种车辆速度检测方法,如图1和图6所示,车辆速度检测方法基于视频监控,该方法包括:S110~S160。
S110、获取道路的监控视频,提取监控视频中连续的多帧图像。
示例性地,获取道路的监控视频包括城市道路、乡村干道的监控视频以及高速公路的监控视频。利用视频处理软件对监控视频进行帧处理,例如可以为Open-cv软件,对监控视频进行帧处理,提取监控视频的各帧图像,获取监控视频的连续的多帧图像。图15和图19为道路的监控视频的多帧图像中的某一帧图像,可见,在该图像中包括道路和多个车辆。
S120、对多帧图像中的车辆进行识别,建立目标车辆的行车轨迹。
在一些示例中,如图19所示,采用目标检测和跟踪的算法对多帧图像进行检测,确定目标车辆并建立目标检测框Bx(bounding box,bbox),基于目标检测框Bx对目标车辆进行跟踪,得到目标车辆的运动轨迹。
需要说明的是,监控视频中的目标车辆可以为一个,也可以为多个,在目标车辆为多个的情况下,对每个目标车辆建立对应的目标检测框Bx,并形成每个目标车辆对应的运动轨迹,采用跟踪算法对多个目标车辆进行跟踪。
示例性地,目标检测算法模型采用yolov5算法,用于识别S110中提取的多帧图像中的目标车辆,并将目标车辆采用目标检测框Bx进行标记。跟踪算法模型采用sort算法,sort算法与yolov5算法的配合运行。其中,yolov5算法提供检测目标,检测目标例如为目标车辆,sort算法实现对多帧图像中的目标车辆进行跟踪。
S130、获取目标车辆在每帧图像中的图像位置坐标。
示例性地,在每帧图像上建立图像坐标系,且图像坐标系的原点与每帧图像的中心重合,然后计算机根据S120的yolov5算法获取的目标检测框数据,根据该目标检测框数据提供的图像坐标位置,获取目标车辆在对应的图像坐标系中的图像位置坐标。例如,如图19所示,图像中目标检测框的图像位置坐标即为对应目标车辆的图像位置坐标。
需要说明的是,目标检测框的图像位置坐标为该目标检测框中心点Bo的位置坐标。
S140、根据图像位置坐标,得到目标车辆在现实世界中的世界位置坐标。
对于每帧图像来说,图像中的图像位置坐标和该图像所对应的现实世界的世界位置坐标具有换算关系,在一些示例中,通过S110获取的多帧图像中任一帧图像,预先计算拍摄监控视频的图像采集装置的参数矩阵,例如图像采集装置可以为相机或摄像头,该图像采集装置的参数矩阵可以反映图像中的图像位置坐标和该图像所对应的现实世界的世界位置坐标之间的换算关系。通过,图像采集装置的参数矩阵可以将多帧图像中某个点的图像位置坐标换算为该点在现实世界的世界位置坐标。
示例性地,建立现实世界中的世界坐标系,其中,世界坐标系的原点可根据情况进行设定,一般情况下,为降低计算量,世界坐标系X轴和图像坐标系的X轴平行,世界坐标系Y轴和图像坐标系的Y轴平行。根据S130获取的每帧图像中目标车辆的图像位置坐标(该目标车辆的目标检测框中心点Bo的图像位置坐标),通过预先计算得到的参数矩阵,计算每帧图像中目标车辆在世界坐标系中对应的世界坐标位置。
S150、根据世界位置坐标,计算多帧图像中的每相邻两帧图像中,目标车辆在现实世界中的移动距离Ly。
示例性地,根据S140获取的每帧图像中目标车辆的世界坐标位置,建立相邻两帧图像中同一目标车辆在世界坐标系中的向量,计算该向量的长度即为目标车辆在现实世界中的移动距离Ly。
S160、根据目标车辆在现实世界中的行驶距离L,以及监控视频的帧率, 计算所述目标车辆在当前帧的速度Vd,其中,行驶距离L根据移动距离Ly得到。
在一些实施例中,S160中根据目标车辆在现实世界中的行驶距离L,以及监控视频的帧率,计算目标车辆在当前帧的速度Vd的方法,包括:
S161、计算在当前帧图像以及在当前帧图像之前的N帧图像中,每相邻两帧图像中目标车辆在现实世界中的移动距离Ly之和,所述移动距离Ly之和作为所述行驶距离L。
S162、根据监控视频的帧率,得到当前帧图像和在当前帧图像之前的第N帧图像之间的时间差Tt。
S163、根据所述行驶距离以及所述时间差得到所述目标车辆在当前帧的计算速度。
示例性地,根据S150中获取的每相邻两帧图像中,目标车辆在现实世界中的移动距离Ly,目标车辆在现实世界中的行驶距离L是当前帧图像以及在当前帧图像之前的N帧图像中,每相邻两帧图像中目标车辆在现实世界中的移动距离Ly之和,即:行驶距离L=移动距离Ly 1+移动距离Ly 2…+移动距离Ly N,其中,移动距离Ly 1为在当前帧图像和当前帧图像之前的第一帧图像中目标车辆在现实世界中的移动距离,移动距离Ly 2为在当前帧图像之前的第一帧图像和当前帧图像之前的第二帧图像中目标车辆在现实世界中的移动距离,移动距离Ly N为在当前帧图像之前的第N-1帧图像和当前帧图像之前的的第N帧图像中目标车辆在现实世界中的移动距离,即行驶距离L包括N个移动距离之和,涉及到N+1帧图像。
根据监控视频的帧率,可获取相邻两帧图像之间的时间t,例如:监控视频的帧率为10fps,则相邻两帧图像之间的时间t为100ms,则当前帧图像和在所述当前帧图像之前的第N帧图像之间的时间差为N×100ms。
因此目标车辆在当前帧的计算速度Vs为目标车辆的行驶距离L在该行驶距离的时间内的平均速度。其中,该行驶距离L的时间是N个相邻两帧图像之间的时间t。即:
Figure PCTCN2022124912-appb-000002
其中,8≤N≤12,例如N可以为8、10或12。
以N为10为例,以当前帧为第100帧为例,目标车辆在第100帧图像之前的N个移动距离之和L为,从第(100-N)帧开始,即从第90帧开始,计算第90帧图像和第91帧图像中,目标车辆在现实世界中的移动距离Ly 1,计 算第91帧图像和第92帧图像中,目标车辆在现实世界中的移动距离Ly 2……以此类推,计算第99帧图像和第100帧图像中,目标车辆在现实世界中的移动距离Ly 10,将移动距离Ly 1~移动距离Ly 10求和,得到目标车辆第100帧之前的10个移动距离Ly之和为行驶距离L。
目标车辆在第100帧的当前帧的计算速度Vs为上述获取的10个移动距离之和L,与第90帧图像至第100帧图像之间的时间差(10×100ms)的比值。
在一些实施例中,将目标车辆在当前帧的计算速度Vs作为目标车辆在当前帧的速度Vd。即当前帧的速度Vd=当前帧的计算速度Vs,例如目标车辆在第100帧的计算速度Vs为目标车辆在第100帧的速度Vd。
在另一些实施例中,对目标车辆在当前帧的计算速度Vs,和目标车辆在当前帧图像之前的M帧图像中,每帧图像的计算速度Vs进行数据平滑处理,并获取经数据平滑处理的结果作为目标车辆在当前帧的速度Vd,其中,3≤M≤5,例如M可以为3、4或5。
例如:获取同一目标车辆的多个当前帧计算速度Vs,以M为3,以及目标车辆的当前帧速度Vd为目标车辆的第100帧速度为例,目标车辆在所述当前帧图像之前的M帧图像为第99帧图像、第98帧图像和第97帧图像,同一目标车辆的多个当前帧计算速度Vs包括,目标车辆在第100帧的计算速度Vs 100、目标车辆在第99帧的计算速度Vs 99、目标车辆在第98帧的计算速度Vs 98和目标车辆在第97帧的计算速度Vs 97,目标车辆在当前帧图像之前的M帧图像中每帧图像的计算速度Vs均采用上述提到的方法计算得到,例如以N为10为例,目标车辆在第99帧的计算速度Vs 99为,从第89帧至第99帧中每相邻两帧图像中目标车辆在现实世界中的移动距离Ly之和,与第89帧图像至第99帧图像之间的时间差(10×100ms)的比值。
对上述四个速度进行数据平滑处理,例如对上述四个速度求平均值,将平均值作为目标车辆的第100帧图像的当前帧速度Vd 100,即:
Figure PCTCN2022124912-appb-000003
在另一些示例中,本公开采用滑动平均法对当前帧计算速度Vs进行数据平滑处理,根据公式:
Figure PCTCN2022124912-appb-000004
其中,当前帧为第m帧,Vd m为目标车辆在第m帧的速度,Vs m-i目标车辆为第m-i帧的计算速度,Vs m+i为目标车辆在第m+i帧的计算速度,Vs m为目标车辆在第m帧的计算速度。例如,M为1时,第100帧图像中目标车辆 的当前帧速度Vd 100即为该目标车辆在第99帧图像的当前帧计算速度Vs 99至第101帧图像中的当前帧计算速度Vs 101的平均值。
通过对采集的每帧图像中目标车辆当前帧计算速度Vs进行数据平滑处理,例如将多个当前帧计算速度Vs的平均值作为最终得到的目标车辆的当前帧速度Vd,可避免因目标检测框抖动造成的目标车辆速度变化造成的某一个当前帧计算速度Vs误差较大的问题,能够提高所获取的目标车辆的当前帧速度Vd的准确性,避免单个误差较大的前帧计算速度Vs对后续判断目标车辆超速或低速行驶的预警产生较大干扰。
本公开提供的车辆速度检测方法,可通过摄像头或者相机对道路上的目标车辆进行持续目标检测,通过获取目标车辆在图像上的图像位置坐标转换为现实世界的世界位置坐标,实现计算目标车辆在现实世界的移动距离和一段道路上目标车辆的瞬时车速,将计算机视觉技术运用与车辆速度检测方法中,实现车辆速度的实时检测,且能够检测车辆在具体某一帧的速度,提高了车速检测的实时性与准确性。该车辆速度检测方法一方面兼顾现有的区间测速和雷达测速的优点,例如可对某段道路的车速进行整体测量,同时也可以获取该段道路上某个瞬时车速。能够实现可对现有目标车辆测速补充或辅助;另一方面可直接采用目前的道路监控系统以及区间测速系统,例如利用现有的区间测速系统的监控装置,将间测速系统的监控拍摄的图像进行如上述实施例的方法进行处理。或者利用现有的监控系统,比如天眼系统等也可获取目标车辆速度,无需再进行大规模的资金投入。
在一些实施例中,如图2和图6所示,在计算道路的监控视频的相邻两帧图像中,目标车辆在现实世界中的移动距离Ly之前,车辆速度检测方法还包括S141和S142。
S141、计算多帧图像中的相邻两帧图像中,目标车辆在图像中的移动距离Lp。
S142、判断目标车辆在图像中的移动距离Lp是否大于距离阈值Q。
若是,则计算目标车辆在现实世界中的移动距离Ly,即执行S150;若否,则继续对目标车辆进行行车轨迹跟踪。
也就是说,基于目标车辆在图像中的移动距离Lp大于距离阈值Q,计算目标车辆在现实世界中的移动距离Ly;基于目标车辆在图像中的移动距离Lp小于或等于距离阈值Q,继续对目标车辆进行行车轨迹跟踪。
示例性地,获取目标车辆在每帧图像中的图像位置坐标后,建立相邻两帧图像中同一目标车辆在图像坐标系中的向量,并计算图像坐标系中的向量 的长度。该图像坐标系中的向量的长度即为目标车辆在相邻两帧图像中的移动距离Lp。将目标车辆在相邻两帧图像中的移动距离Lp与距离阈值Q进行比较,当目标车辆在相邻两帧图像中的移动距离Lp大于距离阈值Q,则进行S150,获取目标车辆的当前帧速度Vd;当位移距离Lp小于或等于距离阈值Q,则返回S120,对该目标车辆进行目标检测。
示例性地,距离阈值Q为所述目标车辆的检测框Bx长度的1/10。
通过计算目标车辆在各帧图像中的移动距离Lp和与距离阈值Q进行比较,可对现实世界中移动距离极低且目标车辆运行速度极低的目标车辆排除,该目标车辆速度近似于零,并无计算意义,可减少这类目标车辆对硬件设备的计算量的占用,从而提高测速系统的运行效率。
在一些实施例中,如图3和图6所示,在计算目标车辆的当前帧速度Vd之前,车辆速度检测方法还包括S151和S152。
S151、计算当前帧图像之前的多帧图像中,多个图像移动距离中大于距离阈值Q的图像移动距离的数量;其中,每个图像移动距离为,每相邻两帧图像中所述目标车辆在图像中的移动距离。
S152、判断大于距离阈值Q的图像移动距离的数量是否大于设定阈值X。若是,则进行S160,获取目标车辆的当前帧速度Vd,若否,则返回S120,对目标车辆进行目标检测。
也就是说,基于大于距离阈值Q的图像移动距离的数量大于设定阈值X,计算目标车辆在当前帧的速度;基于大于距离阈值Q的图像移动距离的数量小于或等于所述设定阈值X,对目标车辆进行行车轨迹跟踪。
在上述实施例中,定义图像移动距离为每相邻两帧图像中所述目标车辆在图像中的移动距离Lp,例如在当前帧图像之前具有M1帧图像,目标车辆到当前帧共行驶了M1个图像移动距离,获取M1个图像移动距离(每相邻两帧图像目标车辆在图像中的移动距离Lp)大于距离阈值Q的图像移动距离的数量,例如该数量为M2。在监控视频中,若数量M2大于设定阈值X,即目标车辆在图像采集装置的视野内运行足够距离,可以计算目标车辆在当前帧的计算速度Vs。若数量M2小于或等于设定阈值X,即目标车辆在图像采集装置的视野内运行距离不足,此时不计算目标车辆在当前帧的计算速度Vs,返回S120,对多帧图像中的车辆进行识别,建立目标车辆的行车轨迹。
示例性地,设定阈值X为9~11,例如设定阈值可以为9、10或11。
在一些实施例中,如图4和图6所示,车辆速度检测方法还包括S170。
S170、判断目标车辆在连续L帧图像中每帧的速度是否均在目标车辆行 驶道路的行车速度限制范围外。3≤L≤7,例如:L可以为3、5或7。
若是,则执行S180,执行预警操作。若否,则不执行预警操作。示例性地,继续对目标车辆进行行车轨迹跟踪。
也就是说,基于所述目标车辆在连续L帧图像中每帧的速度均在所述目标车辆行驶道路的行车速度限制范围外,执行预警操作;基于所述目标车辆在连续L帧图像中有至少一帧的速度在所述目标车辆行驶道路的行车速度限制范围内,不执行预警操作。
如图5或图6所示,目标车辆速度检测方法还包括S180’。
S180’、目标车辆在多个监控视频中进行速度检测时均触发预警后,目标车辆再次进行速度检测时触发预警的情况下,提高告警强度。
示例性地,L可以为5,获取目标车辆的当前帧速度Vd后,当连续5个当前帧速度Vd均高于或者低于该目标车辆所在行驶道路的行车速度限制范围时,例如:城市道路的行车速度限制范围可能为0~40Km/h、0~60Km/h或者0~80Km/h,高速公路的行车速度限制范围可能为100Km/h~120Km/h或80Km/h~100Km/h,表明目标车辆超速行驶,或者低速行驶,则执行预警操作,表示该目标车辆行车不规范。如目标车辆在该行驶道路的行车速度在行车速度限制范围内时,或者部分当前帧速度Vd在目标车辆行驶道路的行车速度限制范围外,但连续帧数低于5时,则表示该目标车辆行车规范,无需执行预警操作,可对该目标车辆继续进行行车轨迹跟踪。
当目标车辆在多个图像采集装置的监控视频中或者同一图像采集装置的多个监控视频中触发预警,例如目标车辆在两个图像采集装置的监控视频中或者同一个图像采集装置的两个监控视频中触发预警,目标车辆再次触发预警时,可提高该次告警的强度。
触发预警或者执行预警操作可以为运行本公开提供的车辆速度检测方法的硬件设备,将违规车辆在图像中的位置信息,拍摄截图等信息传输给数据中台,由数据中台决定向用户端发送告警的形式,具体的形式可由用户端定制化的要求进行设计。其中,用户端可以为交通管理平台系统,交通管理平台系统可以绘制出告警画面并保存告警记录供管理人员使用。
在一些实施例中,如图7所示,在对多帧图像中的车辆进行识别,建立目标车辆的行车轨迹之前目标车辆速度检测方法还包括S111。
S111、如图19所示,在多帧图像上均标注检测区域QE,其中,检测区域QE为封闭图形,位于图像中道路的行驶区域内,检测区域QE的边界在每帧图像上的图像位置坐标固定。
根据世界位置坐标,计算多帧图像中的相邻两帧图像中,目标车辆在现实世界中的移动距离Ly,包括:根据世界位置坐标,计算多帧图像中的相邻两帧图像中,位于检测区域QE内的目标车辆在现实世界中的移动距离Ly。
获取目标车辆的当前帧的速度Vd,包括:计算位于检测区域QE内的目标车辆在当前帧的速度Vd。
示例性地,检测区域QE为封闭区域,检测区域QE在图像上的长和宽大于或等于80个像素。例如检测区域QE对应的现实世界中的区域位于图像中道路的行驶区域内,例如道路的第一行车道、第二行车道和第三行车道,在检测区域QE内运行的目标车辆即为待检测车速的目标车辆,在检测区域QE外围部分(例如车道两侧或者一侧的停车位)停止的目标车辆则不属于待检测车速的目标车辆。
检测区域QE用于标定目标车辆的测速范围,一方面检测区域QE目标车辆拍摄清晰,速度检测准确率高,另一方面对于道路附近的停车位或者院内进行排除,减少不必要检测速度的车辆对系统计算量的占用。
在一些实施例中,如图8所示,在建立目标车辆的行车轨迹之后,车辆速度检测方法还包括S121。
S121、建立目标车辆的身份信息列表;如图9所示,包括:
S1211、采用重识别模型提取目标车辆的特征向量。
S1212、计算每相邻两帧图像中目标车辆的特征向量的夹角余弦。
S1213、判断所述夹角余弦的值是否连续G次大于相似度阈值。
若是,则执行S1214,在车辆信息检索库中建立对应目标车辆的身份信息列表,并将所述目标车辆的特征向量存储至对应的所述目标车辆的身份信息列表中;其中,所述目标车辆的身份信息列表包括所述目标车辆的身份信息;若否,则对所述目标车辆进行目标检测和跟踪。其中,3≤G≤7,相似度阈值为0.42~0.48。
也就是说,基于所述夹角余弦的值连续G次大于相似度阈值,在目标车辆信息检索库中建立对应目标车辆的身份信息列表,并将所述目标车辆的特征向量存储至对应的所述目标车辆的身份信息列表中;其中,所述目标车辆的身份信息列表包括所述目标车辆的身份信息。
在一些示例中,重识别模型采用resnet50的多粒度网络(Multiple Granularity Network,MGN)模型,可对检测目标进行全局特征和局部特征提取,提高识别准确率。
示例性地,对目标车辆进行特征提取,并获取目标车辆的特征向量。将 相邻帧图像中的多个特征向量进行比较,计算特征向量的夹角余弦。若果存在夹角余弦的值连续G此大于相似度阈值,例如G可以为3、5或7;相似度阈值为0.42、0.45或者0.48;则建立该目标车辆的身份信息列表,并且将最新的特性向量存储至该目标车辆的身份信息列表下,多个目标车辆的身份信息列表设置于车辆信息检索库中。其中,车辆信息检索库是预先在系统中设置的数据库,其中包含多个车辆的身份信息列表,每个车辆的身份信息列表中包含能够表明该车辆的身份特征的信息,例如,身份信息列表包括:最新一帧车辆特征向量,车辆出现时间,车辆运动方向,拍摄摄像头序号等信息。若不存在夹角余弦的值连续G此大于相似度阈值,则继续对目标车辆进行跟踪和特征向量提取。
建立目标车辆的身份信息列表,便于将目标车辆的特征信息、持续跟踪过程中的检测速度等信息建立于对应的目标车辆身份信息列表下,利于对多个目标车辆进行身份辨认和识别,可以使每个车辆对应一个跟踪ID(Identity document),在对目标车辆发出预警等过程中,监控视频中的目标车辆与现实世界的目标车辆做到相对应。
在一些实施例中,监控视频中的目标车辆进行目标检测和跟踪还包括一些特殊情况,例如目标车辆跟踪丢失,或者,监控视频中的目标车辆有多个且有两个目标车辆的目标检测框重叠的情况。
在目标车辆跟踪丢失的情况下,例如,当前帧图像中的目标检测框Bx的数量与前一帧图像中的目标检测框Bx的数量减少,或者在sort算法的跟踪过程中,存在某个跟踪目标的信息突然消失的情况。如图10所示,在目标车辆跟踪丢失的情况下,进入S122。
S122、判断目标车辆跟踪丢失的前一帧图像中,目标车辆的目标检测框Bx是否位于检测区域QE内。
若是,则执行S124:将跟踪丢失的目标车辆的特征向量,与在跟踪丢失之后新获取的目标车辆的特征向量进行匹配,并将特征向量匹配一致的新获取的目标车辆的身份信息建立于跟踪丢失的目标车辆的身份信息列表中。若否,则停止对目标车辆找回。
也就是说,基于目标车辆的目标检测框Bx位于检测区域QE内,将跟踪丢失的目标车辆的特征向量,与在跟踪丢失之后新获取的目标车辆的特征向量进行匹配,并将特征向量匹配一致的新获取的目标车辆的身份信息建立于跟踪丢失的目标车辆的身份信息列表中。基于目标车辆的目标检测框Bx位于检测区域QE外,停止对目标车辆找回。
在一些示例中,当目标车辆跟踪丢失后,可对新出现的目标车辆的特征向量与丢失目标车辆的特征向量匹配,匹配规则为计算新出现的目标车辆的特征向量与丢失跟踪目标车辆的特征向量之间的夹角余弦值,大于相似度阈值时认为这两辆车为同一辆车,进行运动轨迹合并,同时更新目标车辆信息检索库中的身份信息列表。
另外,存在目标车辆驶出检测区域QE的情况,此时目标车辆的目标检测框Bx不在检测区域QE内,对不处于检测区域QE的目标车辆,无需进行车速检测。也存在目标车辆驶出检测区域QE后又很快驶出图像采集装置的视野范围的情况,因此当目标车辆跟踪丢失的前一帧图像不在检测区域QE内时,不需要对该目标车辆进行找回。
在一些实施例中,如图11和图19所示,所述对所述多帧图像进行检测,确定所述目标车辆并建立目标检测框,基于所述目标检测框对所述目标车辆进行跟踪,得到所述目标车辆的运动轨迹,在监控视频两个以上的检测框重叠后且不完全重叠,还包括S123。
S123、目标检测框Bx有多个,在两个以上的目标检测框Bx重叠的情况下,提取重叠的目标检测框Bx对应的目标车辆的特征向量。将相邻两帧图像中特征向量的夹角余弦值大于相似度阈值的目标车辆,建立于同一所述身份信息列表中。
在目标检测框Bx重叠情况下,目标跟踪过程中,容易造成目标检测框Bx对应的目标车辆身份信息列表错误互换。例如,如图12所示,图中A目标检测框Bx和B目标检测框Bx表示第J帧图像中的两个重叠的目标检测框,C目标检测框Bx和D目标检测框Bx表示第J+1帧图像中的两个重叠的目标检测框。且图中A目标检测框Bx和D目标检测框Bx对应为同一辆车,图中B目标检测框Bx和C目标检测框Bx对应为同一辆车。但是因为目标检测框Bx重叠状态下,跟踪过程造成混乱,可能造成将第J帧图像中的A目标检测框Bx和第J+1帧图像中的C目标检测框Bx记录为同一目标车辆,第J帧图像中的B目标检测框Bx和第J+1帧图像中的D目标检测框Bx记录为同一目标车辆。因此对目标车辆特征提取,作为目标检测和跟踪过程的补充,可确保目标车辆的身份信息列表与现实世界中对应目标车辆的准确关联,同时在目标检测和跟踪过程出现跟踪丢失和目标检测框重叠的时候,进行辅助补充。
在一些实施例中,如图13所示,在根据图像位置坐标,在根据图像位置坐标,得到目标车辆在现实世界中的世界位置坐标之前,还包括S100。
S100、计算用于拍摄监控视频的图像采集装置的内部参数和外部参数。
内部参数和外部参数用于将所述多帧图像的图像位置坐标和其对应的世界位置坐标进行换算。其中,图像采集装置指针孔相机或者针孔摄像头。
如图14所示,S100计算用于拍摄所述监控视频的图像采集装置的所述内部参数和所述外部参数包括:
S101、如图15所示,在多帧图像中的标注图像上标注第一消失点N1和第二消失点N2。其中,标注图像为所述多帧图像中的任一帧。
示例性地,标注图像上标注至少两条第一消失线XL1和至少两条第二消失线XL2,一条第一消失线XL1与一个车道分界线平行,另一条第一消失线XL1’与另一个车道分界线平行,一条第二消失线XL2与一个所述车道分界线垂直,另一条第二消失线XL2’与另一个所述车道分界线垂直;其中,两条第一消失线XL1相交点为第一消失点N1,两条第二消失线XL2相交点为第二消失点N2。
S102、获取第一消失点N1和第二消失点N2在标注图像中的图像位置坐标。
示例性地,如图16所示,标注图像上建立图像坐标系。其中,图像坐标系原点O与某一帧图片的中心重合,并获取第一消失点N1坐标和第二消失点N2坐标。
S103、建立经过第一消失点N1和第二消失点N2的直线方程式。
示例性地,建立经过第一消失点N1和第二消失点N2的直线方程式ax+by+c=0。
S104、将标注图像的中心与主点重合,根据直线方程式,计算图像采集装置的初始内部参数和初始外部参数。
示例性地,每个标注图像的中心O`与主点重合。其中,主点为成像平面(每个标注图像的平面)与相机光轴的交点。
图像采集装置的初始内部参数K为:
Figure PCTCN2022124912-appb-000005
其中,因为多个图片的中心O`与主点重合,即u 0和V 0均为零(u 0和V 0是主点在图像上的坐标);针孔相机的通用模型考虑了两个像轴之间的倾斜系数,用γ表示,通常采用的简化方法是将倾斜度设为零(γ=0);在标注图像中,原点O在直线方程式ax+by+c=0上的投影点为No。在某一帧图片内,原点O在直线方程式ax+by+c=0上的投影点为No。通过计算可知原点O和投 影点No之间的距离为||ONo||,该距离为即为焦距f。
Figure PCTCN2022124912-appb-000006
其中,Oc为图像采集装置的焦点,直线OcNo与直线方程式ax+by+c=0垂直,即:
Figure PCTCN2022124912-appb-000007
以下为初始外部参数计算过程:
图像采集装置的初始外部参数包括旋转矩阵和平移矩阵。其中,R为世界坐标系和摄像机的坐标系之间的旋转矩阵;T为世界坐标系和摄像机的坐标系之间的平移向量。
建立一个矢量关系,且该矢量关系与世界坐标系具有相同的方向,因此,该矢量关系建立的坐标系和摄像机的坐标系之间的旋转与世界坐标系和摄像机的坐标系之间的旋转相同。
该矢量关系为:
Figure PCTCN2022124912-appb-000008
且Zz’=Xz’×Yz’。即,Xz’在标注图像上的投影为
Figure PCTCN2022124912-appb-000009
Yz’在标注图像上的投影为
Figure PCTCN2022124912-appb-000010
实际就是第一消失线XL1与世界坐标系的Xz轴在标注图像上的对应的Xz1轴平行,第二消失线XL2与世界坐标系的Yz轴在标注图像上的对应的Yz1轴平行。
在Xz’方向上,矢量关系建立的坐标系的方向Fx为:
Figure PCTCN2022124912-appb-000011
在Yz’方向上,矢量关系建立的坐标系的方向Fy为:
Figure PCTCN2022124912-appb-000012
在Xz’方向上,矢量关系建立的坐标系的方向Fx为:
Fz=Fx×Fy
其中,N1x为
Figure PCTCN2022124912-appb-000013
在相机坐标系的X轴方向的分向量,N1y为
Figure PCTCN2022124912-appb-000014
在相机坐标系的Y轴方向的分向量。f为焦距向量,相机坐标系的Z轴在相机光轴上,且第一消失点N1和第二消失点N2在标注图像上,因此
Figure PCTCN2022124912-appb-000015
Figure PCTCN2022124912-appb-000016
的长度为焦距f,方向为相机坐标系的Z轴正方向。N2x为向量
Figure PCTCN2022124912-appb-000017
在相机坐标系的X轴方向的分向量,N2y为向量
Figure PCTCN2022124912-appb-000018
在相机坐标系的Y轴方向的分向量,其中,相机坐标系的原点为相机焦点,即图16的Oc点,相机坐标系的X轴与图像坐标系的Xt轴平行,相机坐标系的Y轴与图像坐标系的Yt轴平行,图像坐标系的Xt轴可与第一消失线XL1重合,图像坐标系的Yt轴可与第二消失线XL2重合。
上述过程得到矢量关系的的方向。
即旋转矩阵R为:
Figure PCTCN2022124912-appb-000019
上述公式中Zzx为世界坐标轴的Zz轴与相机坐标系的Zt轴在Xt轴方向上偏转角度,Zzy为世界坐标轴的Zz轴与相机坐标系的Zt轴在Yt轴方向上偏转角度,Zzz为世界坐标轴的Zz轴与相机坐标系的Zt轴在Zt轴方向上偏转角度。
获取相机视野内的某物体的长度,例如:如图17所示,一段车道线Ll长度为6m,该车道线Ll的一端位于世界坐标系原点,因此,该车道线Ll两个端点的在世界坐标系的坐标位置分别为P1=[0,0,0] T和P2=[P2x,P2y,P2z] T
根据已知的旋转矩阵R,该车道线Ll的两个端点在图像坐标系的坐标位置为P1’和P2’,且具有如下关系:
Figure PCTCN2022124912-appb-000020
其中,图像坐标系的原点和主点重合,因此将图像坐标系中的线段P1’P2’的一端(P1’)平移至图像坐标系的原点,线段P1’P2’与OcP2的交点为Q,获取Q坐标,计算P1’Q的长度。
因为三角形P1OcP2和三角形P1’OcQ相似,因此,
Figure PCTCN2022124912-appb-000021
通过上述计算过程得到初始内部参数K和初始外部参数的值,其中,初始外部参数包括旋转矩R和平移矩阵T,由于在获取监控视频的过程中图像采集装置存在稳定性问题、以及获取坐标准确性等问题,造成初始内部参数K和初始外部参数存在较大误差。
S105、在某一帧图像上选取至少一个标定参考Cr,所述标定参考为在现实世界中两端的间距为已知的标志物,所述标定参考包括虚线车道线的一个线段Cr1、相邻虚线车道线之间的间隔线Cr2、同一虚线车道线中相连两个线段之间的间隔线Cr3。
示例性地,标定参考Cr的数量为8~10个,例如:标定参考Cr的数量可 以为8个、9个或者10个,以标定参考Cr的数量为9个为例,该九个标定参考Cr的两端的间距均已知。
S106、获取所述标注图像中所述标定参考的两端端点的图像位置坐标。
例如,以虚线车道线的一个线段Cr1为例,一标定参考的两端端点的图像位置坐标为P K’或Q K’。
S107、将所述至少一个标定参考作为约束条件,构造约束公式,根据约束公式对初始内部参数和初始外部参数进行迭代,根据所述约束公式的最优解得到所述图像采集装置的内部参数和外部参数。
其中,所述约束公式为:
Figure PCTCN2022124912-appb-000022
其中,N为标定参考Cr的数量,P K为第k个标定参考Cr的一端在现实世界的世界位置坐标,Q K为第k个标定参考Cr的另一端在现实世界的世界位置坐标,P K为第k个标定参考Cr一端在所述标注图像中的图像位置坐标,采用所述初始内部参数和所述初始外部参数计算得到的现实世界的世界位置坐标,Q K为第k个标定参考Cr的另一端在所述标注图像中图像位置坐标,采用所述初始内部参数和初始外部参数计算的现实世界的世界位置坐标,cp表示图像采集装置的约束参数,包括内部参数和外部参数。
根据S106中获取的标定参考的两端端点的图像位置坐标P K’或Q K’,通过公式:
Figure PCTCN2022124912-appb-000023
计算标定参数Cr的世界位置坐标P K和Q K
在一些示例中,标定参数Cr的数量为9个,即获得P K1、P K2、P K3、P K4、P K5、P K6、P K7、P K8、P K9、Q K1、Q K2、Q K3、Q K4、Q K5、Q K6、Q K7、Q K8和Q K9。
||P K-Q K|| 2为标定参考Cr的两端在现实世界的已知距离H,因此可获得H1、H2、H3、H4、H5、H6、H7、H8、H9。
||P K-Q K|| 2为标定参考Cr的两端在世界坐标系中的计算距离B,因此可获得B1、B2、B3、B4、B5、B6、B7、B8、B9。
将上述数值带入约束公式中,对多对已知距离H和计算距离B的差值求和,对初始内部参数和初始外部参数进行迭代。示例性地,S107中根据约束公式对初始内部参数和初始外部参数进行迭代的过程为:为对约束公式进行偏导,之后采用梯度下降法对约束参数进行迭代更新,其中,采用梯度下降 法对约束参数进行迭代更新过程中,调节或者更新的次数可以为100次,每次调节或者更新的幅度可以为0.01。
由于缺乏世界坐标系与图像坐标系之间的关联,S104计算出的初始内部参数K和初始外部参数在不同的拍摄场景下存在较大误差,由此,经过S105~S107,在相机标定过程中加入约束条件,最终求得的约束参数cp是较为准确的图像采集装置的内部参数K、外部参数的旋转矩阵R和外部参数的平移矩阵T,可以提高多帧图像的图像位置坐标和其对应的世界位置坐标进行换算的准确性。另外,本公开的标定参考采用虚线车道线Ll(例如虚线车道线的一个线段Cr1的长度为6米,虚线车道线之间的间隔线Cr2长度为8米)、同一虚线车道线中相连两个线段之间的间隔线Cr3、目标车辆的宽度线Cr4和长度线Cr5等,标定参考的间距在现实世界中均为已知数值,无需工作人员现场测量,提高效率,节省人力。
本公开还提供了一种撞车预警方法,撞车预警方法包括采用如上述实施例提供的车辆速度检测方法,获取道路的监控视频并提取监控视频中连续的多帧图像,对多帧图像中的车辆进行识别,建立目标车辆的行车轨迹、以及对目标车辆速度检测。
如图18和图19所示,撞车预警方法,还包括:S210、S220和S230。
S210、在道路的监控视频中,建立多个目标车辆的运动轨迹。
S220、判断多个目标车辆中,是否有相邻的至少两个目标车辆的运动轨迹为同一运动轨迹。
其中,S220的判断结果包括三种,第一种是多个目标车辆中有相邻两个目标车辆的运动轨迹为同一运动轨迹,第二种是多个目标车辆中有相邻两个以上的目标车辆的运动轨迹为同一运动轨迹,第二种是多个目标车辆中不存在相邻的至少两个以上的目标车辆的运动轨迹为同一运动轨迹,本公开讨论第一种和第二种情况。
若相邻两个目标车辆的运动轨迹为同一运行轨迹,则执行依次执行S230和S230’:
S230、检测相邻两个目标车辆在多帧图像中每帧的速度。
S230’、判断在预设持续时间内,相邻两个目标车辆中,后方目标车辆的速度是否持续大于前方目标车辆的速度。
若是,则执行撞车预警的操作,若否,则不执行撞车预警的操作,示例性地,返回S210在道路的监控视频中,建立多个目标车辆的运动轨迹。
也就是说,基于相邻两个目标车辆中,后方目标车辆的速度在预设持续 时间内持续大于前方目标车辆的速度,执行撞车预警的操作。基于相邻两个目标车辆中,后方目标车辆的速度在预设持续时间内存在小于或等于前方目标车辆的速度,不执行撞车预警的操作,可继续对同一运行轨迹两个目标车辆进行速度检测。
触发撞车预警或者执行撞车预警可以为运行本公开提供的撞车预警方法的硬件设备,将违规车辆在图像中的位置信息,拍摄截图等信息传输给数据中台,由数据中台决定向用户端发送告警的形式,具体的形式可由用户端定制化的要求进行设计。其中,用户端可以为交通管理平台系统,交通管理平台系统可以绘制出告警画面并保存告警记录供管理人员使用。
其中,在相邻两个目标车辆中,所述后方目标车辆为运动轨迹较短的目标车辆,所述前方目标车辆为运动轨迹较长的目标车辆。
例如,如图19所示,目标车辆C1的运动轨迹为Lc1,目标车辆C2的运动轨迹为Lc2,其中Lc1长度大于Lc2长度,即可判定目标车辆C1为前车,目标车辆C2为后车。撞车预警方法,可对同一时间范围内进入图像采集装置拍摄区域的目标车辆,进行运动轨迹的匹配,比较同一运动轨迹上目标车辆的行车速度,判断是否有撞车风险。可提高事故应急反应速度,提高车主的安全风险意识,降低事故发生概率。
如图18所示,若相邻W个目标车辆的运动轨迹为同一运动轨迹,其中,W大于或等于3,撞车预警方法还包括S240、S241和S242。
S240、获取相邻W个目标车辆的车型。
S241、判断相邻W个目标车辆的车型是否为至少一辆小型车或中型车位于两辆大型车中间。
若是,则执行撞车预警的操作;若否,则计算相邻W个目标车辆的速度。
也就是说,基于至少一辆小型车或中型车位于两辆大型车中间,执行撞车预警的操作;基于两辆大型车中间不存在小型车或中型车,计算相邻W个目标车辆的速度。
S242、判断在预设持续时间内,相邻W个目标车辆中,后方目标车辆的速度是否持续大于前方目标车辆的速度。
若是,则执行撞车预警操作;若否,则不执行撞车预警的操作,例如返回S210在道路的监控视频中,建立多个目标车辆的运动轨迹。也就是说,基于所述相邻W个目标车辆中存在后方目标车辆的速度在预设持续时间内持续大于前方目标车辆的速度的情况,执行触发撞车预警操作;基于所述相邻W个目标车辆中存在后方目标车辆的速度在预设持续时间内小于或等于前方目 标车辆的速度的情况,不执行撞车预警的操作。
示例性地,判断目标车辆车型的方法根据S120提供的目标检测框Bx,通过在目标检测框Bx宽度方向上两个端点的图像位置坐标,计算两个端点的图像位置坐标对应的两个世界位置坐标,即可计算该目标检测框Bx内目标车辆的宽度,通过目标车辆宽度可直接获取目标车辆属于大型车或者小型车或者中型车。例如:计算的目标车辆的宽度在1.5米至1.8米为小型车,计算的目标车辆的宽度在1.8米至2.0米为中型车,计算的目标车辆的宽度在2.0米以上为大型车。
计算车型的过程中,仅需对目标检测框Bx的现实世界的宽度和固定值进行比较即可,避免了训练目标车辆属性模型对目标车辆类型进行判别,减轻了系统的计算量。
示例性地,如图19所示,在道路上具有多个目标车辆,且在同一运动轨迹上从前至后依次排列有多个目标车辆,同一运动轨迹例如可以为同一车道,例如目标车辆C1和目标车辆C2均在同一车道上。对该同一运动轨迹上的车型进行判断,若该同一运动轨迹上的车型存在两个大型目标车辆中间有小型目标车辆或者中型目标车辆,即可发出撞车预警。若该同一运动轨迹上的车型为小型车车队或中型车车队或中小型车的混合车队或大型车连续的车队夹杂至上述各型车队中以及大型车车队等类型,则对目标车辆的速度进行检测,判断在预设持续时间内,例如预设持续时间可以为30秒、60秒或120秒,后方目标车辆速度一直保持大于前方目标车辆的速度,则执行撞车预警。
需要说明的是,判断在同一运动轨迹的目标车辆在同一时刻的运动轨迹长度,来判断前方目标车辆或者后方目标车辆,判断在同一运动轨迹的目标车辆在同一时刻的运动轨迹长度的方法可以为当前帧图像中该目标车辆的图像位置坐标与该监控视频第一帧图像中同一目标车辆的图像位置坐标之间的长度。
在一些实施例中,如图20所示,S220:判断是否有至少两个目标车辆的运动轨迹是否为同一运动轨迹的方法,包括:S2201和S2202。
S2201、获取每个目标车辆在多帧图像中的图像位置坐标集合,进行直线方程的拟合,获得每个目标车辆在图像坐标系中的运动直线方程。其中,图像坐标系的原点与每帧图像的中心重合。
S2202、判断各目标车辆的运动直线方程中,是否有至少两条运动直线方程的斜率之差小于斜率阈值,且至少两条运动直线方程的截距之差小于截距阈值。
若是,则判定所述至少运动直线方程对应的至少两个目标车辆的运动轨迹为同一运动轨迹,其中,斜率阈值的范围为3~7,截距阈值的范围为15~25。
也就是说,基于有至少两条运动直线方程的斜率之差小于斜率阈值,且所述至少两条运动直线方程的截距之差小于截距阈值,判定所述至少两条运动直线方程对应的至少两个目标车辆的运动轨迹为同一运动轨迹。
示例性地,根据S110中获取的各帧图像,通过S120对监控视频中的目标车辆进行目标检测和跟踪,建立目标车辆的运动轨迹,以及通过S121建立目标车辆的身份信息列表。获取监控视频中同一目标车辆在各帧图像中的图像位置坐标的集合,并通过该图像位置坐标的集合在图像坐标系内建立该目标车辆在图像坐标系内的运动轨迹。对每个目标车辆的运动轨迹进行直线方程的拟合,例如可以采用最小二乘法进行拟合生成直线方程,多条直线方程中的任意两条的斜率之差小于斜率阈值的范围,且多条直线方程中的任意两条的截距之差小于截距阈值的范围时,即可判断两条直线方程对应的两个目标车辆处于同一运动轨迹。其中,斜率阈值可以为3、4或7。截距阈值可以为15、20或25。
在一些实施例中,同一辆车在多个监控视频的撞车预警中均触发撞车预警操作后,目标车辆在撞车预警中再次触发撞车预的操作时提高告警强度。
示例性地,当目标车辆在多个图像采集装置的监控视频中或者同一图像采集装置的多个监控视频中触发撞车预警,例如目标车辆在两个图像采集装置的监控视频中或者同一个图像采集装置的两个监控视频中触发撞车预警,目标车辆再次触发撞车预警后,可提高告警强度。
本公开还提供了一种电子设备10,如图21所示,一种电子设备10,包括:处理器1和存储器2。处理器1被配置为执行如下步骤:获取道路的监控视频,并将监控视频存储至存储器2;提取监控视频中连续的多帧图像。对多帧图像中的车辆进行识别,建立目标车辆的行车轨迹。获取目标车辆在每帧图像中的图像位置坐标。根据图像位置坐标,得到目标车辆在现实世界中的世界位置坐标。计算道路的监控视频的相邻两帧图像中,目标车辆在现实世界中的移动距离Ly。根据目标车辆在现实世界中的行驶距离L,以及监控视频的帧率,计算目标车辆在当前帧的速度Vd,其中,行驶距离L根据所述移动距离Ly得到。
示例性地,处理器1可以是中央处理单元(Central Processing Unit,简称CPU),还可以是其他通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或 者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
存储器2可以是只读存储器(Read-Only Memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(Random Access Memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器2可以是独立存在,通过通信总线与处理器相连接。存储器2也可以和处理器1集成在一起。
存储在存储器2上并可在处理器1上运行的计算机程序实施,诸如过程或功能的实施方式可以与允许执行至少一种功能或操作的单独的软件模块来实施。软件代码可以有任何适当的编程语言编写的软件应用程序(或程序)来实施,软件代码可以存储在存储器中并且由处理器单元执行。
一种电子设备10,具有执行上述一方面的实施例中目标车辆速度检测的功能,与上述车辆速度检测方法的有益效果相同。
在一些实施例中,处理器1还被配置为执行如下步骤,计算在当前帧图像以及在当前帧图像之前的N帧图像中,每相邻两帧图像中所述目标车辆在在现实世界中的移动距离Ly之和,所述移动距离Ly之和作为所述行驶距离L。根据监控视频的帧率,得到当前帧图像和在当前帧图像之前的第N帧图像之间的时间差。根据行驶距离L以及时间差Tt得到目标车辆在当前帧的计算速度Vs,将目标车辆在当前帧的计算速度Vs作为所述目标车辆在当前帧的速度Vd。
在另一些实施例中,处理器1还被配置为执行如下步骤,根据目标车辆在现实世界中的行驶距离L,以及监控视频的帧率,计算目标车辆在当前帧的速度,包括:计算在当前帧图像以及在当前帧图像之前的N帧图像中,每相邻两帧图像中所述目标车辆在在现实世界中的移动距离Ly之和,所述移动距离Ly之和作为所述行驶距离L。根据监控视频的帧率,得到当前帧图像和在当前帧图像之前的第N帧图像之间的时间差。根据行驶距离L以及时间差得到目标车辆在当前帧的计算速度Vs;对目标车辆在当前帧的计算速度Vs,和目标车辆在当前帧图像之前的M帧图像中,每帧图像的计算速度进行数据平 滑处理,并获取经数据平滑处理的结果作为目标车辆的当前帧的速度Vd。
在一些实施例中,在处理器1被配置为执行计算所述道路的监控视频的相邻两帧图像中,目标车辆在现实世界中的移动距离Ly之前,处理器1还被配置为执行如下步骤:计算道路的监控视频的相邻两帧图像中,目标车辆在图像中的移动距离Lp;判断图像中的移动距离Lp是否大于距离阈值Q,基于目标车辆在图像中的移动距离Lp大于距离阈值Q,计算目标车辆在现实世界中的移动距离Ly;基于目标车辆在图像中的移动距离Lp小于或等于距离阈值Q,继续对目标车辆进行行车轨迹跟踪。
在一些实施例中,在处理器1被配置为执行计算目标车辆的当前帧的速度Vd之前,还被配置为执行如下步骤:计算当前帧图像之前的多帧图像中,多个图像移动距离中大于距离阈值Q的图像移动距离的数量。其中,每个图像移动距离为,每相邻两帧图像中目标车辆在图像中的移动距离Lp。判断大于距离阈值Q的图像移动距离的数量是否大于设定阈值X。基于大于距离阈值Q的图像移动距离的数量大于设定阈值X,计算目标车辆在当前帧的速度;基于大于距离阈值Q的图像移动距离的数量小于或等于设定阈值X,对目标车辆进行行车轨迹跟踪。
在一些实施例中,处理器1还被配置为执行如下步骤:判断目标车辆在连续L帧图像中每帧的速度是否均在目标车辆行驶道路的行车速度限制范围外。基于目标车辆在连续L帧图像中每帧的速度均在目标车辆行驶道路的行车速度限制范围外,执行预警操作;基于目标车辆在连续L帧图像中有至少一帧的速度在目标车辆行驶道路的行车速度限制范围内,不执行预警操作。目标车辆在多个监控视频中进行速度检测时均触发预警后,目标车辆再次进行速度检测时触发预警的情况下,提高告警强度。
在一些实施例中,处理器1还被配置为执行如下步骤:在道路的监控视频中,得到多个目标车辆的运动轨迹。处理器1还被配置为执行判断所述多个目标车辆中,是否有相邻的至少两个目标车辆的运动轨迹为同一运动轨迹。基于相邻两个目标车辆的运动轨迹为同一运行轨迹,检测相邻两个目标车辆多帧图像中当前帧的速度,并判断在预设持续时间内,相邻两个目标车辆中,后方目标车辆的速度是否持续大于前方目标车辆的速度。基于相邻两个目标车辆中,后方目标车辆的速度在预设持续时间内持续大于前方目标车辆的速度,执行撞车预警的操作。基于相邻两个目标车辆中,后方目标车辆的速度在预设持续时间内存在小于或等于前方目标车辆的速度的情况,不执行撞车预警的操作。
在一些实施例中,若相邻W个目标车辆的运动轨迹为同一运动轨迹,W大于或等于3,则处理器1还被配置为执行如下步骤:获取所述相邻W个目标车辆的车型,判断所述相邻W个目标车辆的车型是否为至少一辆小型车或中型车位于两辆大型车中间。基于存在至少一辆小型车或中型车位于所述两辆大型车中间的情况,执行撞车预警的操作。基于不存在至少一辆小型车或中型车位于所述两辆大型车中间的情况,检测所述相邻W个目标车辆在所述多帧图像中每帧的速度,并判断在预设持续时间内,所述相邻W个目标车辆中,后方目标车辆的速度是否持续大于前方目标车辆的速度。基于所述相邻W个目标车辆中存在后方目标车辆的速度在预设持续时间内持续大于前方目标车辆的速度的情况,执行触发撞车预警操作。基于所述相邻W个目标车辆中存在后方目标车辆的速度在预设持续时间内小于或等于前方目标车辆的速度的情况,不执行撞车预警的操作。
本公开还提供了一种车辆预警系统100,如图22所示,车辆预警系统100包括:上述实施例所述的电子设备10,与所电子设备10电连接的若干图像采集装置20,若干图像采集装置20安装于道路附近,若干图像采集装置20用于拍摄道路的监控视频,并将监控视频的数据上传电子设备10。其中,若干图像采集装置20与所述电子设备10中的处理器1电连接,且处理器1将接受的监控视频存储至所述电子设备10中的存储器2。
一种车辆预警系统100采用上述电子设备10,具有上述实施例中一种车辆速度检测方法和一种撞车预警方法相同的有益效果。
本公开还提供一种非暂态的计算机可读存储介质,包括:一种计算机程序产品,存储在非瞬时性的计算机可读存储介质上。计算机程序产品包括计算机程序指令,在计算机(例如,显示装置,终端设备)上执行计算机程序指令时,计算机程序指令使计算机执行如上述实施例提供的车辆速度检测方法和执行如上述实施例提供的撞车预警方法。
本公开还提供一种计算机程序产品。计算机程序产品包括计算机程序指令,在计算机(例如,显示装置,终端设备)上执行计算机程序指令时,计算机程序指令使计算机执行如上述实施例提供的车辆速度检测方法和执行如上述实施例提供的撞车预警方法。
本公开还提供一种计算机程序。当计算机程序在计算机(例如,显示装置,终端设备)上执行时,计算机程序使计算机执行如上述实施例提供的车辆速度检测方法和执行如上述实施例提供的撞车预警方法。
以上所述,仅为本公开的具体实施方式,但本公开的保护范围并不 局限于此,任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,想到变化或替换,都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应以所述权利要求的保护范围为准。

Claims (24)

  1. 一种车辆速度检测方法,包括:
    获取道路的监控视频,提取所述监控视频中连续的多帧图像;
    对所述多帧图像中的车辆进行识别,建立目标车辆的行车轨迹;
    获取所述目标车辆在每帧图像中的图像位置坐标;
    根据所述图像位置坐标,得到所述目标车辆在现实世界中的世界位置坐标;
    根据所述世界位置坐标,计算所述多帧图像中的每相邻两帧图像中,所述目标车辆在现实世界中的移动距离;
    根据所述目标车辆在现实世界中的行驶距离,以及所述监控视频的帧率,计算所述目标车辆在当前帧的速度,其中,所述行驶距离根据所述移动距离得到。
  2. 根据权利要求1所述的车辆速度检测方法,其中,根据所述目标车辆在现实世界中的行驶距离,以及所述监控视频的帧率,计算所述目标车辆在当前帧的速度,包括:
    计算在当前帧图像以及在所述当前帧图像之前的N帧图像中,每相邻两帧图像中所述目标车辆在现实世界中的移动距离之和,所述移动距离之和作为所述行驶距离;
    根据所述监控视频的帧率,得到所述当前帧图像和在所述当前帧图像之前的第N帧图像之间的时间差;
    根据所述行驶距离以及所述时间差得到所述目标车辆在当前帧的计算速度,将所述目标车辆在当前帧的计算速度作为所述目标车辆在当前帧的速度;
    或者,
    计算在当前帧图像以及在所述当前帧图像之前的N帧图像中,每相邻两帧图像中所述目标车辆在现实世界中的移动距离之和,所述移动距离之和作为所述行驶距离;
    根据所述监控视频的帧率,得到所述当前帧图像和在所述当前帧图像之前的第N帧图像之间的时间差;
    根据所述行驶距离以及所述时间差得到所述目标车辆在当前帧的计算速度;
    对所述目标车辆在当前帧的计算速度,和所述目标车辆在所述当前帧图像之前的M帧图像中每帧图像的计算速度进行数据平滑处理,并获取经数据平滑处理的结果作为所述目标车辆在当前帧的速度。
  3. 根据权利要求1或2所述的车辆速度检测方法,其中,在根据所述世 界位置坐标,计算所述多帧图像中的相邻两帧图像中,所述目标车辆在现实世界中的移动距离之前,还包括:
    计算所述多帧图像中的相邻两帧图像中,所述目标车辆在图像中的移动距离;
    判断所述目标车辆在图像中的移动距离是否大于距离阈值;
    基于所述目标车辆在图像中的移动距离大于距离阈值,计算所述目标车辆在现实世界中的移动距离;基于所述目标车辆在图像中的移动距离小于或等于距离阈值,继续对所述目标车辆进行行车轨迹跟踪。
  4. 根据权利要求3所述的车辆速度检测方法,其中,在计算所述目标车辆在当前帧的速度之前,还包括:
    计算当前帧图像之前的多帧图像中,多个图像移动距离中大于所述距离阈值的图像移动距离的数量;其中,每个图像移动距离为,每相邻两帧图像中所述目标车辆在图像中的移动距离;
    判断大于所述距离阈值的图像移动距离的数量是否大于设定阈值;
    基于大于所述距离阈值的图像移动距离的数量大于所述设定阈值,计算所述目标车辆在当前帧的速度;
    基于大于所述距离阈值的图像移动距离的数量小于或等于所述设定阈值,对所述目标车辆进行行车轨迹跟踪。
  5. 根据权利要求1至4中任一项所述的车辆速度检测方法,还包括:
    判断所述目标车辆在连续L帧图像中每帧的速度是否均在所述目标车辆行驶道路的行车速度限制范围外;
    基于所述目标车辆在连续L帧图像中每帧的速度均在所述目标车辆行驶道路的行车速度限制范围外,执行预警操作;
    基于所述目标车辆在连续L帧图像中有至少一帧的速度在所述目标车辆行驶道路的行车速度限制范围内,不执行预警操作;
    所述目标车辆在多个所述监控视频中进行速度检测时均触发预警后,所述目标车辆再次进行速度检测时触发预警的情况下,提高告警强度。
  6. 根据权利要求5所述的车辆速度检测方法,还包括,在对所述多帧图像中的目标车辆进行识别,建立目标车辆的行车轨迹之前,
    在所述多帧图像上均标注检测区域;其中,所述检测区域为封闭图形,位于所述图像中道路的行驶区域内,所述检测区域的边界在每帧图像上的图像位置坐标固定;
    所述根据所述世界位置坐标,计算所述多帧图像中的相邻两帧图像中, 所述目标车辆在现实世界中的移动距离,包括:所述根据所述世界位置坐标,计算所述多帧图像中的相邻两帧图像中,位于所述检测区域内的目标车辆在现实世界中的移动距离;
    所述计算所述目标车辆在当前帧的速度,包括:计算位于所述检测区域内的所述目标车辆在当前帧的速度。
  7. 根据权利要求6所述的车辆速度检测方法,其中,对所述多帧图像中的目标车辆进行识别,建立目标车辆的行车轨迹,包括:
    对所述多帧图像进行检测,确定所述目标车辆并建立目标检测框,基于所述目标检测框对所述目标车辆进行跟踪,得到所述目标车辆的运动轨迹;
    所述目标车辆在每帧图像中的图像位置坐标为,在该帧图像中,所述目标车辆的目标检测框的中心点的图像位置坐标。
  8. 根据权利要求7所述的车辆速度检测方法,还包括:在建立目标车辆的行车轨迹之后,建立所述目标车辆的身份信息列表;
    所述建立所述目标车辆的身份信息列表,包括:
    采用重识别模型提取所述目标车辆的特征向量;
    计算所述每相邻两帧图像中所述目标车辆的特征向量的夹角余弦;
    判断所述夹角余弦的值是否连续G次大于相似度阈值;
    基于所述夹角余弦的值连续G次大于相似度阈值,在车辆信息检索库中建立对应目标车辆的身份信息列表,并将所述目标车辆的特征向量存储至对应的所述目标车辆的身份信息列表中;其中,所述目标车辆的身份信息列表包括所述目标车辆的身份信息。
  9. 根据权利要求8所述的车辆速度检测方法,其中,在所述目标车辆跟踪丢失的情况下,判断在所述目标车辆跟踪丢失的前一帧图像中,所述目标车辆的目标检测框是否位于所述检测区域内;
    基于所述目标车辆的目标检测框位于所述检测区域内,将跟踪丢失的目标车辆的特征向量,与在跟踪丢失之后新获取的目标车辆的特征向量进行匹配,并将特征向量匹配一致的所述新获取的目标车辆的身份信息建立于跟踪丢失的目标车辆的身份信息列表中;
    基于所述目标车辆的目标检测框位于所述检测区域外,停止对所述目标车辆找回。
  10. 根据权利要求8所述的车辆速度检测方法,其中,所述对所述多帧图像进行检测,确定所述目标车辆并建立目标检测框,基于所述目标检测框对所述目标车辆进行跟踪,得到所述目标车辆的运动轨迹,还包括:
    所述目标检测框有多个,在两个以上的目标检测框重叠的情况下,提取重叠的目标检测框对应的目标车辆的特征向量;
    将相邻两帧图像中特征向量的夹角余弦值大于相似度阈值的目标车辆,建立于同一所述身份信息列表中。
  11. 根据权利要求1至10中任一项所述的车辆速度检测方法,其中,在根据所述图像位置坐标,得到所述目标车辆在现实世界中的世界位置坐标之前,还包括:
    计算用于拍摄所述监控视频的图像采集装置的内部参数和外部参数;所述内部参数和所述外部参数用于将所述多帧图像的图像位置坐标和其对应的世界位置坐标进行换算;
    所述计算用于拍摄所述监控视频的图像采集装置的所述内部参数和所述外部参数,包括:
    在所述多帧图像中的标注图像上标注第一消失点和第二消失点;其中,所述标注图像为所述多帧图像中的任一帧;
    获取所述第一消失点和所述第二消失点在所述标注图像中的图像位置坐标;
    建立经过第一消失点和第二消失点的直线方程式;
    将所述标注图像的中心与主点重合,根据所述直线方程式,计算所述图像采集装置的初始内部参数和初始外部参数;
    在所述标注图像上选取至少一个标定参考,所述标定参考为在现实世界中两端的间距为已知距离的标志物,所述标定参考包括虚线车道线的一个线段、相邻虚线车道线之间的间隔线、同一虚线车道线中相连两个线段之间的间隔线;
    获取所述标注图像中所述标定参考的两端端点的图像位置坐标;
    将所述至少一个标定参考作为约束条件,构造约束公式,根据所述约束公式对所述初始内部参数和所述初始外部参数进行迭代,根据所述约束公式的最优解得到所述图像采集装置的所述内部参数和所述外部参数;
    其中,所述约束公式为:
    Figure PCTCN2022124912-appb-100001
    其中,N为所述标定参考的数量,P K为第k个标定参考的一端在所述现实世界的世界位置坐标,Q K为第k个标定参考的另一端在所述现实世界的世界位置坐标;P K为第k个标定参考的一端在所述标注图像中的图像位置坐标, 采用所述初始内部参数和所述初始外部参数计算得到的所述现实世界的世界位置坐标,Q K为第k个标定参考的另一端在所述标注图像中图像位置坐标,采用所述初始内部参数和所述初始外部参数计算的所述现实世界的世界位置坐标;cp表示所述图像采集装置的约束参数,包括所述内部参数和所述外部参数。
  12. 一种撞车预警方法,其中,所述撞车预警方法包括采用如权利要求1~11任一项所述的车辆速度检测方法,获取道路的监控视频并提取所述监控视频中连续的多帧图像;对目标车辆进行目标检测和跟踪、以及速度检测;
    所述撞车预警方法还包括:
    在所述道路的监控视频中,建立多个目标车辆的运动轨迹;
    判断所述多个目标车辆中,是否有相邻的至少两个目标车辆的运动轨迹为同一运动轨迹;
    若相邻两个目标车辆的运动轨迹为同一运行轨迹,检测所述相邻两个目标车辆在所述多帧图像中每帧的速度,并判断在预设持续时间内,所述相邻两个目标车辆中,后方目标车辆的速度是否持续大于前方目标车辆的速度;
    基于所述相邻两个目标车辆中,后方目标车辆的速度在预设持续时间内持续大于前方目标车辆的速度,执行撞车预警的操作;
    基于所述相邻两个目标车辆中,后方目标车辆的速度在预设持续时间内存在小于或等于前方目标车辆的速度,不执行撞车预警的操作。
  13. 根据权利要求12所述的撞车预警方法,其中,所述撞车预警方法还包括:若相邻W个目标车辆的运动轨迹为同一运动轨迹,则获取所述相邻W个目标车辆的车型,W大于或等于3;
    判断所述相邻W个目标车辆的车型是否为至少一辆小型车或中型车位于两辆大型车中间;
    基于存在至少一辆小型车或中型车位于所述两辆大型车中间的情况,执行撞车预警的操作;
    基于不存在至少一辆小型车或中型车位于所述两辆大型车中间的情况,检测所述相邻W个目标车辆在所述多帧图像中每帧的速度,并判断在预设持续时间内,所述相邻W个目标车辆中,后方目标车辆的速度是否持续大于前方目标车辆的速度;
    基于所述相邻W个目标车辆中存在后方目标车辆的速度在预设持续时间内持续大于前方目标车辆的速度的情况,执行触发撞车预警操作;
    基于所述相邻W个目标车辆中存在后方目标车辆的速度在预设持续时间 内小于或等于前方目标车辆的速度的情况,不执行撞车预警的操作。
  14. 根据权利要求12或13所述的撞车预警方法,其中,判断是否有至少两个目标车辆的运动轨迹是否为同一运动轨迹的方法,包括:
    获取每个所述目标车辆在所述多帧图像中的图像位置坐标集合,进行直线方程的拟合,获得每个所述目标车辆在图像坐标系中的运动直线方程,其中,所述图像坐标系的原点与每帧图像的中心重合;
    判断各目标车辆的运动直线方程中,是否有至少两条运动直线方程的斜率之差小于斜率阈值,且所述至少两条运动直线方程的截距之差小于截距阈值;
    基于有至少两条运动直线方程的斜率之差小于斜率阈值,且所述至少两条运动直线方程的截距之差小于截距阈值,判定所述至少两条运动直线方程对应的至少两个目标车辆的运动轨迹为同一运动轨迹。
  15. 根据权利要求14所述的撞车预警方法,其中,同一目标车辆在多个所述监控视频的撞车预警中均触发撞车预警后,所述目标车辆在撞车预警中再次触发撞车预警时,提高告警强度。
  16. 一种电子设备,包括:处理器和存储器;
    所述处理器被配置为执行如下步骤:
    获取道路的监控视频,并将所述监控视频存储至存储器;提取所述监控视频中连续的多帧图像;
    对所述多帧图像中的目标车辆进行识别,建立目标车辆的行车轨迹目标车辆;
    获取所述目标车辆在每帧图像中的图像位置坐标;
    根据所述图像位置坐标,得到所述目标车辆在现实世界中的世界位置坐标;
    计算所述道路的监控视频的相邻两帧图像中,所述目标车辆在现实世界中的移动距离;
    根据所述目标车辆在现实世界中的行驶距离,以及所述监控视频的帧率,计算所述目标车辆在当前帧的速度,其中,所述行驶距离根据所述移动距离得到。
  17. 根据权利要求16所述的电子设备,其中,所述处理器还被配置为执行如下步骤:
    计算在当前帧图像以及在所述当前帧图像之前的N帧图像中,每相邻两帧图像中所述目标车辆在现实世界中的移动距离之和,所述移动距离之和作 为所述行驶距离;
    根据所述监控视频的帧率,得到所述当前帧图像和在所述当前帧图像之前的第N帧图像之间的时间差;
    根据所述行驶距离以及所述时间差得到所述目标车辆在当前帧的计算速度,将所述目标车辆在当前帧的计算速度作为所述目标车辆在当前帧的速度;
    或者,所述处理器还被配置为执行如下步骤:
    计算在当前帧图像以及在所述当前帧图像之前的N帧图像中,每相邻两帧图像中所述目标车辆在现实世界中的移动距离之和,所述移动距离之和作为所述行驶距离;
    根据所述监控视频的帧率,得到所述当前帧图像和在所述当前帧图像之前的第N帧图像之间的时间差;
    根据所述行驶距离以及所述时间差得到所述目标车辆在当前帧的计算速度;
    对所述目标车辆在当前帧的计算速度,和所述目标车辆在所述当前帧图像之前的M帧图像中,每帧图像的计算速度进行数据平滑处理,并获取经数据平滑处理的结果作为所述目标车辆的当前帧的速度。
  18. 根据权利要求16或17所述的电子设备,其中,在所述处理器被配置为根据所述世界位置坐标,计算所述多帧图像中的相邻两帧图像中,所述目标车辆在现实世界中的移动距离之前,还被配置为执行如下步骤:
    计算所述道路的监控视频的相邻两帧图像中,所述目标车辆在图像中的移动距离;
    判断所述目标车辆在图像中的移动距离是否大于距离阈值;
    基于所述目标车辆在图像中的移动距离大于距离阈值,计算所述目标车辆在现实世界中的移动距离;基于所述目标车辆在图像中的移动距离小于或等于距离阈值,继续对所述目标车辆进行行车轨迹跟踪。
  19. 根据权利要求18所述的电子设备,其中,在所述处理器被配置为执行计算所述目标车辆的当前帧的速度之前,还被配置为执行如下步骤:
    计算当前帧图像之前的多帧图像中,多个图像移动距离中大于所述距离阈值的图像移动距离的数量;其中,每个图像移动距离为,每相邻两帧图像中所述目标车辆在图像中的移动距离;
    判断大于所述距离阈值的图像移动距离的数量是否大于设定阈值;
    基于大于所述距离阈值的图像移动距离的数量大于所述设定阈值,计算所述目标车辆在当前帧的速度;
    基于大于所述距离阈值的图像移动距离的数量小于或等于所述设定阈值,对所述目标车辆进行行车轨迹跟踪。
  20. 根据权利要求16至19中任一项所述的电子设备,其中,所述处理器还被配置为执行如下步骤:
    判断所述目标车辆在连续L帧图像中每帧的速度是否均在所述目标车辆行驶道路的行车速度限制范围外;
    基于所述目标车辆在连续L帧图像中每帧的速度均在所述目标车辆行驶道路的行车速度限制范围外,执行预警操作;
    基于所述目标车辆在连续L帧图像中有至少一帧的速度在所述目标车辆行驶道路的行车速度限制范围内,不执行预警操作;
    所述目标车辆在多个所述监控视频中进行速度检测时均触发预警后,所述目标车辆再次进行速度检测时触发预警的情况下,提高告警强度。
  21. 根据权利要求16所述的电子设备,其中,所述处理器还被配置为执行如下步骤:
    在所述道路的监控视频中,得到多个目标车辆的运动轨迹;
    判断所述多个目标车辆中,是否有相邻的至少两个目标车辆的运动轨迹为同一运动轨迹;
    若相邻两个目标车辆的运动轨迹为同一运行轨迹,检测所述相邻两个目标车辆所述多帧图像中当前帧的速度,并判断在预设持续时间内,所述相邻两个目标车辆中,后方目标车辆的速度是否持续大于前方目标车辆的速度;
    基于所述相邻两个目标车辆中,后方目标车辆的速度在预设持续时间内持续大于前方目标车辆的速度,执行撞车预警的操作;
    基于所述相邻两个目标车辆中,后方目标车辆的速度在预设持续时间内存在小于或等于前方目标车辆的速度的情况,不执行撞车预警的操作。
  22. 根据权利要求21所述的电子设备,其中,若相邻W个目标车辆的运动轨迹为同一运动轨迹,W大于或等于3,则所述处理器还被配置为执行如下步骤:
    获取所述相邻W个目标车辆的车型,
    判断所述相邻W个目标车辆的车型是否为至少一辆小型车或中型车位于两辆大型车中间;
    基于存在至少一辆小型车或中型车位于所述两辆大型车中间的情况,执行撞车预警的操作;
    基于不存在至少一辆小型车或中型车位于所述两辆大型车中间的情况, 检测所述相邻W个目标车辆在所述多帧图像中每帧的速度,并判断在预设持续时间内,所述相邻W个目标车辆中,后方目标车辆的速度是否持续大于前方目标车辆的速度;
    基于所述相邻W个目标车辆中存在后方目标车辆的速度在预设持续时间内持续大于前方目标车辆的速度的情况,执行触发撞车预警操作;
    基于所述相邻W个目标车辆中存在后方目标车辆的速度在预设持续时间内小于或等于前方目标车辆的速度的情况,不执行撞车预警的操作。
  23. 一种车辆预警系统,包括:
    权利要求16至22所述的电子设备;
    与所述电子设备电连接的若干图像采集装置,若干图像采集装置安装于道路附近,若干图像采集装置用于拍摄道路的监控视频,并将所述监控视频的数据上传至所述电子设备;
    其中,所述若干图像采集装置与所述电子设备中的处理器电连接,且所述处理器将接收的所述监控视频存储至所述电子设备中的存储器。
  24. 一种非暂态的计算机可读存储介质,包括:一种计算机程序产品,存储在非瞬时性的计算机可读存储介质上;所述计算机程序产品包括计算机程序指令,在计算机上执行所述计算机程序指令时,所述计算机程序指令使计算机执行如权利要求1至11任一项所述的车辆速度检测方法和执行如权利要求12至15任一项所述的撞车预警方法。
PCT/CN2022/124912 2021-12-28 2022-10-12 一种车辆速度检测、撞车预警方法及电子设备 WO2023124383A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111629420.2A CN114332153A (zh) 2021-12-28 2021-12-28 一种车辆速度检测、撞车预警方法及电子设备
CN202111629420.2 2021-12-28

Publications (1)

Publication Number Publication Date
WO2023124383A1 true WO2023124383A1 (zh) 2023-07-06

Family

ID=81014520

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/124912 WO2023124383A1 (zh) 2021-12-28 2022-10-12 一种车辆速度检测、撞车预警方法及电子设备

Country Status (2)

Country Link
CN (1) CN114332153A (zh)
WO (1) WO2023124383A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116740986A (zh) * 2023-08-09 2023-09-12 聊城市瀚格智能科技有限公司 一种隧道行车交通事故风险智能预警方法
CN116863124A (zh) * 2023-09-04 2023-10-10 所托(山东)大数据服务有限责任公司 车辆姿态确定方法、控制器及存储介质
CN116884235A (zh) * 2023-08-09 2023-10-13 广东省交通运输规划研究中心 基于撞线的视频车速检测方法、装置、设备以及存储介质
CN116985827A (zh) * 2023-09-26 2023-11-03 无锡中马汽车配件制造有限公司 用于汽车减震器状态预警的车姿判断装置
CN117275126A (zh) * 2023-11-22 2023-12-22 盛视科技股份有限公司 车辆信息采集驱动控制方法及车道信息采集系统
CN117994741A (zh) * 2024-01-03 2024-05-07 广东智视云控科技有限公司 基于视频监控的车速检测方法、系统及存储介质
CN118196761A (zh) * 2024-05-17 2024-06-14 成都航空职业技术学院 一种针对交通标识线的图像识别方法和系统

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114332153A (zh) * 2021-12-28 2022-04-12 京东方科技集团股份有限公司 一种车辆速度检测、撞车预警方法及电子设备
CN115273368B (zh) * 2022-07-20 2024-06-25 云南电网有限责任公司电力科学研究院 输电线路走廊施工车辆入侵告警方法、介质、设备及系统
CN115240471B (zh) * 2022-08-09 2024-03-01 东揽(南京)智能科技有限公司 一种基于图像采集的智慧厂区避撞预警方法和系统
CN115393803A (zh) * 2022-08-30 2022-11-25 京东方科技集团股份有限公司 车辆违规检测方法、装置及系统、存储介质
CN115684637B (zh) * 2022-12-30 2023-03-17 南京理工大学 基于路侧单目相机标定的高速公路车辆测速方法及设备
CN115966084B (zh) * 2023-03-17 2023-06-09 江西昂然信息技术有限公司 全息路口毫米波雷达数据处理方法、装置及计算机设备
CN116883610A (zh) * 2023-09-07 2023-10-13 园测信息科技股份有限公司 基于车辆识别与轨迹映射的数字孪生路口构建方法和系统
CN117372924B (zh) * 2023-10-18 2024-05-07 中国铁塔股份有限公司 一种视频检测方法及装置
CN118015850B (zh) * 2024-04-08 2024-06-28 云南省公路科学技术研究院 一种多目标车辆车速同步估算方法、系统、终端及介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101877174A (zh) * 2009-09-29 2010-11-03 杭州海康威视软件有限公司 车速测量方法、监控机及车速测量系统
JP2017084115A (ja) * 2015-10-28 2017-05-18 本田技研工業株式会社 車両制御装置、車両制御方法、および車両制御プログラム
CN111583715A (zh) * 2020-04-29 2020-08-25 宁波吉利汽车研究开发有限公司 一种车辆轨迹预测方法、车辆碰撞预警方法、装置及存储介质
CN112798811A (zh) * 2020-12-30 2021-05-14 杭州海康威视数字技术股份有限公司 速度测量方法、装置和设备
CN113744563A (zh) * 2021-08-02 2021-12-03 北京工业大学 一种基于轨迹数据的路-车风险实时估计方法
CN114332153A (zh) * 2021-12-28 2022-04-12 京东方科技集团股份有限公司 一种车辆速度检测、撞车预警方法及电子设备

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101877174A (zh) * 2009-09-29 2010-11-03 杭州海康威视软件有限公司 车速测量方法、监控机及车速测量系统
JP2017084115A (ja) * 2015-10-28 2017-05-18 本田技研工業株式会社 車両制御装置、車両制御方法、および車両制御プログラム
CN111583715A (zh) * 2020-04-29 2020-08-25 宁波吉利汽车研究开发有限公司 一种车辆轨迹预测方法、车辆碰撞预警方法、装置及存储介质
CN112798811A (zh) * 2020-12-30 2021-05-14 杭州海康威视数字技术股份有限公司 速度测量方法、装置和设备
CN113744563A (zh) * 2021-08-02 2021-12-03 北京工业大学 一种基于轨迹数据的路-车风险实时估计方法
CN114332153A (zh) * 2021-12-28 2022-04-12 京东方科技集团股份有限公司 一种车辆速度检测、撞车预警方法及电子设备

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116740986A (zh) * 2023-08-09 2023-09-12 聊城市瀚格智能科技有限公司 一种隧道行车交通事故风险智能预警方法
CN116884235A (zh) * 2023-08-09 2023-10-13 广东省交通运输规划研究中心 基于撞线的视频车速检测方法、装置、设备以及存储介质
CN116884235B (zh) * 2023-08-09 2024-01-30 广东省交通运输规划研究中心 基于撞线的视频车速检测方法、装置、设备以及存储介质
CN116863124A (zh) * 2023-09-04 2023-10-10 所托(山东)大数据服务有限责任公司 车辆姿态确定方法、控制器及存储介质
CN116863124B (zh) * 2023-09-04 2023-11-21 所托(山东)大数据服务有限责任公司 车辆姿态确定方法、控制器及存储介质
CN116985827A (zh) * 2023-09-26 2023-11-03 无锡中马汽车配件制造有限公司 用于汽车减震器状态预警的车姿判断装置
CN116985827B (zh) * 2023-09-26 2023-12-15 无锡中马汽车配件制造有限公司 用于汽车减震器状态预警的车姿判断装置
CN117275126A (zh) * 2023-11-22 2023-12-22 盛视科技股份有限公司 车辆信息采集驱动控制方法及车道信息采集系统
CN117275126B (zh) * 2023-11-22 2024-03-05 盛视科技股份有限公司 车辆信息采集驱动控制方法及车道信息采集系统
CN117994741A (zh) * 2024-01-03 2024-05-07 广东智视云控科技有限公司 基于视频监控的车速检测方法、系统及存储介质
CN118196761A (zh) * 2024-05-17 2024-06-14 成都航空职业技术学院 一种针对交通标识线的图像识别方法和系统

Also Published As

Publication number Publication date
CN114332153A (zh) 2022-04-12

Similar Documents

Publication Publication Date Title
WO2023124383A1 (zh) 一种车辆速度检测、撞车预警方法及电子设备
WO2021004548A1 (zh) 一种基于双目立体视觉系统的车辆智能测速方法
US11200433B2 (en) Detection and classification systems and methods for autonomous vehicle navigation
CN112700470B (zh) 一种基于交通视频流的目标检测和轨迹提取方法
US12106574B2 (en) Image segmentation
Tao et al. Lane marking aided vehicle localization
CN110909711B (zh) 检测车道线位置变化的方法、装置、电子设备和存储介质
CN109359409A (zh) 一种基于视觉与激光雷达传感器的车辆可通过性检测系统
CN104050818B (zh) 基于目标跟踪和特征点匹配的运动车辆测速方法
JP6171612B2 (ja) 仮想レーン生成装置及びプログラム
JP6520740B2 (ja) 物体検出方法、物体検出装置、およびプログラム
Shunsuke et al. GNSS/INS/on-board camera integration for vehicle self-localization in urban canyon
CN108645375B (zh) 一种用于车载双目系统快速车辆测距优化方法
Liu et al. Vision-based real-time lane marking detection and tracking
Ravi et al. Lane width estimation in work zones using LiDAR-based mobile mapping systems
WO2023240805A1 (zh) 一种基于滤波校正的网联车超速预警方法及系统
CN111753639B (zh) 感知地图生成方法、装置、计算机设备和存储介质
US20230222688A1 (en) Mobile device positioning method and positioning apparatus
Tsai et al. Horizontal roadway curvature computation algorithm using vision technology
CN111612818A (zh) 新型双目视觉多目标跟踪方法及系统
CN113111707A (zh) 一种基于卷积神经网络的前车检测与测距方法
CN115273005A (zh) 一种基于改进yolo算法的视觉导航车环境感知方法
Luo et al. Automatic mileage positioning for road inspection using binocular stereo vision system and global navigation satellite system
JP5677281B2 (ja) 車両検知装置
Lu et al. Forward vehicle collision warning based on quick camera calibration

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22913647

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE