Speed measurement method and device, electronic equipment and computer readable storage medium
By calculating the scale factor and ego-vehicle speed between image frames in visual intelligent driving, the problem of dynamic obstacle speed measurement is solved, and accurate and real-time obstacle speed measurement is achieved.
Patent Information
- Application Number
- CN202510885534.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-09-26
AI Technical Summary
In vision-based intelligent driving scenarios, vehicles cannot directly obtain the speed of dynamic obstacles from two-dimensional image data.
By acquiring image frames of the ego vehicle at different times, the scale factor of the target object between image frames is calculated, and the speed of the target object is determined by combining the ego vehicle speed and longitudinal distance.
It realizes the speed measurement of dynamic obstacles in the visual intelligent driving scenario, and improves the accuracy and real-time performance of speed measurement.
Smart Images

Figure CN120703397A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of intelligent driving technology, and in particular to a speed measurement method, device, electronic device, and computer-readable storage medium. Background Art
[0002] In vision-based intelligent driving solutions, vehicles use cameras mounted on them to collect real-time image data to detect, identify, and track surrounding dynamic and static obstacles. Because the images captured by the cameras are two-dimensional, the vehicle cannot directly determine the speed of dynamic obstacles (such as motor vehicles, non-motor vehicles, and pedestrians). Therefore, a method for measuring the speed of dynamic obstacles in vision-based intelligent driving scenarios is urgently needed. Summary of the Invention
[0003] In order to solve the above technical problems, the present disclosure provides a speed measurement method, device, electronic device, and computer-readable storage medium to achieve speed measurement of a target object in a vision-based intelligent driving scenario.
[0004] A first embodiment of the present disclosure provides a speed measurement method, comprising:
[0005] Obtain a first image frame and a second image frame containing a target object captured by the vehicle at a first moment and a second moment; the first moment is earlier than the second moment; and the first moment and the second moment differ by N inter-frame intervals, where N is a positive integer;
[0006] determining a first scale factor of the target object between the image frames based on the first image frame and the second image frame;
[0007] A first speed of the target object at the second moment is determined based on the first scale factor, the inter-frame interval, a longitudinal distance between the ego vehicle and the target object at the second moment, and a speed of the ego vehicle.
[0008] A second embodiment of the present disclosure provides a speed measuring device, comprising:
[0009] an image acquisition module, configured to acquire a first image frame and a second image frame containing the target object, captured by the vehicle at a first moment and a second moment, wherein the first moment is earlier than the second moment, and the first moment and the second moment differ by N interframe intervals, where N is a positive integer;
[0010] a scale factor determination module, configured to determine a first scale factor of the target object between the image frames based on the first image frame and the second image frame;
[0011] The speed determination module is configured to determine a first speed of the target object at the second moment based on the first scale factor, the inter-frame interval, the longitudinal distance between the ego vehicle and the target object at the second moment, and the ego vehicle speed.
[0012] A third aspect of the present disclosure provides a computer-readable storage medium storing a computer program for executing the speed measurement method provided in the first aspect.
[0013] An embodiment of the fourth aspect of the present disclosure provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor for reading the executable instructions from the memory and executing the instructions to implement the speed measurement method provided in the first aspect above.
[0014] The fifth embodiment of the present disclosure provides a computer program product. When an instruction processor in the computer program product executes, the speed measurement method provided by the first aspect of the present disclosure is executed.
[0015] In an embodiment of the present disclosure, an electronic device obtains a first image frame and a second image frame containing a target object, captured by a vehicle at a first moment and a second moment. The first moment is earlier than the second moment, and the first moment and the second moment differ by N interframe intervals, where N is a positive integer. The electronic device then determines a first scale factor of the target object between the image frames based on the first and second image frames, and determines a first speed of the target object at the second moment based on the first scale factor, the interframe interval, the longitudinal distance between the vehicle and the target object at the second moment, and the vehicle's speed. In this way, the electronic device can measure the speed of the target object in a vision-based intelligent driving scenario. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a flowchart of a speed measurement method provided by an exemplary embodiment of the present disclosure.
[0017] Figure 2 It is a flowchart of a speed measurement method provided by another exemplary embodiment of the present disclosure.
[0018] Figure 3 It is a flowchart of a speed measurement method provided by another exemplary embodiment of the present disclosure.
[0019] Figure 4 It is a flowchart of a speed measurement method provided by another exemplary embodiment of the present disclosure.
[0020] Figure 5 Schematic diagram of the structure of a speed measuring device provided by an exemplary embodiment of the present disclosure.
[0021] Figure 62 is a schematic structural diagram of a speed measuring device provided by an exemplary embodiment of the present disclosure.
[0022] Figure 7 2 is a schematic structural diagram of a speed measuring device provided by an exemplary embodiment of the present disclosure.
[0023] Figure 8 2 is a schematic structural diagram of a speed measuring device provided by an exemplary embodiment of the present disclosure.
[0024] Figure 9 is a structural diagram of an electronic device provided by an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] To explain the present disclosure, example embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments. It should be understood that the present disclosure is not limited to the example embodiments.
[0026] It should be noted that the relative arrangement of components and steps, the numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
[0027] Application Overview
[0028] The intelligent driving described in the present disclosure may cover multiple fields such as autonomous driving, assisted driving, and robotic systems. Autonomous driving technology is committed to achieving fully autonomous driving of intelligent vehicles in various complex road conditions without human intervention. It is also called unmanned driving and is an advanced form of intelligent driving. Assisted driving provides drivers with real-time road condition information, warnings, and partial driving operation support, such as automatic parking and adaptive cruise control, through a series of sensors and algorithms, aiming to improve driving safety and convenience. Robotic systems further expand intelligent driving technology to areas such as service robots and industrial robots, enabling robots to autonomously navigate, avoid obstacles, and complete specific tasks in complex environments, such as logistics distribution, warehouse management, etc., demonstrating the wide application potential of intelligent driving technology in different scenarios.
[0029] In vision-based intelligent driving solutions, vehicles use cameras mounted on the vehicle to collect real-time image data to detect, identify, and track surrounding dynamic and static obstacles. However, because the images collected by the cameras are two-dimensional, the vehicle cannot directly obtain the speed of dynamic obstacles (such as motor vehicles, non-motor vehicles, and pedestrians).
[0030] In an embodiment of the present disclosure, an electronic device obtains a first image frame and a second image frame containing a target object, captured by a vehicle at a first moment and a second moment. The first moment is earlier than the second moment, and the first moment and the second moment differ by N interframe intervals, where N is a positive integer. The electronic device then determines a first scale factor of the target object between the image frames based on the first and second image frames, and determines a first speed of the target object at the second moment based on the first scale factor, the interframe interval, the longitudinal distance between the vehicle and the target object at the second moment, and the vehicle's speed. In this way, the electronic device can measure the speed of the target object in a vision-based intelligent driving scenario.
[0031] Exemplary Methods
[0032] Figure 1 FIG. 1 is a flow chart of a speed measurement method provided by an exemplary embodiment of the present disclosure. This embodiment can be applied to electronic devices, such as Figure 1 As shown, the following steps are included:
[0033] Step 101: Obtain a first image frame and a second image frame containing a target object captured by the vehicle at a first moment and a second moment, wherein the first moment is earlier than the second moment and the first moment and the second moment differ by N interframe intervals, where N is a positive integer.
[0034] For example, while the vehicle is driving, a camera mounted on the vehicle can capture real-time images of the environment. For each moment in the environment, the electronic device can detect objects in the environment and obtain a detection frame for each object. For each object, the electronic device can capture an ROI (Region of Interest) image corresponding to the object from the environment image based on the detection frame. The objects are traffic participants (e.g., motor vehicles, non-motor vehicles, pedestrians, cyclists, etc.) in the driving scene in which the vehicle is located.
[0035] When the vehicle needs to measure the speed of a certain target object, the electronic device can obtain the first image frame and the second image frame containing the target object collected by the vehicle at the first moment and the second moment from the ROI image of the target object at each moment. Among them, the first moment is earlier than the second moment, the first moment can be a historical moment, the second moment can be the current moment, or the first moment and the second moment can both be historical moments, which is not limited in the embodiment of the present disclosure. The embodiment of the present disclosure is introduced by taking the first moment as the historical moment and the second moment as the current moment as an example. Other situations are similar and will not be described in detail in the embodiment of the present disclosure. The first moment and the second moment may differ by N inter-frame intervals, where N is a positive integer. That is, the first moment and the second moment may differ by one inter-frame interval (that is, the second moment is T n moment, the first moment is T n-1The first image frame and the second image frame are adjacent image frames), and the first moment and the second moment may also differ by multiple inter-frame intervals (ie, the second moment is T n moment, the first moment is T n-k At the time point, k>1, the first image frame and the second image frame are non-adjacent image frames), which is not limited in the embodiment of the present disclosure.
[0036] Furthermore, in the case where the first moment and the second moment differ by a plurality of interframe intervals, the electronic device may determine the first moment based on the second moment and the fixed number of interframe intervals. For example, if the fixed number of interframe intervals is 5, and the second moment is T 10 moment, the first moment is T5; if the second moment is T7, the first moment is T2, and so on. In addition, the electronic device can also determine the number of inter-frame intervals based on the longitudinal distance between the vehicle and the target at the second moment, and determine the first moment based on the second moment and the determined number of inter-frame intervals. For example, if the longitudinal distance between the vehicle and the target at the second moment is (5m, 20m], the number of inter-frame intervals is 5; if the longitudinal distance between the vehicle and the target at the second moment is (20m, 40m], the number of inter-frame intervals is 10; if the longitudinal distance between the vehicle and the target at the second moment is (40m, 60m], the number of inter-frame intervals is 15; if the longitudinal distance between the vehicle and the target at the second moment is more than 60m, the number of inter-frame intervals is 20. When the longitudinal distance between the vehicle and the target at the second moment is 35m, the second moment is T 15 , then the number of inter-frame intervals is 10, the first moment is T5, when the longitudinal distance between the vehicle and the target object is 55m at the second moment, the second moment is T 15 , then the number of interframe intervals is 15, and the first moment is T0.
[0037] Step 102 : Determine a first scale factor of the target object between the image frames based on the first image frame and the second image frame.
[0038] For example, because the target object moves relative to the vehicle, the size of the target object in the first image frame and the size of the target object in the second image frame will also change accordingly. After the electronic device acquires the first and second image frames of the target object, it can further perform optical flow tracking on the target object based on the first and second image frames to determine a first scale factor of the target object between the image frames. The scale factor is used to represent the degree of change in the relative size of the target object between the image frames.
[0039] It should be noted that if the first image frame and the second image frame are at adjacent moments (ie, T n Moment and T n-1The scale factor between the image frames determined by the electronic device is the image frame between the adjacent moments (i.e., T n Moment and T n-1 Correspondingly, the electronic device can determine the adjacent moments (i.e., T n Moment and T n-1 If the first image frame and the second image frame are at non-adjacent moments (i.e., T n Moment and T n-k The scale factor between the image frames determined by the electronic device is the image frame between the non-adjacent moments (i.e., T n Moment and T n-k At this time, the electronic device needs to further calculate the scale factor based on non-adjacent moments (i.e., T n Moment and T n-k The scale factor between the adjacent moments (i.e., T n Moment and T n-1 The scale factor between the adjacent moments (i.e. T n Moment and T n-1 The scale factor between the image frames is used as the first scale factor between the image frames.
[0040] Step 103 : Determine a first velocity of the target object at the second moment based on the first scale factor, the inter-frame interval, the longitudinal distance between the vehicle and the target object at the second moment, and the vehicle velocity.
[0041] For example, after obtaining the first scale factor of the target object between image frames, the electronic device can determine the change in the target object's movement distance between image frames based on the first scale factor and the longitudinal distance between the ego vehicle and the target object at the second moment. The electronic device can then determine the target object's relative speed relative to the ego vehicle at the second moment based on the change in the target object's movement distance between image frames and the inter-frame interval. The electronic device can then determine the target object's first speed at the second moment based on the target object's relative speed relative to the ego vehicle at the second moment and the ego vehicle's speed at the second moment. The longitudinal distance between the ego vehicle and the target object at the second moment can be calculated based on the target object's detection frame height in the environmental image captured by the ego vehicle at the second moment, the camera's intrinsic parameters, and the camera's extrinsic parameters. The ego vehicle's speed at the second moment can be acquired using the ego vehicle's speed sensor.
[0042] In the disclosed embodiment, an electronic device acquires first and second image frames containing a target object, captured by a vehicle at first and second moments. Based on the first and second image frames, the electronic device determines a first scale factor of the target object between the image frames. Furthermore, based on the first scale factor, the inter-frame interval, the longitudinal distance between the vehicle and the target object at the second moment, and the vehicle's speed, the electronic device determines a first speed of the target object at the second moment. This allows the electronic device to measure the speed of a target object in vision-based intelligent driving scenarios.
[0043] like Figure 2 As shown in the above Figure 1 Based on the embodiment shown, step 102 may include the following steps:
[0044] Step 1021: Based on the first image frame and the second image frame, determine a first feature point of the first image frame and a second feature point of the second image frame, wherein the first feature point corresponds to the second feature point in a one-to-one manner.
[0045] Exemplarily, after the electronic device acquires the first image frame and the second image frame of the target object, it can perform optical flow estimation on the first image frame and the second image frame through an optical flow model based on deep learning, and obtain the optical flow value of each pixel in the first image frame. The optical flow value of each pixel represents the motion vector of the pixel between the first image frame and the second image frame. Then, the electronic device can sample a number of feature points from each pixel of the first image frame as the first feature points of the first image frame. Afterwards, for each first feature point, the electronic device can determine the second feature point corresponding to the first feature point in the second image frame based on the coordinates and optical flow value of the first feature point, and obtain the second feature point of the second image frame. The first feature point corresponds one-to-one to the second feature point.
[0046] It should be noted that the processing process of determining the second feature point corresponding to the first feature point in the second image frame based on the optical flow tracking method in the above embodiment is only an exemplary description. Those skilled in the art can also use other methods to perform optical flow tracking to determine the second feature point corresponding to the first feature point in the second image frame, and the present disclosed embodiment is not limited to this.
[0047] Step 1022 : Determine a first scale factor of the target object between image frames based on the first feature point and the second feature point.
[0048] For example, after obtaining first feature points of a first image frame and second feature points of a second image frame, the electronic device may arbitrarily select two first feature points from each first feature point to form a first feature point pair, and then select the two second feature points corresponding to the two first feature points in the second image frame to form a second feature point pair. The electronic device may then determine a first scale factor of the target object between the image frames based on the first feature point distance of the first feature point pair, the second feature point distance of the second feature point pair, and the number of inter-frame intervals between the first and second image frames.
[0049] In the disclosed embodiment, by performing optical flow estimation on the first image frame and the second image frame through an optical flow model based on deep learning, the optical flow value of each pixel can be obtained quickly and accurately, providing accurate motion vector information for subsequent optical flow-based feature point tracking. At the same time, by sampling feature points from each pixel of the first image frame and calculating the scale factor based on the feature points, the complexity of calculating the scale factor is reduced, thereby improving the timeliness and accuracy of speed measurement. In addition, the electronic device arbitrarily selects two first feature points from each first feature point to form a first feature point pair, and forms a second feature point pair with the second feature points corresponding to the two first feature points in the second image frame. Afterwards, the electronic device determines the first scale factor of the target object between the image frames based on the first feature point distance of the first feature point pair, the second feature point distance of the second feature point pair, and the number of inter-frame intervals between the first and second image frames, thereby reducing the adverse effects of the optical flow-based feature point tracking error on the calculated scale factor, thereby improving the accuracy of speed measurement.
[0050] In the above Figure 2 Based on the illustrated embodiment, step 1021 may include the following steps:
[0051] Step 1: perform optical flow estimation on the first image frame and the second image frame to determine the optical flow value of each pixel point of the first image frame.
[0052] Exemplarily, after the electronic device acquires the first image frame and the second image frame of the target object, the first image frame and the second image frame can be input into the optical flow model based on deep learning. Accordingly, the optical flow model based on deep learning performs optical flow estimation on the first image frame and the second image frame, and outputs the dense optical flow of the first image frame, that is, the optical flow value of each pixel in the first image frame. The optical flow value of each pixel represents the motion vector of the pixel between the first image frame and the second image frame, and the optical flow value of the pixel can be expressed as (△x, △y).
[0053] Step 2: Determine a first feature point of the first image frame from among the pixels of the first image frame.
[0054] Exemplarily, after obtaining the optical flow value of each pixel in the first image frame, the electronic device can further sample a number of feature points as the first feature points of the first image frame in each pixel of the first image frame by uniform sampling or non-uniform sampling. For example, the image size of the first image frame is 82*82 (that is, each row contains 82 pixels and each column contains 82 pixels). The electronic device can uniformly sample 10 first feature points in the pixels of the 1st row, uniformly sample 10 first feature points in the pixels of the 10th row, uniformly sample 10 first feature points in the pixels of the 19th row, and so on, thereby obtaining 10*10=100 first feature points. Among them, the i-th first feature point in the first image frame can be expressed as A i .
[0055] Step three: for each first feature point, determine the second feature point corresponding to the first feature point in the second image frame based on the coordinates and optical flow value of the first feature point.
[0056] For example, after obtaining the first feature point of the first image frame, the electronic device may sum the coordinates (x1, y1) of the first feature point and the optical flow value (△x1, △y1) of the first feature point for each first feature point to obtain the coordinates (x2=x1+△x1, y2=y1+△y1) of the second feature point corresponding to the first feature point in the second image frame. i The corresponding second feature point in the second image frame can be expressed as B i .
[0057] In the disclosed embodiments, optical flow estimation is performed on the first and second image frames using a deep learning-based optical flow model. This allows for rapid and accurate optical flow values for each pixel, providing precise motion vector information for subsequent optical flow-based feature point tracking. Furthermore, by sampling feature points within each pixel of the first image frame, the complexity of subsequent scaling factor calculations is reduced, thereby improving the timeliness and accuracy of speed measurement.
[0058] In the above Figure 2 Based on the illustrated embodiment, step 1022 may include the following steps:
[0059] Step 1: Determine at least one first feature point pair in each first feature point, and determine at least one second feature point pair in each second feature point, wherein the two first feature points included in the first feature point pair correspond to the two second feature points included in the second feature point pair.
[0060] For example, after the electronic device determines the first feature point of the first image frame and the second feature point of the second image frame, the electronic device can arbitrarily select two first feature points A from each first feature point. i and A j , forming a first feature point pair. Among them, the two first feature points A i and A j The first feature point pair composed of can be expressed as CA ij For example, if the number of first feature points in the first image frame is 100, then the number of first feature point pairs is 4950. The first feature point pairs are (A1, A2), (A1, A3) ... (A1, A 100 ), (A2, A3), (A2, A4)... (A2, A 100 )……(A 99 , A 100 ).
[0061] Furthermore, the first feature point A i The corresponding second feature point B in the second image frame i and the first feature point A j The corresponding second feature point B in the second image frame j A second feature point pair can also be formed. Among them, two second feature points B i and B j The second feature point pair composed of can be expressed as CB ij The first feature point pair CA ij With the second feature point CB ij A set of feature point pairs with corresponding relationships can be formed. For example, if the number of second feature points in the second image frame is 100, then the number of second feature point pairs is also 4950. The second feature point pairs are (B1, B2), (B1, B3) ... (B1, B 100 ), (B2, B3), (B2, B4)... (B2, B 100 )……(B 99 , B 100 ).
[0062] Step 2: determining a second scale factor of the target object between the first image frame and the second image frame based on the first feature point distance of the first feature point pair and the second feature point distance of the second feature point pair.
[0063] Exemplarily, the electronic device determines the first feature point pair CA ij After that, CA can be based on the first feature point ij The two first feature points A i and A j Coordinates of the first feature point pair CA ijThe first feature point distance DA ij Among them, the first feature point is DA ij The first feature point pair CA ij The first feature point A i and A j Similarly, the electronic device determines the distance between the second feature point pair CB ij After that, CB can also be based on the second feature point ij The two second feature points B i and B j Coordinates of the second feature point pair CB ij The second feature point distance DB ij Among them, the second feature point is away from DB ij The second feature point pair CB ij The second feature point B i and B j Then, the electronic device can calculate the distance between the second feature point pair CB ij The second feature point distance DB ij CA with the first feature point ij The first feature point distance DA ij Afterwards, the electronic device calculates the ratio of the feature point distances of each set of feature point pairs having a corresponding relationship, further calculates an average ratio, and determines the average ratio as a second scale factor of the target object between the first image frame and the second image frame.
[0064] Step three: determining a first scale factor of the target object between adjacent image frames based on the second scale factor and the number of inter-frame intervals between the first image frame and the second image frame.
[0065] For example, when the first image frame and the second image frame are non-adjacent frames, the second scale factor of the target object between the first image frame and the second image frame determined by the electronic device is also the scale factor between non-adjacent frames. Therefore, the electronic device can determine the number of inter-frame intervals k between the first image frame and the second image frame (i.e., the T corresponding to the first image frame). n-k The time T corresponding to the second image frame n The number of inter-frame intervals between the moments is k), and the second scale factor is raised to the kth power to obtain the first scale factor of the target object between adjacent image frames, which can also be regarded as the first scale factor of the target object at the second moment.
[0066] It should be noted that after the electronic device determines the first scale factor of the target object at the second moment, it may further obtain the first scale factor of the target object at multiple historical moments determined before the second moment. The electronic device may then calculate the average of the first scale factors of the target object at these multiple historical moments, and further calculate the absolute value of the difference between the average value and the first scale factor of the target object at the second moment. The electronic device may then determine whether the absolute value of the difference is greater than a preset difference threshold. If the absolute value of the difference is greater than the difference threshold, it indicates that there is an error jump in the first scale factor of the target object at the second moment. The electronic device may then update the first scale factor of the target object at the second moment by multiplying the first scale factor of the target object at the second moment by a preset weight coefficient. If the absolute value of the difference is less than or equal to the preset difference threshold, it indicates that there has been no sudden change in the first scale factor of the target object at the second moment, and the electronic device may maintain the first scale factor of the target object at the second moment unchanged.
[0067] In an embodiment of the present disclosure, the electronic device determines, in a first image frame and a second image frame of non-adjacent frames, an average ratio of feature point distances between two corresponding feature point pairs as a second scale factor of the target object between the first image frame and the second image frame, and further raises the second scale factor to the kth power based on the number k of inter-frame intervals between the first image frame and the second image frame to obtain the first scale factor of the target object between adjacent image frames, thereby reducing the adverse effect of feature point tracking errors based on optical flow on the calculated scale factor, thereby improving the accuracy of speed measurement.
[0068] In the above Figure 2 Based on the illustrated embodiment, step 1022 may include the following steps:
[0069] In response to a first feature point distance of the first feature point pair being greater than or equal to a preset distance threshold, and / or a second feature point distance of the second feature point pair being greater than or equal to the distance threshold, a second scale factor of the target object between the first image frame and the second image frame is determined based on the first feature point distance of the first feature point pair and the second feature point distance of the second feature point pair.
[0070] Exemplarily, the smaller the first feature point distance of the first feature point pair and the second feature point distance of the second feature point pair, the greater the impact of the feature point tracking error based on optical flow on the scale factor. For example, if the first feature point distance of the first feature point pair is 10 and its true value is 11, and the second feature point distance of the second feature point pair is 9 and its true value is 10, then the error in the scale factor is 10 / 11-9 / 10≈0.0091. If the first feature point distance of the first feature point pair is 5 and its true value is 6, and the second feature point distance of the second feature point pair is 4 and its true value is 5, then the error in the scale factor is 5 / 6-4 / 5≈0.0333. It can be seen that the smaller the first feature point distance of the first feature point pair and the second feature point distance of the second feature point pair, the greater the impact of the feature point tracking error based on optical flow on the scale factor. Therefore, the electronic device can determine whether the first feature point distance of the first feature point pair is greater than or equal to a preset distance threshold, or whether the second feature point distance of the second feature point pair is greater than or equal to the distance threshold. If the first feature point distance of the first feature point pair is greater than or equal to a preset distance threshold, or the second feature point distance of the second feature point pair is greater than or equal to the distance threshold, the electronic device may further determine a second scale factor of the target object between the first image frame and the second image frame based on the first feature point distance of the first feature point pair and the second feature point distance of the second feature point pair. Otherwise, the electronic device discards the first feature point pair and the second feature point pair.
[0071] In addition, the electronic device may also determine whether the first feature point distance of the first feature point pair is greater than or equal to a preset distance threshold, and whether the second feature point distance of the second feature point pair is greater than or equal to the distance threshold. If the first feature point distance of the first feature point pair is greater than or equal to the preset distance threshold, and the second feature point distance of the second feature point pair is greater than or equal to the distance threshold, the electronic device may further determine the second scale factor of the target object between the first image frame and the second image frame based on the first feature point distance of the first feature point pair and the second feature point distance of the second feature point pair. Otherwise, the electronic device discards the first feature point pair and the second feature point pair. The distance threshold may be half the height of the first image frame, half the width of the first image frame, or half the diagonal of the first image frame, which is not limited in the embodiments of the present disclosure. Of course, those skilled in the art may set the distance threshold based on the optical flow tracking error, which is not limited in the embodiments of the present disclosure.
[0072] In the disclosed embodiments, the electronic device determines the second scale factor of the target object between the first image frame and the second image frame based on the first feature point distance of the first feature point pair and the second feature point distance of the second feature point pair only when the first feature point distance of the first feature point pair is greater than or equal to a preset distance threshold, and / or the second feature point distance of the second feature point pair is greater than or equal to the distance threshold. In this way, the electronic device can avoid the problem of a small first feature point distance of the first feature point pair and / or a small second feature point distance of the second feature point pair, which results in a significant impact of the optical flow-based feature point tracking error on the scale factor, thereby improving the accuracy of the scale factor and, in turn, improving the accuracy of the speed measurement.
[0073] like Figure 3 As shown in the above Figure 1 Based on the embodiment shown, step 103 may include the following steps:
[0074] Step 1031 : Determine the relative speed between the target object and the ego vehicle based on the first scale factor, the inter-frame interval, and the longitudinal distance between the ego vehicle and the target object at the second moment.
[0075] For example, the ratio of the height h2 of the detection frame of the target at the second moment (i.e., moment T2) to the height h1 of the detection frame of the target at the first moment (i.e., moment T1) is the fourth scale factor S of the target at the second moment, i.e., h2 / h1=S. Based on the optical imaging principle of the camera, the height h2 of the detection frame of the target at moment i is i The actual height H of the target, the relative distance between the target and the camera at the i-th moment (i.e., the longitudinal distance between the target and the vehicle at the i-th moment) X i And the focal length f of the camera. Specifically, the detection frame height h of the target object at the i-th moment i It is proportional to the actual height H of the target and the focal length f of the camera, and is also proportional to the relative distance between the target and the camera at the i-th moment (i.e., the longitudinal distance between the target and the vehicle at the i-th moment) X i Inversely proportional. Therefore, the height of the detection frame of the target at the first moment (i.e., time T1) is h1=H*f / X1, and the height of the detection frame of the target at the second moment (i.e., time T2) is h2=H*f / X2. Therefore, S=h2 / h1=(H*f / X2) / (H*f / X1)=(H*f / X2)*(X1 / (H*f))=X1 / X2, that is, the height of the detection frame of the target at the second moment (i.e., time T2) is h2=H*f / X2. n The moment before the moment (i.e. T n-1 The longitudinal distance X between the vehicle and the vehicle at the time t-1 and the target object at the second moment (ie T n The longitudinal distance X between the vehicle and the vehicle at the time t The ratio is the first scale factor S of the target at the second moment, that is, Xt-1 / X t = S. The target object is at the second moment (ie T n time) and the relative speed V of the vehicle 相 For the target object at T n The longitudinal distance X from the vehicle at the moment t and the target object at T n-1 The longitudinal distance X from the vehicle at the moment t-1 The difference between the two (that is, the target object is at T relative to the vehicle) n Moment and T n-1 The ratio of the relative moving distance between moments) to the inter-frame interval dt, that is, V 相 =(X t -X t-1 ) / dt. t-1 / X t =S Substituting into the above formula, we can get the target object at the second moment (ie T n time) and the relative speed V of the vehicle 相 =(X t -X t *S) / dt=X t (1-S) / dt.
[0076] Step 1032: Determine a first velocity of the target object at a second moment based on the relative velocity and the vehicle velocity.
[0077] For example, the electronic device determines that the target object is at the second moment (ie, T n time) and the relative speed V of the vehicle 相 After that, the target object can be n time) and the relative speed V of the vehicle 相 and the vehicle's speed V at the second moment 自 The sum of the values is determined as the first velocity V of the target at the second moment. 目 =V 相 +V 自 =X t (1-S) / dt+V 自 .
[0078] In the disclosed embodiment, the electronic device can calculate the relative speed of the target object and the ego vehicle using the first scale factor and the longitudinal distance between the target object and the ego vehicle at the second moment, and further determine the first speed of the target object at the second moment based on the relative speed between the target object and the ego vehicle and the ego vehicle's speed at the second moment, thereby greatly improving the real-time performance of speed measurement.
[0079] In the above Figure 3 Based on the illustrated embodiment, step 1031 may include the following steps:
[0080] The product of the longitudinal distance and the first scale factor is determined; the difference between the longitudinal distance and the product is determined; and the ratio of the difference to the inter-frame interval is determined as the relative speed between the target object and the ego vehicle.
[0081] For example, the target object at the second moment (ie, T n The moment before the moment (i.e. T n-1 The longitudinal distance X between the vehicle and the vehicle at the time t-1 and the target object at the second moment (ie T n The longitudinal distance X between the vehicle and the vehicle at the time t The ratio is the first scale factor S of the target at the second moment, that is, X t-1 / X t = S. The target object is at the second moment (ie T n time) and the relative speed V of the vehicle 相 For the target object at T n The longitudinal distance X from the vehicle at the moment t and the target object at T n-1 The longitudinal distance X from the vehicle at the moment t-1 The difference between the two (that is, the target object is at T relative to the vehicle) n Moment and T n-1 The ratio of the relative moving distance between moments) to the inter-frame interval dt, that is, V 相 =(X t -X t-1 ) / dt. t-1 / X t =S Substituting into the above formula, we can get the target object at the second moment (ie T n time) and the relative speed V of the vehicle 相 =(X t -X t *S) / dt=X t (1-S) / dt.
[0082] In the disclosed embodiment, the electronic device can calculate the relative speed between the target object and the vehicle using the first scale factor and the longitudinal distance between the target object and the vehicle at the second moment, thereby greatly improving the real-time performance of speed measurement.
[0083] like Figure 4 As shown in the above Figure 1 Based on the embodiment shown, step 101 may include the following steps:
[0084] In step 1011 , in response to a candidate image frame containing a target object captured by the vehicle being stored in a cache queue, the candidate image frame is determined as a first image frame.
[0085] For example, to ensure that the electronic device can determine the first scale factor of the target object between image frames based on the historical image frames of the target object at the historical moment and the current image frame of the target object at the current moment, the electronic device needs to pre-store the historical image frames of the target object at the historical moment in a cache queue for subsequent use. The electronic device can pre-store the historical image frames collected by the vehicle at a single historical moment in the cache queue, or it can pre-store the historical image frames collected by the vehicle at multiple historical moments in the cache queue, which is not limited in the present embodiment.
[0086] Furthermore, when the electronic device stores the historical image frames collected by the vehicle at multiple historical moments in advance into a cache queue, the electronic device can select different storage strategies based on the different capacities of the cache queue. (1) If the capacity of the cache queue is large, the electronic device can store all the historical image frames collected by the vehicle at multiple consecutive historical moments into the cache queue. For example, the current moment is T 10 At the same time, the initial time is T0. The electronic device can store all the historical image frames collected by the vehicle from T0 to T9 into the cache queue. At this time, the candidate image frames stored in the cache queue are [M0, M1, M2...M9]. (2) If the capacity of the cache queue is small, the electronic device can store some of the historical image frames collected by the vehicle at multiple historical moments into the cache queue according to the preset storage interval. For example, the current time is T 20 The initial time is T0, and the electronic device can store the vehicle from T0 to T according to the storage interval of 5 frames. 19 The candidate image frames stored in the cache queue are [M0, M5, M 10 , M 15 ].
[0087] In a case where only one candidate image frame containing a target object captured by the vehicle is stored in the cache queue, the electronic device may directly determine the candidate image frame as the first image frame.
[0088] Step 1012 : In response to a plurality of candidate image frames containing the target object captured by the vehicle being stored in the cache queue, a first image frame is determined from the candidate image frames based on the longitudinal distance.
[0089] For example, when a plurality of candidate image frames containing a target object captured by the vehicle are stored in the cache queue, the electronic device may assign a unique number to each candidate image frame in order from earliest to latest time. For example, the cache queue stores four candidate image frames M0, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14, M15, M16, M17, M18, M19, M20, M21, M22, M23, M24, M25, M26, M27, M28, M30, M31, M32, M40, M41, M5 10 , M 15According to the order from early to late, M0 corresponds to number 1, M5 corresponds to number 2, and M 10 The corresponding number is 3, M 15 The corresponding number is 4. The electronic device can query the target number corresponding to the longitudinal distance between the vehicle and the target object at the second moment in the correspondence between the longitudinal distance range and the number of the candidate image frame, and determine the candidate image frame corresponding to the target number from each candidate image frame as the first image frame. For example, if the longitudinal distance is (5m, 20m], the corresponding candidate image frame number is 4; if the longitudinal distance is (20m, 40m], the corresponding candidate image frame number is 3; if the longitudinal distance is (40m, 60m], the corresponding candidate image frame number is 2; if the longitudinal distance is above 60m, the corresponding candidate image frame number is 1. If the longitudinal distance between the vehicle and the target object at the second moment is 35m, the target number is 3, and the first image frame is the candidate image frame M corresponding to the target number 3. 10 If the longitudinal distance between the vehicle and the target object at the second moment is 65m, the target number is 1, and the first image frame is the candidate image frame M0 corresponding to the target number 1.
[0090] In the disclosed embodiment, when the cache queue has a large capacity, the electronic device may store all historical image frames collected by the vehicle at multiple consecutive historical moments in the cache queue. When the cache queue has a small capacity, the electronic device may store historical image frames collected by the vehicle at a specific historical moment in the cache queue, or store a portion of historical image frames collected by the vehicle at multiple historical moments in the cache queue according to a preset storage interval, thereby reducing cache pressure.
[0091] In the above Figure 4 Based on the embodiment shown, the electronic device further performs the following steps:
[0092] In response to the number of inter-frame intervals between the earliest candidate image frame at the image acquisition moment and the second image frame stored in the cache queue being greater than or equal to a preset number threshold, the earliest candidate image frame at the image acquisition moment is removed from the cache queue, and the second image frame is added to the cache queue.
[0093] For example, if the image capture time of the candidate image frame stored in the cache queue is too early, the error in the first scale factor determined by the electronic device will be large. Therefore, the electronic device needs to update the candidate image frames stored in the cache queue. Specifically, if the number of inter-frame intervals between the candidate image frame with the earliest image capture time and the second image frame stored in the cache queue is greater than or equal to a preset number threshold, the electronic device can remove the candidate image frame with the earliest image capture time from the cache queue and add the second image frame to the cache queue. At this time, the second image frame is the candidate image frame.
[0094] Furthermore, if the electronic device stores the historical image frames collected by the vehicle at a historical moment in the cache queue, the preset number threshold may be the maximum acceptable interval number. For example, if the current moment is T5 and the initial moment is T0, the electronic device may store the historical image frames collected by the vehicle at T0 in the cache queue. The candidate image frames stored in the cache queue are [M0], and the number threshold is 10. At T 10 At this moment, after completing the relevant calculations in the above embodiment, the electronic device deletes M0 from the cache queue and sets T 10 The second image frame M at time 10 Added to the cache queue, the candidate image frames stored in the updated cache queue are [M 10 ], and then prepare for the calculation of the first scale factor at the subsequent moment. 20 At this moment, after completing the relevant calculations in the above embodiment, the electronic device caches the M 10 Delete, change T 20 The second image frame M at time 20 Added to the cache queue, the candidate image frames stored in the updated cache queue are [M 20 ], thereby preparing for the calculation of the first scale factor at subsequent moments.
[0095] If the electronic device stores all historical image frames collected by the vehicle at multiple consecutive historical moments in the cache queue, the preset number threshold may be the number of candidate image frames stored in the cache queue. 10 At time T0, the electronic device can store all historical image frames collected by the vehicle from time T0 to time T9 into the cache queue. The candidate image frames stored in the cache queue are [M0, M1, M2, M3, M4, M5, M6, M7, M8, M9], and the number threshold is 10. At T 10 At this moment, after completing the relevant calculations in the above embodiment, the electronic device deletes M0 from the cache queue and sets T 10 The second image frame M at time 10 Add to the cache queue, the candidate image frames stored in the updated cache queue are [M1, M2, M3, M4, M5, M6, M7, M8, M9, M 10 ], and then prepare for the calculation of the first scale factor at the subsequent moment. 11 At this moment, after completing the relevant calculations in the above embodiment, the electronic device deletes M1 from the cache queue and sets T 11 The second image frame M at time 11 Add to the cache queue, the candidate image frames stored in the updated cache queue are [M2, M3, M4, M5, M6, M7, M8, M9, M10 , M 11 ], thereby preparing for the calculation of the first scale factor at subsequent moments.
[0096] If the electronic device stores some of the historical image frames collected by the vehicle at multiple historical moments into the cache queue according to a preset storage interval, the quantity threshold may be the product of the storage interval and the number of candidate image frames stored in the cache queue. 10 The candidate image frames stored in the cache queue at the moment are [M0, M5, M 10 , M 15 ], then the quantity threshold is 5*4=20. 20 At this moment, after completing the relevant calculations in the above embodiment, the electronic device deletes M0 from the cache queue and sets T 20 The second image frame M at time 20 Add to the cache queue, the candidate image frames stored in the updated cache queue are [M5, M 10 , M 15 , M 20 ], and then prepare for the calculation of the first scale factor at the subsequent moment. 25 At this moment, after completing the relevant calculations in the above embodiment, the electronic device deletes M5 from the cache queue and sets T 25 The second image frame M at time 25 Added to the cache queue, the candidate image frames stored in the updated cache queue are [M 10 , M 15 , M 20 , M 25 ], thereby preparing for the calculation of the first scale factor at subsequent moments.
[0097] It should be noted that those skilled in the art can set the quantity threshold based on actual conditions, and the embodiments of the present disclosure are not limited thereto.
[0098] In the above Figure 1 Based on the embodiment shown, the electronic device further performs the following steps:
[0099] Step 1: Obtain a second velocity of the target object at a third moment, wherein the third moment is earlier than the second moment.
[0100] For example, after the electronic device determines the first velocity of the target object at the second moment, it can determine the confidence level of the first velocity of the target object at the second moment based on the second velocity of the target object at a third moment (i.e., a historical moment) determined before the second moment. Therefore, the electronic device can obtain the second velocity of the target object at the third moment. It should be noted that the third moment is a moment before the second moment.
[0101] Step 2: Determine a velocity fitting curve of the target object based on the second velocity.
[0102] For example, after obtaining the second speed of the target object at the third moment, the electronic device can further perform a linear fit based on the second speed of the target object at the third moment to obtain a speed fitting curve of the target object. The speed fitting curve of the target object can represent the trend or pattern of the target object's speed changing over time.
[0103] Step three: determining the confidence level of the first speed based on the first speed and the speed fitting curve.
[0104] Exemplarily, after the electronic device determines the speed fitting curve of the target object, it can determine the predicted speed of the target object at the second moment based on the speed fitting curve. Then, the electronic device can determine the confidence level of the first speed of the target object based on the first speed and the predicted speed of the target object at the second moment. Specifically, the electronic device can calculate the confidence level of the first speed based on the first speed and the predicted speed of the target object at the second moment according to the following formula. Confidence level of the first speed = max(0, 1-|first speed-predicted speed| / difference threshold). For example, if the first speed is 18 m / s, the predicted speed is 15 m / s, and the difference threshold is 5 m / s, then the confidence level of the first speed = max(0, 1-|18-15| / 5) = 0.4. For another example, if the first speed is 21 m / s, the predicted speed is 15 m / s, and the difference threshold is 5 m / s, then the confidence level of the first speed = max(0, 1-|21-15| / 5) = 0. Of course, those skilled in the art may also use other methods (exponential decay method or Gaussian distribution method) to calculate the confidence level of the first velocity, which is not limited in the embodiments of the present invention.
[0105] In the embodiment of the present disclosure, the second speed of the electronic device target at the third moment is used to determine the speed fitting curve of the target object, and the confidence level of the first speed is determined based on the first speed and the speed fitting curve, thereby evaluating the accuracy of the speed estimation and ensuring the safety of intelligent driving.
[0106] Exemplary devices
[0107] Figure 5 FIG. 1 is a schematic diagram of the structure of an image processing device provided by an exemplary embodiment of the present disclosure. Figure 5 As shown, the speed measuring device 500 includes an image acquisition module 510 , a scale factor determination module 520 and a speed determination module 530 .
[0108] An image acquisition module 510 is configured to acquire a first image frame and a second image frame containing the target object captured by the vehicle at a first moment and a second moment, wherein the first moment is earlier than the second moment, and the first moment and the second moment differ by N inter-frame intervals, where N is a positive integer;
[0109] A scale factor determination module 520 is configured to determine a first scale factor of the target object between the image frames based on the first image frame and the second image frame;
[0110] The speed determination module 530 is configured to determine a first speed of the target object at a second moment based on the first scale factor, the inter-frame interval, the longitudinal distance between the ego vehicle and the target object at the second moment, and the ego vehicle speed.
[0111] In some embodiments, as Figure 6 As shown, the scale factor determination module 520 includes:
[0112] A feature point determination unit 521 is configured to determine, based on the first image frame and the second image frame, a first feature point of the first image frame and a second feature point of the second image frame; the first feature point and the second feature point have a one-to-one correspondence;
[0113] The scale factor determining unit 522 is configured to determine a first scale factor of the target object between image frames based on the first feature point and the second feature point.
[0114] In some embodiments, the feature point determination unit 521 is specifically configured to:
[0115] Performing optical flow estimation on the first image frame and the second image frame to determine an optical flow value of each pixel point of the first image frame;
[0116] Determining a first feature point of the first image frame among pixels of the first image frame;
[0117] For each first feature point, a second feature point corresponding to the first feature point in the second image frame is determined based on the coordinates and the optical flow value of the first feature point.
[0118] In some embodiments, the scale factor determining unit 522 is specifically configured to:
[0119] Determine at least one first feature point pair in each first feature point, and determine at least one second feature point pair in each second feature point; the two first feature points included in the first feature point pair correspond to the two second feature points included in the second feature point pair respectively;
[0120] determining a second scale factor of the target object between the first image frame and the second image frame based on a first feature point distance of the first feature point pair and a second feature point distance of the second feature point pair;
[0121] A first scale factor of the object between adjacent image frames is determined based on the second scale factor and the number of inter-frame intervals between the first image frame and the second image frame.
[0122] In some embodiments, the scale factor determining unit 522 is specifically configured to:
[0123] In response to a first feature point distance of the first feature point pair being greater than or equal to a preset distance threshold, and / or a second feature point distance of the second feature point pair being greater than or equal to the distance threshold, a second scale factor of the target object between the first image frame and the second image frame is determined based on the first feature point distance of the first feature point pair and the second feature point distance of the second feature point pair.
[0124] In some embodiments, as Figure 7 As shown, the speed determination module 530 includes:
[0125] a first speed determining unit 531 for determining a relative speed between the target object and the ego vehicle based on the first scale factor, the inter-frame interval, and the longitudinal distance between the ego vehicle and the target object at the second moment;
[0126] The second speed determining unit 532 is configured to determine a first speed of the target object at a second moment based on the relative speed and the vehicle speed.
[0127] In some embodiments, the first speed determining unit 531 is specifically configured to:
[0128] determining the product of the longitudinal distance and the first scale factor;
[0129] Determine the difference between the longitudinal distance and the product;
[0130] The ratio of the difference to the inter-frame interval is determined as the relative speed between the target object and the vehicle.
[0131] In some embodiments, as Figure 8 As shown, the image acquisition module 510 includes:
[0132] The first image acquisition unit 511 is configured to, in response to a candidate image frame containing a target object captured by the vehicle being stored in the cache queue, determine the candidate image frame as a first image frame;
[0133] or,
[0134] The second image acquisition unit 512 is configured to, in response to a plurality of candidate image frames containing the target object captured by the vehicle and stored in the cache queue, determine the first image frame from each candidate image frame based on the longitudinal distance.
[0135] In some embodiments, it further includes:
[0136] An image update unit is configured to remove the earliest candidate image frame at the image acquisition moment from the cache queue and add the second image frame to the cache queue in response to the number of inter-frame intervals between the earliest candidate image frame at the image acquisition moment and the second image frame stored in the cache queue being greater than or equal to a preset number threshold.
[0137] In some embodiments, it further includes:
[0138] A speed acquisition module is used to acquire a second speed of the target object at a third moment; the third moment is earlier than the second moment;
[0139] A speed fitting module, configured to determine a speed fitting curve of the target object based on the second speed;
[0140] The confidence determination module is configured to determine the confidence of the first speed based on the first speed and the speed fitting curve.
[0141] The beneficial technical effects corresponding to the exemplary embodiment of this device can be found in the corresponding beneficial technical effects of the above exemplary method part, which will not be repeated here.
[0142] Exemplary electronic devices
[0143] Figure 9 A structural diagram of an electronic device provided in an embodiment of the present disclosure includes at least one processor 11 and a memory 12.
[0144] The processor 11 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 10 to perform desired functions.
[0145] The memory 12 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), a hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 11 may execute the one or more computer program instructions to implement the speed measurement method and / or other desired functions of the various embodiments of the present disclosure described above.
[0146] In one example, the electronic device 10 may further include an input device 13 and an output device 14 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0147] The input device 13 may also include, for example, a keyboard, a mouse, etc.
[0148] The output device 14 can output various information to the outside, and may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.
[0149] Of course, to simplify, Figure 9 Only some of the components related to the present disclosure in the electronic device 10 are shown, and components such as buses, input / output interfaces, etc. are omitted. In addition, the electronic device 10 may further include any other appropriate components according to specific application scenarios.
[0150] Exemplary computer program products and computer-readable storage media
[0151] In addition to the above methods and devices, embodiments of the present disclosure may also provide a computer program product, including computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the speed measurement method of various embodiments of the present disclosure described in the above "Exemplary Method" section.
[0152] The computer program product may be written in any combination of one or more programming languages to implement the operations of the disclosed embodiments, including object-oriented programming languages such as Java, C++, and conventional procedural programming languages such as C or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's computing device, as a stand-alone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0153] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the processor executes the steps of the speed measurement method of various embodiments of the present disclosure described in the above “Exemplary Method” section.
[0154] Computer readable storage media can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium is, for example, but not limited to, a system, device or component comprising electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0155] The basic principles of the present disclosure have been described above in conjunction with specific embodiments. However, the advantages, strengths, and effects mentioned in this disclosure are merely illustrative and not restrictive, and should not be considered as essential to each embodiment of the present disclosure. Furthermore, the specific details disclosed above are provided for illustrative purposes and to facilitate understanding, rather than as limitations. These details do not limit the present disclosure to necessarily being implemented using these specific details.
[0156] Those skilled in the art may make various changes and modifications to the present disclosure without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is intended to include these modifications and variations.
Claims
1. A speed measurement method, comprising: Acquire a first image frame and a second image frame containing the target object captured by the vehicle at a first moment and a second moment; The first moment is earlier than the second moment; The first moment and the second moment differ by N interframe intervals, where N is a positive integer; determining a first scale factor of the target object between the image frames based on the first image frame and the second image frame; A first speed of the target object at the second moment is determined based on the first scale factor, the inter-frame interval, a longitudinal distance between the ego vehicle and the target object at the second moment, and a speed of the ego vehicle.
2. The method according to claim 1, wherein The determining, based on the first image frame and the second image frame, a first scale factor of the target object between the image frames includes: Based on the first image frame and the second image frame, determining a first feature point of the first image frame and a second feature point of the second image frame; the first feature point and the second feature point have a one-to-one correspondence; A first scale factor of the target object between the image frames is determined based on the first feature point and the second feature point.
3. The method according to claim 2, wherein: The determining of a first feature point of the first image frame and a second feature point of the second image frame based on the first image frame and the second image frame includes: performing optical flow estimation on the first image frame and the second image frame to determine an optical flow value of each pixel point of the first image frame; Determining a first feature point of the first image frame among pixels of the first image frame; For each first feature point, a second feature point corresponding to the first feature point in the second image frame is determined based on the coordinates and the optical flow value of the first feature point.
4. The method according to claim 2, wherein: The determining, based on the first feature point and the second feature point, a first scale factor of the target object between the image frames includes: Determine at least one first feature point pair in each of the first feature points, and determine at least one second feature point pair in each of the second feature points; the two first feature points included in the first feature point pair correspond to the two second feature points included in the second feature point pair, respectively; determining a second scale factor of the target object between the first image frame and the second image frame based on a first feature point distance of the first feature point pair and a second feature point distance of the second feature point pair; A first scale factor of the object between adjacent image frames is determined based on the second scale factor and the number of inter-frame intervals between the first image frame and the second image frame.
5. The method according to claim 4, wherein The determining, based on the first feature point distance of the first feature point pair and the second feature point distance of the second feature point pair, a second scale factor of the target object between the first image frame and the second image frame includes: In response to a first feature point distance of the first feature point pair being greater than or equal to a preset distance threshold, and / or a second feature point distance of the second feature point pair being greater than or equal to the distance threshold, a second scale factor of the target object between the first image frame and the second image frame is determined based on the first feature point distance of the first feature point pair and the second feature point distance of the second feature point pair.
6. The method according to claim 1, wherein Determining a first speed of the target object at the second moment based on the first scale factor, the inter-frame interval, a longitudinal distance between the vehicle and the target object at the second moment, and a speed of the vehicle includes: determining a relative speed between the target object and the ego vehicle based on the first scale factor, the inter-frame interval, and a longitudinal distance between the ego vehicle and the target object at the second moment; A first speed of the target object at the second moment is determined based on the relative speed and the vehicle speed.
7. The method according to claim 6, wherein: The determining, based on the first scale factor, the inter-frame interval, and the longitudinal distance between the ego vehicle and the target object at the second moment, of the relative speed between the target object and the ego vehicle includes: determining a product of the longitudinal distance and the first scale factor; determining a difference between the longitudinal distance and the product; The ratio of the difference to the inter-frame interval is determined as the relative speed between the target object and the vehicle.
8. The method according to claim 1, wherein The obtaining of a first image frame containing a target object captured by the vehicle at a first moment includes: In response to a candidate image frame containing the target object captured by the vehicle being stored in a cache queue, determining the candidate image frame as the first image frame; or, In response to the cache queue storing a plurality of candidate image frames containing the target object captured by the vehicle, the first image frame is determined from the candidate image frames based on the longitudinal distance.
9. The method according to claim 8, further comprising: In response to the number of inter-frame intervals between the earliest candidate image frame at the image acquisition moment stored in the cache queue and the second image frame being greater than or equal to a preset threshold, the earliest candidate image frame at the image acquisition moment is removed from the cache queue, and the second image frame is added to the cache queue.
10. The method according to claim 1, further comprising: Obtaining a second velocity of the target object at a third moment; The third moment is earlier than the second moment; determining a velocity fitting curve of the target object based on the second velocity; A confidence level of the first velocity is determined based on the first velocity and the velocity fitting curve.
11. A speed measuring device comprising: An image acquisition module is used to acquire a first image frame and a second image frame containing a target object captured by the vehicle at a first moment and a second moment; The first moment is earlier than the second moment; the first moment and the second moment differ by N interframe intervals, where N is a positive integer; a scale factor determination module, configured to determine a first scale factor of the target object between the image frames based on the first image frame and the second image frame; The speed determination module is configured to determine a first speed of the target object at the second moment based on the first scale factor, the inter-frame interval, the longitudinal distance between the ego vehicle and the target object at the second moment, and the ego vehicle speed.
12. A computer-readable storage medium storing a computer program, wherein the computer program is used to execute the speed measurement method according to any one of claims 1 to 10.
13. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the speed measurement method described in any one of claims 1 to 10.