A method, apparatus, device and storage medium for measuring distance of an object
By acquiring image frames with a camera and determining the correlation and keyframes, and combining the camera position and cost function to calculate the 3D position of the object, the problem of low reliability in object ranging for autonomous vehicles is solved, achieving low-cost and high-stability ranging results.
Patent Information
- Application Number
- CN202211569543.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-08
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2042-12-08
AI Technical Summary
Existing methods for object ranging in autonomous vehicles suffer from low reliability, especially those based on millimeter-wave radar (low resolution), lidar (high cost and susceptible to environmental influences), and ultrasonic ranging (only suitable for short distances and whose reliability is affected by vehicle speed).
Multiple image frames are acquired by a preset camera. The correlation between the same preset object and different image frames is determined. A set of key frames is determined. The target object is determined based on the correlation and the set of key frames. The three-dimensional position and distance of the target object are calculated using the camera position, the three-dimensional average position and the preset cost function.
It reduces the impact of factors such as weather and vehicle speed on the accuracy of distance measurement, and only requires a low-cost and highly stable camera to complete the distance measurement, solving the problem of low reliability in object distance measurement and greatly reducing costs.
Smart Images

Figure CN116380004B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of autonomous driving technology, and in particular to a method, apparatus, device, and storage medium for object ranging. Background Technology
[0002] With technological advancements and policy updates, the hardware and software of autonomous vehicles are constantly being improved. The development of autonomous vehicles remains inseparable from intelligence and safety, both of which rely on the vehicle's perception of its surroundings, with distance measurement of objects being a crucial component.
[0003] Currently, the main methods for distance measurement in autonomous vehicles are sensor-based, such as millimeter-wave radar, lidar, and ultrasonic radar. Millimeter-wave radar-based distance measurement calculates the position and distance of surrounding objects based on the time difference between transmitted and received millimeter waves; this technology is relatively mature and cost-effective. LiDAR-based distance measurement determines the position and distance of the measured object by comparing the received and transmitted laser signals, providing comprehensive and relatively accurate results. Ultrasonic distance measurement utilizes the speed and time of sound wave propagation in air to determine the position and distance of the measured object, offering advantages such as low cost, simplicity, and strong adaptability.
[0004] However, the ranging resolution of millimeter-wave radar is also relatively low. LiDAR-based ranging is more expensive and easily affected by environmental and weather conditions. While ultrasonic ranging is simple and inexpensive, its relatively slow speed of sound limits its application to short-range distances, and its reliability is affected by vehicle speed. Summary of the Invention
[0005] This invention provides a method, apparatus, device, and storage medium for object ranging, in order to solve the problem of low reliability in object ranging.
[0006] In a first aspect, embodiments of the present invention provide a method for measuring the distance to an object, comprising:
[0007] Multiple image frames are acquired by a preset camera, the correlation between the same preset object appearing in different image frames is determined, and key frames are determined from the multiple image frames to obtain a key frame set;
[0008] Based on the association relationship and the keyframe set, a target object that meets the preset requirements is determined from the preset objects, and multiple consecutive target keyframes are determined from the keyframe set. The preset requirements include the requirement that the target object appears consecutively in multiple different keyframes, and the target keyframes contain the target object.
[0009] Based on the camera position and three-dimensional average position corresponding to the target keyframe, and a preset cost function, the object plane function of the target object is determined, and the three-dimensional position of the target object and the distance of the three-dimensional position from the preset obstacle are determined based on the object plane function. The three-dimensional average position is the average value of the three-dimensional initial positions of the target feature points in the target keyframe, and the target feature points are the feature points of the target object.
[0010] Secondly, embodiments of the present invention provide an object ranging device, comprising:
[0011] The keyframe determination module is used to acquire multiple image frames through a preset camera, determine the correlation between the same preset object appearing in different image frames, and determine keyframes from the multiple image frames to obtain a keyframe set.
[0012] The target keyframe determination module is used to determine a target object that meets preset requirements from the preset objects according to the association relationship and the keyframe set, and to determine multiple consecutive target keyframes from the keyframe set, wherein the preset requirements include the requirement that the target object appears consecutively in multiple different keyframes, and the target keyframe contains the target object;
[0013] The distance determination module is used to determine the object plane function of the target object based on the camera position and three-dimensional average position corresponding to the target keyframe and a preset cost function, and to determine the three-dimensional position of the target object and the distance of the three-dimensional position from the preset obstacle based on the object plane function. The three-dimensional average position is the average value of the three-dimensional initial positions of the target feature points in the target keyframe, and the target feature points are the feature points of the target object.
[0014] Thirdly, embodiments of the present invention provide an electronic device, the electronic device comprising:
[0015] At least one processor;
[0016] and memory that is communicatively connected to at least one processor;
[0017] The memory stores a computer program that can be executed by at least one processor, such that the at least one processor is able to perform the object ranging method described in the first aspect.
[0018] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer instructions for causing a processor to execute the object ranging method of the first aspect described above.
[0019] The object ranging scheme provided in this embodiment of the invention acquires multiple image frames using a preset camera, determines the correlation between the same preset object appearing in different image frames, and determines keyframes from the multiple image frames to obtain a keyframe set. Based on the correlation and the keyframe set, a target object that meets preset requirements is determined from the preset objects, and multiple consecutive target keyframes are determined from the keyframe set. The preset requirements include the requirement that the target object appears consecutively in multiple different keyframes. The target keyframe contains the target object. Based on the camera position and three-dimensional average position corresponding to the target keyframe, and a preset cost function, the object plane function of the target object is determined. Based on the object plane function, the three-dimensional position of the target object and the distance of the three-dimensional position from the preset obstacle are determined. The three-dimensional average position is the average value of the three-dimensional initial positions of the target feature points in the target keyframe, and the target feature points are the feature points of the target object. By adopting the above technical solution, a set of key frames is determined based on the correlation between a preset object and different image frames. Based on this set of key frames and the correlation, the target object and the target key frame are determined. Then, based on the camera position and 3D average position corresponding to the target key frame, as well as the preset cost function, the object plane function is determined. Based on the object plane function, the 3D position of the target object and the distance between the target object and the preset obstacle are determined. Compared with the traditional ranging method that relies on professional ranging sensors, this method only requires a camera with low cost and high stability to complete the ranging, reducing the impact of weather and vehicle speed on the ranging accuracy, solving the problem of low reliability in object ranging, and greatly reducing costs.
[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of an object ranging method provided according to Embodiment 1 of the present invention;
[0023] Figure 2 This is a flowchart of an object ranging method provided in Embodiment 2 of the present invention;
[0024] Figure 3 This is a schematic diagram of optical flow tracing provided according to Embodiment 2 of the present invention;
[0025] Figure 4 This is a schematic diagram of the structure of an object ranging device provided according to Embodiment 3 of the present invention;
[0026] Figure 5 This is a schematic diagram of the structure of an electronic device provided according to Embodiment 4 of the present invention. Detailed Implementation
[0027] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. In the description of this invention, unless otherwise stated, "a plurality of" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist; for example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0029] Example 1
[0030] Figure 1 The flowchart of an object ranging method provided in Embodiment 1 of the present invention is applicable to object ranging. The method can be executed by an object ranging device, which can be implemented in hardware and / or software. The object ranging device can be configured in an electronic device, which can be composed of two or more physical entities or a single physical entity.
[0031] like Figure 1 As shown, the object distance measurement method provided in Embodiment 1 of the present invention specifically includes the following steps:
[0032] S101. Acquire multiple image frames using a preset camera, determine the correlation between the same preset object appearing in different image frames, and determine key frames from the multiple image frames to obtain a key frame set.
[0033] In this embodiment, a preset camera, such as a fisheye camera, can be pre-installed at a preset location on the vehicle, such as the windshield. As the vehicle moves, the preset camera can acquire multiple image frames. As the surrounding environment changes, the objects in the image frames also change. The correlation between preset objects, such as signs, in multiple image frames can be determined. For example, the correlation between preset objects in different image frames can be determined based on the similarity of preset objects in different image frames. Image frames that meet the preset keyframe requirements are determined as keyframes. For example, an image frame with a time interval of 0.1 seconds from the timestamp of the previous keyframe can be determined as a keyframe.
[0034] S102. Based on the association relationship and the keyframe set, determine a target object that meets the preset requirements from the preset objects, and determine multiple consecutive target keyframes from the keyframe set, wherein the preset requirements include the requirement that the target object appears consecutively in multiple different keyframes, and the target keyframes contain the target object.
[0035] In this embodiment, an image frame typically contains multiple objects. The size and / or position of the same preset object often change in different image frames. Therefore, based on the correlation, it can be determined in which image frame the preset object appears, and in which image frame it appears, it can be determined which object is the preset object. Thus, based on the correlation of the preset object in the image frames, a preset object that meets the preset requirements can be determined from a set of keyframes containing multiple keyframes. This object is the target object. For example, a preset object appearing in six consecutive keyframes can be determined as the target object. These six keyframes can be determined as target keyframes, or they can be filtered, and the filtered result can be determined as the target keyframe. For example, a keyframe among the six keyframes that meets the preset target keyframe requirements can be determined as the target keyframe. The target keyframe requirements can be requirements for the feature points of the target object, such as the number of feature points being greater than a preset threshold. The feature points of the target object can be obtained using relevant feature extraction algorithms, and there are no restrictions here.
[0036] S103. Based on the camera position and three-dimensional average position corresponding to the target keyframe, and a preset cost function, determine the object plane function of the target object, and determine the three-dimensional position of the target object and the distance of the three-dimensional position from the preset obstacle based on the object plane function, wherein the three-dimensional average position is the average value of the three-dimensional initial positions of the target feature points in the target keyframe, and the target feature points are the feature points of the target object.
[0037] In this embodiment, based on at least two camera positions corresponding to the target keyframe, the normal vector of the plane containing the target object can be determined. For example, the difference between the two camera positions can be used as the normal vector. The average three-dimensional position of the target object can be considered as a point on the plane containing the target object. Based on this normal vector and the point position, the general formula of the object plane function can be determined. Using the cost function, the object plane function of the target object can be determined based on the general formula of the object plane function. Then, using this object plane function, the position coordinates of the target object, i.e., the three-dimensional position of the target object, can be determined. The distance between this three-dimensional position and the position of the preset obstacle is the distance between the target object and the preset obstacle. Here, the average three-dimensional position of the target object is the average of the initial three-dimensional positions of the target feature points in the target keyframe. The initial three-dimensional position can be understood as the three-dimensional position of the target feature points obtained using a preset method, such as triangulation. The camera position can be understood as the position of the preset camera when capturing the current target keyframe in the world coordinate system.
[0038] The object ranging method provided in this embodiment of the invention acquires multiple image frames using a preset camera, determines the correlation between the same preset object appearing in different image frames, and determines keyframes from the multiple image frames to obtain a keyframe set. Based on the correlation and the keyframe set, a target object that meets preset requirements is determined from the preset objects, and multiple consecutive target keyframes are determined from the keyframe set. The preset requirements include the requirement that the target object appears consecutively in multiple different keyframes. The target keyframe contains the target object. Based on the camera position and three-dimensional average position corresponding to the target keyframe, and a preset cost function, the object plane function of the target object is determined. Based on the object plane function, the three-dimensional position of the target object and the distance of the three-dimensional position from the preset obstacle are determined. The three-dimensional average position is the average value of the three-dimensional initial positions of the target feature points in the target keyframe, and the target feature points are the feature points of the target object. The technical solution of this invention determines a set of key frames based on the association relationship of a preset object in different image frames. Then, based on this set of key frames and the association relationship, it determines the target object and the target key frame. Next, based on the camera position and 3D average position corresponding to the target key frame, and a preset cost function, it determines the object's plane function. Finally, based on this object plane function, it determines the 3D position of the target object and the distance between the target object and a preset obstacle. Compared with traditional ranging methods that rely on professional ranging sensors, this method only requires a camera with low cost and high stability to complete the ranging, reducing the impact of weather and vehicle speed on ranging accuracy, solving the problem of low reliability in object ranging, and significantly reducing costs.
[0039] Optionally, before determining the object plane function of the target object based on the camera position and 3D average position corresponding to the target keyframe, and a preset cost function, the method further includes: for each target object, using a preset triangulation method, camera intrinsic parameters, and the camera pose of the target keyframe, determining the 3D initial position of the target feature points of the current target object, wherein the number of the 3D initial positions is consistent with the number of target feature points; for each target object, based on the 3D initial positions, determining the mean of all 3D initial positions of the current target object, and determining the mean as the 3D average position of the current target object.
[0040] For example, given the camera intrinsic parameters, the camera pose of the target keyframe, and the position coordinates of the target feature points within the target keyframe, the initial 3D position of each target feature point of each target object can be calculated using triangulation. By averaging the initial 3D positions of the target feature points for each target object, the average 3D position of the current target object can be obtained. Here, a target keyframe can contain multiple target objects, and each target object can contain multiple target feature points. The position coordinates of the target feature points within the target keyframe can be understood as their position coordinates in the image coordinate system of the target keyframe.
[0041] Example 2
[0042] Figure 2 This is a flowchart of an object ranging method provided in Embodiment 2 of the present invention. The technical solution of the present invention is further optimized based on the above optional technical solutions, and a specific method for object ranging is given.
[0043] Optionally, determining a target object that meets preset requirements from the preset objects based on the association relationship and the keyframe set, and determining multiple consecutive target keyframes from the keyframe set, includes: determining, based on the association relationship and the keyframe set, a target object that appears consecutively in multiple keyframes and appears more than a preset number of frames from the preset objects, and determining all of the multiple keyframes as target keyframes, wherein the number of target feature points of the target object in each target keyframe is greater than a third preset threshold. The advantage of this setting is that it accurately determines the target object from multiple preset objects in the image frame, shielding the interference of temporarily appearing irrelevant objects on the ranging accuracy.
[0044] Optionally, determining the object plane function of the target object based on the camera position and 3D average position corresponding to the target keyframe, and a preset cost function, includes: determining a target normal vector based on the camera position corresponding to the target keyframe; determining a first function based on the target normal vector and 3D average position; processing the first function using a preset iterative algorithm, such that the first result of the first cost function corresponding to the processed first function is less than a first set value, and determining the processed first function as a second function; processing the second function using a preset iterative algorithm, such that the second result of the second cost function corresponding to the processed second function is less than a second set value, and determining the processed second function as the object plane function of the target object, wherein the second cost function is determined based on the shape error of the target object; wherein the second cost function is determined based on the shape error of the target object, and the determination method of the first result includes... The method includes: determining the first position coordinates of each target feature point, wherein the first position coordinates are the position coordinates of the target feature point in the last target keyframe containing the target feature point, and the position coordinates are determined based on the image coordinate system in the image frame; based on the first function, performing a planar inverse projection operation and a reprojection operation on the first position coordinates to obtain second position coordinates, wherein the second position coordinates are in the image coordinate system; according to the association relationship, in multiple target keyframes, for each target feature point of each target object, calculating the first absolute value of the difference between the second position coordinates and the position coordinates of the first associated point, and summing all the first absolute values to obtain the first result of the first cost function of the current target object, wherein the first associated point is the target feature point associated with the target feature point corresponding to the first position coordinates in the target keyframe, determined according to the association relationship. The advantage of this setup is that by utilizing iterative algorithms and cost functions, the object's planar function is accurately determined, improving the ranging accuracy of the target object.
[0045] like Figure 2 As shown in Embodiment 2 of the present invention, a method for measuring the distance of an object specifically includes the following steps:
[0046] S201. Acquire multiple image frames using a preset camera, determine the correlation between the same preset object appearing in different image frames, and determine key frames from the multiple image frames to obtain a key frame set.
[0047] Optionally, the method for determining the association relationship includes: using a preset feature point extraction algorithm to determine feature points of a preset object from the image frames; and using a preset optical flow tracing algorithm to track the feature points in the image frames to determine the association relationship of the feature points of the preset object appearing in different image frames. The advantage of this setup is that by using an optical flow tracing algorithm to track feature points, the association relationship of feature points of the same object in different image frames can be accurately determined.
[0048] Specifically, Figure 3 This diagram illustrates optical flow tracing. It utilizes a pre-defined feature point extraction algorithm, such as Scale Invariant Feature Transform (SIFT), to extract feature points of a pre-defined object from image frames. When the object moves, the brightness pattern of its corresponding points in the image also moves. For example, if the pre-defined object is a sign, then during vehicle movement, the sign is a moving object relative to the vehicle, and the pixel intensity of the sign in the image frame will change regularly accordingly. Therefore, by tracking the pre-defined object using optical flow, the correlation between the object's feature points appearing in different image frames can be determined. Specifically, by using a pre-defined optical flow tracing algorithm, such as Kanade-Lucas-Tomasi Tracking (KLT), the correlation can be determined by tracking feature points in the image frame. Figure 3 As shown, the same preset object (road sign) is related in two adjacent image frames (the image frame in the upper right corner and the image frame in the lower left corner), and the dots in the preset object are the feature points of the preset object. Optical flow can be understood as the instantaneous velocity of pixel movement of a spatially moving object on the observation imaging plane.
[0049] Optionally, the method for determining the key frame includes: determining the image frame whose value of a preset parameter is greater than a set threshold corresponding to the preset parameter as a key frame, wherein the preset parameter includes at least one of the time interval between the image frame and the previous key frame, the distance interval, and the parallax angle.
[0050] For example, if the set threshold for the time interval between the current image frame and the previous keyframe is 0.1 seconds, the set threshold for the distance interval between the current image frame and the previous keyframe is 5 meters, and the set threshold for the parallax angle between the current image frame and the previous keyframe is 10 degrees, then if at least one of the following occurs: the time interval between the current image frame and the previous keyframe is greater than 0.1 seconds, the distance interval between the current image frame and the previous keyframe is greater than 5 meters, or the parallax angle between the current image frame and the previous keyframe is greater than 10 degrees, then the current image frame can be determined as a keyframe. The distance interval between the image frame and the keyframe can be understood as the distance between the location of the image frame and the location of the keyframe in the world coordinate system.
[0051] S202. Based on the association relationship and the key frame set, determine the target object that appears continuously in multiple key frames from the preset objects and appears more times than the preset number of frames, and determine all the multiple key frames as target key frames.
[0052] Wherein, the number of target feature points of the target object in each target keyframe is greater than a third preset threshold.
[0053] For example, if the preset frame count is 6 and the third preset threshold is 3, then when a preset object appears consecutively in keyframes, appears consecutively for more than 6 frames, and has more than 3 feature points in each keyframe, the preset object can be identified as a target object, and all consecutive keyframes can be identified as target keyframes. A target keyframe can contain multiple target objects simultaneously, and the first and / or last frames of consecutive keyframes corresponding to each target object can be different. For each target object, the range of keyframes corresponding to different target objects can be different. For example, if target object a appears in keyframes 1 to 10, then the keyframe range corresponding to target object a is keyframes 1 to 10. If target object b appears in keyframes 1 to 8, then the corresponding keyframe range is keyframes 1 to 8. That is, target object a and target object b can appear in the same keyframe (keyframe 1) and disappear after different keyframes (keyframes 10 and 8).
[0054] S203. Determine the target normal vector based on the camera position corresponding to the target keyframe.
[0055] Specifically, since the direction vector of the plane where the target object is located is usually parallel to the direction vector of the vehicle's movement, in the world coordinate system, if the camera position coordinates of the first keyframe of the target object (i.e., the starting keyframe) are A1 and the camera position coordinates of the last keyframe of the target object (i.e., the ending keyframe) are A2, then the normal vector of the plane where the target object is located, i.e., the target normal vector, can be obtained from the calculation result of A2-A1.
[0056] S204. Determine the first function based on the target normal vector and the three-dimensional average position.
[0057] Specifically, the general form of the plane equation, i.e. the first function, can be determined using the plane's normal vector, i.e. the target normal vector, and a point on the plane, i.e. the three-dimensional average position.
[0058] S205. The first function is processed using a preset iterative algorithm, such that the first result of the first cost function corresponding to the processed first function is less than a first set value, and the processed first function is determined as the second function.
[0059] Specifically, a preset iterative algorithm, such as the Gauss-Newton iteration method, can be used to iterate the first function and determine whether the value of the first cost function (the value of the loss function) is less than a first set value, such as 0.4. If it is less, the first function after the iteration can be determined as the second function; if it is greater, the iteration can continue based on the first function after the previous iteration.
[0060] Optionally, the method for determining the first result includes:
[0061] 1) Determine the first position coordinates of each of the target feature points, wherein the first position coordinates are the position coordinates of the target feature points in the last target keyframe containing the target feature points, and the position coordinates are determined based on the image coordinate system in the image frame.
[0062] Specifically, the target feature points can be denoted as P(o, k, n), where o represents the target object identifier, k represents the target keyframe identifier, and n represents the target feature point identifier. For example, P(1, 2, 3) can represent the third target feature point of target object 1 in keyframe 2. For each target feature point of a target object, if the last target keyframe containing the target feature point P of the current target object is e, then the first position coordinate can be denoted as P(o, k, n). 2D Accordingly, the first position coordinates of all target feature points of the current target object can be determined.
[0063] 2) Based on the first function, after performing a planar inverse projection operation and a reprojection operation on the first position coordinates, a second position coordinate is obtained, wherein the second position coordinate is in the image coordinate system.
[0064] Specifically, for each target object's feature points, the first function after iterative processing is used to perform a planar inverse projection on the first position coordinates of the current target object, obtaining the three-dimensional position coordinates, which can be denoted as P. 3D (o, k, n), and then projected back onto the target feature points corresponding to the first position into multiple target keyframes to obtain the second position coordinates, which can be denoted as P. reproj (o, k, n) correspondingly determines the second position coordinates of all target feature points of the current target object. Since the current target object typically contains multiple target feature points, the second position coordinates can contain multiple coordinates.
[0065] 3) Based on the association relationship, in the multiple target keyframes, for each target feature point of each target object, calculate the first absolute value of the difference between the second position coordinate and the position coordinate of the first associated point, and sum all the first absolute values to obtain the first result of the first cost function of the current target object, wherein the first associated point is the target feature point associated with the target feature point corresponding to the first position coordinate determined according to the association relationship in the target keyframe.
[0066] For example, the first cost function C1 can be represented as follows:
[0067]
[0068] Where K represents the number of target keyframes corresponding to the target feature points of the target object, N represents the number of target feature points of the target object, and || represents taking the absolute value. For example, if the second position coordinate is P reproj If (o, 1, 1), then the position coordinates of the first associated point are P(o, 1, 1).
[0069] The advantage of this setting is that by calculating the absolute value of the difference between the second position coordinates of all target feature points (the reprojection and projected coordinates of the position coordinates of the target feature points in the last target keyframe) and the position coordinates of the first associated point (the coordinates of the target feature points associated with the current target feature point in the target keyframe), and summing these absolute values, it is possible to accurately determine whether the loss value of the first function after iterative processing is less than the first set value.
[0070] S206. The second function is processed using a preset iterative algorithm, so that the second result of the second cost function corresponding to the processed second function is less than a second set value, and the processed second function is determined as the object plane function of the target object.
[0071] The second cost function is determined based on the shape error of the target object.
[0072] Specifically, a pre-defined iterative algorithm, such as the Gauss-Newton iteration method, can be used to iterate the second function and determine whether the value of the second cost function (the value of the loss function) is less than a second set value, such as 0.2. If it is less, the second function after the iteration can be determined as the object plane function of the target object; if it is greater, the iteration can continue based on the second function after the previous iteration. The first and second set values can be the same or different.
[0073] Optionally, the method for determining the second result includes:
[0074] 1) Determine the third position coordinates of the set point of the target box, wherein the target box is an object box generated in the target keyframe based on the target object, and the third position coordinates are the position coordinates of the set point in the last target keyframe containing the set point of the target box.
[0075] Specifically, the object bounding box (target bounding box) can be pre-marked in the target keyframe based on the shape of the target object. The shape of the object bounding box can be a rectangle, etc. The setpoint of the target bounding box can be denoted as Q(o, k, m), where m represents the setpoint identifier. For each setpoint of the target object, if the last target keyframe containing the setpoint Q of the current target object is f, then the third position coordinate can be denoted as Q(o, k, m). The position coordinates of point Q in the image coordinate system of target keyframe f can be denoted as Q(o, k, m). 2D This allows us to determine the third position coordinates of all set points of the current target object. The set points can be the vertices of the corners of the target bounding box; if the target bounding box is rectangular, the set points can be the vertices of all four corners.
[0076] 2) Based on the second function, after performing a planar inverse projection operation and a reprojection operation on the third position coordinates, a fourth position coordinate is obtained, wherein the fourth position coordinate is in the image coordinate system.
[0077] Specifically, before iterating over the second function, for each target object's set point, the iteratively processed second function is used to perform a planar inverse projection on all set third position coordinates of the current target object to obtain its three-dimensional position coordinates, which can be denoted as Q. 3D (o, k, m), and then projected back onto the setpoint corresponding to the third position into multiple target keyframes to obtain the fourth position coordinates, which can be denoted as Q. reproj (o, k, m) correspondingly determines the fourth position coordinates of all set points of the current target object. Since the current target object typically contains multiple set points, the second position coordinates can contain multiple coordinates.
[0078] 3) Based on the association relationship, in multiple target keyframes, for each set point of the target box of each target object, calculate the second absolute value of the difference between the fourth position coordinate and the position coordinate of the second association point, and sum all the second absolute values to obtain the intermediate result of the second cost function of the current target object, wherein the second association point is the set point of the target box of the target object associated with the target object corresponding to the third position coordinate, determined according to the association relationship in the target keyframe.
[0079] For example, the second cost intermediate function C2 can be represented as follows:
[0080]
[0081] Where K represents the number of target keyframes corresponding to the current target object's setpoint, Y represents the number of setpoints of the current target object, and || represents taking the absolute value. For example, if the fourth position coordinate is Q... reproj If (o, 1, 1), then the position coordinates of the second associated point are Q(o, 1, 1).
[0082] 4) Based on the second function, after performing a planar inverse projection operation on the third position coordinates, the fifth position coordinates are obtained.
[0083] For example, by performing a planar inverse projection on the third position coordinates, we can obtain the three-dimensional position coordinates, which can be denoted as Q′. 3D (o, k, m).
[0084] 5) Based on the association relationship and the fifth position coordinates, in multiple target keyframes, for the target bounding box of each target object, determine the third absolute value of the difference between the opposite sides of the inverse projection bounding box of the current target object, and the fourth absolute value of the difference between the inverse projection angle of the target bounding box of the current target object and a preset angle, and perform a weighted summation of the third absolute value, the fourth absolute value and the intermediate result to obtain a second result, wherein the inverse projection bounding box is the object bounding box determined based on the fifth position coordinates, and the inverse projection angle is each corner of the inverse projection bounding box.
[0085] Specifically, the inverse projection frame can be understood as the object frame formed by connecting the fifth position coordinates, and the inverse projection angle can be understood as the corner of the inverse projection frame. If the inverse projection frame is a rectangle, then the inverse projection angle is the four vertex corners of the rectangle.
[0086] For example, the second cost function C3 can be represented as follows:
[0087]
[0088] Where a, b, and c are weighting coefficients, I represents the number of target keyframes corresponding to the inverse projection bounding box of the target object, J represents the number of target keyframes corresponding to the inverse projection angle of the target object, and Δl is the difference between opposite sides of the inverse projection bounding box of the target object. This is the difference between each inverse projection angle of the target object's bounding box and a preset angle. If the target bounding box is rectangular, the preset angle can be 90 degrees.
[0089] Optionally, the first cost function and the second cost function can be used simultaneously to calculate the loss value of the first function after iterative processing. For example, the total loss value of the first function can be determined by weighted summation of the results of the first cost function and the second cost function. If the total loss value is lower than the set loss threshold, the first function after iterative processing can be determined as the object plane function.
[0090] The advantage of this setting is that by taking the absolute value of the difference between the sides of the inverse projection frame of the target object, the absolute value of the difference between the inverse projection angle and the preset angle, and the weighted sum of the intermediate results, it is possible to accurately determine whether the loss value of the second function after iterative processing is less than the second set value, thereby accurately determining the object plane function of the target object.
[0091] S207. Determine the three-dimensional position of the target object and the distance of the three-dimensional position from the preset obstacle based on the object plane function.
[0092] Optionally, determining the three-dimensional position of the target object and the distance of the three-dimensional position from the preset obstacle based on the object plane function includes: using the object plane function to perform inverse projection processing on a set point of the target box of each target object to obtain the three-dimensional position to be determined of the current target object; for each target object, if the distance between the three-dimensional position to be determined and the preset obstacle is within a set range, then the three-dimensional position to be determined is determined as the three-dimensional position of the current target object, and the distance between the three-dimensional position and the preset obstacle is determined. The advantage of this setting is that by determining the specific distance between the target object and the preset obstacle, target objects with normal distance measurement can be filtered out.
[0093] Specifically, object plane functions can be used to calculate the 3D position of the set point of the target frame for each target object, i.e., the 3D position to be determined. Then, for each target object, the distance between the 3D position of the current target object's set point and the preset obstacle is calculated. For example, if the target object is a sign and the preset obstacle is the road surface, the vertical distance between the 3D position of the sign's target frame's set point and the road surface can be calculated. If it exceeds the set range (e.g., greater than zero meters and less than 3 meters), it indicates that the 3D position is abnormal and can be discarded. If it falls within the set range, the 3D position to be determined can be determined as the current target object's 3D position, and the distance between this 3D position and the road surface can be determined. The preset obstacle may include vehicles, etc.
[0094] Optionally, for each target object, if the distance between the three-dimensional position to be determined and the preset position falls within a set range, then the three-dimensional position to be determined is determined as the current three-dimensional position of the target object, and the distance between the three-dimensional position and the preset obstacle is determined. The preset position may include the center position of a road, etc.
[0095] Optionally, if the target bounding box of the target object is not a rectangle, a preset cost function matching the bounding box can be used to determine the object's planar function. If the target object is a rod, the perpendicularity of the rod to the ground and the degree of collinearity of the target feature points on the rod can be used as error constraints to construct the cost function.
[0096] The object ranging method provided in this invention determines a keyframe set based on the pre-defined correlation relationship of objects in different image frames. Then, based on this keyframe set and correlation relationship, it identifies target objects and target keyframes that appear consecutively in multiple keyframes. Next, based on the target normal vector and the three-dimensional average position, it determines the general form of the object plane function, i.e., the first function. Using a pre-defined iterative algorithm and a pre-defined cost function, it determines the object plane function. Finally, based on this object plane function, it determines the distance between the target object and pre-defined obstacles. The cost function accurately determines the object plane function of road signs, poles, and other objects waiting for ranging during autonomous driving. This method requires less computing power to meet the accuracy requirements of object ranging, solving the problem of low reliability in object ranging and significantly reducing costs.
[0097] Example 3
[0098] Figure 4 This is a schematic diagram of an object ranging device provided in Embodiment 3 of the present invention. Figure 4 As shown, the device includes: a keyframe determination module 301, a target keyframe determination module 302, and a distance determination module 303, wherein:
[0099] The keyframe determination module is used to acquire multiple image frames through a preset camera, determine the correlation between the same preset object appearing in different image frames, and determine keyframes from the multiple image frames to obtain a keyframe set.
[0100] The target keyframe determination module is used to determine a target object that meets preset requirements from the preset objects according to the association relationship and the keyframe set, and to determine multiple consecutive target keyframes from the keyframe set, wherein the preset requirements include the requirement that the target object appears consecutively in multiple different keyframes, and the target keyframe contains the target object;
[0101] The distance determination module is used to determine the object plane function of the target object based on the camera position and three-dimensional average position corresponding to the target keyframe and a preset cost function, and to determine the three-dimensional position of the target object and the distance of the three-dimensional position from the preset obstacle based on the object plane function. The three-dimensional average position is the average value of the three-dimensional initial positions of the target feature points in the target keyframe, and the target feature points are the feature points of the target object.
[0102] The object ranging device provided in this embodiment of the invention determines a set of key frames based on the pre-defined correlation relationship of an object in different image frames, and determines the target object and target key frames based on the key frame set and correlation relationship. Then, based on the camera position and three-dimensional average position corresponding to the target key frame, as well as a pre-defined cost function, the object plane function is determined. Finally, based on the object plane function, the three-dimensional position of the target object and the distance between the target object and a pre-defined obstacle are determined. Compared with the traditional ranging method that relies on a professional ranging sensor, this device only requires a camera with low cost and high stability to complete the ranging, reducing the impact of factors such as weather and vehicle speed on the ranging accuracy, solving the problem of low reliability in object ranging, and greatly reducing costs.
[0103] Optionally, the method for determining the association relationship includes: using a preset feature point extraction algorithm to determine the feature points of a preset object from the image frame; and using a preset optical flow tracing algorithm to track the feature points in the image frame to determine the association relationship of the feature points of the preset object appearing in different image frames.
[0104] Optionally, the target keyframe determination module is specifically used to determine, based on the association relationship and the keyframe set, a target object that appears continuously in multiple keyframes and appears more than a preset number of frames from the preset objects, and to determine all of the multiple keyframes as target keyframes, wherein the number of target feature points of the target object in each target keyframe is greater than a third preset threshold.
[0105] Optionally, the device may also include:
[0106] The initial position determination module is used to determine the object plane function of the target object for each target object before determining the object plane function based on the camera position and three-dimensional average position corresponding to the target key frame and the preset cost function. This is done by using a preset triangulation method, camera intrinsic parameters and the camera pose of the target key frame to determine the three-dimensional initial position of the target feature points of the current target object. The number of the three-dimensional initial positions is the same as the number of target feature points.
[0107] The average position determination module is used to determine the object plane function of the target object based on the camera position and three-dimensional average position corresponding to the target key frame and the preset cost function, for each target object, determine the average of all three-dimensional initial positions of the current target object based on the three-dimensional initial position, and determine the average as the three-dimensional average position of the current target object.
[0108] Optional, the distance determination module includes:
[0109] The normal vector determination unit is used to determine the target normal vector based on the camera position corresponding to the target keyframe;
[0110] The first function determination unit is used to determine the first function based on the target normal vector and the three-dimensional average position;
[0111] The second function determination unit is used to process the first function using a preset iterative algorithm, so that the first result of the first cost function corresponding to the processed first function is less than a first set value, and to determine the processed first function as the second function.
[0112] The plane function determination unit is used to process the second function using a preset iterative algorithm, so that the second result of the second cost function corresponding to the processed second function is less than a second set value, and to determine the processed second function as the object plane function of the target object, wherein the second cost function is determined based on the shape error of the target object;
[0113] The second cost function is determined based on the shape error of the target object. The determination of the first result includes: determining the first position coordinates of each target feature point, wherein the first position coordinates are the position coordinates of the target feature point in the last target keyframe containing the target feature point, and the position coordinates are determined based on the image coordinate system in the image frame; based on the first function, performing a planar inverse projection operation and a reprojection operation on the first position coordinates to obtain the second position coordinates, wherein the second position coordinates are in the image coordinate system; according to the association relationship, in multiple target keyframes, for each target feature point of each target object, calculating the first absolute value of the difference between the second position coordinates and the position coordinates of the first associated point, and summing all the first absolute values to obtain the first result of the first cost function of the current target object, wherein the first associated point is the target feature point associated with the target feature point corresponding to the first position coordinates in the target keyframe according to the association relationship.
[0114] Optionally, the method for determining the second result includes: determining the third position coordinates of the set point of the target box, wherein the target box is an object box generated based on the target object in the target keyframe, and the third position coordinates are the position coordinates of the set point in the last target keyframe containing the set point of the target box; based on the second function, performing a planar inverse projection operation and a reprojection operation on the third position coordinates to obtain a fourth position coordinate, wherein the fourth position coordinate is in the image coordinate system; according to the association relationship, in multiple target keyframes, for each set point of the target box of each target object, calculating the second absolute value of the difference between the fourth position coordinate and the position coordinate of the second association point, and summing all the second absolute values to obtain an intermediate result of the second cost function of the current target object. The second association point is a set point of the target box of the target object associated with the target object corresponding to the third position coordinate, determined according to the association relationship in the target keyframe. Based on the second function, a fifth position coordinate is obtained after performing a planar inverse projection operation on the third position coordinate. According to the association relationship and the fifth position coordinate, in multiple target keyframes, for the target box of each target object, the third absolute value of the difference between the opposite sides of the inverse projection box of the current target object and the fourth absolute value of the difference between the inverse projection angle of the target box of the current target object and a preset angle are determined. The third absolute value, the fourth absolute value and the intermediate result are weighted and summed to obtain a second result. The inverse projection box is the object box determined based on the fifth position coordinate, and the inverse projection angle is each corner of the inverse projection box.
[0115] Optional, the distance determination module includes:
[0116] The three-dimensional position determination unit is used to perform inverse projection processing on the set points of the target box of each target object using the object plane function to obtain the three-dimensional position to be determined of the current target object.
[0117] The distance determination unit is used to determine the three-dimensional position to be determined as the current three-dimensional position of the target object if the distance between the three-dimensional position to be determined and the preset obstacle is within a set range for each target object, and to determine the distance between the three-dimensional position and the preset obstacle.
[0118] The object ranging device provided in the embodiments of the present invention can execute the object ranging method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0119] Example 4
[0120] Figure 5A schematic diagram of an electronic device 40 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0121] like Figure 5 As shown, the electronic device 40 includes at least one processor 41 and a memory, such as a read-only memory (ROM) 42 or a random access memory (RAM) 43, communicatively connected to the at least one processor 41. The memory stores computer programs executable by the at least one processor. The processor 41 can perform various appropriate actions and processes based on the computer program stored in the ROM 42 or loaded into the RAM 43 from storage unit 48. The RAM 43 may also store various programs and data required for the operation of the electronic device 40. The processor 41, ROM 42, and RAM 43 are interconnected via a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0122] Multiple components in electronic device 40 are connected to I / O interface 45, including: input unit 46, such as keyboard, mouse, etc.; output unit 47, such as various types of monitors, speakers, etc.; storage unit 48, such as disk, optical disk, etc.; and communication unit 49, such as network card, modem, wireless transceiver, etc. Communication unit 49 allows electronic device 40 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0123] Processor 41 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 41 performs the various methods and processes described above, such as methods for object ranging.
[0124] In some embodiments, the object ranging method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 40 via ROM 42 and / or communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the object ranging method described above may be performed. Alternatively, in other embodiments, processor 41 may be configured to perform the object ranging method by any other suitable means (e.g., by means of firmware).
[0125] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0126] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0127] The computer equipment provided above can be used to execute the object ranging method provided in any of the above embodiments, and has the corresponding functions and beneficial effects.
[0128] Example 5
[0129] In the context of this invention, a computer-readable storage medium may be a tangible medium, and the computer-executable instructions, when executed by a computer processor, are used to perform a method for object ranging, the method comprising:
[0130] Multiple image frames are acquired by a preset camera, the correlation between the same preset object appearing in different image frames is determined, and key frames are determined from the multiple image frames to obtain a key frame set;
[0131] Based on the association relationship and the keyframe set, a target object that meets the preset requirements is determined from the preset objects, and multiple consecutive target keyframes are determined from the keyframe set. The preset requirements include the requirement that the target object appears consecutively in multiple different keyframes, and the target keyframes contain the target object.
[0132] Based on the camera position and three-dimensional average position corresponding to the target keyframe, and a preset cost function, the object plane function of the target object is determined, and the three-dimensional position of the target object and the distance of the three-dimensional position from the preset obstacle are determined based on the object plane function. The three-dimensional average position is the average value of the three-dimensional initial positions of the target feature points in the target keyframe, and the target feature points are the feature points of the target object.
[0133] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by, or in conjunction with, an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0134] The computer equipment provided above can be used to execute the object ranging method provided in any of the above embodiments, and has the corresponding functions and beneficial effects.
[0135] It is worth noting that in the embodiments of the above-mentioned object ranging device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0136] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A method for measuring the distance of an object, characterized in that, include: Multiple image frames are acquired by a preset camera, the correlation between the same preset object appearing in different image frames is determined, and key frames are determined from the multiple image frames to obtain a key frame set; Based on the association relationship and the keyframe set, a target object that meets the preset requirements is determined from the preset objects, and multiple consecutive target keyframes are determined from the keyframe set. The preset requirements include the requirement that the target object appears consecutively in multiple different keyframes, and the target keyframes contain the target object. Based on the camera position and three-dimensional average position corresponding to the target keyframe, and a preset cost function, the object plane function of the target object is determined, and the three-dimensional position of the target object and the distance of the three-dimensional position from the preset obstacle are determined based on the object plane function. The three-dimensional average position is the average value of the three-dimensional initial positions of the target feature points in the target keyframe, and the target feature points are the feature points of the target object.
2. The method according to claim 1, characterized in that, The methods for determining the association include: The feature points of a preset object are determined from the image frame using a preset feature point extraction algorithm. Using a preset optical flow tracing algorithm, the feature points in the image frame are tracked to determine the correlation between the feature points of the preset object appearing in different image frames.
3. The method according to claim 1, characterized in that, The step of determining a target object that meets preset requirements from the preset objects based on the association relationship and the keyframe set, and determining multiple consecutive target keyframes from the keyframe set, includes: Based on the association and the keyframe set, a target object is determined from the preset objects that appears continuously in multiple keyframes and appears more than a preset number of frames. All of the multiple keyframes are determined as target keyframes, wherein the number of target feature points of the target object in each target keyframe is greater than a third preset threshold.
4. The method according to claim 1, characterized in that, Before determining the object plane function of the target object based on the camera position and 3D average position corresponding to the target keyframe, and a preset cost function, the method further includes: For each target object, the three-dimensional initial position of the target feature points of the current target object is determined by using a preset triangulation method, camera intrinsic parameters, and the camera pose of the target key frame. The number of the three-dimensional initial positions is the same as the number of target feature points. For each target object, based on the three-dimensional initial position, the mean of all three-dimensional initial positions of the current target object is determined, and the mean is determined as the three-dimensional average position of the current target object.
5. The method according to any one of claims 1-4, characterized in that, The step of determining the object plane function of the target object based on the camera position and 3D average position corresponding to the target keyframe, and a preset cost function, includes: Determine the target normal vector based on the camera position corresponding to the target keyframe; The first function is determined based on the target normal vector and the three-dimensional average position; The first function is processed using a preset iterative algorithm, such that the first result of the first cost function corresponding to the processed first function is less than a first set value, and the processed first function is determined as the second function. The second function is processed using a preset iterative algorithm, so that the second result of the second cost function corresponding to the processed second function is less than a second set value, and the processed second function is determined as the object plane function of the target object; The second cost function is determined based on the shape error of the target object, and the method for determining the first result includes: Determine the first position coordinates of each target feature point, wherein the first position coordinates are the position coordinates of the target feature point in the last target keyframe containing the target feature point, and the position coordinates are determined based on the image coordinate system in the image frame; Based on the first function, after performing a planar inverse projection operation and a reprojection operation on the first position coordinates, a second position coordinate is obtained, wherein the second position coordinate is in the image coordinate system; Based on the association relationship, in multiple target keyframes, for each target feature point of each target object, the first absolute value of the difference between the second position coordinate and the position coordinate of the first associated point is calculated, and all the first absolute values are summed to obtain the first result of the first cost function of the current target object, wherein the first associated point is the target feature point associated with the target feature point corresponding to the first position coordinate determined according to the association relationship in the target keyframe.
6. The method according to claim 5, characterized in that, The methods for determining the second result include: The third position coordinates of the set point of the target box are determined, wherein the target box is an object box generated in the target keyframe based on the target object, and the third position coordinates are the position coordinates of the set point in the last target keyframe containing the set point of the target box; Based on the second function, after performing a planar inverse projection operation and a reprojection operation on the third position coordinates, a fourth position coordinate is obtained, wherein the fourth position coordinate is in the image coordinate system; Based on the association relationship, in multiple target keyframes, for each set point of the target box of each target object, the second absolute value of the difference between the fourth position coordinate and the position coordinate of the second association point is calculated, and all the second absolute values are summed to obtain the intermediate result of the second cost function of the current target object. The second association point is the set point of the target box of the target object associated with the target object corresponding to the third position coordinate, determined according to the association relationship in the target keyframe. Based on the second function, the fifth position coordinates are obtained by performing a planar inverse projection operation on the third position coordinates; Based on the association relationship and the fifth position coordinates, in multiple target keyframes, for the target bounding box of each target object, the third absolute value of the difference between the opposite sides of the inverse projection bounding box of the current target object and the fourth absolute value of the difference between the inverse projection angle of the target bounding box of the current target object and a preset angle are determined. The third absolute value, the fourth absolute value and the intermediate result are weighted and summed to obtain a second result, wherein the inverse projection bounding box is the object bounding box determined based on the fifth position coordinates and the inverse projection angle is each corner of the inverse projection bounding box.
7. The method according to claim 6, characterized in that, The step of determining the three-dimensional position of the target object and the distance of the three-dimensional position from the preset obstacle based on the object plane function includes: Using the object plane function, inverse projection is performed on the set points of the target box of each target object to obtain the current target object's undetermined three-dimensional position; For each target object, if the distance between the three-dimensional position to be determined and the preset obstacle is within a set range, then the three-dimensional position to be determined is determined as the three-dimensional position of the current target object, and the distance between the three-dimensional position and the preset obstacle is determined.
8. A device for measuring the distance of an object, characterized in that, include: The keyframe determination module is used to acquire multiple image frames through a preset camera, determine the correlation between the same preset object appearing in different image frames, and determine keyframes from the multiple image frames to obtain a keyframe set. The target keyframe determination module is used to determine a target object that meets preset requirements from the preset objects according to the association relationship and the keyframe set, and to determine multiple consecutive target keyframes from the keyframe set, wherein the preset requirements include the requirement that the target object appears consecutively in multiple different keyframes, and the target keyframe contains the target object; The distance determination module is used to determine the object plane function of the target object based on the camera position and three-dimensional average position corresponding to the target keyframe and a preset cost function, and to determine the three-dimensional position of the target object and the distance of the three-dimensional position from the preset obstacle based on the object plane function. The three-dimensional average position is the average value of the three-dimensional initial positions of the target feature points in the target keyframe, and the target feature points are the feature points of the target object.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, which enables the at least one processor to perform the object ranging method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method for measuring the distance between objects according to any one of claims 1-7.
Citation Information
Patent Citations
Vision large-span ranging method based on unmanned aerial vehicle
CN110319772A
Monocular camera-based distance measurement method, device and equipment, and storage medium
CN112902911A