A ranging method, device, terminal device and automobile
By adjusting the camera's shooting angle and combining it with gyroscope detection, the problem of inaccurate distance measurement by the camera on slopes was solved, enabling accurate obstacle distance measurement under various road conditions, reducing costs and improving safety.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- YINWANG INTELLIGENT TECHNOLOGIES CO LTD
- Filing Date
- 2020-09-09
- Publication Date
- 2026-07-07
AI Technical Summary
In existing autonomous driving systems, camera ranging functions are inaccurate in measuring the distance to target objects on uphill or downhill roads, leading to safety hazards. Furthermore, radar ranging is costly, limiting its commercial application.
By capturing road information with a camera, calculating the slope angle of the road in front of the vehicle and the slope angle of the road where the vehicle is located, adjusting the camera's shooting angle, and combining this with a gyroscope to detect the vehicle's tilt angle, the distance between the vehicle and obstacles is accurately calculated.
It enables accurate measurement of distance to obstacles under various road conditions, including straight lines, curves, and inclines, reducing safety hazards and lowering system costs.
Smart Images

Figure CN114236521B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent driving technology, and in particular to a ranging method, device, terminal equipment, and automobile. Background Technology
[0002] In the field of autonomous driving, advanced driver assistance systems (ADAS) are primarily based on artificial intelligence (AI) algorithms. They utilize cameras to acquire information about lane lines, obstacles, traffic signs, road markings, traffic lights, and other elements, thereby enabling functions such as forward collision warning (FCW), lane departure warning (LDW), and automatic emergency braking (AEB). However, the implementation of these functions requires distance information for targets such as vehicles, pedestrians, and obstacles.
[0003] In existing technologies, distance measurement of target objects primarily relies on radar as the ranging sensor. However, radar is expensive, severely hindering the commercialization of autonomous driving systems. Furthermore, vehicles currently equipped with autonomous driving systems mainly employ monocular and binocular camera solutions to achieve distance measurement. However, once these cameras are fixed in their positions, they remain stationary. If the road surface is uphill or downhill, the measured distance to the target object may be farther or closer than the actual distance, posing a significant safety hazard. Summary of the Invention
[0004] To address the aforementioned problems, embodiments of this application provide a ranging method, apparatus, terminal device, and vehicle.
[0005] In a first aspect, this application provides a ranging method, the method comprising: acquiring a first image captured by a camera along the driving direction of a first vehicle, the first image including road information; obtaining the slope angle of the road in front of the first vehicle based on the first image; obtaining a first shooting direction based on the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located; adjusting the shooting angle of the camera based on the first shooting direction; receiving a second image captured by the camera after the shooting angle adjustment, the second image including a second vehicle; and calculating the distance between the first vehicle and the second vehicle based on the second image.
[0006] In this embodiment, after the camera captures an image, the slope angle of the road in front of the vehicle is determined based on reference objects such as lane lines, edge lines, and guardrails in the image. Then, the shooting direction of the camera is calculated based on the slope angle of the road in front of the vehicle and the slope angle of the road it is on. If the camera captures images of other vehicles, pedestrians, or other obstacles, the distance between them is calculated more accurately.
[0007] In one embodiment, before receiving the second image captured by the camera after the shooting angle has been adjusted, the method further includes: obtaining the turning angle of the road ahead of the first vehicle based on the first image, wherein the turning angle is the angle between the driving direction of the first vehicle and the extension direction of the road ahead of the first vehicle, and the direction of the driving direction of the first vehicle and the direction of the road ahead of the driving direction of the first vehicle are determined by the road information; obtaining a second shooting direction based on the turning angle of the road ahead of the first vehicle; and adjusting the shooting angle of the camera based on the second shooting direction.
[0008] In this embodiment, the vehicle is not limited to driving in a straight line, but also to turning, and even more complex driving situations such as turning uphill and turning downhill. In this case, it is necessary to consider that the shooting direction of the camera 201 is not limited to the vertical direction of movement, but also needs to consider the horizontal direction of movement. Therefore, the horizontal movement angle of the camera is determined according to the angle between the vehicle's driving direction and the extension line of the road in front of the vehicle. Then, the shooting angle of the camera is adjusted so that if the camera captures other vehicles, pedestrians or other obstacles in the image, the distance between them can be calculated more accurately and there will be no blind spots.
[0009] In one embodiment, the method further includes: displaying on a display screen the driving status of the first vehicle and the second vehicle on the road and / or the distance value between the first vehicle and the second vehicle.
[0010] In this embodiment, by displaying the driving status and distance of the vehicle and other vehicles on the display screen, the driver can better understand the environment in which the vehicle is located, and the driver can feel a sense of security.
[0011] In one embodiment, the method further includes: when the distance between the first vehicle and the second vehicle is less than a set safe distance, displaying a warning message on the display screen or broadcasting a warning message through a speaker.
[0012] In this implementation, dangerous situations are promptly reported to the driver so that the driver can take timely evasive action.
[0013] In one implementation, the slope angle of the road where the first vehicle is located is determined based on the angle of the bias of the detection gyroscope.
[0014] In one embodiment, before acquiring the first image captured by the camera along the driving direction of the first vehicle, the method includes: determining the original shooting direction of the camera, wherein the original shooting direction is the shooting direction in which the camera is located when the ranging function is activated; the step of adjusting the shooting angle of the camera according to the first shooting direction specifically includes: determining the azimuth and angle of the first shooting direction relative to the original shooting direction based on the original shooting direction and the first shooting direction; and controlling the adjustment device to adjust the shooting angle of the camera to the first shooting direction based on the azimuth and the angle.
[0015] In one embodiment, obtaining the first shooting direction based on the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located specifically includes: when the slope angle of the road in front of the first vehicle is the same as the slope angle of the road where the first vehicle is located, determining the first shooting direction as the driving direction of the first vehicle.
[0016] In one embodiment, obtaining the first shooting direction based on the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located specifically includes: when the slope angle of the road in front of the first vehicle is not equal to zero and the slope angle of the road where the first vehicle is located is equal to zero, determining the first shooting direction as the slope angle of the road in front of the first vehicle.
[0017] In one embodiment, obtaining the first shooting direction based on the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located specifically includes: when the slope angle of the road in front of the first vehicle is equal to zero and the slope angle of the road where the first vehicle is located is not equal to zero, determining the first shooting direction as the slope angle of the road where the first vehicle is located.
[0018] In one embodiment, obtaining the first shooting direction based on the slope angle of the road ahead of the first vehicle and the slope angle of the road where the first vehicle is located specifically includes: when both the slope angle of the road ahead of the first vehicle and the slope angle of the road where the first vehicle is located are not equal to zero, determining whether the road ahead of the first vehicle and the road where the first vehicle is located are uphill or downhill; when the road ahead of the first vehicle is uphill and the road where the first vehicle is located is downhill, determining the first shooting direction as the slope angle of the road ahead of the first vehicle and the slope angle of the road where the first vehicle is located. The first shooting direction is determined as the sum of the slope angles of the road ahead and the road where the first vehicle is located, when the road ahead of the first vehicle is downhill and the road where the first vehicle is located is uphill. When both the road ahead of the first vehicle and the road where the first vehicle is located are uphill or downhill, and the slope angles of the road ahead of the first vehicle and the road where the first vehicle is located are not equal, the first shooting direction is determined as the difference between the slope angles of the road ahead of the first vehicle and the road where the first vehicle is located.
[0019] Secondly, this application provides a ranging device, comprising: a receiving unit, configured to acquire a first image captured by a camera along the driving direction of a first vehicle, the first image including road information; a processing unit, configured to obtain the slope angle of the road ahead of the first vehicle based on the first image; obtain a first shooting direction based on the slope angle of the road ahead of the first vehicle and the slope angle of the road where the first vehicle is located; and adjust the shooting angle of the camera based on the first shooting direction; the receiving unit is further configured to receive a second image captured by the camera after the shooting angle has been adjusted, the second image including a second vehicle; and the processing unit is further configured to calculate the distance between the first vehicle and the second vehicle based on the second image.
[0020] In one embodiment, the processing unit is further configured to: obtain, based on the first image, a turning angle of the road ahead of the first vehicle, wherein the turning angle is the angle between the driving direction of the first vehicle and the extension direction of the road ahead of the first vehicle, and the driving direction of the first vehicle and the direction of the road ahead of the driving direction are determined by the road information; obtain a second shooting direction based on the turning angle of the road ahead of the first vehicle; and adjust the shooting angle of the camera based on the second shooting direction.
[0021] In one embodiment, the processing unit is further configured to display on the display screen the driving status of the first vehicle and the second vehicle on the road and / or the distance value between the first vehicle and the second vehicle.
[0022] In one embodiment, the processing unit is further configured to display a warning message on the display screen or broadcast a warning message through a speaker when the distance between the first vehicle and the second vehicle is less than a set safe distance.
[0023] In one implementation, the slope angle of the road where the first vehicle is located is determined based on the angle of the bias of the detection gyroscope.
[0024] In one embodiment, the processing unit is specifically configured to determine the original shooting direction of the camera, which is the shooting direction of the camera when the ranging function is activated; determine the azimuth and angle of the first shooting direction relative to the original shooting direction based on the original shooting direction and the first shooting direction; and control the adjustment device to adjust the shooting angle of the camera to the first shooting direction based on the azimuth and the angle.
[0025] In one embodiment, the processing unit is specifically used to determine the first shooting direction as the driving direction of the first vehicle when the slope angle of the road in front of the first vehicle is the same as the slope angle of the road where the first vehicle is located.
[0026] In one embodiment, the processing unit is specifically used to determine the first shooting direction as the slope angle of the road in front of the first vehicle when the slope angle of the road in front of the first vehicle is not equal to zero and the slope angle of the road where the first vehicle is located is equal to zero.
[0027] In one embodiment, the processing unit is specifically used to determine the first shooting direction as the slope angle of the road where the first vehicle is located when the slope angle of the road in front of the first vehicle is equal to zero and the slope angle of the road where the first vehicle is located is not equal to zero.
[0028] In one embodiment, the processing unit is specifically configured to: determine whether the road in front of the first vehicle and the road where the first vehicle is located are uphill or downhill when both the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located are not equal to zero; determine the first shooting direction as the sum of the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located when both the road in front of the first vehicle and the road where the first vehicle is located are downhill; determine the first shooting direction as the sum of the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located when both the road in front of the first vehicle and the road where the first vehicle is located are uphill or downhill, and the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located are not equal when both the road in front of the first vehicle and the road where the first vehicle is located are uphill or downhill, respectively.
[0029] Thirdly, this application provides an adjustment device, comprising: an upper servo motor and a lower servo motor for receiving electrical signals and rotating; an upper rotating gear set coupled to the upper servo motor for rotating when the upper servo motor rotates; a lower rotating gear set coupled to the lower servo motor for rotating when the lower servo motor rotates; a fixed bracket including a first gear slot and a second gear slot, the first gear slot being coupled to the upper rotating gear set and the second gear slot being coupled to the lower rotating gear set, for rotating along a first direction when the upper servo motor rotates and rotating along a second direction when the lower servo motor rotates; the first direction and the second direction are perpendicular to each other; the fixed bracket is coupled to a camera for adjusting the shooting direction of the camera.
[0030] Fourthly, this application provides a terminal device including at least one processor, the processor being configured to execute instructions stored in a memory to cause the terminal device to perform the methods as described in the first aspect.
[0031] Fifthly, this application provides a vehicle, characterized in that it includes a camera, an adjustment device, and a ranging device, wherein the adjustment device is used to adjust the shooting angle of the camera, and the ranging device may be the ranging device described in the second aspect or its embodiments.
[0032] In one embodiment, the adjustment device includes: an upper servo motor and a lower servo motor for receiving electrical signals and rotating; an upper rotating gear set coupled to the upper servo motor for rotating when the upper servo motor rotates; a lower rotating gear set coupled to the lower servo motor for rotating when the lower servo motor rotates; a fixed bracket including a first gear slot and a second gear slot, the first gear slot being coupled to the upper rotating gear set and the second gear slot being coupled to the lower rotating gear set, for rotating along a first direction when the upper servo motor rotates and rotating along a second direction when the lower servo motor rotates; the first direction and the second direction are perpendicular to each other; the fixed bracket is coupled to a camera for adjusting the shooting direction of the camera.
[0033] In a sixth aspect, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the methods that are possible implementations of the first aspect.
[0034] In a seventh aspect, this application provides a computing device, including a memory and a processor, characterized in that the memory stores executable code, and when the processor executes the executable code, it implements the methods that may be implemented in the first aspect. Attached Figure Description
[0035] The accompanying drawings used in the description of the embodiments or prior art are briefly introduced below.
[0036] Figure 1 This is a schematic diagram of a monocular ranging scenario.
[0037] Figure 2 A schematic diagram of the structure of a vehicle provided in an embodiment of this application;
[0038] Figure 3 This is a schematic diagram of the structure of an adjustment device provided in an embodiment of this application;
[0039] Figure 4 A flowchart illustrating a ranging method provided in an embodiment of this application;
[0040] Figure 5 This is a schematic diagram of an image captured by a camera provided in an embodiment of this application;
[0041] Figure 6 (a) A schematic diagram of a processor provided in this application simulating a preset lane line based on the identified lane line;
[0042] Figure 6(b) A schematic diagram showing the positional relationship between the disappearance point of a preset lane line and the disappearance point of an actual lane line, provided in an embodiment of this application;
[0043] Figure 7 Nine road condition diagrams provided for embodiments of this application;
[0044] Figure 8 This is a schematic diagram of an image captured by a camera provided in an embodiment of this application;
[0045] Figure 9 This is a schematic diagram of a ranging device provided in an embodiment of this application. Detailed Implementation
[0046] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0047] The solution provided in this application involves monocular ranging, where the principle of monocular ranging is to obtain the homography matrix through actual calibration. In computer vision, the homography of a plane is defined as the projection mapping from one plane to another. Therefore, the mapping of a point on a two-dimensional plane to the imager of a camera is an example of planar homography.
[0048] For example, such as Figure 1 As shown, the mapping from a point Q on the object plane to a point q on the image plane uses homogeneous coordinates. This mapping can be represented by matrix multiplication, as follows:
[0049]
[0050] Homography can then be simply expressed as:
[0051]
[0052] Where s represents the scale of any scale (the purpose is to define homography to that scale), and H consists of two parts: the physical transformation W of the object plane used for positioning and observation, and the intrinsic parameter matrix M of the camera.
[0053] The physical transformation W is the sum of the effects of partial rotation R and partial translation t related to the observed image plane, and is:
[0054] W = [R t]; (3)
[0055] The intrinsic parameter matrix M of the camera is:
[0056]
[0057] Among them, fx f y c represents the focal length of the camera. x c y Indicates the optical center of the camera.
[0058] Then the homography of formula (2) is expressed as:
[0059]
[0060] Since homography studies the mapping from one plane to another, then the formula above... This can be simplified to planar coordinates. Let Z = 0. At this point, points on the object plane are represented by (x, y), and points on the camera plane are also represented by two-dimensional points, meaning the coordinates in the Z direction are removed. Therefore, relative to the rotation matrix R, when R is decomposed into R = [r1r2 r3], r3 is also discarded. The homography at this point is expressed as:
[0061]
[0062] Where x and y represent coordinates on the image plane, s represents a scale of any size, and f x f y c represents the focal length of the camera. x c y The optical center of the camera is represented by r1 and r2, which represent the coordinates of the rotation matrix R in the x and y directions, respectively. X and Y represent the coordinates of the object plane.
[0063] In the process of monocular ranging, the distance between the target object and the camera in the actual state is calculated by detecting the distance of the target object in the x and y coordinates in the image captured by the camera, and then by formula (6).
[0064] Figure 2 This is a schematic diagram of a vehicle architecture provided as an embodiment of this application. (For example...) Figure 2 As shown, the vehicle 200 includes a camera 201, a gyroscope 202, an adjustment device 203, a processor 204, and a bus 205. The camera 201, gyroscope 202, adjustment device 203, and processor 204 in the vehicle 200 can establish a communication connection via the bus 205.
[0065] The camera 201 can exist independently or as a device such as a dashcam or vehicle monitoring system. In this application, the camera 201 is used to capture images of the area in front of the vehicle 200 in its direction of travel, and then sends the captured images to the processor 204 for processing. The images captured by the camera 201 may include target objects such as roads, lane lines, other vehicles, pedestrians, and obstacles.
[0066] The gyroscope 202, which can be a three-axis gyroscope, a six-axis gyroscope, etc., is fixedly installed at a certain position within the vehicle 200. It can exist independently or form an inertial navigation system together with the accelerometer, allowing the angle of the vehicle 200's offset relative to the horizontal direction to be determined by detecting the offset angle of the gyroscope 202. In this application, the processor 204 determines whether the road where the vehicle 200 is located is horizontal, tilted upwards, or tilted downwards by detecting the offset angle of the gyroscope 202, and determines whether the vehicle 200 is traveling in a straight line, turning left, or turning right during driving.
[0067] The adjustment device 203 is used to fix the camera 201 to the vehicle 200 and adjust the shooting direction of the camera 201 by receiving adjustment commands sent by the processor 204. For example, as shown... Figure 3 As shown, the adjustment device 203 includes a fixed bracket 2031, an upper rotating gear set 2032, an upper servo motor 2033, a lower rotating gear set 2034, and a lower servo motor 2035. The fixed bracket 2031 includes gear slots that are coupled to both the upper rotating gear set 2032 and the lower rotating gear set 2034. The upper rotating gear set 2032 is coupled to one of the two gear slots on the upper servo motor 2033 and the fixed bracket 2031. The lower servo motor 2035 is coupled to the other of the two gear slots on the lower rotating gear set 2034 and the fixed bracket 2031. The fixed bracket 2031 is coupled to the camera 201.
[0068] After receiving the adjustment command (i.e., electrical signal) sent by the processor 204, the upper servo motor 2033 rotates, thereby driving one of the two gear slots to rotate through the upper rotating gear set 2032, causing the fixed bracket 2031 to rotate left and right in the horizontal direction (or up and down in the vertical direction), thus realizing the left and right movement of the shooting direction of the camera 201 in the horizontal direction; after receiving the adjustment command (i.e., electrical signal) sent by the processor 204, the lower servo motor 2035 rotates, thereby driving the other gear slot in the two gear slots to rotate through the lower rotating gear set 2034, causing the fixed bracket 2031 to rotate up and down in the vertical direction (or left and right in the horizontal direction), thus realizing the up and down movement of the shooting direction of the camera 201 in the vertical direction.
[0069] The processor 204 communicates with the camera 201, gyroscope 202, and adjustment device 203 via bus 205. It receives images from the camera 201 and calculates the slope angle β of the road ahead of the vehicle 200 in the direction of travel based on a lane line recognition algorithm. Simultaneously, it calculates the slope angle α of the road where the vehicle 200 is located by detecting the offset angle of the gyroscope 202. Then, based on the slope angle α of the road where the vehicle 200 is located and the slope angle β of the road in the direction of travel, it calculates the direction in which the camera 201 will adjust its shooting direction.
[0070] The processor 204 then determines the direction and angle to be adjusted based on the current shooting direction of the camera 201 and the direction to be adjusted. Then, based on the desired shooting direction, it determines whether the upper servo motor 2033 or the lower servo motor 2035 receives electrical signals, or whether both receive signals simultaneously. Based on the desired angle, it determines the operating time of the upper servo motor 2033 and the lower servo motor 2035. This adjusts the shooting direction of the camera 201 to the direction calculated by the processor 204. Subsequently, when the camera 201 detects other vehicles, pedestrians, or other obstacles in front of the vehicle 200, it calculates the distance between the obstacle and the vehicle 200 using monocular ranging principles. This distance is more accurate than before the shooting direction of the camera 201 was adjusted.
[0071] The processor 204 in this application can also be a server. The vehicle 200 communicates with the server through a communication unit, and then the server replaces the function of the processor 204.
[0072] The following example, using vehicle 200 traveling in a straight line, illustrates how processor 204 implements the technical solution of this application.
[0073] Figure 4 This is a flowchart illustrating a ranging method provided in an embodiment of this application. Figure 4 As shown, the specific implementation process of processor 204 is as follows:
[0074] Step S401: Acquire the image captured by camera 201.
[0075] When the ranging function is turned on, the initial shooting direction of the camera 201 can be the shooting direction of the camera 201 when the ranging function was turned off last time, or the processor 204 can control the adjustment device 203 to correct the shooting direction of the camera 201 to the alignment line (that is, the direction of the vehicle 200 when it is traveling in a straight line). This application does not limit this.
[0076] The image captured by camera 201 must include at least one reference point reflecting road changes, in order to subsequently calculate the slope angle β of the road ahead of the vehicle 200's travel direction. This reference point can be lane lines, lane edge lines, guardrails, etc. After receiving the image, processor 204 performs AI recognition. If no lane lines, edge lines, guardrails, or other reference points are identified in the image, it sends a command to camera 201 to recapture the image.
[0077] Step S402: Calculate the slope angle β of the road ahead of the vehicle 200 in the direction of travel.
[0078] For example, taking lane lines as a reference point, when camera 201 captures such... Figure 5 After obtaining the lane lines on both sides of the lane where vehicle 200 is located, the processor 204 uses existing lane line recognition algorithms such as spatial convolutional neural network (SCNN) and Hough transform to identify the lane lines on both sides of the lane where vehicle 200 is located. After obtaining the lane lines on both sides of the lane where vehicle 200 is located, the processor 204 calculates the coordinate position of the intersection point (also called the "hidden point") of the extension lines of the two lane lines on both sides of the lane where vehicle 200 is located in the image. Then, the processor 204 determines whether the coordinate position of the calculated hidden point is the same as the coordinate position of the preset hidden point based on the hidden point of the lane lines on a horizontal road. If they are the same, it indicates that the road ahead of vehicle 200 in the direction of travel is horizontal; if they are not the same, and the coordinate position of the calculated hidden point is below the coordinate position of the preset hidden point, it indicates that the road ahead of vehicle 200 in the direction of travel is downhill; if they are not the same, and the coordinate position of the calculated hidden point is above the coordinate position of the preset hidden point, it indicates that the road ahead of vehicle 200 in the direction of travel is uphill. Meanwhile, the processor 204 calculates the slope angle β based on the coordinates of the two hidden points.
[0079] In one possible example, such as Figure 6 As shown in (a), after the processor 204 identifies the lane lines on the road according to the lane line recognition algorithm, it simulates a preset lane line based on the starting point of the actual lane line. The preset lane line is a virtual lane line when the processor 204 considers the road ahead of the vehicle 200 in the direction of travel to be a flat road. Point "P" is the disappearance point of the preset lane line; Figure 6 As shown in (b), the processor 204 processes the actual lane lines to obtain the actual hidden point "Q". Based on the coordinate positions of the virtual hidden point "P" and the actual hidden point "Q" on the image, the processor 204 determines that the actual hidden point "Q" is located above the virtual hidden point "P", which indicates that the road ahead of the vehicle 200 in the direction of travel is uphill, and calculates the slope angle β.
[0080] Step S403: Obtain the bias angle of the gyroscope 202 and determine the slope angle α of the road where the vehicle 200 is located.
[0081] Specifically, since the gyroscope 202 is fixed inside the vehicle 200, the state of the gyroscope 202 is related to whether the road where the vehicle 200 is located is horizontal. Therefore, the processor 202 can obtain the slope angle α of the road where the vehicle 200 is located by obtaining the bias angle of the gyroscope 202.
[0082] Step S404: Determine the shooting direction of camera 201 based on the slope angle α of the road where vehicle 200 is located and the slope angle β of the road in front of the direction of travel of vehicle 200.
[0083] Here, based on the slope angle α of the road where vehicle 200 is located and the slope angle β of the road in the direction of travel, road conditions can be divided into 9 types, such as... Figure 7 As shown, the routes are (flat road, flat road), (flat road, downhill), (flat road, uphill), (uphill, flat road), (uphill, downhill), (uphill, uphill), (downhill, flat road), (downhill, downhill), and (downhill, uphill).
[0084] For the three road conditions (flat road, flat road), (uphill, uphill), and (downhill, downhill), if the slope angle α of the road where vehicle 200 is located is equal to the slope angle β of the road ahead of vehicle 200, then the road on which vehicle 200 is traveling is actually on a plane, so the shooting direction of camera 201 needs to be adjusted to the alignment line. If the original shooting direction of camera 201 is already on the alignment line, then no adjustment of the shooting direction of camera 201 is needed.
[0085] However, for the two road conditions of (uphill, uphill) and (downhill, downhill), if the slope angle α of the road where vehicle 200 is located is not equal to the slope angle β of the road in front of vehicle 200 in the direction of travel, then the road on which vehicle 200 is traveling is not actually on the same plane, so the shooting direction of camera 201 is not on the alignment. The shooting direction of camera 201 is adjusted to be parallel to the plane of the road in front of the direction of travel of vehicle 200. That is, the angle between the shooting direction of camera 201 and the guideline needs to be adjusted to the difference between the slope angle α of the road where vehicle 200 is located and the slope angle β of the road in front of the direction of travel of vehicle 200. The orientation of the shooting direction relative to the guideline is determined according to the road conditions and slope angles. Specifically: For road conditions (uphill, uphill), if slope angle α is greater than slope angle β, the shooting direction is vertically downward relative to the guideline; for road conditions (uphill, uphill), if slope angle α is less than slope angle β, the shooting direction is vertically upward relative to the guideline; for road conditions (downhill, downhill), if slope angle α is greater than slope angle β, the shooting direction is vertically upward relative to the guideline; for road conditions (downhill, downhill), if slope angle α is less than slope angle β, the shooting direction is vertically downward relative to the guideline.
[0086] For road conditions (flat road, downhill), if the slope angle α of the road where vehicle 200 is located is not equal to the slope angle β of the road ahead of vehicle 200, then the road on which vehicle 200 is traveling is not actually on the same plane. Therefore, the shooting direction of camera 201 is not on the alignment line. The shooting direction of camera 201 needs to be adjusted to be parallel to the plane of the road ahead of vehicle 200. That is, the angle between the shooting direction of camera 201 and the alignment line needs to be adjusted to the slope angle β of the road ahead of vehicle 200, and located in the vertically downward direction of the alignment line.
[0087] For road conditions (flat road, uphill), if the slope angle α of the road where vehicle 200 is located is not equal to the slope angle β of the road ahead of vehicle 200, then the road on which vehicle 200 is traveling is not actually on the same plane. Therefore, the shooting direction of camera 201 is not on the alignment line. The shooting direction of camera 201 needs to be adjusted to be parallel to the plane of the road ahead of vehicle 200. That is, the angle between the shooting direction of camera 201 and the alignment line needs to be adjusted to the slope angle β of the road ahead of vehicle 200, and it needs to be located in the vertically upward direction of the alignment line.
[0088] For road conditions (uphill, flat), if the slope angle α of the road where vehicle 200 is located is not equal to the slope angle β of the road ahead of vehicle 200, then the road on which vehicle 200 is traveling is not actually on the same plane. Therefore, the shooting direction of camera 201 is not on the alignment line. The shooting direction of camera 201 needs to be adjusted to be parallel to the plane of the road ahead of vehicle 200. That is, the angle between the shooting direction of camera 201 and the alignment line needs to be adjusted to the slope angle β of the road where vehicle 200 is located, and it needs to be located in the vertically downward direction of the alignment line.
[0089] For road conditions of uphill and downhill, if the slope angle α of the road where vehicle 200 is located is not equal to the slope angle β of the road ahead of vehicle 200, then the road on which vehicle 200 is traveling is not actually on the same plane. Therefore, the shooting direction of camera 201 is not on the alignment. The shooting direction of camera 201 needs to be adjusted to be parallel to the plane of the road ahead of vehicle 200. That is, the angle between the shooting direction of camera 201 and the alignment needs to be adjusted to be the sum of the slope angle α of the road where vehicle 200 is located and the slope angle β of the road ahead of vehicle 200, and it needs to be located in the vertically downward direction of the alignment.
[0090] For road conditions (downhill, flat road), if the slope angle α of the road where vehicle 200 is located is not equal to the slope angle β of the road ahead of vehicle 200, then the road on which vehicle 200 is traveling is not actually on the same plane. Therefore, the shooting direction of camera 201 is not on the alignment line. The shooting direction of camera 201 needs to be adjusted to be parallel to the plane of the road ahead of vehicle 200. That is, the angle between the shooting direction of camera 201 and the alignment line needs to be adjusted to the slope angle α of the road where vehicle 200 is located, and it needs to be located in the vertically upward direction of the alignment line.
[0091] For road conditions (downhill, uphill), if the slope angle α of the road where vehicle 200 is located and the slope angle β of the road ahead of vehicle 200 are not equal, then the road where vehicle 200 is traveling is not actually on the same plane. Therefore, the shooting direction of camera 201 is not on the alignment. The shooting direction of camera 201 needs to be adjusted to be parallel to the plane of the road ahead of vehicle 200. That is, the angle between the shooting direction of camera 201 and the alignment needs to be adjusted to the sum of the slope angle α of the road where vehicle 200 is located and the slope angle β of the road ahead of vehicle 200, and it needs to be located in the vertically upward direction of the alignment.
[0092] Step S405: Generate control commands based on the original shooting direction of camera 201 and the calculated shooting direction of camera 201.
[0093] The control commands are used to control whether the upper servo motor 2033 or the lower servo motor 2035 in the regulating device 202 is energized, and for what duration. Since this scheme only considers the straight-line travel of the vehicle 200, the question of whether the upper servo motor 2033 is energized does not need to be considered.
[0094] Specifically, the initial shooting direction of camera 201 is known regardless of its position when the ranging function was last turned off, or whether it was subsequently corrected to the alignment line. Whether the servo motor 2035 is powered on and for how long under the control of processor 201 is related to the initial shooting direction of camera 201 and the calculated shooting direction.
[0095] For example, taking the original shooting direction of camera 201 as being on the guideline, when the road condition is (flat road, downhill), since the angle between the shooting direction of camera 201 and the guideline is the slope angle β of the road in front of the direction of vehicle 200 travel, and it is located in the vertically downward direction of the guideline, the processor needs to control the lower servo motor 2035 to be powered on, so as to move the shooting direction of camera 201 downward (for example, to make the lower servo motor 2035 rotate counterclockwise), and determine the working time of the lower servo motor 2035 based on the slope angle β and the rotation speed of the lower servo motor 2035, and then generate control instructions based on the information such as the identifier of the powered motor, the power-on command, the rotation direction and the working time.
[0096] Step S406: Send an adjustment command to the adjustment device 203.
[0097] Step S407: Receive feedback information sent by the regulating device 203.
[0098] For example, after receiving the control command generated in step 405, the adjustment device 203 parses it to obtain information such as the identifier of the energized motor, the energizing command, the rotation direction, and the working time. Following the control command, the adjustment device 203 energizes the lower servo motor 2035 and rotates it counterclockwise for a specified time. After the lower servo motor 2035 has completed its operation, the adjustment device 203 sends a feedback message to the processor 204, indicating that the adjustment device 203 has adjusted the shooting direction of the camera 201 to the specified direction.
[0099] In step S408, the second image sent by camera 201 is received. The second image includes obstacles such as the target vehicle and pedestrians.
[0100] Step S409: Calculate the distance between vehicle 200 and the target vehicle.
[0101] In reality, camera 201 is always in shooting mode. Regardless of whether the shooting direction of camera 201 changes according to road conditions, when processor 204 detects that the image captured by camera 201 includes obstacles such as target vehicles and pedestrians, it calculates the distance between vehicle 200 and the obstacles using the "monocular ranging principle". After processor 204 controls adjustment device 203 to change the shooting direction of camera 201 according to road conditions, if the captured image still includes obstacles, the distance between vehicle 200 and obstacles calculated by processor 204 at this time is more accurate than before the adjustment.
[0102] The above description of the specific implementation of processor 204 takes the straight-line driving of vehicle 200 as an example. In real life, vehicles are not limited to straight-line driving, but also to turning driving, and even more complex driving situations such as turning uphill and turning downhill. In this case, it is necessary to consider that the shooting direction of camera 201 is not limited to vertical movement, but also needs to consider horizontal movement.
[0103] For example, when camera 201 captures such Figure 8 When the image shown is displayed, the processor 204 identifies the lane lines on both sides of the lane where the vehicle 200 is located using a lane line recognition algorithm. Then, it calculates that if the positions of the disappearance points of the two lane lines on both sides of the lane where the vehicle 200 is located are above and to the left of the preset disappearance point coordinates, it indicates that the road ahead of the vehicle 200 in the direction of travel is a "left turn uphill" road condition. At this time, the processor 204 calculates the slope angle of the road ahead of the vehicle 200 in the direction of travel and the horizontal angle γ between the two disappearance points based on the coordinates of the two disappearance points.
[0104] Regarding the vertical adjustment of camera 202, as described above... Figure 4 and Figure 4 The corresponding steps S402-S407 have already been described, and will not be repeated here.
[0105] For the horizontal adjustment of camera 202, after obtaining the angle γ between the two blanking points in the horizontal direction, processor 204 needs to energize the upper servo motor 2033 to move the shooting direction of camera 201 to the left (e.g., to rotate the upper servo motor 2033 clockwise). Based on the angle γ and the rotational speed of the upper servo motor 2033, processor 204 determines the working time of the upper servo motor 2033. Then, it generates a control command based on information such as the motor's identifier, energizing command, rotation direction, and working time, and sends it to adjustment device 203. Upon receiving the control command, adjustment device 203 energizes the upper servo motor 2033 and rotates it clockwise for the specified time. After the upper servo motor 2033 has completed its operation, adjustment device 203 sends a feedback message to processor 204, indicating that adjustment device 203 has adjusted the shooting direction of camera 201 to the specified direction.
[0106] In the description of the shooting direction adjustment of camera 202 in the vertical and horizontal directions, it was mentioned that two control commands were sent to adjustment device 203 and feedback information was sent from adjustment device 203 to processor 204. In fact, the two adjustment processes are carried out synchronously. Therefore, the control commands and feedback information for controlling the upper servo motor 2033 and the lower servo motor 2035 are packaged together and sent together.
[0107] In addition, the above-described embodiments of this application use a single camera to measure distance using the "monocular ranging principle". If cost and accuracy requirements are not considered, two cameras, or even three or four cameras, can be used, and this application does not limit them here.
[0108] In this embodiment, after the camera 201 captures an image, the slope angle of the road ahead of the vehicle 200 is determined based on reference objects such as lane lines, edge lines, and guardrails in the image. Based on the slope angle of the road where the vehicle 200 is located, determined by the gyroscope 202, the shooting direction of the camera 201 is calculated. The control adjustment device 203 adjusts the shooting direction of the camera 201 to the specified direction, so that when the camera 201 captures images of obstacles such as target vehicles or pedestrians on the road ahead of the vehicle 200, the distance between them can be calculated more accurately using the monocular ranging principle.
[0109] Figure 9 This is a schematic diagram of a ranging device provided in an embodiment of this application. Figure 9 As shown, the device 900 includes a receiving unit 901 and a processing unit 902.
[0110] The receiving unit 901 is used to acquire a first image captured by the camera along the driving direction of the first vehicle, the first image including road information;
[0111] The processing unit 902 is configured to obtain the slope angle of the road in front of the first vehicle based on the first image; obtain a first shooting direction based on the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located; and adjust the shooting angle of the camera based on the first shooting direction.
[0112] The receiving unit 901 is also used to receive a second image captured by the camera after the shooting angle has been adjusted, the second image including the second vehicle;
[0113] The processing unit 902 is further configured to calculate the distance between the first vehicle and the second vehicle based on the second image.
[0114] In one embodiment, the processing unit 902 is further configured to: obtain the turning angle of the road ahead of the first vehicle based on the first image, wherein the turning angle is the angle between the driving direction of the first vehicle and the extension direction of the road ahead of the first vehicle, and the driving direction of the first vehicle and the direction of the road ahead of the driving direction are determined by the road information; obtain a second shooting direction based on the turning angle of the road ahead of the first vehicle; and adjust the shooting angle of the camera based on the second shooting direction.
[0115] In one embodiment, the processing unit 902 is further configured to display on the display screen the driving status of the first vehicle and the second vehicle on the road and / or the distance value between the first vehicle and the second vehicle.
[0116] In one embodiment, the processing unit 902 is further configured to display a warning message on the display screen or broadcast a warning message through a speaker when the distance between the first vehicle and the second vehicle is less than a set safe distance.
[0117] In one implementation, the slope angle of the road where the first vehicle is located is determined based on the angle of the bias of the detection gyroscope.
[0118] In one embodiment, the processing unit 902 is specifically used to determine the original shooting direction of the camera, which is the shooting direction of the camera when the ranging function is activated; based on the original shooting direction and the first shooting direction, determine the position and angle of the first shooting direction in the original shooting direction; based on the position and the angle, control the adjustment device to adjust the shooting angle of the camera to the first shooting direction.
[0119] In one embodiment, the processing unit 902 is specifically used to determine the first shooting direction as the driving direction of the first vehicle when the slope angle of the road in front of the first vehicle is the same as the slope angle of the road where the first vehicle is located.
[0120] In one embodiment, the processing unit 902 is specifically used to determine the first shooting direction as the slope angle of the road in front of the first vehicle when the slope angle of the road in front of the first vehicle is not equal to zero and the slope angle of the road where the first vehicle is located is equal to zero.
[0121] In one embodiment, the processing unit 902 is specifically used to determine the first shooting direction as the slope angle of the road where the first vehicle is located when the slope angle of the road in front of the first vehicle is equal to zero and the slope angle of the road where the first vehicle is located is not equal to zero.
[0122] In one embodiment, the processing unit 902 is specifically configured to: determine whether the road in front of the first vehicle and the road where the first vehicle is located are uphill or downhill when both the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located are not equal to zero; determine the first shooting direction as the sum of the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located when both the road in front of the first vehicle and the road where the first vehicle is located are uphill; determine the first shooting direction as the sum of the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located when both the road in front of the first vehicle and the road where the first vehicle is located are uphill or downhill, and the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located are not equal when both the road in front of the first vehicle and the road where the first vehicle is located are uphill or downhill, respectively.
[0123] The present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform any of the methods described above.
[0124] The present invention provides a computing device, including a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement any of the above-described methods.
[0125] Those skilled in the art will recognize that the units and algorithm steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application.
[0126] Furthermore, various aspects or features of the embodiments of this application can be implemented as methods, apparatus, or articles of manufacture using standard programming and / or engineering techniques. The term "article of manufacture" as used in this application encompasses a computer program accessible from any computer-readable device, carrier, or medium. For example, computer-readable media may include, but are not limited to: magnetic storage devices (e.g., hard disks, floppy disks, or magnetic tapes), optical discs (e.g., compact discs (CDs), digital versatile discs (DVDs), etc.), smart cards, and flash memory devices (e.g., erasable programmable read-only memory (EPROMs), cards, sticks, or key drives, etc.). Additionally, the various storage media described herein may represent one or more devices and / or other machine-readable media for storing information. The term "machine-readable medium" may include, but is not limited to, wireless channels and various other media capable of storing, containing, and / or carrying instructions and / or data.
[0127] In the above embodiments, Figure 9 The air-to-air interactive device 900 can be implemented entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid state disks (SSDs)).
[0128] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply 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 this application.
[0129] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0130] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0131] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0132] If the aforementioned function is implemented as 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 technical solution of this application embodiment, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or an access network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0133] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application.
Claims
1. A distance measurement method, characterized in that, The method includes: Acquire a first image captured by the camera along the driving direction of the first vehicle, the first image including road information; Based on the first image, obtain the slope angle of the road in front of the first vehicle; The first shooting direction is obtained based on the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located; Adjust the shooting angle of the camera according to the first shooting direction; Receive a second image captured by the camera after the shooting angle has been adjusted, the second image including the second vehicle; Based on the second image, the distance between the first vehicle and the second vehicle is calculated; The distance between the first vehicle and the second vehicle is displayed on the screen. The slope angle of the road where the first vehicle is located is determined based on the angle of the bias of the detection gyroscope. The step of obtaining the first shooting direction based on the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located includes: When the slope angle of the road ahead of the first vehicle is the same as the slope angle of the road where the first vehicle is located, the first shooting direction is determined to be the driving direction of the first vehicle; or... When the slope angle of the road ahead of the first vehicle is not zero, and the slope angle of the road where the first vehicle is located is zero, the first shooting direction is determined to be the slope angle of the road ahead of the first vehicle; or, When the slope angle of the road in front of the first vehicle is zero, but the slope angle of the road where the first vehicle is located is not zero, the first shooting direction is determined to be the slope angle of the road where the first vehicle is located; or, When both the slope angle of the road ahead of the first vehicle and the slope angle of the road where the first vehicle is located are not zero, it is determined whether the road ahead of the first vehicle and the road where the first vehicle is located are uphill or downhill; when the road ahead of the first vehicle is uphill and the road where the first vehicle is located is downhill, the first shooting direction is determined to be the sum of the slope angle of the road ahead of the first vehicle and the slope angle of the road where the first vehicle is located; or... When both the slope angle of the road ahead of the first vehicle and the slope angle of the road where the first vehicle is located are not zero, it is determined whether the road ahead of the first vehicle and the road where the first vehicle is located are uphill or downhill. When the road ahead of the first vehicle is downhill and the road where the first vehicle is located is uphill, the first shooting direction is determined to be the sum of the slope angle of the road ahead of the first vehicle and the slope angle of the road where the first vehicle is located; or... When the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located are both not equal to zero, it is determined that the road in front of the first vehicle and the road where the first vehicle is located are uphill or downhill. When both the road in front of the first vehicle and the road where the first vehicle is located are uphill or downhill, and the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located are not equal, the first shooting direction is determined to be the difference between the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located.
2. The method according to claim 1, characterized in that, Before receiving the second image captured by the camera after the shooting angle has been adjusted, the method further includes: Based on the first image, the turning angle of the road ahead of the first vehicle is obtained. The turning angle is the angle between the driving direction of the first vehicle and the direction of the extension of the road ahead of the first vehicle. The driving direction of the first vehicle and the direction of the road ahead of the driving direction are determined by the road information. The second shooting direction is obtained based on the turning angle of the road ahead of the first vehicle; Adjust the camera's shooting angle according to the second shooting direction.
3. The method according to any one of claims 1-2, characterized in that, The method further includes: The display screen shows the driving status of the first vehicle and the second vehicle on the road.
4. The method according to any one of claims 1-2, characterized in that, The method further includes: When the distance between the first vehicle and the second vehicle is less than the set safe distance, a warning message is displayed on the screen or a warning message is broadcast through the speaker.
5. The method according to claim 3, characterized in that, The method further includes: When the distance between the first vehicle and the second vehicle is less than the set safe distance, a warning message is displayed on the screen or a warning message is broadcast through the speaker.
6. The method according to claim 1, characterized in that, Before acquiring the first image taken by the camera along the direction of travel of the first vehicle, the process includes: Determine the original shooting direction of the camera, which is the shooting direction of the camera when the ranging function is activated; The step of adjusting the shooting angle of the camera according to the first shooting direction specifically includes: Based on the original shooting direction and the first shooting direction, determine the position and angle of the first shooting direction relative to the original shooting direction; Based on the orientation and the included angle, the control adjustment device adjusts the shooting angle of the camera to the first shooting direction.
7. A ranging device, characterized in that, include: The receiving unit is used to acquire a first image captured by the camera along the driving direction of the first vehicle, the first image including road information; The processing unit is configured to obtain the slope angle of the road in front of the first vehicle based on the first image; The first shooting direction is obtained based on the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located; Adjust the shooting angle of the camera according to the first shooting direction; The receiving unit is also configured to receive a second image captured by the camera after the shooting angle has been adjusted, the second image including the second vehicle; The processing unit is further configured to calculate the distance between the first vehicle and the second vehicle based on the second image, and display the distance value between the first vehicle and the second vehicle on the display screen; The slope angle of the road where the first vehicle is located is determined based on the angle of the bias of the detection gyroscope. The processing unit is specifically configured to determine the first shooting direction as the driving direction of the first vehicle when the slope angle of the road ahead of the first vehicle is the same as the slope angle of the road where the first vehicle is located; or... When the slope angle of the road ahead of the first vehicle is not zero, and the slope angle of the road where the first vehicle is located is zero, the first shooting direction is determined to be the slope angle of the road ahead of the first vehicle; or, When the slope angle of the road in front of the first vehicle is zero, but the slope angle of the road where the first vehicle is located is not zero, the first shooting direction is determined to be the slope angle of the road where the first vehicle is located; or, When both the slope angle of the road ahead of the first vehicle and the slope angle of the road where the first vehicle is located are not zero, it is determined whether the road ahead of the first vehicle and the road where the first vehicle is located are uphill or downhill; when the road ahead of the first vehicle is uphill and the road where the first vehicle is located is downhill, the first shooting direction is determined to be the sum of the slope angle of the road ahead of the first vehicle and the slope angle of the road where the first vehicle is located; or... When both the slope angle of the road ahead of the first vehicle and the slope angle of the road where the first vehicle is located are not zero, it is determined whether the road ahead of the first vehicle and the road where the first vehicle is located are uphill or downhill. When the road ahead of the first vehicle is downhill and the road where the first vehicle is located is uphill, the first shooting direction is determined to be the sum of the slope angle of the road ahead of the first vehicle and the slope angle of the road where the first vehicle is located; or... When the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located are both not equal to zero, it is determined that the road in front of the first vehicle and the road where the first vehicle is located are uphill or downhill. When both the road in front of the first vehicle and the road where the first vehicle is located are uphill or downhill, and the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located are not equal, the first shooting direction is determined to be the difference between the slope angle of the road in front of the first vehicle and the slope angle of the road where the first vehicle is located.
8. The apparatus according to claim 7, characterized in that, The processing unit is further configured to obtain the turning angle of the road ahead of the first vehicle based on the first image, wherein the turning angle is the angle between the driving direction of the first vehicle and the extension direction of the road ahead of the first vehicle, and the driving direction of the first vehicle and the direction of the road ahead of the driving direction are determined by the road information. The second shooting direction is obtained based on the turning angle of the road ahead of the first vehicle; Adjust the camera's shooting angle according to the second shooting direction.
9. The apparatus according to any one of claims 7-8, characterized in that, The processing unit is also configured to display the driving status of the first vehicle and the second vehicle on the road on the display screen.
10. The apparatus according to any one of claims 7-8, characterized in that, The processing unit is further configured to display a warning message on the display screen or broadcast a warning message through a speaker when the distance between the first vehicle and the second vehicle is less than a set safe distance.
11. The apparatus according to claim 9, characterized in that, The processing unit is further configured to display a warning message on the display screen or broadcast a warning message through a speaker when the distance between the first vehicle and the second vehicle is less than a set safe distance.
12. The apparatus according to claim 7, characterized in that, The processing unit is specifically used to determine the original shooting direction of the camera, which is the shooting direction of the camera when the ranging function is activated. Based on the original shooting direction and the first shooting direction, determine the position and angle of the first shooting direction relative to the original shooting direction; Based on the orientation and the included angle, the control adjustment device adjusts the shooting angle of the camera to the first shooting direction.
13. A terminal device, characterized in that, It includes at least one processor, the processor being configured to execute instructions stored in a memory to cause a terminal device to perform the method as described in any one of claims 1-6.
14. A vehicle, characterized in that, It includes a camera and an adjustment device, the adjustment device being used to adjust the shooting angle of the camera; The vehicle also includes the ranging device as described in any one of claims 7-12.
15. The vehicle according to claim 14, characterized in that, The regulating device includes: The upper and lower servo motors are used to receive electrical signals and rotate. The upper rotating gear set is coupled to the upper servo motor and is used to rotate when the upper servo motor rotates; The lower rotating gear set is coupled to the lower servo motor and is used to rotate when the lower servo motor rotates; The fixed bracket includes a first gear slot and a second gear slot. The first gear slot is coupled to the upper rotating gear set, and the second gear slot is coupled to the lower rotating gear set. It is used to rotate in a first direction when the upper servo motor rotates and to rotate in a second direction when the lower servo motor rotates. The first direction and the second direction are perpendicular to each other. The fixed bracket is coupled to the camera and is used to adjust the shooting direction of the camera.
16. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed in a computer, causes the computer to perform the method described in any one of claims 1-6.
17. A computing device, comprising a memory and a processor, characterized in that, The memory stores executable code, and when the processor executes the executable code, it implements the method of any one of claims 1-6.