Vehicle anti-collision warning method, device, terminal equipment and storage medium
By obtaining the image in front of the driving vehicle, determining the location information of the target vehicle and the road's vanishing point, dividing the grid, and calculating the collision time, it solves the problem of low early warning accuracy in the existing technology and achieves higher real-time and accuracy. sex.
Patent Information
- Application Number
- CN202110047532.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-14
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2041-01-14
AI Technical Summary
Among the existing vehicle anti-collision warning methods, the warning accuracy is low, especially when measuring long distances, the accuracy is low and the cost is high, and real-time performance is difficult to guarantee.
By obtaining the image in front of the driving vehicle, the location information of the target vehicle and the road's vanishing point is determined, the grid is divided, the collision time between the driving vehicle and the target vehicle is calculated, and early warning information is sent when the collision time is less than the time threshold.
The real-time and accuracy of the vehicle anti-collision warning method is improved, it can cope with different road conditions and enhance the accuracy of early warning.
Smart Images

Figure CN112634359B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer vision technology, and in particular, relates to a vehicle anti-collision warning method, device, terminal equipment and storage medium. Background Art
[0002] With the continuous development of the automobile industry, vehicles have become an indispensable means of transportation in people's lives. The number of vehicles on the road has gradually increased, and the issue of safe driving has attracted more and more attention. From the analysis of vehicle traffic accidents, it is found that 80% of the accidents are caused by drivers' untimely response and improper operation, of which 65% are caused by rear-end collisions, and the rest are caused by side collisions, scratches, etc.
[0003] At present, most vehicle anti-collision warning methods use radar or binocular vision ranging methods to measure the distance to the obstacle vehicle in front, and then issue a safety warning. However, the distance measured by radar is short, and the accuracy is low when measuring at long distances. The binocular vision ranging method is expensive and difficult to ensure real-time performance, resulting in a decrease in the accuracy of the vehicle warning system. Therefore, exploring a vehicle anti-collision warning method with higher warning accuracy has become an important issue that needs to be solved urgently. Summary of the invention
[0004] The embodiments of the present application provide a vehicle collision avoidance warning method, device, terminal equipment and storage medium, which can solve the problem of low warning accuracy in existing vehicle collision avoidance methods.
[0005] In a first aspect, an embodiment of the present application provides a vehicle anti-collision warning method, the vehicle anti-collision warning method comprising:
[0006] Acquire N frames of images to be detected, where the images to be detected are images in front of the moving vehicle, and N is an integer greater than zero;
[0007] Acquire a target vehicle in the image to be detected;
[0008] Acquire a road vanishing point in the image to be detected and position information of the road vanishing point, wherein the position information of the road vanishing point refers to position information of the road vanishing point in the image to be detected;
[0009] According to the position information of the road vanishing point, the road area in the image to be detected is grid-divided to obtain M grid areas, where M is an integer greater than 1;
[0010] Determining a collision time between the moving vehicle and the target vehicle according to the M grid areas;
[0011] If the collision time is less than the time threshold, a warning message is sent.
[0012] In a second aspect, an embodiment of the present application provides a vehicle anti-collision warning device, the vehicle anti-collision warning device comprising:
[0013] An image acquisition module, used to acquire N frames of images to be detected, where the images to be detected are images in front of the moving vehicle, and N is an integer greater than zero;
[0014] A target determination module, used to determine the target vehicle in the image to be detected;
[0015] A position acquisition module, used to acquire the road vanishing point in the image to be detected and the position information of the road vanishing point, wherein the position information of the road vanishing point refers to the position information of the road vanishing point in the image to be detected;
[0016] A grid division module, used for performing grid division on the road area in the image to be detected according to the position information of the road vanishing point, to obtain M grid areas, where M is an integer greater than 1;
[0017] A determination module, used to determine the collision time between the moving vehicle and the target vehicle according to the M grid areas;
[0018] The sending module is used to send a warning message if the collision time is less than a time threshold.
[0019] In a third aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the vehicle collision avoidance warning method as described in the first aspect above are implemented.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the vehicle collision avoidance warning method as described in the first aspect above are implemented.
[0021] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes the steps of the vehicle collision avoidance warning method described in any one of the first aspects above.
[0022] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the present application obtains N frames of images to be detected in front of the moving vehicle, and then determines the target vehicle in the image to be detected (i.e., the obstacle vehicle in front of the moving vehicle). Since the target vehicle in each frame of the image is obtained, the real-time and accuracy of the vehicle anti-collision warning method can be guaranteed. At the same time, the road vanishing point in the image to be detected and the position information of the road vanishing point are obtained. Since each frame of the image to be detected is different, the road vanishing point and the position information of the road vanishing point in each frame of the image to be detected are also different. Different from the fixed road vanishing point in the prior art, the road vanishing point proposed in the present application is real-time, can cope with different road conditions, and has high accuracy. And according to the position information of the road vanishing point, the road area in the image to be detected is grid-divided, and the collision time between the moving vehicle and the target vehicle is determined according to the grid area. If the collision time is less than the time threshold, the warning information is sent, which can improve the warning accuracy in the vehicle anti-collision warning method. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0024] Figure 1 It is a flow chart of a vehicle anti-collision warning method provided in Example 1 of the present application;
[0025] Figure 2 is an example graph of a response graph;
[0026] Figure 3 This is an example diagram of the division of the grid area;
[0027] Figure 4 is the geometric relationship diagram between the camera and the target vehicle;
[0028] Figure 5 It is a structural schematic diagram of a vehicle anti-collision warning device provided in Example 2 of the present application;
[0029] Figure 6 It is a structural diagram of a terminal device provided in Example 3 of the present application. DETAILED DESCRIPTION
[0030] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0031] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0032] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0033] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0034] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0035] It should be understood that the size of the serial numbers of the steps in this embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0036] In order to illustrate the technical solution of the present application, specific embodiments are provided below.
[0037] Reference Figure 1 , shows a flow chart of a vehicle anti-collision warning method provided in Embodiment 1 of the present application, the vehicle anti-collision warning method is applied to a terminal device, and as shown in the figure, the vehicle anti-collision warning method may include the following steps:
[0038] Step 101, obtaining N frames of images to be detected, where N is an integer greater than zero.
[0039] In an embodiment of the present application, the image to be detected refers to an image in front of a moving vehicle. The image in front of the moving vehicle may be taken by a camera installed on the moving vehicle. After the camera takes the image in front of the moving vehicle, the image taken in front of the moving vehicle may be sent to a terminal device. The terminal device may obtain N frames of images to be detected by receiving the image in front of the moving vehicle sent by the camera in real time. The camera may be a vehicle-mounted camera installed on a moving vehicle, and its installation position may ensure that the camera takes the image in front of the moving vehicle.
[0040] Specifically, the terminal device that receives the image in front of the moving vehicle sent by the camera in real time can be an Advanced Driver Assistance System (ADAS) embedded platform. ADAS is a system that uses various sensors installed on the vehicle (such as millimeter wave radar, laser radar, single / binocular camera and satellite navigation) to sense the surrounding environment at any time during the vehicle's driving, collect data information of the surrounding environment (such as the vehicle's speed, road conditions, obstacle locations, etc.), and analyze and calculate the data information to increase the safety of vehicle driving. ADAS can transmit images through a mobile Ad Hoc network (such as transmitting the image in front of the moving vehicle sent by the camera in real time). The mobile Ad Hoc network can be formed by the interaction of wireless data transmission terminals loaded on the vehicle, without the support of other wired and wireless networks, and has a fast data transmission speed, which improves the real-time performance of the advanced driver assistance system.
[0041] Step 102, determining the target vehicle in the image to be detected.
[0042] Among them, the target vehicle in the image to be detected may refer to the obstacle vehicle in front of the above-mentioned moving vehicle. If there are multiple obstacle vehicles in front of the moving vehicle in the image to be detected, the vehicle occupying the largest area in the image to be detected is selected as the target vehicle. Obtaining the target vehicle in the image to be detected may refer to obtaining the position information of the target vehicle in the image to be detected.
[0043] Optionally, obtaining the position information of the target vehicle in the image to be detected includes:
[0044] If the image to be detected is a target image, the image to be detected is input into the first deep learning network to obtain the position information of the target vehicle in the image to be detected, where the target image is the first frame image or the image obtained every k frames, where k is an integer greater than zero and less than N.
[0045] In an embodiment of the present application, if the image to be detected is a target image, the image to be detected is input into the first deep learning network, the real position information of the target vehicle in the image to be detected is output, and the tracking position information of the target vehicle in the image to be detected is obtained through the filter tracker. If the error between the actual position information and the tracking position information is greater than the preset error threshold, the tracking position information is corrected according to the actual position information to eliminate the error, and the position information of the target vehicle in the image to be detected is output by the filter tracker. According to the position information of the target vehicle output by the filter tracker at this time, a partial image of the target vehicle is obtained from the image to be detected, and the partial image of the target vehicle is input into the second deep learning network, and the output is the target area of the target vehicle in the image to be detected. Among them, the target area can be framed in the form of a target frame in the image to be detected.
[0046] Specifically, the target image is an interval frame image in the image to be detected. First, the first frame image in the image to be detected is obtained as the target image, and then the image to be detected after the interval k frames is set to be the target image. Whether the image to be detected is the target image can be judged according to the frame number in which the acquired image is located. The position information of the target vehicle is located by using the interval frame method, which can improve the operating efficiency of the vehicle anti-collision warning device. Wherein, k is an integer greater than zero and less than N.
[0047] Exemplarily, assuming that the image to be detected currently acquired is the 6th frame image, according to the above scheme, the first frame image is set as the target image, and the image to be detected after an interval of 5 frames is also set as the target image, then the image to be detected currently acquired in the 6th frame is also the target image, and the relevant steps when the above-mentioned image to be detected is the target image need to be executed.
[0048] Specifically, the first deep learning network can use a trained lightweight deep learning network structure, input the image to be detected into the lightweight deep learning network, and directly output the real position information of the target vehicle in the image to be detected. The second deep learning network can be a trained regression neural network.
[0049] In a specific implementation, the tracking position information of the target vehicle in the image to be detected can be obtained through a filter tracker. A filter tracker based on the kernel correlation filter algorithm (KCF) can be used to extract the grayscale features of the previous frame of the image to be detected, and the target vehicle is tracked according to the grayscale features, and the tracking position information of the target vehicle in the image to be detected is output.
[0050] Optionally, obtaining the position information of the target vehicle in the image to be detected further includes:
[0051] If the image to be detected is not the target image, the position information of the target vehicle in the image to be detected is determined according to the position information of the target vehicle in the previous frame of the image to be detected.
[0052] In an embodiment of the present application, if the detected image is not the target image, the grayscale features of the previous frame of the image to be detected are extracted, and the target vehicle is tracked according to the grayscale features and the position information of the target vehicle in the previous frame of the image to be detected, and the tracking position information of the target vehicle in the image to be detected is obtained. According to the tracking position information, a partial image of the target vehicle is obtained, and the partial image of the target vehicle is input into the second deep learning network, and the output is the target area of the target vehicle in the image to be detected. Among them, the target area can be framed in the form of a target frame in the image to be detected.
[0053] Exemplarily, assuming that the image to be detected currently acquired is the 4th frame image, according to the above scheme, the first frame image is set as the target image, and the image to be detected after an interval of 5 frames is also set as the target image, then the image to be detected currently acquired in the 4th frame is not the target image, and the relevant steps when the above-mentioned acquired detection image is not the target image need to be executed.
[0054] It should be understood that the tracking position information of the target vehicle in the image to be detected in this embodiment can also adopt a KCF-based filter tracker, and the second deep learning network can be a trained regression neural network.
[0055] It should be noted that the filter tracker in this application can adopt a filter tracker based on the KCF algorithm, and can also adopt other filter tracking algorithms related to deep learning, which is not limited in this application.
[0056] Step 103: Acquire the road vanishing point and the position information of the road vanishing point in the image to be detected.
[0057] The position information of the road vanishing point may refer to the position information of the road vanishing point in the image to be detected. The road vanishing point in the image to be detected may be obtained by using a directional voting algorithm based on image features. The directional voting algorithm based on image features includes: according to the gradient direction corresponding to the candidate point of the road vanishing point in the image to be detected, a straight line is drawn through the candidate point, and the response values of the candidate points passed by the straight line are accumulated by 1. After traversing all the candidate points, according to the accumulated times corresponding to each candidate point, the candidate point with the largest accumulated times is determined as the road vanishing point of the image to be detected. The candidate points are obtained by preprocessing the image to be detected.
[0058] For example, see Figure 2The candidate points and candidate point gradient directions in the , candidate points with the same gradient direction can be connected as a straight line, for example, candidate point P and candidate point Q are connected, and pass through candidate point H, at this time, the values of candidate points P, Q, and H are all accumulated by 1. According to the above scheme, Figure 2 It can be concluded that the cumulative number of times corresponding to candidate point H is 4, the cumulative number of times corresponding to candidate point I is 2, and the cumulative numbers corresponding to the remaining candidate points in the figure are all 1, so candidate point H is determined to be the road vanishing point of the image to be detected.
[0059] Optionally, obtaining a road vanishing point in the image to be detected includes:
[0060] If the image to be detected is the first frame image, the target point corresponding to the optical center of the camera in the image to be detected is determined as the road vanishing point of the image to be detected;
[0061] If the image to be detected is not the first frame image, then obtaining the road vanishing point of the previous frame image of the image to be detected, and determining the local image of the road vanishing point in the previous frame image;
[0062] Get the grayscale image of the local image;
[0063] Obtain a pixel direction map corresponding to the grayscale image, where the direction map includes the direction angle corresponding to each pixel point in the grayscale image;
[0064] Perform edge detection on the grayscale image to obtain an edge detection image;
[0065] Perform image difference calculation on the grayscale image to obtain a difference image;
[0066] Determine a candidate point set map according to the edge detection map and the difference map, wherein the candidate point set map includes at least one candidate point, and the candidate point is obtained by filtering pixel points in the edge detection map and the difference map;
[0067] According to the candidate point set map and the pixel direction map, a response map corresponding to the candidate point set map is obtained, and the point with the largest response value in the response map is determined to be the road vanishing point in the image to be detected, wherein the response value of a candidate point in the response map is the number of times the candidate point is crossed by a straight line, and the straight line passing through the candidate point is obtained by gathering candidate points with the same gradient direction as the candidate point.
[0068] In the embodiment of the present application, the target point corresponding to the optical center of the camera in the image to be detected can be determined by first obtaining the optical center position coordinates of the camera according to the camera calibration, thereby calibrating the position coordinates (cx, cy) of the target point corresponding to the optical center position coordinates of the camera in the image to be detected according to the optical center position coordinates of the camera. If the image to be detected is the first frame image, the position coordinates (cx, cy) of the target point are determined to be the position coordinates of the road vanishing point in the first frame image, thereby updating the position information of the road vanishing point in the collected image to be detected according to the position coordinates of the road vanishing point in the first frame image.
[0069] The image to be detected is not the first frame image, which may mean that the acquisition time of the image to be detected is later than the acquisition time of the first frame image, and the road vanishing point of the image to be detected is updated according to the road vanishing point of the previous frame image, specifically including:
[0070] First, a local image of the road vanishing point of the previous frame image is obtained, and the local image is compressed, and the compressed local image is converted into a grayscale image, and the grayscale image is subjected to Gaussian filtering to smooth the image, and the grayscale image after Gaussian filtering is obtained, and the grayscale image is input as an input image into a directional filter (including filter convolution kernels with different directions), and the gradient direction of each pixel point can be obtained by sliding convolution on the grayscale image through the convolution kernel, and the pixel direction map corresponding to the grayscale image can be obtained by traversing all the pixels in the image to be detected. At the same time, edge detection is performed on the grayscale image after Gaussian filtering to obtain an edge detection map, and the grayscale image is subjected to differential calculation (i.e., sliding convolution calculation is performed on the grayscale image using the convolution kernel), the pixel value of each pixel point in the grayscale image is obtained, and a differential map is obtained. Secondly, the pixel points whose gradient direction is close to the vertical direction in the edge detection image are filtered to obtain the candidate points of the road vanishing point in the edge detection image, and the pixel values in the difference image are filtered to obtain the candidate points of the road vanishing point in the difference image. The candidate points in the edge detection image and the difference image are fused (for example, by using the point set addition method to fuse), and the candidate point set map is determined. Finally, according to the candidate point set map and the pixel direction map, the above-mentioned direction voting algorithm based on image features is used to obtain the response map corresponding to the candidate point set map, and the point with the largest response value is determined as the road vanishing point in the image to be detected.
[0071] It should be understood that performing sliding convolution on a grayscale image through a convolution kernel may mean that a region centered on each pixel position in the grayscale image is convolved with the convolution kernel, and the size of the region centered on each pixel position is the same as the size of the convolution kernel, wherein the convolution kernel is a matrix with odd rows and columns.
[0072] It should also be understood that the compression scale that can be used for image compression of the local image is 160*90, and the pixel values in the difference image that are less than a threshold are filtered, and the threshold may be 0.05.
[0073] Step 104 , gridding the road area in the image to be detected according to the position information of the road vanishing point to obtain M grid areas, where M is an integer greater than 1.
[0074] The position information of the road vanishing point may refer to the position information of the vanishing point in the image to be detected, and the position information may be represented by position coordinates.
[0075] In this embodiment, the horizontal coordinate of the position coordinate of the road vanishing point is used as the horizontal coordinate of the center of the grid division area, and the vertical coordinate of the grid division area is set to 50 meters. The grid division is performed according to the size of the grid division area to obtain M grid areas. The grid division area may refer to the area within 50 meters in front of the vehicle.
[0076] For example, see Figure 3 , where 301 refers to the road vanishing point in the image to be detected, 302 refers to the grid area obtained by division, and each grid represents a 5-meter interval vertically and a 1-meter interval horizontally, and the total vertical length of the grid is 50 meters. Figure 3 The road vanishing point in the figure refers to the intersection point of parallel straight lines at infinity.
[0077] Step 105: determining the collision time between the moving vehicle and the target vehicle according to the M grid areas.
[0078] In this embodiment, the distance between the moving vehicle and the target vehicle can be determined based on the M grid areas, and the collision time between the moving vehicle and the target vehicle can be determined based on the distance between the moving vehicle and the target vehicle and the relative speed between the moving vehicle and the target vehicle. The relative speed between the moving vehicle and the target vehicle is calculated based on the variation of the distance measurement results (i.e., the distance between the moving vehicle and the target vehicle) in the continuous frame images before the image to be detected. The distance between the moving vehicle and the target vehicle determined based on the M grid areas is the real distance in the actual road scene.
[0079] Specifically, after determining the distance between the moving vehicle and the target vehicle, filtering and denoising is performed on the distance measurement result, wherein the filtering and denoising of the distance measurement result may adopt a Kalman filter algorithm.
[0080] Optionally, determining the distance between the moving vehicle and the target vehicle according to the position information of the target vehicle in the image to be detected and the M grid areas includes:
[0081] According to the position information of the target vehicle in the image to be detected, a target frame in the image to be detected is determined, and the target frame is used to frame the area of the target vehicle in the image to be detected;
[0082] If there is an overlapping area between the target frame and the M grid areas, the distance between the moving vehicle and the target vehicle is determined based on the target frame and the M grid areas;
[0083] If there is no overlapping area between the target frame and the M grid areas, the distance between the moving vehicle and the target vehicle is determined based on the camera's intrinsic parameters, the target frame, and the position information of the road vanishing point.
[0084] In an embodiment of the present application, the target frame of the image to be detected can be determined by inputting a partial image containing the target vehicle in the image to be detected into a trained recurrent neural network, and determining the output rectangular frame containing the target vehicle as the target frame in the image to be detected.
[0085] Among them, Figure 3 As shown, when the target frame falls within the grid area, the distance between the moving vehicle and the target vehicle can be divided into multiple segments (at least two segments) of linear proportional relationships according to the size of the grid area, and the distance between the moving vehicle and the target vehicle is determined according to the above linear proportional relationships.
[0086] The camera's internal parameters can be obtained by calibrating the camera using a chessboard. Among them, fx and fy are the focal length of the camera on the x-axis and the focal length of the y-axis in the image coordinate system, respectively, and cx and cy are the offset of the camera's optical axis on the x-axis and the offset of the y-axis in the image coordinate system, respectively.
[0087] Optionally, if there is no overlapping area between the target frame and the M grid areas, determining the distance between the moving vehicle and the target vehicle according to the intrinsic parameters of the camera, the target frame, and the position information of the road vanishing point includes:
[0088] If there is no overlapping area between the target frame and the M grid areas, the installation height of the camera on the moving vehicle and the position information of the midpoint of the lower frame of the target frame in the image to be detected are obtained;
[0089] Determine the distance between the midpoint and the road vanishing point according to the position information of the midpoint and the road vanishing point in the image to be detected;
[0090] According to the optical center coordinates of the camera, determine the target point corresponding to the optical center in the image to be detected, as well as the position information of the target point in the image to be detected;
[0091] Determine the distance between the target point and the road vanishing point according to the position information of the target point and the road vanishing point in the image to be detected;
[0092] Determine the pitch angle of the camera based on the coordinates of the optical center and the distance between the target point and the road vanishing point;
[0093] The distance between the moving vehicle and the target vehicle is determined based on the installation height, the distance between the midpoint and the road vanishing point, the distance between the target point and the road vanishing point, and the pitch angle.
[0094] In the embodiment of the present application, the intrinsic parameters of the camera may refer to the optical center coordinates of the camera and the focal length of the camera. The optical center coordinates of the camera are calibrated (cx, cy), and the focal length of the camera is F c ,Right now Figure 4 The distance between the middle and OB.
[0095] The installation height of the camera on a moving vehicle can be the distance from the installation position of the camera to the road surface. The position information of the midpoint of the lower frame of the target frame in the image to be detected can be represented by the position coordinates. The distance between the midpoint and the road vanishing point is the difference between the longitudinal coordinates of the road vanishing point and the midpoint of the lower frame of the target frame. The distance between the target point and the road vanishing point is the difference between the longitudinal coordinates of the target point and the road vanishing point. The pitch angle of the camera can be obtained by the distance between the optical center coordinates and the target point, and the focal length of the camera can be obtained by trigonometric calculation based on the focal length of the camera and the difference between the longitudinal coordinates of the target point and the road vanishing point.
[0096] For example, by Figure 4 The geometric constraint relationship in the figure illustrates the specific scheme for obtaining the distance between the moving vehicle and the target vehicle in this application. In the figure, point O is the optical center of the camera, OB is the direction of the optical axis of the camera, AC is the imaging plane of the image in front of the moving vehicle, and the focal distance line segment OB between the optical center of the camera O and AC is the focal length F c , the camera is installed at a height of H on the moving vehicle c , point A is the road vanishing point, point D is the midpoint of the lower frame of the target vehicle, point C is the corresponding point of the midpoint of the lower frame of the target vehicle in the imaging plane, and the ordinate of the road vanishing point in the imaging plane is a y , the ordinate of point B on the imaging plane is c y , the ordinate of point C on the imaging plane is c y1 , then the distance between AB can be expressed as |a y -c y |, the calculation formula of the pitch angle can be expressed as follows:
[0097]
[0098] pass Figure 4 From the geometric constraints in , we can get that triangle OCA and triangle ODF are similar triangles, and there is the following proportional relationship between triangle OCA and triangle ODF:
[0099]
[0100] Where OB is the focal length F c , AC is the difference between the ordinates of point A and point C. According to the relationship between trigonometric functions, the size of DF is H. c / cosθ, according to the above known values, the size of line segment OE can be calculated by the above formula:
[0101]
[0102] From the geometric relationship in triangle OEF, OF=OE / cosθ, and from the geometric relationship in triangle DGF, FG=H c tanθ, then the distance between the moving vehicle and the target vehicle d = OF-FG.
[0103] Step 106: If the collision time is less than the time threshold, a warning message is sent.
[0104] In the embodiment of the present application, the relative speed between the moving vehicle and the target vehicle is obtained as v, the distance between the moving vehicle and the target vehicle in the image to be detected is d, and the collision time is obtained as t according to the ratio of the distance between the moving vehicle and the target vehicle and the relative speed. When the collision time is less than the set time threshold, the terminal device sends a warning message to remind the driver to slow down or keep a safe distance.
[0105] The present application obtains N frames of images to be detected in front of the moving vehicle, and then obtains the target vehicle in the image to be detected (i.e., the obstacle vehicle in front of the moving vehicle). Since the target vehicle in each frame of the image is obtained, the real-time and accuracy of the vehicle anti-collision warning method can be guaranteed. At the same time, the road vanishing point and the position information of the road vanishing point in the image to be detected are obtained. Since each frame of the image to be detected is different, the road vanishing point and the position information of the road vanishing point in each frame of the image to be detected are also different. Different from the fixed road vanishing point in the prior art, the road vanishing point proposed in the present application is real-time, can cope with different road conditions, and has high accuracy. And according to the position information of the road vanishing point, the road area in the image to be detected is grid-divided, and the collision time between the moving vehicle and the target vehicle is determined according to the grid area. If the collision time is less than the time threshold, the warning information is sent, which can improve the warning accuracy in the vehicle anti-collision warning method.
[0106] Reference Figure 5 , shows a schematic diagram of the structure of a vehicle anti-collision warning device provided in Embodiment 2 of the present application. For the sake of convenience, only the parts related to the embodiment of the present application are shown. The vehicle anti-collision warning device may specifically include the following modules:
[0107] An image acquisition module 501 is used to acquire N frames of images to be detected, where the images to be detected are images in front of the moving vehicle, and N is an integer greater than zero;
[0108] A target determination module 502 is used to determine a target vehicle in the image to be detected;
[0109] A position acquisition module 503 is used to acquire the road vanishing point and the position information of the road vanishing point in the image to be detected, where the position information of the road vanishing point refers to the position information of the road vanishing point in the image to be detected;
[0110] A grid division module 504 is used to divide the road area in the image to be detected into grids according to the position information of the road vanishing point, and obtain M grid areas, where M is an integer greater than 1;
[0111] A determination module 505, for determining a collision time between the moving vehicle and the target vehicle according to the M grid areas;
[0112] The sending module 506 is configured to send a warning message if the collision time is less than a time threshold.
[0113] In the embodiment of the present application, the determination module 505 may specifically include the following submodules:
[0114] A distance determination submodule is used to determine the distance between the moving vehicle and the target vehicle based on the M grid areas;
[0115] The time determination submodule is used to determine the collision time between the moving vehicle and the target vehicle according to the distance between the moving vehicle and the target vehicle.
[0116] In an embodiment of the present application, the vehicle anti-collision warning device further includes:
[0117] A target position acquisition module is used to obtain the position information of the target vehicle in the image to be detected;
[0118] The target distance determination module is used to determine the distance between the moving vehicle and the target vehicle according to the position information of the target vehicle in the image to be detected and the M grid areas.
[0119] Optionally, the target distance determination module may include the following submodules:
[0120] The target frame determination submodule is used to determine the target frame in the image to be detected according to the position information of the target vehicle in the image to be detected. The target frame is used to frame the area of the target vehicle in the image to be detected;
[0121] A first determination submodule is used to determine the distance between the moving vehicle and the target vehicle according to the target frame and the M grid areas if there is an overlapping area between the target frame and the M grid areas;
[0122] The second determination submodule is used to determine the distance between the moving vehicle and the target vehicle according to the intrinsic parameters of the camera, the target frame and the position information of the road vanishing point if there is no overlapping area between the target frame and the M grid areas.
[0123] Optionally, the second determining submodule is specifically used for:
[0124] If there is no overlapping area between the target frame and the M grid areas, the installation height of the camera on the moving vehicle and the position information of the midpoint of the lower frame of the target frame in the image to be detected are obtained;
[0125] Determine the distance between the midpoint and the road vanishing point according to the position information of the midpoint and the road vanishing point in the image to be detected;
[0126] According to the optical center coordinates of the camera, determine the target point corresponding to the optical center in the image to be detected, as well as the position information of the target point in the image to be detected;
[0127] Determine the distance between the target point and the road vanishing point according to the position information of the target point and the road vanishing point in the image to be detected;
[0128] Determine the pitch angle of the camera based on the coordinates of the optical center and the distance between the target point and the road vanishing point;
[0129] The distance between the moving vehicle and the target vehicle is determined based on the installation height, the distance between the midpoint and the road vanishing point, the distance between the target point and the road vanishing point, and the pitch angle.
[0130] Optionally, the target location acquisition module is specifically used for:
[0131] If the image to be detected is a target image, the image to be detected is input into the first deep learning network to obtain the position information of the target vehicle in the image to be detected, where the target image is the first frame image and the images obtained every k frames, where k is an integer greater than zero and less than N;
[0132] If the image to be detected is not the target image, the position information of the target vehicle in the image to be detected is determined according to the position information of the target vehicle in the previous frame of the image to be detected.
[0133] In the embodiment of the present application, the location acquisition module 503 may specifically include the following submodules:
[0134] The target point determination submodule is used to determine the target point corresponding to the optical center of the camera in the image to be detected as the road vanishing point of the image to be detected if the image to be detected is the first frame image;
[0135] A local determination submodule, for obtaining a road vanishing point of a previous frame of the image to be detected if the image to be detected is not the first frame of the image, and determining a local image of the road vanishing point in the previous frame of the image;
[0136] Grayscale acquisition submodule, used to obtain the grayscale image of the local image;
[0137] A direction acquisition submodule is used to obtain a pixel direction map corresponding to the grayscale image, where the pixel direction map includes a direction angle corresponding to each pixel point in the grayscale image;
[0138] The detection submodule is used to perform edge detection on the grayscale image to obtain an edge detection image;
[0139] A calculation submodule is used to perform image difference calculation on the grayscale image to obtain a difference image;
[0140] A candidate point determination submodule, used to determine a candidate point set map according to the edge detection map and the difference map, wherein the candidate point set map includes at least one candidate point, wherein the candidate point is obtained by filtering the pixel points in the edge detection map and the difference map;
[0141] The vanishing point determination submodule is used to obtain the response map corresponding to the candidate point set map according to the candidate point set map and the pixel direction map, and determine that the point with the largest response value in the response map is the road vanishing point in the image to be detected, wherein the response value of a candidate point in the response map is the number of times the candidate point is crossed by a straight line, and the straight line passing through the candidate point is obtained by gathering the candidate points with the same gradient direction as the candidate point.
[0142] The vehicle anti-collision warning device provided in the embodiment of the present application can be applied in the aforementioned method embodiment. For details, please refer to the description of the aforementioned method embodiment, which will not be repeated here.
[0143] Figure 6 Schematic diagram of the structure of the terminal device provided in the third embodiment of the present application. Figure 6 As shown, the terminal device 6 of this embodiment includes: at least one processor 610 ( Figure 6 Only one is shown in the figure) a processor, a memory 620, and a computer program 621 stored in the memory 620 and executable on the at least one processor 610, wherein the processor 610 implements the steps in any of the above-mentioned vehicle collision avoidance warning method embodiments when executing the computer program 621.
[0144] The terminal device 600 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor 610 and a memory 620. Those skilled in the art will appreciate that Figure 6 It is only an example of the terminal device 600 and does not constitute a limitation on the terminal device 600. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0145] The processor 610 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0146] In some embodiments, the memory 620 may be an internal storage unit of the terminal device 600, such as a hard disk or memory of the terminal device 600. In other embodiments, the memory 620 may also be an external storage device of the terminal device 600, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal device 600. Further, the memory 620 may also include both an internal storage unit of the terminal device 600 and an external storage device. The memory 620 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 620 may also be used to temporarily store data that has been output or is to be output.
[0147] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0148] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0149] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0150] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0151] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0152] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0153] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0154] The present application implements all or part of the processes in the above-mentioned embodiment method, and may also be completed through a computer program product. When the computer program product runs on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0155] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application is described in detail with reference to the above-mentioned embodiments, a person skilled in the art should understand that the technical solutions described in the above-mentioned embodiments can still be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A vehicle anti-collision warning method, It is characterized in that The vehicle anti-collision warning method comprises: Acquire N frames of images to be detected, where the images to be detected are images in front of the moving vehicle, and N is an integer greater than zero; Determining a target vehicle in the image to be detected; Acquire a road vanishing point in the image to be detected and position information of the road vanishing point, wherein the position information of the road vanishing point refers to position information of the road vanishing point in the image to be detected; According to the position information of the road vanishing point, the road area in the image to be detected is grid-divided to obtain M grid areas, where M is an integer greater than 1; Determining a collision time between the moving vehicle and the target vehicle according to the M grid areas; If the collision time is less than the time threshold, a warning message is sent; Determining the collision time between the moving vehicle and the target vehicle according to the M grid areas includes: Determining the distance between the moving vehicle and the target vehicle according to the M grid areas; Determining a collision time between the moving vehicle and the target vehicle according to a distance between the moving vehicle and the target vehicle; After determining the target vehicle in the image to be detected, the method further includes: Obtaining position information of the target vehicle in the image to be detected; Determining the distance between the moving vehicle and the target vehicle according to the M grid areas includes: Determine the distance between the moving vehicle and the target vehicle according to the position information of the target vehicle in the image to be detected and the M grid areas; The image to be detected is collected by a camera, and determining the distance between the moving vehicle and the target vehicle according to the position information of the target vehicle in the image to be detected and the M grid areas includes: Determine a target frame in the image to be detected according to the position information of the target vehicle in the image to be detected, wherein the target frame is used to frame and select an area of the target vehicle in the image to be detected; If there is an overlapping area between the target frame and the M grid areas, determining the distance between the moving vehicle and the target vehicle according to the target frame and the M grid areas; If there is no overlapping area between the target frame and the M grid areas, the distance between the moving vehicle and the target vehicle is determined according to the intrinsic parameters of the camera, the target frame and the position information of the road vanishing point.
2. The vehicle anti-collision warning method according to claim 1, It is characterized in that The internal parameters of the camera include the coordinates of the optical center of the camera. If there is no overlapping area between the target frame and the M grid areas, determining the distance between the moving vehicle and the target vehicle according to the internal parameters of the camera, the target frame and the position information of the road vanishing point includes: If there is no overlapping area between the target frame and the M grid areas, obtaining the installation height of the camera on the moving vehicle and the position information of the midpoint of the lower frame of the target frame in the image to be detected; Determine the distance between the midpoint and the road vanishing point according to the position information of the midpoint and the road vanishing point in the image to be detected; Determine, according to the optical center coordinates of the camera, a target point corresponding to the optical center in the image to be detected, and position information of the target point in the image to be detected; Determining the distance between the target point and the road vanishing point according to the position information of the target point and the road vanishing point in the image to be detected; Determining the pitch angle of the camera according to the optical center coordinates and the distance between the target point and the road vanishing point; The distance between the traveling vehicle and the target vehicle is determined according to the installation height, the distance between the midpoint and the road vanishing point, the distance between the target point and the road vanishing point, and the pitch angle.
3. The vehicle anti-collision warning method according to claim 1, It is characterized in that The obtaining of the position information of the target vehicle in the image to be detected comprises: If the image to be detected is a target image, the image to be detected is input into a first deep learning network to obtain the position information of the target vehicle in the image to be detected, where the target image is the first frame image or the image obtained every k frames, where k is an integer greater than zero and less than N; If the image to be detected is not the target image, the position information of the target vehicle in the image to be detected is determined according to the position information of the target vehicle in a previous frame of the image to be detected.
4. The vehicle anti-collision warning method according to any one of claims 1 to 3, It is characterized in that The image to be detected is collected by a camera, and obtaining the road vanishing point in the image to be detected includes: If the image to be detected is the first frame image, determining the target point corresponding to the optical center of the camera in the image to be detected as the road vanishing point of the image to be detected; If the image to be detected is not the first frame image, obtaining a road vanishing point of a frame image before the image to be detected, and determining a local image of the road vanishing point in the previous frame image; Obtaining a grayscale image of the local image; Obtain a pixel direction map corresponding to the grayscale image, wherein the pixel direction map includes a direction angle corresponding to each pixel point in the grayscale image; Performing edge detection on the grayscale image to obtain an edge detection image; Performing image difference calculation on the grayscale image to obtain a difference image; Determine a candidate point set map according to the edge detection map and the difference map, wherein the candidate point set map includes at least one candidate point, and the candidate point is obtained by filtering pixel points in the edge detection map and the difference map; According to the candidate point set map and the pixel direction map, a response map corresponding to the candidate point set map is obtained, and the point with the largest response value in the response map is determined to be the road vanishing point in the image to be detected, wherein the response value of a candidate point in the response map is the number of times the candidate point is crossed by a straight line, and the straight line passing through the candidate point is obtained by gathering candidate points with the same gradient direction as the candidate point.
5. A vehicle anti-collision warning device, It is characterized in that The vehicle anti-collision warning device comprises: An image acquisition module, used to acquire N frames of images to be detected, where the images to be detected are images in front of the moving vehicle, and N is an integer greater than zero; A target determination module, used to determine the target vehicle in the image to be detected; A position acquisition module, used to acquire the road vanishing point in the image to be detected and the position information of the road vanishing point, wherein the position information of the road vanishing point refers to the position information of the road vanishing point in the image to be detected; A grid division module, used for performing grid division on the road area in the image to be detected according to the position information of the road vanishing point, to obtain M grid areas, where M is an integer greater than 1; A determination module, used to determine the collision time between the moving vehicle and the target vehicle according to the M grid areas; A sending module, configured to send a warning message if the collision time is less than a time threshold; The determination module comprises: A distance determination submodule, used to determine the distance between the moving vehicle and the target vehicle according to the M grid areas; A time determination submodule, used to determine the collision time between the moving vehicle and the target vehicle according to the distance between the moving vehicle and the target vehicle; The vehicle anti-collision warning device also includes: A target position acquisition module, used to acquire the position information of the target vehicle in the image to be detected; Correspondingly, the determining module further includes: A target distance determination module, used to determine the distance between the moving vehicle and the target vehicle according to the position information of the target vehicle in the image to be detected and the M grid areas; The target distance determination module comprises: A target frame determination submodule, used to determine a target frame in the image to be detected according to the position information of the target vehicle in the image to be detected, wherein the target frame is used to frame and select an area of the target vehicle in the image to be detected; A first determination submodule, configured to determine the distance between the moving vehicle and the target vehicle according to the target frame and the M grid areas if there is an overlapping area between the target frame and the M grid areas; The second determination submodule is used to determine the distance between the moving vehicle and the target vehicle according to the intrinsic parameters of the camera, the target frame and the position information of the road vanishing point if there is no overlapping area between the target frame and the M grid areas.
6. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.
7. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
