Distance measurement method, terminal device and storage medium
By detecting the image frames of the intelligent driving vehicle and determining the position type, combining the pixel information of the static and dynamic targets, the actual distance between the dynamic target and the target vehicle is calculated, and the distance measurement accuracy of the intelligent driving vehicle in a complex environment is solved. The problem of insufficient improvements in operation accuracy.
Patent Information
- Application Number
- CN202411330826.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-02-11
AI Technical Summary
It is difficult for intelligently driven vehicles to ensure the accuracy of dynamic target ranging in complex road environments, which affects the accuracy of avoidance and deceleration operations.
A distance measurement method is adopted to detect the current image frame, and the estimated distance between the dynamic target and the target vehicle is obtained, and the position type of the dynamic target is determined based on the estimated distance. Combining the pixel information of the static target or the pixel information of the target component on the dynamic target, the actual distance between the dynamic target and the target vehicle is calculated using a division and conquer method.
It improves the accuracy of dynamic target ranging and enhances the ability of intelligent driving vehicles to avoid and slow down operations in complex environments.
Smart Images

Figure CN119413078A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent driving technology, and in particular to a distance measurement method, a terminal device and a storage medium. Background Art
[0002] With the advancement of technology and the development of science and technology, intelligent driving has become a research hotspot in the field of transportation vehicles at this stage. Intelligent driving vehicles need to perceive targets in the surrounding environment in real time to make corresponding decisions. The image acquisition unit is a common sensor used by intelligent driving vehicles to perceive the surrounding environment. The image acquisition unit is configured to obtain image data around the intelligent driving vehicle. Furthermore, the intelligent driving vehicle determines the targets in the surrounding environment from the image data and divides them into dynamic targets and static targets according to whether the targets are moving.
[0003] For intelligent driving vehicles, it is necessary to measure the relative distance between themselves and dynamic targets in a timely manner so as to perform avoidance, deceleration and other operations in a timely manner. However, due to the complex and changeable road environment, the accuracy of distance measurement is difficult to guarantee. Therefore, how to improve the distance measurement accuracy of dynamic targets has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The present application provides a distance measurement method, a terminal device and a storage medium.
[0005] A technical solution adopted by the present application is to provide a distance measurement method, the method comprising:
[0006] Performing target detection on the current image frame to obtain dynamic targets and static targets in the current image frame; wherein the current image frame is acquired by using an image acquisition component on the target vehicle;
[0007] Obtaining the estimated distance between the dynamic target and the target vehicle;
[0008] Determine the location type of the dynamic target based on the estimated distance;
[0009] According to the position type of the dynamic target, combined with the first pixel information of the static target, or combined with the second pixel information of the target component on the dynamic target, the actual distance between the dynamic target and the target vehicle is calculated.
[0010] Optionally, determining the location type of the dynamic target according to the estimated distance includes:
[0011] In response to the estimated distance being less than or equal to the first preset distance and the dynamic target being incomplete, determining the location type to be the first location type;
[0012] In response to the estimated distance being greater than a first preset distance and less than a second preset distance, determining the location type to be a second location type;
[0013] In response to the estimated distance being greater than the second preset distance, the location type is determined to be a third location type.
[0014] Optionally, the target component is a complete target in the current image frame;
[0015] The second pixel information includes a first pixel size of a first detection box corresponding to the target component;
[0016] According to the position type of the dynamic target, combined with the first pixel information of the static target, or combined with the second pixel information of the target component on the dynamic target, the actual distance between the dynamic target and the target vehicle is calculated, including:
[0017] In response to the position type being the first position type, acquiring an object category of the dynamic object, and identifying an object component on the dynamic object from the dynamic object to obtain a first detection frame;
[0018] determining a first actual size of the target component according to the target category;
[0019] The actual distance is calculated according to the first pixel size and the first actual size.
[0020] Optionally, the dynamic target is a motor vehicle or a non-motor vehicle, and the target component is at least one of a wheel, a license plate, a cargo box, and a container.
[0021] Optionally, the first pixel information is a lane pixel width corresponding to the lane line;
[0022] According to the position type of the dynamic target, combined with the first pixel information of the static target, or combined with the second pixel information of the target component on the dynamic target, the actual distance between the dynamic target and the target vehicle is calculated, including:
[0023] In response to the position type being the second position type, acquiring a deflection angle between the dynamic target and the target vehicle;
[0024] In response to the deflection angle being greater than a preset angle, constructing a target straight line using the deflection angle and a target grounding point in a second detection frame of the dynamic target;
[0025] Obtaining a first intersection point and a second intersection point between the target straight line and the lane line where the dynamic target is located; and determining the lane pixel width using the first intersection point and the second intersection point;
[0026] Obtaining a third intersection point between the target straight line and the second detection frame; and calculating the target actual width of the dynamic target using the target grounding point and the third intersection point;
[0027] The actual distance between the dynamic target and the target vehicle is calculated using the target actual width and target pixel width.
[0028] Optionally, the target ground point and the third intersection point are located in the world coordinate system.
[0029] The target actual width of the dynamic target is calculated using the target grounding point and the third intersection point, including:
[0030] Obtaining the distance between the target grounding point and the third intersection point, and using the distance as the first actual width; and obtaining the lane actual width corresponding to the lane line;
[0031] Obtain a first projection point of the target ground point in the image coordinate system and a second projection point of the third intersection point in the image coordinate system, and calculate a pixel distance between the first projection point and the second projection point;
[0032] Determine a second actual width according to the lane pixel width, the lane actual width, and the pixel distance;
[0033] The target actual width is calculated using the first actual width and the second actual width.
[0034] Optionally, in response to the position type being the second position type, after the step of obtaining the deflection angle between the dynamic target and the target vehicle, the method further includes:
[0035] In response to the deflection angle being less than a preset angle, obtaining an actual lane width of the lane; and obtaining a lane pixel width and a third pixel size of a third detection frame corresponding to the dynamic target;
[0036] The actual distance is calculated based on the actual lane width, lane pixel width and the third pixel size.
[0037] Optionally, the pixel information of the static target is a fourth pixel size of a fourth detection frame corresponding to the static target;
[0038] According to the position type of the dynamic target, combined with the first pixel information of the static target, or combined with the second pixel information of the target component on the dynamic target, the actual distance between the dynamic target and the target vehicle is calculated, including:
[0039] In response to the position type being the third position type, determining a fourth actual size of the static object according to the object type of the static object, and acquiring a fourth pixel size;
[0040] Obtaining a fifth pixel size of a fifth detection box corresponding to the dynamic target;
[0041] The actual distance is calculated according to the fourth actual size, the fourth pixel size, and the fifth pixel size.
[0042] Another technical solution adopted by the present application is to provide a terminal device, the terminal device comprising a memory and a processor connected to the memory;
[0043] The memory is used to store program data, and the processor is used to execute the program data to achieve the distance measurement as described above.
[0044] Another technical solution adopted by the present application is to provide a computer storage medium, wherein the computer storage medium is used to store program data, and when the program data is executed by a computer, it is used to implement the distance measurement method as described above.
[0045] The beneficial effects of the present application are: obtaining an estimated distance between a dynamic target and a target vehicle, determining the location type of the dynamic target according to the estimated distance, and calculating the actual distance between the dynamic target and the target vehicle according to the location type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target. The distance measurement method provided by the present application adopts a divide-and-conquer approach for the location type of the dynamic target, combines different pixel information to measure the distance of the dynamic target, and improves the accuracy of the distance measurement result. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0047] Figure 1 It is a flow chart of an embodiment of a distance measurement method provided by the present application;
[0048] Figure 2 It is a schematic diagram of the relationship between the first pixel width, the first actual width and the actual distance according to an embodiment of the present application;
[0049] Figure 3 is a schematic diagram of an embodiment of a dynamic obstacle provided by the present application;
[0050] Figure 4 is a flow chart of another embodiment of the distance measurement method provided by the present application;
[0051] Figure 5 is a schematic diagram of an embodiment of a truncated type dynamic obstacle provided by the present application;
[0052] Figure 6 It is a schematic diagram of an embodiment of a normal type of dynamic obstacle provided by the present application;
[0053] Figure 7 is a schematic diagram of an embodiment of a distant dynamic obstacle provided by the present application;
[0054] Figure 8 is a schematic diagram of an embodiment of a wire pole distance measurement method provided by the present application;
[0055] Fig. 9 It is a structural diagram of an embodiment of a terminal device provided by the present application;
[0056] Fig.10 It is a structural diagram of an embodiment of a computer storage medium provided by the present application. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0058] In the embodiments of the present application, the world coordinate system mainly refers to the self-vehicle coordinate system. Generally speaking, the self-vehicle coordinate system is a right-handed coordinate system. In one application scenario, the origin of the self-vehicle coordinate system is the center of the rear axle of the target vehicle (self-vehicle), the positive direction of the Y-axis is the direction from the origin to the front of the vehicle, and the positive direction of the Z-axis is the direction from the origin to the roof; or, the positive direction of the X-axis is the direction from the origin to the front of the vehicle, and the positive direction of the Z-axis is the direction from the origin to the roof. In another application scenario, the origin of the self-vehicle coordinate system is the center of mass of the target vehicle (self-vehicle), the positive direction of the Y-axis is the direction from the origin to the front of the vehicle, and the positive direction of the Z-axis is the direction from the origin to the roof; or, the positive direction of the X-axis is the direction from the origin to the front of the vehicle, and the positive direction of the Z-axis is the direction from the origin to the roof.
[0059] In the related art, intelligent driving vehicles can use monocular ranging or multi-eye ranging to determine the distance between a dynamic target and a target vehicle. As a typical multi-eye ranging method, binocular ranging uses the parallax formed by the imaging of the target between two cameras to determine the distance between the obstacle and the camera set on the vehicle, and then determine the distance between the target and the vehicle. It can be understood that the size of the parallax reflects the distance between the target and the vehicle. However, binocular ranging is heavily dependent on the accuracy of camera calibration. Moreover, targets located in the distance may be blurred, and binocular ranging will not be able to accurately measure the distance of targets beyond a certain distance. In addition, the binocular ranging method also increases the hardware cost to a certain extent.
[0060] Among the related technical solutions for monocular ranging, one solution is to use the calibrated camera external parameters to calculate the ground point where the target is located to achieve ranging. This method assumes that the ground plane where the target vehicle is located is on the same plane as the ground plane where the target is located, and obtains the spatial position of the obstacle through 2D to 3D conversion. This solution relies on the accuracy of the camera's calibration parameters and requires that the road surface cannot change significantly. If the road surface is undulating, the ranging accuracy of this solution will be reduced.
[0061] Another solution is to measure the distance by the vehicle height, using the target's image frame and true height, relying on the true value of the target height, using the method of similar triangles, using the camera height and the target height, to get the distance of the obstacle. This method is more commonly used, but with the current variety of target types, it is difficult to obtain the true height of each target.
[0062] Another solution is to use lane lines for distance measurement. The distance to the obstacle is calculated by the ratio of the width of the lane line where the vehicle is located to the width of the obstacle. However, this solution does not take into account the error caused by inaccurate rear frame when the obstacle is in a curve.
[0063] This application mainly designs a set of methods to improve the accuracy of measuring the distance between dynamic targets and target vehicles. Unlike traditional methods, this application adopts a divide-and-conquer approach, starting from the perspective of the estimated distance between the dynamic target and the target vehicle, combined with the pixel information of the static target, or the pixel information of the target component of the dynamic target, to more accurately obtain the actual distance between the dynamic target and the target vehicle.
[0064] Please refer to Figure 1 , Figure 1 It is a flow chart of an embodiment of a distance measurement method provided by the present application.
[0065] like Figure 1 As shown, the distance measurement method in the embodiment of the present application may specifically include the following steps:
[0066] S1, performing target detection on the current image frame to obtain dynamic targets and static targets in the current image frame.
[0067] The current image frame is acquired by using the image acquisition component on the target vehicle.
[0068] The distance measurement method provided in the present application is mainly performed by a distance measurement device. In some embodiments, the distance measurement device may be the image acquisition component itself. In some embodiments, the distance measurement device may be a device that is communicatively connected to the image acquisition component. For example, the device may be a device for monitoring images, a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, and an autonomous vehicle, a robot, a security system, or any one or more products of glasses and helmets for augmented reality or virtual reality. In some possible implementations, the distance measurement method may be implemented by a processor calling computer-readable instructions stored in a memory.
[0069] Optionally, the image acquisition component can be any one of a camera and an event camera. It can be understood that the image acquisition component is used to save the environmental information around the target vehicle in the form of an image.
[0070] It should be noted that the distance measurement method provided in this application realizes distance measurement in a monocular vision manner.
[0071] Specifically, the distance measuring device obtains the image frames collected by the image collection component, performs target detection on each image frame, and determines the target in the image.
[0072] For example, the target may include one or more combinations of vehicles, pedestrians, non-motor vehicles, road signs, road lane lines, trees around the road, street lights, fences, etc. This is not limited here.
[0073] In some possible embodiments, the distance measuring device performs target detection on the current image frame to obtain a target detection result corresponding to the current image frame. The target detection result includes the type of the target and the pixel position of the detection frame corresponding to the target. Optionally, the distance measuring device converts the pixel position of the target into the current position of the target in the world coordinate system.
[0074] Furthermore, the distance measuring device compares the historical position of the same target in the world coordinate system in the historical image frame (eg, the previous image frame) with the current position to determine whether the target is a static target or a dynamic target.
[0075] In some embodiments, in response to a difference between a historical position and a current position of the same object being less than a preset difference, the object is determined to be a static object.
[0076] In some embodiments, in response to a difference between a historical position and a current position of the same target being greater than a preset difference, the target is determined to be a dynamic target.
[0077] In some possible embodiments, the distance measuring device determines whether the target is a static target or a dynamic target according to the target category. For example, if the target category is one of a tree, a fence, a road sign, a lane line, and a street light, the distance measuring device determines that the target is a static target. For example, if the target category is one of a pedestrian, a motor vehicle, and a non-motor vehicle, the distance measuring device determines that the target is a dynamic target.
[0078] It should be understood that only relying on the category of the target to determine whether it is a static target or a dynamic target may result in inaccurate judgment. Based on this, the position comparison method mentioned above can also be combined to improve the accuracy of distinguishing static targets from dynamic targets.
[0079] S2, obtain the estimated distance between the dynamic target and the target vehicle.
[0080] In some embodiments, the distance detection device obtains the estimated distance between the dynamic target and the target vehicle according to the size of the detection frame corresponding to the dynamic target.
[0081] It can be understood that the closer the dynamic target is to the target vehicle, the larger the size of its detection frame. The distance between the dynamic target and the target vehicle can be estimated through the above relationship.
[0082] In some possible embodiments, taking into account the differences in actual sizes of dynamic targets of different categories (for example, the actual sizes of pedestrians and motor vehicles are quite different), the distance detection device can obtain the estimated distance between the dynamic target and the target vehicle based on the size of the detection box corresponding to the dynamic target and the category corresponding to the dynamic target.
[0083] It should be noted that this step is intended to estimate the distance range between the dynamic target and the target vehicle, and it is not necessary to calculate the distance value between the dynamic target and the target vehicle.
[0084] Of course, this step can also utilize the pixel size of the detection frame corresponding to the dynamic target and the relationship between the internal parameters (intrinsic parameters) and external parameters (extrinsic parameters) between the image acquisition components to determine the actual size of the dynamic target, and then estimate the distance between the dynamic target and the target vehicle based on the pixel size, actual size and focal length of the image acquisition component.
[0085] S3, determining the location type of the dynamic target according to the estimated distance.
[0086] In some embodiments, the distance measuring device determines the location type of the dynamic target based on the size of the estimated distance.
[0087] In some possible embodiments, the distance measuring device determines whether the estimated distance falls into a first distance interval, a second distance interval, or a third distance interval to determine the location type of the dynamic target, wherein the first distance interval is smaller than the second distance interval, and the second distance interval is smaller than the third distance interval.
[0088] Exemplarily, the location type may include short distance, medium distance, and long distance. For example, if the estimated distance falls into the first distance interval, the location type corresponding to the dynamic target is short distance. If the estimated distance falls into the second distance interval, the location type corresponding to the dynamic target is medium distance. If the estimated distance falls into the third distance interval, the location type corresponding to the dynamic target is long distance.
[0089] In some possible embodiments, the distance measuring device may also determine the relative position between the dynamic target and the target vehicle based on the position of the detection frame of the dynamic target in the image frame. Furthermore, the distance measuring device determines the position type of the dynamic target using the relative position and the estimated distance.
[0090] Exemplarily, the position types include close distance on the left, close distance on the right, close distance in the center, medium distance on the left, medium distance on the right, medium distance in the center, far distance on the left, far distance on the right, and far distance in the center.
[0091] S4, calculating the actual distance between the dynamic target and the target vehicle according to the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target.
[0092] Specifically, the distance measuring device calculates the actual distance between the dynamic target and the target vehicle according to the position type of the dynamic target in combination with the first pixel information of the static target or the second pixel information of the target component on the dynamic target.
[0093] In this step, the actual size of the static target is a priori knowledge, or the actual size of the target component is a priori knowledge. That is, the actual size of the static target or the actual size of the target component is known. The above sizes can be obtained by prior measurement or pre-input.
[0094] Exemplarily, when the position type of the dynamic target is close distance, the distance measuring device calculates the actual distance between the dynamic target and the target vehicle in combination with the second pixel information of the target component on the dynamic target.
[0095] Exemplarily, when the position type of the dynamic target is medium distance or long distance, the distance measuring device calculates the actual distance between the dynamic target and the target vehicle in combination with the first pixel information of the static target.
[0096] In some possible embodiments, the first pixel information refers to the pixel size of the static object.
[0097] In some possible embodiments, the second pixel information refers to the pixel size of the target component.
[0098] In some possible embodiments, a plurality of image acquisition components are provided on the target vehicle, and the distance measurement device uses the image frames acquired by the plurality of image acquisition components to respectively perform the distance measurement method as described above, and obtains a plurality of groups of relative distance values corresponding to a single dynamic target. Furthermore, any one of the average, mode, and median of the plurality of groups of relative distance values is taken as the actual distance between the dynamic target and the target vehicle, so as to further improve the accuracy of the distance measurement.
[0099] In some possible embodiments, the distance measurement device can respectively combine the first pixel information of different static targets in the same current image frame to determine multiple sets of candidate distances between the same dynamic target and the target vehicle, and then take any one of the average, mode, and median of the multiple sets of candidate distances as the actual distance, thereby further improving the accuracy of the distance measurement.
[0100] Similarly, in some possible embodiments, the distance measurement device can respectively combine the second pixel information of different target components in the same current image frame to determine multiple sets of candidate distances between the same dynamic target and the target vehicle, and then take any one of the average, mode, and median of the multiple sets of candidate distances as the actual distance, thereby further improving the accuracy of the distance measurement.
[0101] In some embodiments, the actual distance between the dynamic target and the target vehicle may be the lateral distance between the dynamic target and the static target, the longitudinal distance between the dynamic target and the static target, or the vector sum of the lateral distance and the longitudinal distance between the dynamic target and the static target.
[0102] It can be understood that, according to the position type of the dynamic target, combined with the first pixel information of the static target, or combined with the second pixel information of the target component on the dynamic target, the actual distance obtained is the relative distance between the dynamic target and the image acquisition device. The distance measurement device can compensate for the above relative distance by pre-measuring the position difference between the image acquisition device and the origin of the vehicle coordinate system, or pre-measuring the position difference between the image acquisition device and the front or side of the vehicle, to obtain a more accurate actual distance.
[0103] The above scheme obtains the estimated distance between the dynamic target and the target vehicle, determines the position type of the dynamic target based on the estimated distance, and calculates the actual distance between the dynamic target and the target vehicle based on the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target. The distance measurement method provided in the present application adopts a divide-and-conquer approach according to the position type of the dynamic target, combines different pixel information to measure the distance of the dynamic target, and improves the accuracy of the distance measurement result.
[0104] Another embodiment of the distance measurement method provided in the present application may specifically include the following steps:
[0105] S11, performing target detection on the current image frame to obtain dynamic targets and static targets in the current image frame.
[0106] S12, obtaining an estimated distance between the dynamic target and the target vehicle.
[0107] S13: In response to the estimated distance being less than or equal to the first preset distance and the dynamic target being incomplete, determining the location type as the first location type.
[0108] Specifically, in response to the estimated distance being less than or equal to the first preset distance and the dynamic target being incomplete in the current image frame, the distance measurement device determines that the position type of the dynamic target is the first position type.
[0109] In some embodiments, the dynamic target may be blocked by the surrounding environment, and / or the dynamic target may be partially located outside the field of view of the image acquisition component, and therefore, the dynamic target may be incomplete in the current image frame.
[0110] Exemplarily, the first preset distance is between 0.5m-15m, and there is no limitation on this.
[0111] It can be understood that the size of the first preset distance is also related to the focal length of the image acquisition component. The smaller the focal length, the smaller the first preset distance. It can be seen that the larger the focal length, the larger the first preset distance.
[0112] S14: In response to the estimated distance being greater than the first preset distance and less than the second preset distance, determining the location type as the second location type.
[0113] Specifically, in response to the estimated distance being greater than the first preset distance and less than the second preset distance, the location type is determined to be the second location type.
[0114] Exemplarily, the second preset distance is between 50m and 100m, and there is no limitation on this.
[0115] Similarly, the size of the second preset distance is also related to the focal length of the image acquisition component. The smaller the focal length, the smaller the second preset distance. The larger the focal length, the larger the second preset distance.
[0116] It can be understood that the second position type corresponds to the “middle distance” mentioned above.
[0117] S15: In response to the estimated distance being greater than the second preset distance, determining the location type as a third location type.
[0118] Specifically, in response to the estimated distance being greater than the second preset distance, the location type is determined to be the third location type.
[0119] It can be understood that the third location type is the “long distance” mentioned above.
[0120] S16, calculating the actual distance between the dynamic target and the target vehicle according to the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target.
[0121] Exemplarily, in response to the position type of the dynamic target being the first position type, the distance measuring device calculates the actual distance between the dynamic target and the target vehicle in combination with the second pixel information of the target component on the dynamic target.
[0122] Exemplarily, in response to the position type of the dynamic target being the second position type or the third position type, the distance measuring device calculates the actual distance between the dynamic target and the target vehicle in combination with the first pixel information of the static target.
[0123] The above scheme obtains the estimated distance between the dynamic target and the target vehicle, determines the position type of the dynamic target based on the estimated distance, and calculates the actual distance between the dynamic target and the target vehicle based on the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target. The distance measurement method provided in the present application adopts a divide-and-conquer approach according to the position type of the dynamic target, combines different pixel information to measure the distance of the dynamic target, and improves the accuracy of the distance measurement result.
[0124] Another embodiment of the distance measurement method provided in the present application may specifically include the following steps:
[0125] S21, performing target detection on the current image frame to obtain dynamic targets and static targets in the current image frame.
[0126] S22, obtaining an estimated distance between the dynamic target and the target vehicle.
[0127] S23: In response to the estimated distance being less than or equal to the first preset distance and the dynamic target being incomplete, determining the location type as the first location type.
[0128] The target component is a complete target in the current image frame, and the second pixel information includes a first pixel size of a first detection frame corresponding to the target component.
[0129] S24, in response to the position type being the first position type, obtaining the target category of the dynamic target, and identifying the target component on the dynamic target from the dynamic target to obtain a first detection frame.
[0130] Specifically, in response to the position type of the dynamic target being the first position type, the distance measurement device obtains the target category of the dynamic target, and identifies the target component on the dynamic target from the dynamic target to obtain a first detection frame.
[0131] Exemplarily, target categories may include large trucks, small trucks, small cars, bicycles, etc., which are not limited here.
[0132] In some embodiments, the dynamic target is a motor vehicle. In some embodiments, the target component is at least one of a wheel of the vehicle (or a spare tire hanging at the rear of the vehicle), a license plate of the vehicle, and a cargo box of the vehicle (for example, a container disposed on a truck, or a cargo box at the rear of a truck).
[0133] In some embodiments, the dynamic target is a non-motor vehicle, such as a bicycle or an electric bicycle. In some embodiments, the target component is at least one of a wheel of a non-motor vehicle and a license plate of a non-motor vehicle. In some possible embodiments, the target component is a trunk of a non-motor vehicle.
[0134] In some possible application scenarios, the dynamic target of the first position type may be a motor vehicle or non-motor vehicle located in front of the target vehicle and very close to the target vehicle. At this time, the distance measurement device cannot obtain the head and tail frames corresponding to the dynamic target, the detection frame size corresponding to the dynamic target, and cannot effectively characterize the actual size of the dynamic target. In this scenario, the distance measurement device can use the pixel size information of the complete target components (such as license plates, spare tires, trunks, standard containers) in the current image frame, and the actual sizes corresponding to these target components, to calculate the actual distance between the dynamic target and the target vehicle.
[0135] For example, the actual size of a license plate of a motor vehicle or non-motor vehicle can be determined by referring to relevant national standards or local specifications.
[0136] For example, the actual size of a cargo box (container) of a motor vehicle can be determined by directly referring to the size of a standard container.
[0137] For example, the actual size of a trunk of a non-motor vehicle can be determined based on actual size values of common trunks of different types.
[0138] In some possible application scenarios, the dynamic target of the first position type may be a motor vehicle or non-motor vehicle located on the side of the target vehicle, which is not completely covered by the field of view of the image acquisition component. Similarly, the distance measurement device cannot obtain the head and tail frames corresponding to the dynamic target, the detection frame size corresponding to the dynamic target, and cannot effectively characterize the actual size of the dynamic target. In this scenario, the distance measurement device can use the pixel size of the complete target components (such as wheels) in the current image frame and the actual size corresponding to these target components to calculate the actual distance between the dynamic target and the target vehicle.
[0139] S25, determining a first actual size of the target component according to the target category.
[0140] In some embodiments, the distance measuring device obtains the specific target category of the dynamic target. For a dynamic target of the motor vehicle category, the corresponding specific target category may be any one of a large truck, a muck truck, a container truck, a small truck, a large bus, a medium bus, a small bus, a car, a jeep, a motorcycle, etc. For a dynamic target of the non-motor vehicle category, the corresponding specific target category may be any one of a tricycle, an electric bicycle, a bicycle, etc.
[0141] In some embodiments, the dynamic target is a motor vehicle or a non-motor vehicle, and the target component is a wheel. Considering that motor vehicles or non-motor vehicles of different specific target categories have different corresponding wheel sizes, based on this, the distance measurement device determines the specific target category of the dynamic target belonging to the motor vehicle or non-motor vehicle, and determines the actual size of the wheel from the corresponding national standards, local specifications, industry standards and other prior knowledge according to the specific target category. Similarly, if the target component is a spare tire suspended behind the dynamic target, the first actual size of the spare tire can also be determined based on the aforementioned prior knowledge.
[0142] In some embodiments, the dynamic target is a motor vehicle or a non-motor vehicle, and the target component is a license plate. Taking into account the different sizes of license plates corresponding to motor vehicles and non-motor vehicles, the distance measurement device determines the specific target category of the dynamic target belonging to the motor vehicle or non-motor vehicle, and determines the first actual size of the license plate from the corresponding national standards, local specifications, industry standards and other prior knowledge based on the specific target category.
[0143] S26, calculating the actual distance according to the first pixel size and the first actual size.
[0144] Specifically, the distance measuring device calculates the actual distance according to the first pixel size, the first actual size, and the focal length of the image acquisition component.
[0145] The first pixel size may include a first pixel height and a first pixel width, and the first actual size may include a first actual height and a first actual width.
[0146] See also Figure 2 In this embodiment, the actual distance satisfies the following relationship:
[0147]
[0148] Among them, Dis1 is the actual distance, W t1 is the first actual width, w t1 is the first pixel width, and f is the focal length.
[0149] Of course, the distance measuring device may also use the first pixel height and the first actual height, as well as the focal length, to calculate the actual distance according to the above relationship.
[0150] The above scheme obtains the estimated distance between the dynamic target and the target vehicle, determines the position type of the dynamic target based on the estimated distance, and calculates the actual distance between the dynamic target and the target vehicle based on the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target. The distance measurement method provided in the present application adopts a divide-and-conquer approach according to the position type of the dynamic target, combines different pixel information to measure the distance of the dynamic target, and improves the accuracy of the distance measurement result.
[0151] Another embodiment of the distance measurement method provided in the present application may specifically include the following steps:
[0152] S31, performing target detection on the current image frame to obtain dynamic targets and static targets in the current image frame.
[0153] S32, obtaining an estimated distance between the dynamic target and the target vehicle.
[0154] S33: In response to the estimated distance being greater than the first preset distance and less than the second preset distance, determining the location type as the second location type.
[0155] The first pixel information is the lane pixel width corresponding to the lane line.
[0156] S34: In response to the position type being the second position type, obtaining a deflection angle between the dynamic target and the target vehicle.
[0157] Specifically, in response to the position type of the dynamic target being the second position type, the distance measurement device uses the positional relationship between the 2D detection frame and the pseudo 3D detection frame corresponding to the dynamic target in the world coordinate system to obtain the deflection angle between the dynamic target and the target vehicle.
[0158] It can be understood that in the current image frame, the pseudo 3D detection frame of the dynamic target can reflect the orientation between the dynamic target and the target vehicle. The orientation between the dynamic target and the target vehicle can be left or right. For example, if the head frame (head frame) of the dynamic target is to the left relative to the tail frame (tail frame), the corresponding orientation of the dynamic target is left.
[0159] See also Figure 3 In this embodiment, the direction of the dynamic target is to the right (eg, turn right).
[0160] Specifically, the distance measurement device inputs the current image frame into the target detection model to obtain the tail frame and pseudo 3D detection frame corresponding to the dynamic target in the current image frame. Points a, b, and d are obtained. The projection points of points a, b, and d in the world coordinate system are respectively Figure 3 Point A, point B, and point D in the diagram.
[0161] It can be understood that in this embodiment, since the tail frame corresponding to the dynamic target is obtained by monocular vision, and then the tail frame is back-projected to the world coordinate system. Since there is a deflection angle between the dynamic target and the target vehicle, point A is not the actual left grounding point of the dynamic target. In order to improve the ranging accuracy, it is necessary to determine the actual left grounding point of the dynamic target.
[0162] Furthermore, the distance measuring device uses the coordinate values of point B and point D to determine the deflection angle.
[0163] Among them, the deflection angle satisfies the following relationship:
[0164]
[0165] Among them, x1 is the horizontal coordinate of point B, x2 is the horizontal coordinate of point D, y1 is the vertical coordinate of point B, y2 is the vertical coordinate of point D, and θ is the deflection angle.
[0166] S35, in response to the deflection angle being greater than the preset angle, constructing a target straight line using the deflection angle and the target grounding point in the second detection frame of the dynamic target.
[0167] In some possible embodiments, in response to the absolute value of the deflection angle being greater than a preset angle, the distance measuring device constructs a target straight line using the deflection angle and a target grounding point in the second detection frame of the dynamic target.
[0168] Among them, the second detection frame corresponds to the tail frame of the dynamic target.
[0169] Optionally, the preset angle may be between 0 and 15°, which is not limited here.
[0170] In this embodiment, the target touchdown point is point B, which may also be referred to as an anchor point. The distance measuring device determines the linear equation of the target straight line l using the deflection angle and the target touchdown point.
[0171] The target grounding point may be considered as the actual grounding point of the dynamic target.
[0172] In other embodiments, the direction of the dynamic target is to the left, and the target touchdown point is point C.
[0173] S36, obtaining a first intersection point and a second intersection point between the target straight line and the lane line where the dynamic target is located, and determining the lane pixel width using the first intersection point and the second intersection point.
[0174] Specifically, the distance measuring device performs target detection on the current image frame to obtain at least two lane lines in the image frame. Further, the distance measuring device determines a lane line equation corresponding to each lane line.
[0175] In this embodiment, the lane where the dynamic target is located includes two lane lines, namely the left lane line and the right lane line, and the distance measuring device obtains the first intersection point E between the target straight line l and the left lane line, and the second intersection point F between the target straight line l and the right lane line. It can be understood that since the straight line equation of the target straight line, the lane line equation corresponding to the left lane line, and the lane line equation corresponding to the right lane line are known, the coordinates of the first intersection point E and the second intersection point F in the world coordinate system can be determined.
[0176] S37, obtaining a third intersection point between the target straight line and the second detection frame, and calculating the target actual width of the dynamic target using the target grounding point and the third intersection point.
[0177] Specifically, the distance measuring device combines the target straight line with the projection of the second detection frame in the world coordinate system, that is, combines the target straight line with the projected second detection frame to determine the third intersection point.
[0178] More specifically, the distance measuring device projects the left edge of the second detection frame to the world coordinate system to obtain the projected left edge, and then combines the projected left edge with the target straight line to obtain the third intersection. Further, the distance measuring device calculates the distance between the target grounding point and the third intersection, and uses the distance as the actual width of the dynamic target. It can be understood that in this embodiment, the third intersection is used to identify the actual left grounding point of the dynamic target. Figure 3 The third intersection point is point C.
[0179] In other embodiments, the orientation of the dynamic target is to the left, and the distance measuring device uses the right edge of the second detection frame to project to the world coordinate system to obtain the projected right edge, and then combines the projected right edge with the target straight line to obtain the third intersection. Further, the distance measuring device calculates the distance between the target grounding point and the third intersection, and uses the distance as the actual width of the dynamic target. In this embodiment, the third intersection is used to reflect the actual right grounding point of the dynamic target.
[0180] S38, using the target actual width and the target pixel width, the actual distance between the dynamic target and the target vehicle is calculated.
[0181] In some embodiments, the distance measuring device obtains the projection point of the target ground point in the image coordinate system to obtain a first projection pixel point, and obtains the projection point of the third intersection in the image coordinate system to obtain a second projection pixel point. The target pixel width is the pixel distance between the first projection pixel point and the second projection pixel point.
[0182] Furthermore, the distance measuring device calculates the actual distance between the dynamic target and the target vehicle using the target actual width, the target pixel width, and the focal length of the image acquisition unit.
[0183] Among them, the actual distance satisfies the following relationship:
[0184] Dis2=f`·(W t2 / w t2 )
[0185] Where Dis2 is the actual distance, f is the focal length, and W t2 is the actual width of the target, w t2 is the target pixel width.
[0186] The above scheme obtains the estimated distance between the dynamic target and the target vehicle, determines the position type of the dynamic target based on the estimated distance, and calculates the actual distance between the dynamic target and the target vehicle based on the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target. The distance measurement method provided in the present application adopts a divide-and-conquer approach according to the position type of the dynamic target, combines different pixel information to measure the distance of the dynamic target, and improves the accuracy of the distance measurement result.
[0187] Another embodiment of the distance measurement method provided in the present application may specifically include the following steps:
[0188] S41, performing target detection on the current image frame to obtain dynamic targets and static targets in the current image frame.
[0189] S42, obtaining an estimated distance between the dynamic target and the target vehicle.
[0190] S43: In response to the estimated distance being greater than the first preset distance and less than the second preset distance, determining the location type as the second location type.
[0191] The first pixel information is the lane pixel width corresponding to the lane line.
[0192] S44, in response to the position type being the second position type, obtaining a deflection angle between the dynamic target and the target vehicle.
[0193] S45, in response to the deflection angle being greater than the preset angle, constructing a target straight line using the deflection angle and the target grounding point in the second detection frame of the dynamic target.
[0194] S46, obtaining a first intersection point and a second intersection point between the target straight line and the lane line where the dynamic target is located, and determining the lane pixel width using the first intersection point and the second intersection point.
[0195] S47, obtaining the distance between the target touchdown point and the third intersection point, and using the distance as the first actual width; and obtaining the actual width of the lane corresponding to the lane line.
[0196] Specifically, the first actual width may be expressed as W1.
[0197] Among them, the target grounding point and the third intersection point are located in the world coordinate system.
[0198] Specifically, the lane line corresponds to the actual lane width, that is, the actual width of the lane between the left lane line and the right lane line.
[0199] It can be understood that the distance measuring device can determine the actual lane width by referring to relevant national standards and / or local standards.
[0200] S48, obtaining a first projection point of the target ground point in the image coordinate system and a second projection point of the third intersection point in the image coordinate system, and calculating a pixel distance between the first projection point and the second projection point.
[0201] In this embodiment, the distance measuring device obtains the first projection point b of the target ground point B in the image coordinate system, and obtains the second projection point c of the third intersection point C in the image coordinate system, and calculates the pixel distance between the first projection point b and the second projection point c.
[0202] Among them, the first projection point corresponds to the first projection pixel point mentioned above, and the second projection point corresponds to the second projection pixel point mentioned above.
[0203] S49, determining a second actual width according to the lane pixel width, the lane actual width, and the pixel distance.
[0204] Specifically, the distance measuring device determines a proportional relationship according to the lane pixel width and the pixel distance, and then determines the second actual width by using the lane actual width and the proportional relationship.
[0205] In some embodiments, the second actual width satisfies the following relationship:
[0206]
[0207] Among them, W2 is the second actual width, W4 is the actual lane width, d p is the pixel distance, w l4 is the lane pixel width.
[0208] S50, calculating a target actual width using the first actual width and the second actual width.
[0209] In some embodiments, the target actual width satisfies the following relationship:
[0210] W t2 =W1*x1+W2*x2
[0211] Among them, W t2 is the target actual width, x1 is the first weight corresponding to the first actual width, and x2 is the second weight corresponding to the second actual width. Moreover, x1+x2=1.
[0212] For example, x1=x2=0.5, that is, the actual width of the target satisfies the following relationship:
[0213] W t2 =(W1+W2) / 2
[0214] S51, using the target actual width and the target pixel width, calculate the actual distance between the dynamic target and the target vehicle.
[0215] The above scheme obtains the estimated distance between the dynamic target and the target vehicle, determines the position type of the dynamic target based on the estimated distance, and calculates the actual distance between the dynamic target and the target vehicle based on the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target. The distance measurement method provided in the present application adopts a divide-and-conquer approach according to the position type of the dynamic target, combines different pixel information to measure the distance of the dynamic target, and improves the accuracy of the distance measurement result.
[0216] Another embodiment of the distance measurement method provided in the present application may specifically include the following steps:
[0217] S61, performing target detection on the current image frame to obtain dynamic targets and static targets in the current image frame.
[0218] S62, obtaining an estimated distance between the dynamic target and the target vehicle.
[0219] S63: In response to the estimated distance being greater than the first preset distance and less than the second preset distance, determining the location type as the second location type.
[0220] The first pixel information is the lane pixel width corresponding to the lane line.
[0221] S64: In response to the position type being the second position type, obtaining a deflection angle between the dynamic target and the target vehicle.
[0222] S65, in response to the deflection angle being less than the preset angle, obtaining the actual lane width of the lane, and obtaining the lane pixel width and the third pixel size of the third detection frame corresponding to the dynamic target.
[0223] Specifically, in response to the deflection angle being less than the preset angle, the distance measuring device determines that the dynamic target is located in the straight lane, and obtains the lane actual width and lane pixel width corresponding to the straight lane, and the third pixel size of the third detection frame corresponding to the dynamic target located in the straight lane.
[0224] Optionally, the actual lane width may be measured in advance, or may be obtained from a road width specification (eg, a national standard or an industry specification, etc.).
[0225] In some embodiments, the distance measuring device obtains the lane line from the current image frame, and determines the lane pixel width using the pixel positions of the left and right lane lines of the current lane.
[0226] In some embodiments, the third pixel size is a third pixel width of the third detection box.
[0227] S66, calculating the actual distance according to the actual lane width, the lane pixel width and the third pixel size.
[0228] In some embodiments, the third pixel size is a third pixel width of the third detection box.
[0229] Furthermore, the distance measuring device determines a third actual width of the dynamic target according to the actual lane width, the lane pixel width and the third pixel width.
[0230] Specifically, the third actual width satisfies the following relationship:
[0231]
[0232] Among them, W t3 is the third actual width, W l3 is the actual lane width, w t3 is the third pixel width, wl3 is the lane pixel width.
[0233] Furthermore, the distance measuring device calculates the actual distance according to the third actual width, the third pixel width, and the focal length of the image acquisition component.
[0234] Specifically, the actual distance satisfies the following relationship:
[0235]
[0236] Among them, Dis3 is the actual distance and f is the focal length.
[0237] The above scheme obtains the estimated distance between the dynamic target and the target vehicle, determines the position type of the dynamic target based on the estimated distance, and calculates the actual distance between the dynamic target and the target vehicle based on the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target. The distance measurement method provided in the present application adopts a divide-and-conquer approach according to the position type of the dynamic target, combines different pixel information to measure the distance of the dynamic target, and improves the accuracy of the distance measurement result.
[0238] Another embodiment of the distance measurement method provided in the present application may specifically include the following steps:
[0239] S71, performing target detection on the current image frame to obtain dynamic targets and static targets in the current image frame.
[0240] S72, obtaining an estimated distance between the dynamic target and the target vehicle.
[0241] S73: In response to the estimated distance being greater than the second preset distance, determining the location type as a third location type.
[0242] The pixel information of the static target is the fourth pixel size of the fourth detection frame corresponding to the static target.
[0243] S74, in response to the position type being the third position type, determining a fourth actual size of the static object according to the object type of the static object, and acquiring a fourth pixel size.
[0244] When the dynamic target is far away from the target vehicle, it is difficult to ensure that the ground plane where the dynamic target is located is in the same plane as the ground plane where the target vehicle is located. Therefore, the distance measurement device can only use the height ranging method to measure the distance. However, the actual size of the dynamic target is not constant. For example, the actual size of a truck is related to the cargo it pulls. At this time, other methods are needed to obtain the size of the dynamic target.
[0245] In this embodiment, the distance measuring device obtains a detection frame of the static target from the current image frame, and further obtains a fourth pixel height of the static target.
[0246] Optionally, the static target may be any one or more of a street lamp, a road guardrail, a dividing strip with a certain height, a cone barrel, a road sign, and a road sign, which are not limited here.
[0247] In some possible embodiments, the fourth actual height of the static target may be determined according to relevant standard regulations (such as national standards or industry specifications, etc.), or may be obtained in advance through actual measurement.
[0248] In some application scenarios, the distance measuring device obtains a fourth pixel width of the static object, and uses a priori width value of the category to which the static object belongs as a fourth actual width of the static object.
[0249] In a possible embodiment, after step S73, the following steps may be performed:
[0250] S741, in response to the position type being the third position type, obtaining a target category of the dynamic target, and identifying a target component on the dynamic target from the dynamic target to obtain a sixth detection frame.
[0251] Among them, the target component is a complete target in the current image frame.
[0252] In some possible embodiments, the dynamic target is a motor vehicle. More specifically, the dynamic target is a truck, and the target component is a cargo box of the vehicle (or a container loaded on the truck). It should be noted that this embodiment is not applicable to trucks loaded with bulk cargo.
[0253] It can be understood that in long-distance scenarios, the cargo box or container of a truck has a certain size. The distance measuring device can use its pixel size (i.e., the sixth pixel size) and the actual size (i.e., the sixth actual size) to determine the proportional relationship, and then use the proportional relationship and the pixel size of the vehicle (i.e., the fifth pixel size below) to determine the actual size of the truck (i.e., the fifth actual size).
[0254] Likewise, the actual size of the cargo box or container is a standard value, and the distance measuring device can determine it by consulting relevant parameters.
[0255] S75, obtaining a fifth pixel size of a fifth detection box corresponding to the dynamic target.
[0256] Optionally, the fifth pixel size may include at least one of a fifth pixel width and a fifth pixel height of the fifth detection frame.
[0257] In some embodiments, the distance measuring device obtains the height of the fifth detection frame corresponding to the dynamic target to obtain a fifth pixel height.
[0258] In some embodiments, the distance measuring device obtains the width of a fifth detection frame corresponding to the dynamic target to obtain a fifth pixel width.
[0259] S76, calculating the actual distance according to the fourth actual size, the fourth pixel size, and the fifth pixel size.
[0260] Specifically, the distance measuring device determines the fifth actual size of the dynamic obstacle based on the fourth actual size, the fourth pixel size, and the fifth pixel size. Further, the distance measuring device calculates the actual distance between the dynamic target and the target vehicle using the fifth pixel size and the fifth actual size of the dynamic obstacle and the focal length of the image acquisition component.
[0261] In some embodiments, the distance measuring device determines a fifth actual height of the dynamic obstacle based on the fourth actual height, the fourth pixel height, and the fifth pixel height. Further, the distance measuring device calculates the actual distance between the dynamic target and the target vehicle using the fifth pixel height and the fifth actual height of the dynamic obstacle and the focal length of the image acquisition component.
[0262] In some embodiments, the distance measuring device determines a fifth actual width of the dynamic obstacle based on the fourth actual width, the fourth pixel width, and the fifth pixel width. Further, the distance measuring device calculates the actual distance between the dynamic target and the target vehicle using the fifth pixel width and the fifth actual width of the dynamic obstacle and the focal length of the image acquisition component.
[0263] It should be noted that the distance measuring device determines the fifth actual size of the dynamic obstacle based on the fourth actual size, the fourth pixel size, and the fifth pixel size, and uses the fifth pixel size and the fifth actual size of the dynamic obstacle and the focal length of the image acquisition component to calculate the specific calculation method of the actual distance between the dynamic target and the target vehicle. Please refer to the step S66 above, which will not be repeated here.
[0264] The above scheme obtains the estimated distance between the dynamic target and the target vehicle, determines the position type of the dynamic target based on the estimated distance, and calculates the actual distance between the dynamic target and the target vehicle based on the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target. The distance measurement method provided in the present application adopts a divide-and-conquer approach according to the position type of the dynamic target, combines different pixel information to measure the distance of the dynamic target, and improves the accuracy of the distance measurement result.
[0265] See also Figure 4 , Figure 4 It is a flow chart of another embodiment of the distance measurement method provided by the present application.
[0266] like Figure 4 As shown, another embodiment of the distance measurement method provided by the present application may specifically include the following steps:
[0267] S101, obtaining a current image frame.
[0268] Specifically, the distance measuring device obtains a current image frame captured by a camera.
[0269] S102, performing target detection on the current image frame to obtain dynamic obstacles in the current image frame.
[0270] Specifically, the distance measurement device inputs the current image frame into the target detection model to obtain the 2D detection frame and head and tail frame (pseudo 3D frame) of the dynamic obstacle, and obtains static obstacles such as lane lines and lamp poles.
[0271] Among them, dynamic obstacles correspond to the dynamic targets mentioned above, and static obstacles correspond to the static targets mentioned above.
[0272] In some possible embodiments, the target detection model further outputs a detection frame of a target component corresponding to the dynamic obstacle, and the target component may be a wheel.
[0273] S103: Obtain an estimated distance of the dynamic obstacle, and determine a location category of the dynamic obstacle according to the estimated distance.
[0274] In some possible embodiments, the distance measuring device obtains the estimated distance of the dynamic obstacle according to the size of the 2D detection frame of the dynamic obstacle.
[0275] Among them, the location categories of dynamic obstacles include truncation, normal category, and distant category.
[0276] The truncated category is that the estimated distance of the dynamic obstacle is less than the first threshold distance, the dynamic obstacle is incomplete (for example, blocked), and the target component is complete. The normal category is that the estimated distance of the dynamic obstacle is greater than or equal to the first threshold distance and less than the second threshold distance. The distant category is that the estimated distance of the dynamic obstacle is greater than or equal to the second threshold distance.
[0277] This embodiment adopts different ranging schemes according to the estimated position of the dynamic obstacle to improve the accuracy of ranging.
[0278] S104 , in response to the position category of the dynamic obstacle being a truncation category, using a wheel odometry method for the dynamic obstacle to determine an actual distance between the dynamic obstacle and the vehicle.
[0279] See also Figure 5When the dynamic obstacle is a truncated category, the dynamic obstacle has no tail frame, and the position of the whole vehicle frame cannot describe the real height of the vehicle, so the calculation result of the height distance measurement method is inaccurate. The only frame that can truly show the position of the vehicle is the tire frame. The distance measurement device obtains the obstacle category from the classification of the model, such as large trucks and small trucks. Furthermore, the distance measurement device searches for the national standard size of the tire according to the category of the dynamic obstacle, and then measures the actual distance between the dynamic obstacle and the vehicle according to the pixel height and the real height of the tire.
[0280] S105 , in response to the position category of the dynamic obstacle being a normal category, using a normal distance measurement method for the dynamic obstacle to determine an actual distance between the dynamic obstacle and the vehicle.
[0281] In some application scenarios, such as Figure 6 As shown in the figure, the dynamic obstacle belonging to the normal category is located in the straight lane. The detection head and tail frames of the dynamic obstacle and the fitted lane lines can be used to calculate the actual distance between the dynamic obstacle and the vehicle.
[0282] Specifically, on an ordinary straight lane, the width of the dynamic obstacle is W, and the lane width is D. The actual width D of the lane can be known from the width of the national standard road, and the actual width W of the dynamic obstacle can be known from the ratio of the lane pixel width d to the dynamic obstacle pixel width w in the image.
[0283] Furthermore, the distance Dis between the dynamic obstacle and the vehicle is determined based on the focal length f of the camera, the real width W of the dynamic obstacle, and the pixel width w of the dynamic obstacle, that is:
[0284]
[0285] However, this method can only be used on straight roads. On curves, the dynamic obstacle deflects to a certain extent, so that the tail frame no longer truly describes the relationship between the tail of the dynamic obstacle and the lane line.
[0286] like Figure 3 and Figure 6 As shown in the figure, when there is a corner between the dynamic obstacle and the vehicle, the tail frame of the dynamic obstacle cannot completely fit the tail of the dynamic obstacle, and the distance measurement by the tail frame will be inaccurate, such as Figure 3 and Figure 6 The dashed tail box shown in the figure cannot truly reflect the actual width of the vehicle if the box width is used. At this time, using the width and the lane line width where the line l11 is located will lead to inaccurate distance measurement. Therefore, we need to obtain the actual pixel width of the dynamic obstacle under the line l12 and the actual lane line width, so as to obtain the actual distance.
[0287] In some possible embodiments, S105 may specifically include the following steps:
[0288] S111, calculating the deflection angle θ between the dynamic obstacle and the vehicle.
[0289] First, project the side points b and d of the dynamic obstacle in the current image frame to the world coordinates to obtain points B and D on the 3D plane. Use the coordinates of these two points to calculate the target vehicle angle:
[0290]
[0291] S112, taking the right side grounding point B of the head and tail frame of the right-turning vehicle as the anchor point, the equation of the straight line l12 is calculated by the deflection angle θ and the coordinates of point B.
[0292] S113, the obtained equation of the straight line l12 and the equation of the lane line fitting are combined to find the intersection points E and F of the straight line and the two lane lines, and the two intersection points are projected from the world coordinate system to the image coordinate system to obtain the 2D pixel point e corresponding to E and the 2D pixel point f corresponding to F.
[0293] S114, the straight line l12 and the tail frame are combined to determine the intersection C. The distance between the spatial points B and C is used as the first width w1 of the dynamic obstacle.
[0294] S115, the distance between the back-projected pixel points e and f is the pixel value of the actual road width, the distance between the back-projected coordinates b and c of points B and C in the pixel coordinate system is the pixel value of the actual width of the dynamic obstacle, and the second width w2 of the dynamic obstacle is obtained through the pixel ratio of 2d.
[0295] S116, calculating the average of w1 and w2 to obtain the real width of the dynamic obstacle, so as to calculate the distance of the obstacle.
[0296] By using the above method, the actual distance between the dynamic obstacle and the vehicle on the standard road can be measured by obtaining the national standard road width. The same method can be used for vehicles turning left, and the anchor point B can be changed to C.
[0297] S106: In response to the position category of the dynamic obstacle being a far category, a lane line distance measurement method or a pole distance measurement method is used for the dynamic obstacle to determine an actual distance between the dynamic obstacle and the vehicle.
[0298] When the dynamic obstacle is far away, it is difficult to ensure that the ground plane where the dynamic obstacle is located is in the same plane as the ground plane where the vehicle is located. In this case, the height ranging method can only be used, but the height of the obstacle is not constant. Figure 7 As shown, Figure 7The height of the truck in the image is related to the goods being transported, so other methods are needed to obtain the height of the dynamic obstacle.
[0299] Specifically, S106 may include the following steps:
[0300] S121, using the target detection model to output a detection frame of a static target such as a pole, and output a tail frame of a dynamic obstacle.
[0301] S122, fitting the points on the upper side of the same type of poles at different positions to obtain a straight line, and fitting the points on the lower side of the same type of poles at different positions to obtain a straight line, and the vertical pixel height between the two straight lines is the height of the pole. The two straight lines are Figure 8 The denser dotted line in the middle.
[0302] S123, project the position of the rear frame onto the lower straight line to obtain point Q, and QP is the pixel value of the height of the pole at that point.
[0303] S125, using the ratio of the pixel height of the QP to the height of the tail frame and the actual height of the pole, the actual height of the dynamic obstacle is obtained.
[0304] S126, calculating the actual distance between the dynamic obstacle and the vehicle according to the actual height and pixel height of the dynamic obstacle.
[0305] In some application scenarios, if the category of the dynamic obstacle is not a truck, the method provided by S105 can also be used to determine the actual distance between the dynamic obstacle and the vehicle.
[0306] S107, motion state analysis and trajectory fusion.
[0307] In some application scenarios, after tracking for a period of time, the distance measurement device obtains the motion trajectory of the dynamic obstacle. Furthermore, the distance measurement device corrects the distance measurement based on the motion trajectory to obtain more accurate position information.
[0308]
[0309] Among them, x0 is the position information of the dynamic obstacle in the previous frame, v is the speed fitted by the dynamic obstacle, and x m is the measured position of the current frame, x' is the corrected position of the current frame, and the distance measuring device obtains the accurate current position by calculating the average of the position obtained by the motion state of the dynamic obstacle and the current measured position.
[0310] The above scheme obtains the estimated distance between the dynamic target and the target vehicle, determines the position type of the dynamic target based on the estimated distance, and calculates the actual distance between the dynamic target and the target vehicle based on the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target. The distance measurement method provided in the present application adopts a divide-and-conquer approach according to the position type of the dynamic target, combines different pixel information to measure the distance of the dynamic target, and improves the accuracy of the distance measurement result.
[0311] Please continue to see Fig. 9 , Fig. 9 The terminal device 500 of the embodiment of the present application includes a processor 51 and a memory 52 .
[0312] The processor 51 and the memory 52 are connected to the bus. The memory 52 stores program data. The processor 51 is used to execute the program data to implement the distance measurement method described in the above embodiment.
[0313] In the embodiment of the present application, the processor 51 may also be referred to as a CPU (Central Processing Unit). The processor 51 may be an integrated circuit chip having the ability to process signals. The processor 51 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or the processor 51 may also be any conventional processor, etc.
[0314] This application also provides a computer storage medium, please continue to refer to Fig.10 , Fig.10 1 is a schematic diagram of the structure of an embodiment of a computer storage medium provided in the present application. The computer storage medium 600 stores program data 61. When the program data 61 is executed by a processor, it is used to implement the distance measurement method of the above embodiment.
[0315] When the embodiments of the present application are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0316] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Equivalent structures or equivalent process changes made by utilizing the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A distance measurement method, characterized in that: The method comprises: Performing target detection on the current image frame to obtain dynamic targets and static targets in the current image frame; wherein the current image frame is acquired by using an image acquisition component on a target vehicle; Obtaining an estimated distance between the dynamic target and the target vehicle; determining a location type of the dynamic target according to the estimated distance; According to the position type of the dynamic target, combined with the first pixel information of the static target, or combined with the second pixel information of the target component on the dynamic target, the actual distance between the dynamic target and the target vehicle is calculated.
2. The method according to claim 1, characterized in that The determining the location type of the dynamic target according to the estimated distance includes: In response to the estimated distance being less than or equal to a first preset distance and the dynamic target being incomplete, determining the location type to be a first location type; In response to the estimated distance being greater than a first preset distance and less than a second preset distance, determining the location type to be a second location type; In response to the estimated distance being greater than the second preset distance, determining the location type as a third location type.
3. The method according to claim 2, characterized in that The target component is a complete target in the current image frame; The second pixel information includes a first pixel size of a first detection box corresponding to the target component; The actual distance between the dynamic target and the target vehicle is calculated based on the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target, including: In response to the position type being the first position type, acquiring an object category of the dynamic object, and identifying the object component on the dynamic object from the dynamic object to obtain the first detection frame; Determining a first actual size of the target component according to the target category; The actual distance is calculated according to the first pixel size and the first actual size.
4. The method according to claim 3, characterized in that The dynamic target is a motor vehicle or a non-motor vehicle; the target component is at least one of a wheel, a license plate, a cargo box, and a container.
5. The method according to claim 2, characterized in that: The first pixel information is the lane pixel width corresponding to the lane line; The actual distance between the dynamic target and the target vehicle is calculated based on the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target, including: In response to the position type being a second position type, acquiring a deflection angle between the dynamic target and the target vehicle; In response to the deflection angle being greater than a preset angle, constructing a target straight line using the deflection angle and a target grounding point in a second detection frame of the dynamic target; Acquire a first intersection point and a second intersection point between the target straight line and the lane line where the dynamic target is located; and determine the lane pixel width using the first intersection point and the second intersection point; Acquire a third intersection point between the target straight line and the second detection frame; and calculate the target actual width of the dynamic target using the target grounding point and the third intersection point; The actual distance between the dynamic target and the target vehicle is calculated using the target actual width and the target pixel width.
6. The method according to claim 5, characterized in that The target ground point and the third intersection point are located in the world coordinate system. The step of calculating the target actual width of the dynamic target by using the target grounding point and the third intersection point comprises: Acquire the distance between the target grounding point and the third intersection point, and use the distance as the first actual width; and acquire the actual width of the lane corresponding to the lane line; Obtain a first projection point of the target ground point in the image coordinate system and a second projection point of the third intersection point in the image coordinate system, and calculate a pixel distance between the first projection point and the second projection point; Determining a second actual width according to the lane pixel width, the lane actual width, and the pixel distance; The target actual width is calculated using the first actual width and the second actual width.
7. The method according to claim 5, characterized in that After the step of acquiring the deflection angle between the dynamic target and the target vehicle in response to the position type being the second position type, the method further includes: In response to the deflection angle being less than the preset angle, acquiring the actual lane width of the lane; and acquiring the lane pixel width and a third pixel size of a third detection frame corresponding to the dynamic target; The actual distance is calculated according to the actual lane width, the lane pixel width and the third pixel size.
8. The method according to claim 2, characterized in that: The pixel information of the static target is a fourth pixel size of a fourth detection frame corresponding to the static target; The actual distance between the dynamic target and the target vehicle is calculated based on the position type of the dynamic target, in combination with the first pixel information of the static target, or in combination with the second pixel information of the target component on the dynamic target, including: In response to the position type being the third position type, determining a fourth actual size of the static object according to the object type of the static object, and acquiring the fourth pixel size; Obtaining a fifth pixel size of a fifth detection box corresponding to the dynamic target; The actual distance is calculated according to the fourth actual size, the fourth pixel size, and the fifth pixel size.
9. A terminal device, characterized in that: The terminal device includes a processor and a memory connected to the processor, wherein: The memory stores program instructions; The processor is configured to execute program instructions stored in the memory to implement the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The storage medium stores program instructions, and when the program instructions are executed, the method according to any one of claims 1 to 8 is implemented.