Tractor and trailer included angle measuring method based on image recognition
By installing a camera on the tractor, using imaging principles and mathematical calculations, the problems of poor applicability and high cost of angle calculation between the tractor and the trailer are solved, and accurate calculations and low-cost implementations are achieved at various angles.
Patent Information
- Application Number
- CN202411907786.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-15
Smart Images

Figure CN119826732A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of transport vehicles, and in particular to a method for measuring the angle between a tractor and a trailer based on image recognition. Background Art
[0002] With the advent of the intelligent era, trucks with transportation functions urgently need to enter the door of the intelligent era. However, the tractor and trailer are pin-connected, which leads to the special situation that there is always an angle between the tractor and the trailer. In order to promote the current 360° panoramic imaging technology, automatic driving technology and other related cutting-edge intelligent technologies, it is necessary to accurately identify the angle between the tractor and the trailer. For this reason, the angle calculation between the tractor and the trailer has become a key link in cutting-edge intelligent technology. There are currently three main methods for calculating the angle.
[0003] The first method is to calculate the angle based on the identification code. It mainly involves installing a camera behind the tractor and installing a corresponding identification code (such as pasting a fixed-size color block) on the front plane of the box trailer. The angle between the tractor and the trailer is calculated by relying on the shape change of the identification code in the camera. The disadvantage of this method is that it has certain requirements for the shape of the trailer and is not suitable for flatbed trailers. At the same time, since the camera needs to be able to capture the identification code, it cannot be recognized in large angles.
[0004] The second method is to calculate the angle based on an angle sensor, which mainly adds an angle sensor at the connection pin between the tractor and the trailer to directly measure the angle between the tractor and the trailer. The disadvantages of this method are that the installation method of the sensor is too complicated, which is not conducive to the aftermarket, and the cost is high, which is not conducive to promotion.
[0005] The third method is to calculate the angle by laser radar ranging, which mainly involves installing a laser radar behind the tractor to illuminate the trailer behind it, calculate the distance by emitting a laser beam and receiving the reflected signal, and then deduce the angle. The disadvantage of this method is that it is expensive and not conducive to promotion. Summary of the invention
[0006] The purpose of the present invention is to provide a method for measuring the angle between a tractor and a trailer based on image recognition, so as to solve the problems that the method for calculating the angle between a tractor and a trailer proposed in the above background technology has poor applicability, cannot be recognized at large angles, is high in cost, is not conducive to promotion, and the like.
[0007] To achieve the above object, the present invention provides the following technical solution: a method for measuring the angle between a tractor and a trailer based on image recognition, comprising the following steps:
[0008] S1, obtaining the left pixels of the trailer in the left camera picture through the left camera, and obtaining the right pixels of the trailer in the right camera picture through the right camera;
[0009] S2, determining the pixel ratio of the left pixel to the right pixel, and calculating the distance from the camera to the end of the trailer based on the determination result;
[0010] S3, calculating the angle between the tractor and the trailer according to the distance from the camera to the end of the trailer;
[0011] S4. Reversely verify whether the angle between the tractor and the trailer calculated this time is correct. If it is correct, output the angle between the tractor and the trailer calculated this time. If it is incorrect, keep outputting the angle between the tractor and the trailer calculated last time.
[0012] Optionally, in S1, the left pixels of the trailer in the left camera picture are obtained through the left camera, and the right pixels of the trailer in the right camera picture are obtained through the right camera. Specifically, the generated image training model is used according to the pictures taken by each camera to identify the pixel length occupied by the trailer in the camera imaging picture.
[0013] Optionally, in S2, the pixel sizes occupied by the left pixels and the right pixels are compared, and the distance from the camera to the end of the trailer is calculated through the comparison result. Specifically, it is determined whether the left pixel is smaller than the right pixel. If so, the distance from the camera to the end of the trailer is calculated based on the left pixel value, and the angle between the tractor and the trailer is calculated based on the distance from the camera to the end of the trailer. Otherwise, the distance from the camera to the end of the trailer is calculated based on the right pixel value, and the angle between the tractor and the trailer is calculated based on the distance from the camera to the end of the trailer.
[0014] Optionally, in S2, it is determined whether the left pixel is smaller than the right pixel, the pixel length occupied by the trailer of the left camera is the left pixel, and the pixel length occupied by the trailer of the right camera is the right pixel. It is concluded that: if the left pixel is smaller than the right pixel, turn left, and calculate the angle between the tractor and the trailer according to the left pixel value. At this time, the left camera image is the far edge of the trailer compartment; if the left pixel is larger than the right pixel, turn right, and calculate the angle between the tractor and the trailer according to the right pixel value. At this time, the right camera image is the far edge of the trailer compartment; if the left pixel is equal to the right pixel, there is no rotation.
[0015] Optionally, the distance from the camera to the end of the trailer is the horizontal length from the camera on the tractor to the far edge of the trailer compartment during the rotation process.
[0016] Optionally, the angle between the tractor and the trailer is calculated according to the distance from the camera to the end of the trailer. First, the angle formed by the far edge of the trailer compartment, the rotation axis and the camera connection line when the tractor and the trailer are not rotating is calculated according to the size parameters of the tractor and the trailer. Then, the angle formed by the tractor camera, the rotation axis and the connection line of the far edge of the trailer compartment during the rotation process is calculated according to the horizontal length from the tractor camera to the far edge of the trailer compartment, the angle between the connection line of the tractor camera and the far edge of the trailer compartment and the camera imaging plane, the angle between the connection line of the tractor camera and the rotation axis and the camera imaging plane, the angle between the connection line of the tractor camera and the rotation axis and the side body, and the angle of the tractor camera rotating backward. The difference between the angle formed by the connection line of the tractor camera, the rotation axis and the far edge of the trailer compartment when there is no rotation and the angle formed by the connection line of the tractor camera, the rotation axis and the far edge of the trailer compartment during the rotation process is the above-mentioned angle between the tractor and the trailer.
[0017] Optionally, in S4, reversely verify whether the calculated angle between the tractor and the trailer is correct. If it is correct, output the calculated angle between the tractor and the trailer. If it is not correct, keep outputting the angle between the tractor and the trailer calculated last time. Specifically, reversely verify whether the calculated angle between the tractor and the trailer is correct. If it is correct, output the calculated angle between the tractor and the trailer. If it is not correct, keep outputting the angle between the tractor and the trailer calculated last time. Specifically, after calculating the angle between the tractor and the trailer according to the pixel value on the left, reversely verify that the image acquisition uses the angle between the tractor and the trailer calculated in the previous step to calculate the pixel value on the right. Theoretical value; determine whether |right pixel - right pixel theoretical value| is less than the error value. If so, the image recognition correctly outputs the angle between the tractor and the trailer. If not, the image recognition is incorrect and the previous angle between the tractor and the trailer is maintained. After calculating the angle between the tractor and the trailer according to the right pixel value, reversely verify the image acquisition and use the angle between the tractor and the trailer calculated in the previous step to calculate the theoretical value of the left pixel. Determine whether |left pixel - left pixel theoretical value| is less than the error value. If so, the image recognition correctly outputs the angle between the tractor and the trailer. If not, the image recognition is incorrect and the previous angle between the tractor and the trailer is maintained.
[0018] Compared with the prior art, the present invention has the following beneficial effects:
[0019] The present invention proposes a method for calculating the angle between a tractor and a trailer based on a mathematical model. A camera is installed on each side of the tractor, and the trailer body on the corresponding side is illuminated by the camera. The distance from the camera to the end of the trailer is calculated by the pixel length occupied by the body in the camera image, using the camera imaging principle and mathematical calculations such as trigonometric functions, and thus the angle between the tractor and the trailer is calculated. The angle calculation between the tractor and the trailer can be solved by using multiple cameras equipped in commercial vehicles for blind spot detection, forward collision warning and other functions. The method can be used for calculation of large angles and small angles, has strong applicability, low cost, and is conducive to promotion. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A flow chart of the method for measuring the angle between a tractor and a trailer provided by the present invention;
[0021] Figure 2 This is a schematic diagram of the installation structure of the left camera and the right camera in the present invention;
[0022] Figure 3 It is a diagram of basic parameters when the tractor and trailer are not rotating in the present invention;
[0023] Figure 4 This is a schematic diagram of projection imaging of the far / near edges of a trailer in the camera of the present invention;
[0024] Figure 5 The trend diagram of the angle between the tractor and the trailer and the imaging angle of the far / near edge of the trailer in the present invention;
[0025] Figure 6 The geometric model and parameter annotation diagram for calculating the angle between the tractor and the trailer in the present invention;
[0026] Figure 7 The geometric model and parameter annotation diagram for reverse verification at small angles in the present invention;
[0027] Figure 8 It is the geometric model and parameter annotation diagram for reverse verification at large angles in the present invention;
[0028] Fig. 9 This is a program execution diagram of the method for measuring the angle between a tractor and a trailer provided by the present invention. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0030] The present invention provides a method for measuring the angle between a tractor and a trailer based on image recognition, such as Figure 1 As shown, the following steps are included:
[0031] S1, obtaining the left pixels of the trailer in the left camera picture through the left camera, and obtaining the right pixels of the trailer in the right camera picture through the right camera;
[0032] Figure 2 As shown, a left camera and a right camera are installed on the left and right sides of the tractor respectively, the left camera illuminates the trailer on the left, and the right camera illuminates the trailer on the right;
[0033] In S1, the left pixels of the trailer in the left camera's picture are obtained through the left camera, and the right pixels of the trailer in the right camera's picture are obtained through the right camera. Specifically, the generated image training model is used according to the pictures taken by each camera to identify the pixel length occupied by the trailer in the camera imaging picture.
[0034] like Figure 3 As shown, the dimension parameter values of the tractor and the trailer are obtained. The dimension parameter values of the tractor and the trailer are measured when the tractor and the trailer are not rotated. The dimension parameter values of the tractor and the trailer are as follows:
[0035] A1 and A2 are the camera positions; O is the rotation axis; B1 and B2 are the far edges of the trailer compartment; C1 and C2 are the near edges of the trailer compartment; d1 is the distance between the left and right cameras of the tractor; d2 is the width of the trailer; l1 is the horizontal length from the tractor camera to the rotation axis; l2 is the horizontal length from the rear of the trailer to the rotation axis; l3 is the front overhang length of the trailer; r1 is the horizontal length from the camera to the rotation axis; r2 is the horizontal length from the far edge of the trailer compartment to the rotation axis; r3 is the horizontal length from the near edge of the trailer compartment to the rotation axis; r4 is the horizontal length from the tractor camera to the near edge of the trailer compartment on the other side; l0 is the horizontal length from the camera to the far edge of the trailer compartment on the same side; l0' is the horizontal length from the camera to the near edge of the trailer compartment on the same side; γ0 is the angle formed by the line connecting the far edge of the trailer compartment, the rotation axis and the camera when there is no rotation; γ0' is the angle formed by the line connecting the near edge of the trailer compartment, the rotation axis and the camera when there is no rotation.
[0036] Among them, d1, d2, l1, l2, and l3 can be obtained according to the size parameters of the tractor and trailer.
[0037] r1, r2, r3, r4, l0, l0' can be calculated by the Pythagorean theorem:
[0038]
[0039] γ0 and γ0' can be calculated according to the law of cosines:
[0040]
[0041] S2, determining the pixel size ratio of the left pixel and the right pixel, and calculating the distance from the camera to the end of the trailer based on the determination result, wherein the distance from the camera to the end of the trailer is the horizontal length from the camera on the tractor to the far edge of the trailer compartment during the rotation process;
[0042] In S2, the pixel sizes occupied by the left pixel and the right pixel are compared, and the distance from the camera to the end of the trailer is calculated through the comparison result. Specifically, it is determined whether the left pixel is smaller than the right pixel. If so, the distance from the camera to the end of the trailer is calculated based on the left pixel value, and the angle between the tractor and the trailer is calculated based on the distance from the camera to the end of the trailer. Otherwise, the distance from the camera to the end of the trailer is calculated based on the right pixel value, and the angle between the tractor and the trailer is calculated based on the distance from the camera to the end of the trailer.
[0043] In S2, it is determined whether the left pixel is smaller than the right pixel. The pixel length occupied by the trailer of the left camera is the left pixel, and the pixel length occupied by the trailer of the right camera is the right pixel. It is concluded that: if the left pixel is smaller than the right pixel, turn left, and calculate the angle between the tractor and the trailer according to the left pixel value. At this time, the left camera image is the far edge of the trailer compartment. If the left pixel is larger than the right pixel, turn right, and calculate the angle between the tractor and the trailer according to the right pixel value. At this time, the right camera image is the far edge of the trailer compartment; if the left pixel is equal to the right pixel, there is no rotation.
[0044] In order to verify whether the calculated angle is a left-biased angle or a right-biased angle, a simulation verification is performed here. Figure 4 As shown, according to the camera imaging principle, it is obtained as shown in formula (1):
[0045]
[0046] Tanθ is calculated from formula (1) as shown in formula (2):
[0047]
[0048] In formula (1) and formula (2), f is the focal length, k is the ratio of pixel value to physical value, a is the complete pixel length of the imaging screen, b is the pixel length occupied by the trailer, and θ is the angle between the edge of the trailer compartment and the camera (θ1 is the angle between the far edge of the trailer compartment and the camera on the same side, θ2 is the angle between the near edge of the trailer compartment and the camera on the same side, and θ1 and θ2 both satisfy the above formula)
[0049] Due to the characteristics of the truck, the rotation angle between the truck and the trailer The range is [0°,130°], depending on the The simulation results show that Figure 5 The rules shown:
[0050] Since the range of θ is [0°, 90°], tanθ is a monotonically increasing function, and tanθ1≥tanθ2, f and k are both constants, so according to It can be concluded that: b1≤b2 (b1 is the pixel length occupied by the far edge of the trailer compartment, b2 is the pixel length occupied by the near edge of the trailer compartment)
[0051] Regulation b l is the pixel length of the trailer on the left camera, b r is the pixel length of the trailer on the right camera. In summary, we can conclude that: b l r , then turn left (the left camera image shows the far edge of the trailer compartment); b l >b r , then turn right (the right camera image shows the far edge of the trailer compartment); b l =b r , then there is no rotation.
[0052] S3, calculating the angle between the tractor and the trailer according to the distance from the camera to the end of the trailer;
[0053] In S3, the angle between the tractor and the trailer is calculated according to the distance from the camera to the end of the trailer. First, the angle formed by the far edge of the trailer compartment, the rotation axis and the camera line when the tractor and the trailer are not rotating is calculated according to the size parameters of the tractor and the trailer. Then, the angle formed by the tractor camera, the rotation axis and the line connecting the far edge of the trailer compartment during the rotation process is calculated according to the horizontal length from the tractor camera to the far edge of the trailer compartment, the angle between the line connecting the tractor camera and the far edge of the trailer compartment and the camera imaging plane, the angle between the line connecting the tractor camera and the rotation axis and the camera imaging plane, the angle between the line connecting the tractor camera and the rotation axis and the side body, and the angle of the tractor camera rotating backward. The difference between the angle formed by the line connecting the tractor camera, the rotation axis and the far edge of the trailer compartment when there is no rotation and the angle formed by the line connecting the tractor camera, the rotation axis and the far edge of the trailer compartment during the rotation process is the above-mentioned angle between the tractor and the trailer.
[0054] according to Figure 6 Calculate the parameters in b: l and b r The smaller b value is selected as b1, and the triangle formed by the far edge of the trailer body is used to make the following calculation:
[0055] Figure 6 Where l is the horizontal length from the tractor camera to the far edge of the trailer compartment during the rotation process; θ1 is the angle between the line connecting the tractor camera and the far edge of the trailer compartment and the camera imaging plane; α is the angle between the line connecting the tractor camera and the rotating shaft and the camera imaging plane; β is the angle between the line connecting the tractor camera and the rotating shaft and the side body; ω is the backward rotation angle of the tractor camera; γ is the angle formed by the line connecting the tractor camera, the rotating shaft and the far edge of the trailer compartment during the rotation process.
[0056] According to the camera imaging principle, formula (3) is obtained:
[0057]
[0058] Tanθ1 is calculated from equation (3), and thus θ1 is obtained as shown in equation (4):
[0059]
[0060] According to the angle relationship shown in the figure, we can get formula (5):
[0061] α=ω-β (5) Calculated from formula (5), α is shown in formula (6):
[0062]
[0063] According to the cosine function, we can get formula (7):
[0064] r2 2 = l 2 +r1 2 -2r1lcos(θ1-α) (7)
[0065] Length l>0, l is calculated by formula (7) as shown in formula (8):
[0066]
[0067] According to the sine theorem, we can get equation (9):
[0068]
[0069] Sinγ is calculated by equation (8) and equation (9), and thus γ is obtained as shown in equation (10):
[0070]
[0071] The final rotation angle according to the geometric rotation relationship Satisfying formula (11):
[0072]
[0073] Final rotation angle The calculation is completed (the above formula is satisfied whether the included angle is a small angle or a large angle).
[0074] S4. Reversely verify whether the angle between the tractor and the trailer calculated this time is correct. If it is correct, output the angle between the tractor and the trailer calculated this time. If it is incorrect, keep outputting the angle between the tractor and the trailer calculated last time.
[0075] Optionally, in S4, reverse verification is performed to determine whether the angle between the tractor and the trailer calculated this time is correct. If it is correct, the angle between the tractor and the trailer calculated this time is output; if it is incorrect, the angle between the tractor and the trailer calculated last time is output. Specifically, after calculating the angle between the tractor and the trailer according to the left pixel value, reverse verification is performed on the image acquisition using the angle between the tractor and the trailer calculated in the previous step to calculate the theoretical value of the right pixel; determine whether |right pixel - right pixel theoretical value| is less than the error value; if so, the image recognition correctly outputs the angle between the tractor and the trailer this time; otherwise, the image recognition incorrectly maintains the previous angle between the tractor and the trailer; after calculating the angle between the tractor and the trailer according to the right pixel value, reverse verification is performed on the image acquisition using the angle between the tractor and the trailer calculated in the previous step to calculate the theoretical value of the left pixel; determine whether |left pixel - left pixel theoretical value| is less than the error value; if so, the image recognition correctly outputs the angle between the tractor and the trailer this time; otherwise, the image recognition incorrectly maintains the previous angle between the tractor and the trailer.
[0076] Compare b l and b r The larger b value is recorded as b0, and the following calculation is made using the triangle formed by the near edge of the trailer compartment:
[0077] Verification 1: Reverse verification of image acquisition at small angles
[0078] according to Figure 7 Calculate the parameters in Figure 7 In the equation, γ1' is the angle formed by the line connecting the tractor camera, the rotating shaft and the near edge of the trailer compartment during the rotation process at a small angle; θ2 is the angle between the line connecting the tractor camera and the near edge of the trailer compartment and the camera imaging plane at a small angle; α is the angle between the line connecting the tractor camera and the rotating shaft and the camera imaging plane; l1' is the horizontal length from the tractor camera to the near edge of the trailer compartment at a small angle; b2 is the pixel length of the trailer occupied by reverse deduction at a small angle.
[0079] Known rotation angle Find the value of b2:
[0080] According to the geometric rotation relationship, γ1' satisfies equation (12):
[0081]
[0082] According to the cosine theorem, l1′ satisfies equation (13):
[0083]
[0084] According to the sine theorem, we can get equation (14):
[0085]
[0086] Formula (15) is obtained by calculating formula (12), formula (13) and formula (14):
[0087]
[0088] Since the tractor camera is installed symmetrically, the α value here is consistent with the α value when calculating the angle, so θ2 can be calculated based on this.
[0089] According to the camera imaging principle, formula (16) is obtained:
[0090]
[0091] The b2 calculated by formula (16) is shown in formula (17):
[0092]
[0093] Verification 2: Reverse verification of image acquisition at large angles
[0094] according to Figure 8 Calculate the parameters in Figure 8 In the figure, γ2' is the angle formed by the line connecting the tractor camera, the shaft and the near edge of the trailer compartment during the rotation process at a large angle; γ3' is the angle formed by the line connecting the tractor camera, the near edge of the opposite trailer compartment and the shaft; θ3 is the angle between the line connecting the tractor camera and the near edge of the trailer compartment and the camera imaging plane at a large angle; α is the angle between the line connecting the tractor camera and the shaft and the camera imaging plane; l2' is the horizontal length from the tractor camera to the near edge of the trailer compartment at a large angle; b3 is the pixel length of the trailer occupied by reverse deduction at a large angle.
[0095] Known rotation angle Find the value of b3:
[0096] According to the cosine theorem, γ3' satisfies equation (18):
[0097]
[0098] According to the geometric rotation relationship, γ2' satisfies equation (19):
[0099]
[0100] According to the cosine theorem, l2′ satisfies equation (20):
[0101]
[0102] According to the sine theorem, we can get equation (21):
[0103]
[0104] Formula (22) is obtained by calculating formula (19), formula (20) and formula (21):
[0105]
[0106] Since the tractor camera is installed symmetrically, the α value here is consistent with the α value when calculating the angle, so θ3 can be calculated based on this.
[0107] According to the camera imaging principle, formula (23) is obtained:
[0108]
[0109] b3 is calculated from formula (23) as shown in formula (24):
[0110]
[0111] δ is a constant error value. If |b0-b2|<δ or |b0-b3|<δ, the recognition is correct. Otherwise, the recognition is wrong and the collected graphics do not meet the requirements.
[0112] This application calculates the distance from the camera to the end of the trailer by using the pixel ratio of the vehicle body in the left camera and right camera images, and uses the camera imaging principle and trigonometric mathematical calculations to calculate the angle between the tractor and the trailer. The specific method and program execution are as follows: Fig. 9As shown, the program starts: respectively identify the pixel range occupied by the trailer in the left camera screen and the pixel range occupied by the trailer in the right camera screen; determine whether the left pixel is smaller than the right pixel, if so, calculate the angle between the tractor and the trailer according to the left pixel value, reversely verify that the image acquisition uses the angle between the tractor and the trailer calculated in the previous step, calculate the theoretical value of the right pixel, determine whether |right pixel-right pixel theoretical value| is less than the error value, if so, the image recognition correctly outputs the angle between the tractor and the trailer this time, otherwise, the image recognition is incorrect and the previous angle between the tractor and the trailer is maintained; determine whether the left pixel is smaller than the right pixel, if otherwise, calculate the angle between the tractor and the trailer according to the right pixel value, reversely verify that the image acquisition uses the angle between the tractor and the trailer calculated in the previous step, calculate the theoretical value of the left pixel; determine whether |left pixel-left pixel theoretical value| is less than the error value, if so, the image recognition correctly outputs the angle between the tractor and the trailer this time, otherwise, the image recognition is incorrect and the previous angle between the tractor and the trailer is maintained, and the program ends.
Claims
1. A method for measuring the angle between a tractor and a trailer based on image recognition, characterized in that: The following steps are involved: S1, obtaining the left pixels of the trailer in the left camera picture through the left camera, and obtaining the right pixels of the trailer in the right camera picture through the right camera; S2, determining the pixel ratio of the left pixel to the right pixel, and calculating the distance from the camera to the end of the trailer based on the determination result; S3, calculating the angle between the tractor and the trailer according to the distance from the camera to the end of the trailer; S4. Reversely verify whether the angle between the tractor and the trailer calculated this time is correct. If it is correct, output the angle between the tractor and the trailer calculated this time. If it is incorrect, keep outputting the angle between the tractor and the trailer calculated last time.
2. The method for measuring the angle between a tractor and a trailer based on image recognition according to claim 1, characterized in that: In S1, the left pixels of the trailer in the left camera's picture are obtained through the left camera, and the right pixels of the trailer in the right camera's picture are obtained through the right camera. Specifically, the generated image training model is used according to the pictures taken by each camera to identify the pixel length occupied by the trailer in the camera imaging picture.
3. The method for measuring the angle between a tractor and a trailer based on image recognition according to claim 2, characterized in that: In S2, the pixel sizes occupied by the left pixel and the right pixel are compared, and the distance from the camera to the end of the trailer is calculated through the comparison result. Specifically, it is determined whether the left pixel is smaller than the right pixel. If so, the distance from the camera to the end of the trailer is calculated based on the left pixel value, and the angle between the tractor and the trailer is calculated based on the distance from the camera to the end of the trailer. Otherwise, the distance from the camera to the end of the trailer is calculated based on the right pixel value, and the angle between the tractor and the trailer is calculated based on the distance from the camera to the end of the trailer.
4. The method for measuring the angle between a tractor and a trailer based on image recognition according to claim 3, characterized in that: In S2, it is determined whether the left pixel is smaller than the right pixel. The pixel length occupied by the trailer of the left camera is the left pixel, and the pixel length occupied by the trailer of the right camera is the right pixel. It is concluded that: if the left pixel is smaller than the right pixel, turn left, and calculate the angle between the tractor and the trailer according to the left pixel value. At this time, the left camera image is the far edge of the trailer compartment. If the left pixel is larger than the right pixel, turn right, and calculate the angle between the tractor and the trailer according to the right pixel value. At this time, the right camera image is the far edge of the trailer compartment; if the left pixel is equal to the right pixel, there is no rotation.
5. According to the method for measuring the angle between a tractor and a trailer based on image recognition as described in claim 4, in S2, the distance from the camera to the end of the trailer is the horizontal length from the camera on the tractor to the far edge of the trailer compartment during the rotation process.
6. A method for measuring the angle between a tractor and a trailer based on image recognition according to claim 5, in S3, the angle between the tractor and the trailer is calculated according to the distance from the camera to the end of the trailer, firstly, the angle formed by the far edge of the trailer car body, the shaft and the camera line when the tractor and the trailer are not rotating is calculated according to the size parameters of the tractor and the trailer, and then the angle formed by the tractor camera, the shaft and the far edge of the trailer car body during the rotation process is calculated according to the horizontal length from the tractor camera to the far edge of the trailer car body, the angle between the line connecting the tractor camera and the far edge of the trailer car body and the camera imaging plane, the angle between the line connecting the tractor camera and the shaft and the camera imaging plane, the angle between the line connecting the tractor camera and the shaft and the side body, and the angle of the tractor camera rotating backward. The difference between the angle formed by the line connecting the tractor camera, the shaft and the far edge of the trailer car body when there is no rotation and the angle formed by the line connecting the tractor camera, the shaft and the far edge of the trailer car body during the rotation process is the above-mentioned angle between the tractor and the trailer.
7. The method for measuring the angle between a tractor and a trailer based on image recognition according to claim 6, characterized in that: In S4, reverse verification is performed to determine whether the angle between the tractor and the trailer calculated this time is correct. If it is correct, the angle between the tractor and the trailer calculated this time is output; if it is incorrect, the angle between the tractor and the trailer calculated last time is output. Specifically, after calculating the angle between the tractor and the trailer according to the left pixel value, reverse verification is performed on the image acquisition using the angle between the tractor and the trailer calculated in the previous step to calculate the theoretical value of the right pixel; it is determined whether |right pixel - right pixel theoretical value| is less than the error value. If so, the image recognition correctly outputs the angle between the tractor and the trailer this time. If not, the image recognition incorrectly maintains the previous angle between the tractor and the trailer; after calculating the angle between the tractor and the trailer according to the right pixel value, reverse verification is performed on the image acquisition using the angle between the tractor and the trailer calculated in the previous step to calculate the theoretical value of the left pixel; it is determined whether |left pixel - left pixel theoretical value| is less than the error value. If so, the image recognition correctly outputs the angle between the tractor and the trailer this time. If not, the image recognition incorrectly maintains the previous angle between the tractor and the trailer.