A method and device for calculating the heading angle of a target vehicle based on visual information
By obtaining the detection frame of the target vehicle from the target detection network, combining the number and position of the wheels, and using different formulas to calculate the heading angle, the problem of difficulty in calculating the heading angle of the target vehicle according to different forms of vehicle conditions in the prior art is solved, and the accurate heading angle calculation under different driving conditions is achieved.
Patent Information
- Application Number
- CN202210182625.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-27
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2042-02-27
AI Technical Summary
It is difficult for the prior art to calculate the heading angle of the target vehicle under different driving conditions using different calculation methods based on different forms of vehicle conditions.
By obtaining the detection frame of the target vehicle from the target detection network, the intersection ratio of the rear frame, the front frame and the wheel frame with the target box are calculated, and combining the number and position of the wheels, different formulas are used to calculate the heading angle, including the use of the cosine function and the sine function to calculate the heading angle.
It realizes the accurate calculation of the heading angle of the target vehicle under different driving conditions, and the inspection is more comprehensive and the results are accurate and reliable.
Smart Images

Figure CN114549645B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automobile intelligent driving technology, and in particular to a method and device for calculating a target vehicle heading angle based on visual information. Background Art
[0002] In the external vision of autonomous driving, it is very necessary to estimate the posture and calculate the attributes of other target vehicles on the road. The attributes of the target can be used to effectively avoid the target vehicle and respond to the target vehicle's behavior in a timely manner to ensure the safety of the vehicle. Among them, the heading angle is an important point in the target vehicle's attributes. The heading angle is the angle between the target vehicle's body direction and the vehicle's body direction in the ground coordinate system.
[0003] Regarding the current technical solutions for target vehicle heading angle calculation, the Chinese invention patent with publication number CN111291786A discloses a vehicle-mounted visual real-time multi-target heading angle estimation method and device, which directly uses neural networks and data labels through deep learning, and directly uses the network to output the heading angle size, but this method requires a large amount of calibration data support and model training process; the Chinese invention patent with publication number CN110962844A discloses a vehicle heading angle correction method and system storage medium and terminal. The calculation of the heading angle only mentions the situation when the wheels on the same side are detected at the same time, but does not mention the situation when both wheels are not detected, which has certain limitations. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, the technical problem to be solved by the present invention is: how to provide a method for calculating the heading angle under different driving conditions by using different calculation methods according to different vehicle conditions.
[0005] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0006] A method for calculating a target vehicle heading angle based on visual information, characterized in that it comprises the following steps:
[0007] (1) Obtain the detection frame of the target vehicle from the target detection network. The detection frame includes the entire target frame, the vehicle rear frame, the vehicle front frame, and the wheel frame. Detect the pixel coordinates of the upper left point and the lower right point of the frame rectangle of the target frame, the vehicle body frame, the vehicle rear frame, the vehicle front frame, and the wheel frame, respectively. Calculate the pixel coordinate information of the required ground point of the detection frame, and convert the pixel coordinates into the distance information of the world coordinate system by calling the coordinate conversion function;
[0008] (2) According to the pixel coordinates of the vehicle body frame, the vehicle tail frame, the vehicle front frame and the wheel frame, the intersection and union ratios of the vehicle tail frame, the vehicle front frame and the wheel frame with the target whole frame are calculated respectively, the target frames detected by the same target are integrated, and the position of the detected part of the target vehicle is determined. If the vehicle tail frame is detected, step (3) is executed; if the vehicle front frame is detected, step (4) is executed; if only the target whole frame is detected, step (5) is executed;
[0009] (3) Determine the number of wheels detected. If the number of wheels detected is greater than or equal to 2, and the lateral distances between the grounding point C(X, Y) of the rear frame and the grounding points of each wheel are greater than 0 or less than 0, the wheels are on the same side; otherwise, they are on the opposite side;
[0010] If the wheels are on the same side, select the two wheels with the largest distance between the wheel contact points among all the wheels, namely wheel A (X1, Y1) and wheel B (X2, Y2). According to the distance between these two wheels and the tail frame contact point C (X, Y), determine the wheel orientation, such as Then wheel B is the wheel close to the rear frame, and the direction vector pointing to the front of the vehicle determined by the two wheels is The direction vector of the vehicle is the unit vector The angle between the vehicle and the target vehicle is calculated according to the cosine function:
[0011]
[0012] According to the vehicle's circumferential heading angle coverage of -360° to 360°, the positive and negative angles are calculated using the sine function:
[0013]
[0014] like Then θ=-θ, otherwise θ=θ;
[0015] If the wheel is on the opposite side, calculate the coordinates of the line connecting the midpoint of the line connecting wheel N (X1, Y1) and wheel M (X2, Y2) and the line connecting the tail frame grounding point C (X, Y), and point to the direction vector of the target vehicle's head frame, that is, Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ① and formula ②;
[0016] If the number of wheels detected is 1, the position of the wheel is determined based on the lateral distance difference between the grounding point C(X, Y) of the rear frame and the grounding point of the wheel. If it is greater than 0, the direction vector of the vehicle is calculated based on the pixel coordinates Z(X1, Y1) of the lower right point of the rear frame and the coordinates A(X2, Y2) of the grounding point of the wheel. Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ① and formula ②; if the difference is less than 0, calculate the direction vector of the vehicle according to the pixel coordinates Z (X3, Y3) of the lower left corner of the rear frame and the coordinates A (X2, Y2) of the wheel contact point Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ① and formula ②
[0017] If the number of wheels detected is 0, the intersection and union ratio of the rear frame and the target frame is used to determine that the rear of the target vehicle is facing the vehicle. If the intersection and union ratio of the rear frame and the target frame is greater than k, the k value range is 0.93-0.95, the target vehicle is judged to be facing the vehicle, and the heading angle of the target vehicle is determined according to the camera of the vehicle. If the intersection and union ratio of the rear frame and the target frame is less than or equal to k, the k value range is 0.93-0.95, the lateral speed and longitudinal speed of the target vehicle are obtained, and the heading angle of the target vehicle is calculated by trigonometric functions in combination with the longitudinal speed of the vehicle.
[0018] (4) Determine the number of wheels detected. If the number of wheels detected is greater than or equal to 2, and the lateral distances between the head frame grounding point C (X, Y) and the grounding points of each wheel are greater than 0 or less than 0, the wheels are on the same side, otherwise they are on the opposite side;
[0019] If the wheels are on the same side, select the two wheels with the largest distance between the wheel contact points among all the wheels, namely wheel A (X1, Y1) and wheel B (X2, Y2), and determine the wheel orientation based on the distance between these two wheels and the head frame contact point C (X, Y), such as Then wheel A is the wheel close to the front frame, and the direction vector pointing to the front of the vehicle determined by the two wheels is The direction vector of the vehicle is the unit vector The angle between the vehicle and the target vehicle is calculated according to the cosine function:
[0020]
[0021] According to the vehicle's circumferential heading angle coverage of -360° to 360°, the positive and negative angles are calculated using the sine function:
[0022]
[0023] like Then θ=-θ, otherwise θ=θ;
[0024] If the wheel is on the opposite side, calculate the coordinates of the line connecting the midpoint of the wheel N (X1, Y1) and the wheel M (X2, Y2) and the line connecting the head frame grounding point C (X, Y), and point to the direction vector of the target vehicle head frame, that is, Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ③ and formula ④;
[0025] If the number of wheels detected is 1, the position of the wheel is determined based on the lateral distance difference between the grounding point C (X, Y) of the front frame and the grounding point of the wheel. If it is greater than 0, the direction vector of the vehicle is calculated based on the pixel coordinates Z (X1, Y1) of the lower right point of the front frame and the coordinates A (X2, Y2) of the grounding point of the wheel. Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ③ and formula ④. If the difference is less than 0, calculate the direction vector of the vehicle according to the pixel coordinates Z (X3, Y3) of the lower left corner of the vehicle head frame and the coordinates A (X2, Y2) of the wheel contact point. Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ③ and formula ④;
[0026] If the number of wheels detected is 0, the intersection and union ratio of the front frame and the target frame is judged. If the intersection and union ratio of the front frame and the target frame is greater than k, the range of k value is 0.93-0.95, it is judged that the head of the target vehicle is facing the host vehicle, and the heading angle of the target vehicle is determined according to the camera of the host vehicle; if the intersection and union ratio of the front frame and the target frame is less than or equal to k, the range of k value is 0.93-0.95, the lateral speed and longitudinal speed of the target vehicle are obtained, and the heading angle of the target vehicle is calculated by trigonometric function in combination with the longitudinal speed of the host vehicle;
[0027] (5) If two wheels are detected, determine the target vehicle's direction vector based on the line connecting the two wheels and the direction of the target vehicle's longitudinal velocity. Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ① and formula ②;
[0028] If only one wheel is detected, the lateral and longitudinal velocities of the target vehicle are obtained according to the tracking logic, and the heading angle of the target vehicle is calculated using trigonometric functions in combination with the longitudinal velocity of the vehicle.
[0029] As an optimization, if any of the detection conditions in steps (3) to (5) cannot be met, the heading angle is 0.
[0030] As an optimization, in step (3), if the number of wheels detected is greater than or equal to 2, the heading angle confidence is 1; if the number of wheels detected is 1 and the lateral distance difference between the grounding point of the rear frame and the grounding point of the wheel is greater than 0, the heading angle confidence is 0.1; if the number of wheels detected is 0 and the intersection-and-joint ratio of the rear frame to the target frame is greater than k, the heading angle confidence is 1; if the number of wheels detected is 0 and the intersection-and-joint ratio of the rear frame to the target frame is less than or equal to k, the heading angle confidence is 0;
[0031] In step (4), if the number of wheels detected is greater than or equal to 2, the heading angle confidence is 1; if the number of wheels detected is 1 and the lateral distance difference between the grounding point of the rear frame and the grounding point of the wheel is greater than 0, the heading angle confidence is 0.1; if the number of wheels detected is 0 and the intersection-and-joint ratio of the front frame to the target frame is greater than k, the heading angle confidence is 1; if the number of wheels detected is 0 and the intersection-and-joint ratio of the front frame to the target frame is less than or equal to k, the heading angle confidence is 0;
[0032] In step (5), if two wheels are detected, the heading angle confidence is 1, and if only one wheel is detected, the heading angle confidence is 0;
[0033] If any of the detection conditions in steps (3) to (5) cannot be met, the heading angle confidence is 0;
[0034] If the heading angle confidence of five consecutive detection cycles is always 0 and the calculated heading angle does not jump, the calculated heading angle is directly output; otherwise, the heading angle is the sum of the product of the heading angle calculation value and the heading angle confidence of five consecutive detection cycles, and then divided by the sum of the confidence of the five detection cycles, and sliding window filtering is performed.
[0035] An electronic device for implementing a method for calculating a heading angle of a target vehicle based on visual information, comprising a memory configured to store executable instructions;
[0036] The processor is configured to execute executable instructions stored in the memory to implement the above-mentioned method for calculating the heading angle of the target vehicle based on visual information.
[0037] A computer-readable storage medium stores computer program instructions, which execute the above-mentioned method for calculating a heading angle of a target vehicle based on visual information.
[0038] In summary, the beneficial effects of the present invention are as follows: the present invention utilizes the information detected by the detection network to calculate the heading angle of the target vehicle under different working conditions according to the different output results of the detection frame, so that the detection is more comprehensive and the results are accurate and reliable. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to make the purpose, technical solution and advantages of the invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings, in which:
[0040] Figure 1 It is a schematic diagram of the heading angle calculation process of the present invention. DETAILED DESCRIPTION
[0041] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0042] like Figure 1 As shown, a method for calculating the heading angle of a target vehicle based on visual information in this specific embodiment is characterized by comprising the following steps:
[0043] (1) Obtain the detection frame of the target vehicle from the target detection network. The detection frame includes the entire target frame, the vehicle rear frame, the vehicle front frame, and the wheel frame. Detect the pixel coordinates of the upper left point and the lower right point of the frame rectangle of the target frame, the vehicle body frame, the vehicle rear frame, the vehicle front frame, and the wheel frame, respectively. Calculate the pixel coordinate information of the required ground point of the detection frame, and convert the pixel coordinates into the distance information of the world coordinate system by calling the coordinate conversion function;
[0044] (2) According to the pixel coordinates of the vehicle body frame, the vehicle tail frame, the vehicle front frame and the wheel frame, the intersection and union ratio of the vehicle tail frame, the vehicle front frame and the wheel frame with the target whole frame is calculated respectively, the target frames detected by the same target are integrated, and the position of the detected part of the target vehicle is determined. If the vehicle tail frame is detected, step (3) is executed; if the vehicle front frame is detected, step (4) is executed; if only the target whole frame is detected, step (5) is executed;
[0045] (3) Determine the number of wheels detected. If the number of wheels detected is greater than or equal to 2, and the lateral distances between the grounding point C (X, Y) of the rear frame and the grounding points of each wheel are greater than 0 or less than 0, the wheels are on the same side; otherwise, they are on the opposite side;
[0046] If the wheels are on the same side, select the two wheels with the largest distance between the wheel contact points among all the wheels, namely wheel A (X1, Y1) and wheel B (X2, Y2). According to the distance between these two wheels and the tail frame contact point C (X, Y), determine the wheel orientation, such as Then wheel B is the wheel close to the rear frame, and the direction vector pointing to the front of the vehicle determined by the two wheels is The direction vector of the vehicle is the unit vector The angle between the vehicle and the target vehicle is calculated according to the cosine function:
[0047]
[0048] According to the vehicle's circumferential heading angle coverage of -360° to 360°, the positive and negative angles are calculated using the sine function:
[0049]
[0050] like Then θ=-θ, otherwise θ=θ;
[0051] If the wheel is on the opposite side, calculate the coordinates of the line connecting the midpoint of the line connecting wheel N (X1, Y1) and wheel M (X2, Y2) and the line connecting the tail frame grounding point C (X, Y), and point to the direction vector of the target vehicle's head frame, that is, Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ① and formula ②;
[0052] If the number of wheels detected is 1, the position of the wheel is determined based on the lateral distance difference between the grounding point C(X, Y) of the rear frame and the grounding point of the wheel. If it is greater than 0, the direction vector of the vehicle is calculated based on the pixel coordinates Z(X1, Y1) of the lower right point of the rear frame and the coordinates A(X2, Y2) of the grounding point of the wheel. Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ① and formula ②; if the difference is less than 0, calculate the direction vector of the vehicle according to the pixel coordinates Z (X3, Y3) of the lower left corner of the rear frame and the coordinates A (X2, Y2) of the wheel contact point Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ① and formula ②
[0053] If the number of wheels detected is 0, the intersection and union ratio of the rear frame and the target frame is used to determine that the rear of the target vehicle is facing the vehicle. If the intersection and union ratio of the rear frame and the target frame is greater than k, the k value range is 0.93-0.95, the target vehicle is judged to be facing the vehicle, and the heading angle of the target vehicle is determined according to the camera of the vehicle. If the intersection and union ratio of the rear frame and the target frame is less than or equal to k, the k value range is 0.93-0.95, the lateral speed and longitudinal speed of the target vehicle are obtained, and the heading angle of the target vehicle is calculated by trigonometric functions in combination with the longitudinal speed of the vehicle.
[0054] (4) Determine the number of wheels detected. If the number of wheels detected is greater than or equal to 2, and the lateral distances between the head frame grounding point C (X, Y) and the grounding points of each wheel are greater than 0 or less than 0, the wheels are on the same side, otherwise they are on the opposite side;
[0055] If the wheels are on the same side, select the two wheels with the largest distance between the wheel contact points among all the wheels, namely wheel A (X1, Y1) and wheel B (X2, Y2), and determine the wheel orientation based on the distance between these two wheels and the head frame contact point C (X, Y), such as Then wheel A is the wheel close to the front frame, and the direction vector pointing to the front of the vehicle determined by the two wheels is The direction vector of the vehicle is the unit vector The angle between the vehicle and the target vehicle is calculated according to the cosine function:
[0056]
[0057] According to the vehicle's circumferential heading angle coverage of -360° to 360°, the positive and negative angles are calculated using the sine function:
[0058]
[0059] like Then θ=-θ, otherwise θ=θ;
[0060] If the wheel is on the opposite side, calculate the coordinates of the line connecting the midpoint of the wheel N (X1, Y1) and the wheel M (X2, Y2) and the line connecting the head frame grounding point C (X, Y), and point to the direction vector of the target vehicle head frame, that is, Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ③ and formula ④;
[0061] If the number of wheels detected is 1, the position of the wheel is determined based on the lateral distance difference between the grounding point C (X, Y) of the front frame and the grounding point of the wheel. If it is greater than 0, the direction vector of the vehicle is calculated based on the pixel coordinates Z (X1, Y1) of the lower right point of the front frame and the coordinates A (X2, Y2) of the grounding point of the wheel. Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ③ and formula ④. If the difference is less than 0, calculate the direction vector of the vehicle according to the pixel coordinates Z (X3, Y3) of the lower left corner of the vehicle head frame and the coordinates A (X2, Y2) of the wheel contact point. Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ③ and formula ④;
[0062] If the number of wheels detected is 0, the intersection and union ratio of the front frame and the target frame is judged. If the intersection and union ratio of the front frame and the target frame is greater than k, the range of k value is 0.93-0.95, it is judged that the head of the target vehicle is facing the host vehicle, and the heading angle of the target vehicle is determined according to the camera of the host vehicle; if the intersection and union ratio of the front frame and the target frame is less than or equal to k, the range of k value is 0.93-0.95, the lateral speed and longitudinal speed of the target vehicle are obtained, and the heading angle of the target vehicle is calculated by trigonometric function in combination with the longitudinal speed of the host vehicle;
[0063] (5) If two wheels are detected, determine the target vehicle's direction vector based on the line connecting the two wheels and the direction of the target vehicle's longitudinal velocity. Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ① and formula ②;
[0064] If only one wheel is detected, the lateral and longitudinal velocities of the target vehicle are obtained according to the tracking logic. Combined with the longitudinal velocity of the vehicle, the heading angle of the target vehicle is calculated using trigonometric functions.
[0065] In this specific implementation, if any one of the detection conditions in step (3) to step (5) cannot be met, the heading angle is 0.
[0066] In this specific implementation, in step (3), if the number of wheels detected is greater than or equal to 2, the heading angle confidence is 1, if the number of wheels detected is 1 and the lateral distance difference between the grounding point of the rear frame and the grounding point of the wheel is greater than 0, the heading angle confidence is 0.1, if the number of wheels detected is 0 and the intersection and union ratio of the rear frame and the target whole frame is greater than k, the heading angle confidence is 1, if the number of wheels detected is 0 and the intersection and union ratio of the rear frame and the target whole frame is less than or equal to k, the heading angle confidence is 0; in step (4), if the number of wheels detected is greater than or equal to 2, the heading angle confidence is 1, if the number of wheels detected is 1 and the lateral distance difference between the grounding point of the rear frame and the grounding point of the wheel is greater than 0, the heading angle confidence is 0.1, if the number of wheels detected is 0 and the intersection and union ratio of the front frame and the target whole frame is greater than k, the heading angle confidence is 1, if the number of wheels detected is 0 and the intersection and union ratio of the front frame and the target whole frame is less than or equal to k, the heading angle confidence is 0;
[0067] In step (5), if two wheels are detected, the heading angle confidence is 1, and if only one wheel is detected, the heading angle confidence is 0;
[0068] If any of the detection conditions in steps (3) to (5) cannot be met, the heading angle confidence is 0;
[0069] If the heading angle confidence of five consecutive detection cycles is always 0 and the calculated heading angle does not jump, the calculated heading angle is directly output; otherwise, the heading angle is the sum of the product of the heading angle calculation value and the heading angle confidence of five consecutive detection cycles, and then divided by the sum of the confidence of the five detection cycles, and sliding window filtering is performed.
[0070] The present invention also discloses an electronic device for realizing a method for calculating a heading angle of a target vehicle based on visual information, comprising a memory configured to store executable instructions;
[0071] The processor is configured to execute executable instructions stored in the memory to implement the above-mentioned method for calculating the heading angle of the target vehicle based on visual information.
[0072] The present invention also discloses a computer-readable storage medium on which computer program instructions are stored. The computer program instructions execute the above-mentioned method for calculating the heading angle of a target vehicle based on visual information.
[0073] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described with reference to the preferred embodiments of the present invention, it should be understood by those skilled in the art that various changes may be made in form and details without departing from the spirit and scope of the present invention as defined in the appended claims.
Claims
1. A method for calculating a target vehicle heading angle based on visual information, characterized in that: The following steps are involved: (1) Obtain the detection frame of the target vehicle from the target detection network. The detection frame includes the entire target frame, the vehicle rear frame, the vehicle front frame, and the wheel frame. Detect the pixel coordinates of the upper left point and the lower right point of the frame rectangle of the target frame, the vehicle body frame, the vehicle rear frame, the vehicle front frame, and the wheel frame, respectively. Calculate the pixel coordinate information of the required ground point of the detection frame, and convert the pixel coordinates into the distance information of the world coordinate system by calling the coordinate conversion function; (2) According to the pixel coordinates of the vehicle body frame, the vehicle tail frame, the vehicle front frame and the wheel frame, the intersection and union ratios of the vehicle tail frame, the vehicle front frame and the wheel frame with the target whole frame are calculated respectively, the target frames detected by the same target are integrated, and the position of the detected part of the target vehicle is determined. If the vehicle tail frame is detected, step (3) is executed; if the vehicle front frame is detected, step (4) is executed; if only the target whole frame is detected, step (5) is executed; (3) Determine the number of wheels detected. If the number of wheels detected is greater than or equal to 2, and the lateral distances between the grounding point C(X, Y) of the rear frame and the grounding points of each wheel are greater than 0 or less than 0, the wheels are on the same side; otherwise, they are on the opposite side; If the wheels are on the same side, select the two wheels with the largest distance between the wheel contact points among all the wheels, namely wheel A (X1, Y1) and wheel B (X2, Y2). According to the distance between these two wheels and the tail frame contact point C (X, Y), determine the wheel orientation, such as Then wheel B is the wheel close to the rear frame, and the direction vector pointing to the front of the vehicle determined by the two wheels is The direction vector of the vehicle is the unit vector The angle between the vehicle and the target vehicle is calculated according to the cosine function: According to the vehicle's circumferential heading angle coverage of -360° to 360°, the positive and negative angles are calculated using the sine function: if Then θ = -θ, otherwise θ = θ; If the wheel is on the opposite side, calculate the coordinates of the line connecting the midpoint of the line connecting wheel N (X1, Y1) and wheel M (X2, Y2) and the line connecting the tail frame grounding point C (X, Y), and point to the direction vector of the target vehicle's head frame, that is, Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ① and formula ②; If the number of wheels detected is 1, the position of the wheel is determined based on the lateral distance difference between the grounding point C(X,Y) of the rear frame and the grounding point of the wheel. If it is greater than 0, the direction vector of the vehicle is calculated based on the pixel coordinates Z(X1,Y1) of the lower right point of the rear frame and the coordinates A(X2,Y2) of the grounding point of the wheel. Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ① and formula ②; if the difference is less than 0, calculate the direction vector of the vehicle according to the pixel coordinates Z (X3, Y3) of the lower left corner of the rear frame and the coordinates A (X2, Y2) of the wheel contact point Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ① and formula ②; If the number of wheels detected is 0, the intersection and union ratio of the rear frame and the target frame is used to determine that the rear of the target vehicle is facing the vehicle. If the intersection and union ratio of the rear frame and the target frame is greater than k, the k value range is 0.93-0.95, the target vehicle is judged to be facing the vehicle, and the heading angle of the target vehicle is determined according to the camera of the vehicle. If the intersection and union ratio of the rear frame and the target frame is less than or equal to k, the k value range is 0.93-0.95, the lateral speed and longitudinal speed of the target vehicle are obtained, and the heading angle of the target vehicle is calculated by trigonometric functions in combination with the longitudinal speed of the vehicle. (4) Determine the number of wheels detected. If the number of wheels detected is greater than or equal to 2, and the lateral distances between the head frame grounding point C(X, Y) and the grounding points of each wheel are greater than 0 or less than 0, the wheels are on the same side; otherwise, they are on the opposite side; If the wheels are on the same side, select the two wheels with the largest distance between the wheel contact points among all wheels, namely wheel A (X1, Y1) and wheel B (X2, Y2). According to the distance between these two wheels and the head frame contact point C (X, Y), determine the orientation of the wheels, such as Then wheel A is the wheel close to the front frame, and the direction vector pointing to the front of the vehicle determined by the two wheels is The direction vector of the vehicle is the unit vector The angle between the vehicle and the target vehicle is calculated according to the cosine function: According to the vehicle's circumferential heading angle coverage of -360° to 360°, the positive and negative angles are calculated using the sine function: if Then θ = -θ, otherwise θ = θ; If the wheel is on the opposite side, calculate the coordinates of the line connecting the midpoint of the line connecting wheel N (X1, Y1) and wheel M (X2, Y2) and the line connecting the head frame grounding point C (X, Y), and point to the direction vector of the head frame of the target vehicle, that is, Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ③ and formula ④; If the number of wheels detected is 1, the position of the wheel is determined based on the lateral distance difference between the grounding point C(X,Y) of the front frame and the grounding point of the wheel. If it is greater than 0, the direction vector of the vehicle is calculated based on the pixel coordinates Z(X1,Y1) of the lower right point of the front frame and the coordinates A(X2,Y2) of the grounding point of the wheel. Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ③ and formula ④; if the difference is less than 0, calculate the direction vector of the vehicle according to the pixel coordinates Z (X3, Y3) of the lower left corner of the vehicle head frame and the coordinates A (X2, Y2) of the wheel contact point Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ③ and formula ④; If the number of wheels detected is 0, the intersection and union ratio of the front frame and the target frame is judged. If the intersection and union ratio of the front frame and the target frame is greater than k, the range of k value is 0.93-0.95, it is judged that the head of the target vehicle is facing the host vehicle, and the heading angle of the target vehicle is determined according to the camera of the host vehicle; if the intersection and union ratio of the front frame and the target frame is less than or equal to k, the range of k value is 0.93-0.95, the lateral speed and longitudinal speed of the target vehicle are obtained, and the heading angle of the target vehicle is calculated by trigonometric function in combination with the longitudinal speed of the host vehicle; (5) If two wheels are detected, determine the target vehicle's direction vector based on the line connecting the two wheels and the direction of the target vehicle's longitudinal velocity. Using the target vehicle direction vector With the vehicle direction vector Calculate the heading angle according to formula ① and formula ②; If only one wheel is detected, the lateral and longitudinal velocities of the target vehicle are obtained according to the tracking logic. Combined with the longitudinal velocity of the vehicle, the heading angle of the target vehicle is calculated using trigonometric functions.
2. The method for calculating the heading angle of a target vehicle based on visual information according to claim 1, characterized in that: If any of the detection conditions in steps (3) to (5) cannot be met, the heading angle is 0.
3. The method for calculating the heading angle of a target vehicle based on visual information according to claim 2, characterized in that: In step (3), if the number of wheels detected is greater than or equal to 2, the heading angle confidence is 1; if the number of wheels detected is 1 and the lateral distance difference between the grounding point of the rear frame and the grounding point of the wheel is greater than 0, the heading angle confidence is 0.1; if the number of wheels detected is 0 and the intersection-and-joint ratio of the rear frame to the target frame is greater than k, the heading angle confidence is 1; if the number of wheels detected is 0 and the intersection-and-joint ratio of the rear frame to the target frame is less than or equal to k, the heading angle confidence is 0; In step (4), if the number of wheels detected is greater than or equal to 2, the heading angle confidence is 1; if the number of wheels detected is 1 and the lateral distance difference between the grounding point of the rear frame and the grounding point of the wheel is greater than 0, the heading angle confidence is 0.1; if the number of wheels detected is 0 and the intersection-and-joint ratio of the front frame to the target frame is greater than k, the heading angle confidence is 1; if the number of wheels detected is 0 and the intersection-and-joint ratio of the front frame to the target frame is less than or equal to k, the heading angle confidence is 0; In step (5), if two wheels are detected, the heading angle confidence is 1, and if only one wheel is detected, the heading angle confidence is 0; If any of the detection conditions in steps (3) to (5) cannot be met, the heading angle confidence is 0; If the heading angle confidence is 0 for five consecutive detection cycles and the calculated heading angle does not jump, the calculated heading angle is directly output; On the contrary, the heading angle is the sum of the products of the heading angle calculation values of five consecutive detection cycles and the heading angle confidence, and then divided by the sum of the confidences of the five detection cycles to perform sliding window filtering.
4. An electronic device for realizing a method for calculating a target vehicle heading angle based on visual information, characterized in that: including a memory configured to store executable instructions; A processor configured to execute executable instructions stored in the memory to implement the method according to any one of claims 1 to 3.
5. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: The computer program instructions execute the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Vehicle course angle correction method and system, storage medium and terminal
CN110962844A
Vehicle-mounted visual real-time multi-target course angle estimation method and device
CN111291786A