Dynamic threshold-based logistics transportation early warning method and device, electronic equipment and product
By using a dynamic threshold-based method and employing binocular cameras and grayscale dynamic threshold calculation, accurate distance measurement and early warning for logistics vehicles under varying lighting conditions were achieved, solving the problem of decreased distance measurement accuracy caused by changes in lighting in existing technologies.
Patent Information
- Application Number
- CN202611334280.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-11-27
AI Technical Summary
In environments with drastic changes in lighting, the feature point extraction effect of existing distance measurement methods is affected, resulting in a decrease in the accuracy of vehicle distance measurement and the inability to provide timely warnings or false alarms.
A dynamic threshold-based method is adopted, which acquires images through a binocular camera, calculates the grayscale dynamic threshold, performs feature point detection and matching, calculates the vehicle distance by combining the camera focal length and optical center distance, and provides early warning based on the dynamic safety distance.
In environments with varying lighting conditions, the accuracy of vehicle distance measurement has been improved, avoiding false alarms and the inability to provide timely warnings, thus enabling accurate early warnings during the logistics and transportation process.
Smart Images

Figure CN123181879A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision technology, specifically relating to a logistics transportation early warning method, device, electronic equipment, and product based on dynamic thresholds. Background Technology
[0002] In the logistics and transportation industry, vehicles typically have heavy loads and high inertia, resulting in significantly longer braking distances than ordinary passenger cars. Therefore, logistics vehicles must maintain a greater safety distance from the vehicle in front to cope with emergencies and avoid rear-end collisions. Accurate and real-time detection of the distance to the vehicle in front has become a core technological requirement for active safety systems in logistics vehicles.
[0003] Features from Accelerated Segment Test (FAST) is a commonly used distance measurement method, often used to detect the distance to vehicles ahead. However, the operating environment of logistics vehicles experiences drastic changes in lighting (such as tunnel entrances and exits, nighttime headlight illumination, or rainy weather), making the feature point extraction performance of the FAST algorithm highly susceptible to image brightness: when the ambient brightness is too low or the contrast is small, the gray-level difference between pixels decreases, and many true corner points are missed because they are below a fixed threshold; when the brightness is too high or the contrast is large, the gray-level difference increases, and many non-feature points are misclassified as feature points, leading to feature point redundancy and clustering. This brightness sensitivity severely reduces the quality and consistency of feature point extraction, resulting in problems such as drastic fluctuations in the number of feature points, uneven distribution, and increased mismatch rates. This, in turn, increases the parallax calculation error, ultimately leading to a decrease in the accuracy of vehicle distance measurement. Consequently, it can result in failure to provide timely warnings when the distance to the vehicle ahead is too close, and false alarms when a safe distance is maintained.
[0004] Therefore, how to provide an effective solution for accurate early warning of vehicle distance during logistics transportation has become a pressing problem to be solved in existing technologies. Summary of the Invention
[0005] The purpose of this invention is to provide a logistics transportation early warning method, device, electronic device and product based on dynamic thresholds to solve the above-mentioned problems existing in the prior art.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a logistics transportation early warning method based on dynamic thresholds, comprising: First and second images of the area in front of the logistics transport vehicle are acquired using a binocular camera. Extract the first vehicle region image from the first image and the second vehicle region image from the second image; The first vehicle region image and the second vehicle region image are converted into grayscale images to obtain a first grayscale image corresponding to the first vehicle region image and a second grayscale image corresponding to the second vehicle region image. Based on the gray values of each pixel in the first grayscale image and the second grayscale image, as well as the gray values of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image is calculated. Based on the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image, and the grayscale value of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, feature point detection is performed on the first grayscale image and the second grayscale image to obtain a first feature point set in the first grayscale image and a second feature point set in the second grayscale image. Feature point matching is performed on the first set of feature points and the second set of feature points to obtain at least two sets of matched feature points; Based on the average pixel coordinate difference corresponding to the at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera, the distance between the logistics transport vehicle and the vehicle in front is calculated. The dynamic safe distance between the logistics transport vehicle and the vehicle in front is determined based on the current speed of the logistics transport vehicle. Based on the vehicle distance and the dynamic safety distance, an abnormal vehicle distance warning is issued for the logistics transportation vehicle.
[0007] In one possible design, based on the gray values of each pixel in the first grayscale image and the second grayscale image, and the gray values of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, a dynamic grayscale threshold corresponding to each pixel in the first grayscale image and the second grayscale image is calculated, including: Based on the gray values of each pixel in the first grayscale image and the second grayscale image, and the gray values of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image is calculated according to the following formula.
[0008] in, α Represents dynamic coefficients. n This represents the total number of neighboring pixels. This represents the grayscale value of the i-th neighboring pixel. This represents the maximum grayscale value of the neighboring pixels of the i-th pixel. This represents the minimum gray value of the neighboring pixels of the i-th pixel. It represents the average gray value of all neighboring pixels of the i-th pixel, excluding the pixels corresponding to the maximum and minimum gray values.
[0009] In one possible design, feature point detection is performed on the first grayscale image and the second grayscale image based on the dynamic grayscale thresholds corresponding to each pixel in the first grayscale image and the second grayscale image, as well as the grayscale values of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, including: Iterate through the grayscale values of each pixel in the first grayscale image and the second grayscale image; For any pixel in the first grayscale image and the second grayscale image, the neighboring pixels of the pixel are numbered in a clockwise direction; Select k neighboring pixels at equal intervals from all neighboring pixels of any given pixel in numerical order; If the absolute value of the grayscale difference between any pixel and its k neighboring pixels is greater than the grayscale dynamic threshold corresponding to any pixel, then any pixel is determined to be a candidate feature point. If any pixel is a candidate feature point, then m neighboring pixels are selected from all neighboring pixels of the pixel in numerical order at equal intervals, and there are no duplicate pixels between the m neighboring pixels and the k neighboring pixels. If the absolute value of the grayscale difference between any pixel and its m neighboring pixels is greater than the grayscale dynamic threshold corresponding to any pixel, then any pixel is determined to be a feature point.
[0010] In one possible design, the distance between the neighboring pixels of any pixel and any pixel is 2-4 pixel units.
[0011] In one possible design, feature point matching is performed on the first set of feature points and the second set of feature points to obtain at least two sets of matched feature points, including: The feature points in the first feature point set are combined with the feature points in the second feature point set in pairs to obtain multiple sets of candidate feature points; Calculate the Hamming distance between the first feature point and the second feature point in each group of candidate feature points to obtain the Hamming distance between multiple groups of candidate feature points, wherein the first feature point is the feature point in the first set of feature points, and the second feature point is the feature point in the second set of feature points; Sort the Hamming distances of multiple candidate feature points in ascending order; Select the j groups of candidate feature points that are ranked highest; Randomly select q groups of candidate feature points from the j groups of candidate feature points, where q is less than j and q is greater than or equal to 2; For the q groups of candidate feature points, the pixel coordinate transformation matrix between the first and second candidate feature points in the q groups of candidate feature points is calculated based on the pixel coordinates of the two feature points in each group of candidate feature points. Verify whether the pixel coordinates of the first feature point and the second feature point in the multiple sets of candidate feature points conform to the pixel coordinate transformation matrix; Any set of candidate feature points whose pixel coordinates conform to the pixel coordinate transformation matrix of the first feature point and the second feature point are taken as a set of matched feature points, and at least two sets of matched feature points are obtained.
[0012] In one possible design, the distance between the logistics transport vehicle and the vehicle in front is calculated based on the average pixel coordinate difference corresponding to the at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera, including: Based on the average pixel coordinate difference corresponding to the at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera, the distance between the logistics transport vehicle and the vehicle in front is calculated according to the following formula.
[0013] Where c represents the focal length of the binocular camera, D represents the optical center distance between the two cameras in the binocular camera, and d represents the average pixel coordinate difference corresponding to the at least two sets of matched feature points.
[0014] In one possible design, the abnormal vehicle distance warning for the logistics transport vehicle is based on the vehicle distance and the dynamic safety distance, including: If the distance between vehicles is less than the dynamic safe distance, an abnormal distance warning message is generated.
[0015] Secondly, the present invention provides a logistics transportation early warning device based on dynamic thresholds, comprising: The acquisition unit is used to acquire a first image and a second image of the area in front of the logistics transport vehicle through a binocular camera. An extraction unit is used to extract the first vehicle region image from the first image and the second vehicle region image from the second image; The conversion unit is used to convert the first vehicle region image and the second vehicle region image into grayscale images to obtain a first grayscale image corresponding to the first vehicle region image and a second grayscale image corresponding to the second vehicle region image. The first calculation unit is used to calculate the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image based on the grayscale value of each pixel in the first grayscale image and the second grayscale image, as well as the grayscale value of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image. The feature point detection unit is used to perform feature point detection on the first grayscale image and the second grayscale image based on the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image, as well as the grayscale value of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, to obtain a first feature point set in the first grayscale image and a second feature point set in the second grayscale image. A feature point matching unit is used to perform feature point matching on the first feature point set and the second feature point set to obtain at least two sets of matched feature points. The second calculation unit is used to calculate the distance between the logistics transport vehicle and the vehicle in front based on the average pixel coordinate difference corresponding to the at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera. The determining unit is used to determine the dynamic safe distance between the logistics transport vehicle and the vehicle in front based on the current speed of the logistics transport vehicle; The early warning unit is used to issue an abnormal vehicle distance warning to the logistics transport vehicle based on the vehicle distance and the dynamic safety distance.
[0016] Thirdly, the present invention provides an electronic device comprising a memory, a processor, and a transceiver connected in sequence and communication, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the logistics transportation early warning method based on dynamic thresholds as described in the first aspect or any possible design of the first aspect.
[0017] Fourthly, the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, perform the logistics transportation early warning method based on dynamic thresholds as described in the first aspect or any possible design of the first aspect.
[0018] Fifthly, the present invention provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform the logistics transportation early warning method based on dynamic thresholds as described in the first aspect or any possible design of the first aspect.
[0019] Beneficial effects: This invention discloses a logistics transportation early warning scheme based on dynamic thresholds, which can eliminate the influence of illumination changes on vehicle distance detection, enabling accurate early warning of vehicle distance during logistics transportation. Specifically, a first image and a second image of the area in front of the logistics transportation vehicle are acquired using a binocular camera; a first vehicle area image is extracted from the first image and a second vehicle area image is extracted from the second image; the first and second vehicle area images are converted into grayscale images to obtain a first grayscale image corresponding to the first vehicle area image and a second grayscale image corresponding to the second vehicle area image; based on the grayscale values of each pixel in the first and second grayscale images, and the grayscale values of the neighboring pixels of each pixel in the first and second grayscale images, a grayscale dynamic threshold corresponding to each pixel in the first and second grayscale images is calculated; based on the grayscale dynamic threshold corresponding to each pixel in the first and second grayscale images, and the... The gray values of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image are used to perform feature point detection on the first grayscale image and the second grayscale image to obtain a first set of feature points in the first grayscale image and a second set of feature points in the second grayscale image. Feature point matching is performed on the first set of feature points and the second set of feature points to obtain at least two sets of matched feature points. Based on the average pixel coordinate difference corresponding to the at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera, the distance between the logistics transport vehicle and the vehicle in front is calculated. Based on the current speed of the logistics transport vehicle, the dynamic safe distance between the logistics transport vehicle and the vehicle in front is determined. Based on the distance between the logistics transport vehicle and the dynamic safe distance, an abnormal distance warning is issued for the logistics transport vehicle. Because, during feature point detection, the grayscale dynamic threshold corresponding to each pixel is determined based on the grayscale values of the pixels and their neighboring pixels in the image, and feature point detection is performed on the grayscale image based on the grayscale dynamic threshold, the impact of brightness changes on feature point extraction is reduced, and the increase in parallax calculation error caused by brightness changes is avoided. This improves the accuracy of vehicle distance measurement, avoids the inability to provide timely warnings when the distance to the vehicle in front is too close, and avoids false alarms when a safe distance is maintained. This enables accurate warnings of vehicle distance during logistics transportation, which is convenient for practical application and promotion.
[0020] Furthermore, during feature point detection, k neighboring pixels are first selected at equal intervals from all neighboring pixels of a given pixel for candidate feature point evaluation. After a pixel is identified as a candidate feature point, m neighboring pixels are selected at equal intervals from the remaining neighboring pixels for a second evaluation. In this way, it is not necessary to extract all neighboring pixels of a given pixel for calculation during feature point detection, thereby reducing computational load and improving the efficiency of feature point detection. This, in turn, improves the efficiency of vehicle distance detection and warning, enabling timely warnings when the vehicle distance is too low.
[0021] Furthermore, during the feature point matching process, the Hamming distance of each pair of candidate feature points is calculated by combining them pairwise. Multiple groups of candidate feature points with small Hamming distances are selected to calculate the pixel coordinate transformation matrix between candidate feature points within each group. This pixel coordinate transformation matrix is then used to verify the multiple groups of candidate feature points, selecting at least two groups of feature points that conform to the pixel coordinate transformation matrix as the matched feature points. This eliminates the problem of mismatched feature points caused by noise and jitter, thereby achieving accurate feature point matching and providing accurate warnings regarding vehicle distance. Attached Figure Description
[0022] Figure 1 A flowchart of a logistics transportation early warning method based on dynamic thresholds provided in an embodiment of this application; Figure 2 A block diagram of a logistics transportation early warning device based on dynamic thresholds provided in an embodiment of this application; Figure 3 This is a block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in conjunction with the accompanying drawings and descriptions of the embodiments or the prior art. Obviously, the following description of the structure of the accompanying drawings is 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. It should be noted that the description of these embodiments is for the purpose of helping to understand the present invention, but does not constitute a limitation of the present invention.
[0024] It should be understood that although the terms first, second, etc., may be used herein to describe various units, these units should not be limited by these terms. These terms are only used to distinguish one unit from another. For example, a first unit may be referred to as a second unit, and similarly, a second unit may be referred to as a first unit, without departing from the scope of the exemplary embodiments of the invention.
[0025] It should be understood that the term "and / or" that may appear in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, B exists alone, and A and B exist simultaneously. The term " / and" that may appear in this document describes another relationship between related objects, indicating that two relationships can exist. For example, A / and B can mean: A exists alone, and A and B exist alone. In addition, the character " / " that may appear in this document generally indicates that the related objects before and after it are in an "or" relationship.
[0026] It should be understood that specific details are provided in the following description to facilitate a complete understanding of the exemplary embodiments. However, those skilled in the art will understand that the exemplary embodiments can be implemented without these specific details. For example, the system may be shown in block diagrams to avoid obscuring the example with unnecessary details. In other instances, well-known processes, structures, and techniques may be shown without unnecessary details to avoid obscuring the exemplary embodiments.
[0027] To provide accurate early warning of vehicle distance during logistics transportation, this application provides a logistics transportation early warning method, device, electronic device, and product based on dynamic thresholds. The dynamic threshold-based logistics transportation early warning method, device, electronic device, and product can eliminate the influence of changes in illumination on vehicle distance detection, so as to provide accurate early warning of vehicle distance during logistics transportation.
[0028] The logistics transportation early warning method based on dynamic thresholds provided in this application can be applied to forward collision warning (FCW) systems for logistics transportation vehicles. It is understood that the execution entity described herein does not constitute a limitation on the embodiments of this application.
[0029] The logistics transportation early warning method based on dynamic thresholds provided in the embodiments of this application will be described in detail below.
[0030] like Figure 1 The diagram shown is a flowchart of a logistics transportation early warning method based on dynamic thresholds provided in the first aspect of the present application. The logistics transportation early warning method based on dynamic thresholds may include, but is not limited to, the following steps S101-S109.
[0031] Step S101. Acquire a first image and a second image of the area in front of the logistics transport vehicle using a binocular camera.
[0032] The binocular camera can be deployed in front of the logistics vehicle, and the left and right cameras of the binocular camera can respectively acquire the first and second images of the area in front of the vehicle in real time.
[0033] Step S102. Extract the first vehicle region image from the first image and the second vehicle region image from the second image.
[0034] Specifically, a first vehicle region image can be extracted from a first image, and a second vehicle region image can be extracted from a second image using an object detection algorithm. The object detection algorithm is existing technology and will not be described in detail here.
[0035] Step S103. Convert the first vehicle region image and the second vehicle region image into grayscale images to obtain a first grayscale image corresponding to the first vehicle region image and a second grayscale image corresponding to the second vehicle region image.
[0036] Step S104. Based on the gray values of each pixel in the first grayscale image and the second grayscale image, and the gray values of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, calculate the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image.
[0037] In this context, the distance between any neighboring pixel and any other pixel is 2-4 pixel units, which means the neighborhood radius is 2-4 pixels.
[0038] In one or more embodiments, the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image can be calculated according to the following formula based on the grayscale values of each pixel in the first grayscale image and the second grayscale image, as well as the grayscale values of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image.
[0039] in, This represents the dynamic grayscale threshold corresponding to the i-th pixel in the first grayscale image and the second grayscale image. α Represents dynamic coefficients. n This represents the total number of neighboring pixels. This represents the grayscale value of the i-th neighboring pixel. This represents the maximum grayscale value of the neighboring pixels of the i-th pixel. This represents the minimum gray value of the neighboring pixels of the i-th pixel. It represents the average gray value of all neighboring pixels of the i-th pixel, excluding the pixels corresponding to the maximum and minimum gray values.
[0040] Step S105. Based on the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image, and the grayscale values of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, feature point detection is performed on the first grayscale image and the second grayscale image to obtain the first feature point set in the first grayscale image and the second feature point set in the second grayscale image.
[0041] In one or more embodiments, feature point detection is performed on the first grayscale image and the second grayscale image, which may include, but is not limited to, the following steps S1051-S1056.
[0042] Step S1051. Traverse the grayscale values of each pixel in the first grayscale image and the second grayscale image.
[0043] Step S1052. For any pixel in the first grayscale image and the second grayscale image, number the neighboring pixels of the pixel in a clockwise direction.
[0044] In one or more embodiments, when numbering the neighboring pixels of any pixel, the numbering can start from the neighboring pixels directly above any pixel and proceed in the order of 0, 1, 2...
[0045] Step S1053. Select k neighboring pixels at equal intervals from all neighboring pixels of any given pixel according to their numbering order.
[0046] Step S1054. If the absolute value of the grayscale difference between any pixel and the k neighboring pixels is greater than the grayscale dynamic threshold corresponding to any pixel, then the pixel is determined to be a candidate feature point.
[0047] Understandably, if the absolute value of the grayscale difference between any pixel and its k neighboring pixels is not all greater than the grayscale dynamic threshold corresponding to any pixel, then that pixel is determined not to be a candidate feature point, and the process proceeds to the judgment of the next pixel.
[0048] Step S1055. If any pixel is a candidate feature point, then select m neighboring pixels at equal intervals from all neighboring pixels of any pixel in numerical order, and there are no duplicate pixels between the m neighboring pixels and the k neighboring pixels.
[0049] Since the absolute value of the grayscale difference between any pixel and its k neighboring pixels has already been determined, there are no duplicate pixels between the selected m neighboring pixels and the k neighboring pixels, thus avoiding redundant calculations.
[0050] Step S1056. If the absolute value of the grayscale difference between any pixel and the m neighboring pixels is greater than the grayscale dynamic threshold corresponding to any pixel, then the pixel is determined to be a feature point.
[0051] Understandably, if the absolute value of the grayscale difference between any pixel and its m neighboring pixels is not all greater than the grayscale dynamic threshold corresponding to any pixel, then it can be determined that any pixel is not a feature point, and the judgment of the next pixel is then initiated.
[0052] After all pixels are judged, a first feature point set is formed by using all feature points in the first grayscale image, and a second feature point set is formed by using all feature points in the second grayscale image.
[0053] Step S106. Perform feature point matching on the first feature point set and the second feature point set to obtain at least two sets of matched feature points.
[0054] In one or more embodiments, feature point matching of the first feature point set and the second feature point set may include, but is not limited to, the following steps S1061-S1068.
[0055] Step S1061. Combine the feature points in the first feature point set with the feature points in the second feature point set in pairs to obtain multiple sets of candidate feature points.
[0056] Assuming that the first set of feature points includes a feature points and the second set of feature points includes b feature points, then the a feature points and the b feature points can be combined in pairs to obtain a×b groups of candidate feature points, with each group of candidate point points including two feature points.
[0057] Step S1062. Calculate the Hamming distance between the first and second feature points in each group of candidate feature points to obtain the Hamming distance between multiple groups of candidate feature points.
[0058] Each set of candidate points includes two feature points. For ease of explanation, in this embodiment, the two feature points in a set of candidate points are referred to as the first feature point and the second feature point, respectively. The first feature point is a feature point in the first set of feature points, and the second feature point is a feature point in the second set of feature points.
[0059] Step S1063. Sort the Hamming distances of multiple candidate feature points in ascending order.
[0060] Step S1064. Select the j-th group of candidate feature points that are ranked first.
[0061] Where j is generally a positive integer greater than or equal to 3.
[0062] Step S1065. Randomly select q groups of candidate feature points from the j groups of candidate feature points.
[0063] Where q is less than j, and q is a positive integer greater than or equal to 2.
[0064] Step S1066. For q groups of candidate feature points, based on the pixel coordinates of two feature points in each group of candidate feature points, calculate the pixel coordinate transformation matrix between the first and second candidate feature points in the q groups of candidate feature points.
[0065] Step S1067. Verify whether the pixel coordinates of the first feature point and the second feature point in multiple sets of candidate feature points conform to the pixel coordinate transformation matrix.
[0066] That is, verify whether the pixel coordinates of the first and second feature points in a set of candidate feature points satisfy the geometric relationship described by the pixel coordinate transformation matrix. In other words, after transforming the pixel coordinates of the first feature point in a set of candidate feature points using the pixel coordinate transformation matrix, check whether the resulting pixel coordinates are substantially consistent with the pixel coordinates of the second feature point in the same set of candidate feature points. If they are substantially consistent, then it is determined that the pixel coordinates of the first and second feature points in the same set of candidate feature points conform to the pixel coordinate transformation matrix.
[0067] Step S1068. Select any set of candidate feature points whose pixel coordinates conform to the pixel coordinate transformation matrix of the first feature point and the second feature point as a set of matched feature points, and obtain at least two sets of matched feature points.
[0068] Since the pixel coordinate transformation matrix is calculated based on q sets of candidate feature points, and q is greater than or equal to 2, there must be at least two sets of candidate feature points whose first and second feature points match the pixel coordinate transformation matrix, which means that at least two sets of matching feature points must be obtained.
[0069] Step S107. Based on the average pixel coordinate difference corresponding to at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera, calculate the distance between the logistics transport vehicle and the vehicle in front.
[0070] In one or more embodiments, the distance between the logistics transport vehicle and the vehicle in front can be calculated according to the following formula based on the average pixel coordinate difference corresponding to the at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera.
[0071] Where c represents the focal length of the binocular camera, D represents the optical center distance between the two cameras in the binocular camera, and d represents the average pixel coordinate difference corresponding to the at least two sets of matched feature points.
[0072] Step S108. Determine the dynamic safe distance between the logistics transport vehicle and the vehicle in front based on the current speed of the logistics transport vehicle.
[0073] The dynamic safe distance between a logistics transport vehicle and the vehicle in front is positively correlated with the current speed of the logistics transport vehicle; the higher the current speed, the greater the dynamic safe distance. The relationship between the dynamic safe distance and the current speed of the logistics transport vehicle can be set based on practical experience.
[0074] Step S109. Provide early warning of abnormal vehicle distances for logistics transportation vehicles based on vehicle distance and dynamic safety distance.
[0075] Specifically, if the distance between vehicles is less than the dynamic safe distance, an abnormal distance warning message will be generated to remind the driver to slow down. If the distance between vehicles is greater than or equal to the dynamic safe distance, no warning will be issued.
[0076] The present invention provides a logistics transportation early warning method based on dynamic thresholds, which acquires a first image and a second image of the area in front of a logistics transportation vehicle using a binocular camera; extracts a first vehicle area image from the first image and a second vehicle area image from the second image; converts the first and second vehicle area images into grayscale images to obtain a first grayscale image corresponding to the first vehicle area image and a second grayscale image corresponding to the second vehicle area image; calculates a grayscale dynamic threshold corresponding to each pixel in the first and second grayscale images based on the grayscale values of each pixel in the first and second grayscale images and the grayscale values of the neighboring pixels of each pixel in the first and second grayscale images; and calculates a grayscale dynamic threshold based on the grayscale values of each pixel in the first and second grayscale images. Using a dynamic threshold and the grayscale values of neighboring pixels of each pixel in the first and second grayscale images, feature point detection is performed on the first and second grayscale images to obtain a first set of feature points in the first grayscale image and a second set of feature points in the second grayscale image. Feature point matching is then performed on the first and second set of feature points to obtain at least two sets of matched feature points. Based on the average pixel coordinate difference corresponding to the at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera, the distance between the logistics transport vehicle and the vehicle in front is calculated. Based on the current speed of the logistics transport vehicle, a dynamic safe distance between the logistics transport vehicle and the vehicle in front is determined. Based on the distance and the dynamic safe distance, an abnormal distance warning is issued for the logistics transport vehicle. In feature point detection, a dynamic grayscale threshold is determined for each pixel based on its grayscale value and that of its neighbors. Feature point detection is then performed on the grayscale image based on this dynamic threshold, reducing the impact of brightness changes on feature point extraction and preventing increased parallax calculation errors caused by brightness variations. This improves the accuracy of vehicle distance measurement, avoiding situations where warnings are not issued when the distance to the vehicle ahead is too close, or where false alarms occur when a safe distance is maintained. This enables accurate distance warnings during logistics transportation, facilitating practical application and widespread adoption. Furthermore, in the feature point detection process, k neighboring pixels are selected at equal intervals from all neighboring pixels of a given pixel for candidate feature point evaluation. After a candidate feature point is identified, m neighboring pixels are selected at equal intervals from the remaining pixels for a second evaluation. This eliminates the need to extract and calculate all neighboring pixels of a given pixel during feature point detection, reducing computational load and improving the efficiency of feature point detection. This, in turn, enhances the efficiency of vehicle distance detection and warning, enabling timely warnings when the distance to the vehicle is too low.Furthermore, during the feature point matching process, the Hamming distance of each pair of candidate feature points is calculated by combining them pairwise. Multiple groups of candidate feature points with small Hamming distances are selected to calculate the pixel coordinate transformation matrix between candidate feature points within each group. This pixel coordinate transformation matrix is then used to verify the multiple groups of candidate feature points, selecting at least two groups of feature points that conform to the pixel coordinate transformation matrix as the matched feature points. This eliminates the problem of mismatched feature points caused by noise and jitter, thereby achieving accurate feature point matching and providing accurate warnings regarding vehicle distance.
[0077] Please see Figure 2 The second aspect of this application provides a logistics transportation early warning device based on dynamic thresholds, comprising: The acquisition unit is used to acquire a first image and a second image of the area in front of the logistics transport vehicle through a binocular camera. An extraction unit is used to extract the first vehicle region image from the first image and the second vehicle region image from the second image; The conversion unit is used to convert the first vehicle region image and the second vehicle region image into grayscale images to obtain a first grayscale image corresponding to the first vehicle region image and a second grayscale image corresponding to the second vehicle region image. The first calculation unit is used to calculate the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image based on the grayscale value of each pixel in the first grayscale image and the second grayscale image, as well as the grayscale value of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image. The feature point detection unit is used to perform feature point detection on the first grayscale image and the second grayscale image based on the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image, as well as the grayscale value of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, to obtain a first feature point set in the first grayscale image and a second feature point set in the second grayscale image. A feature point matching unit is used to perform feature point matching on the first feature point set and the second feature point set to obtain at least two sets of matched feature points. The second calculation unit is used to calculate the distance between the logistics transport vehicle and the vehicle in front based on the average pixel coordinate difference corresponding to the at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera. The determining unit is used to determine the dynamic safe distance between the logistics transport vehicle and the vehicle in front based on the current speed of the logistics transport vehicle; The early warning unit is used to issue an abnormal vehicle distance warning to the logistics transport vehicle based on the vehicle distance and the dynamic safety distance.
[0078] The working process, working details and technical effects of the logistics transportation early warning device based on dynamic threshold provided in the second aspect of this embodiment can be found in the first aspect of the embodiment, and will not be repeated here.
[0079] Please see Figure 3 The third aspect of this application provides an electronic device, including a memory, a processor, and a transceiver that are sequentially and communicatively connected, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the logistics transportation early warning method based on dynamic thresholds as described in the first aspect of the application.
[0080] Specifically, the memory may include, but is not limited to, random access memory (RAM), read-only memory (ROM), flash memory, first-in-first-out (FIFO) memory, and / or last-in-first-out (FILO) memory, etc.; the processor may not be limited to microprocessors of the STM32F105 series, ARM (Advanced RISC Machines), x86 architecture processors, or processors with integrated NPU (neural-network processing units); the transceiver may be, but is not limited to, WiFi (Wireless Fidelity) wireless transceivers, Bluetooth wireless transceivers, General Packet Radio Service (GPRS) wireless transceivers, ZigBee (a low-power LAN protocol based on the IEEE 802.15.4 standard), 3G transceivers, 4G transceivers, and / or 5G transceivers, etc.
[0081] This fourth aspect of the embodiment provides a computer-readable storage medium storing instructions containing the logistics transportation early warning method based on dynamic thresholds as described in the first aspect of the embodiment. Specifically, the computer-readable storage medium stores instructions that, when executed on a computer, perform the logistics transportation early warning method based on dynamic thresholds as described in the first aspect. The computer-readable storage medium refers to a data storage medium, which may include, but is not limited to, floppy disks, optical disks, hard disks, flash memory, USB flash drives, and / or Memory Sticks. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
[0082] The fifth aspect of this embodiment provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform the logistics transportation early warning method based on dynamic thresholds as described in the first aspect of the embodiment, wherein the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0083] Finally, it should be noted that the above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A logistics transportation early warning method based on dynamic thresholds, characterized in that, include: First and second images of the area in front of the logistics transport vehicle are acquired using a binocular camera. Extract the first vehicle region image from the first image and the second vehicle region image from the second image; The first vehicle region image and the second vehicle region image are converted into grayscale images to obtain a first grayscale image corresponding to the first vehicle region image and a second grayscale image corresponding to the second vehicle region image. Based on the gray values of each pixel in the first grayscale image and the second grayscale image, as well as the gray values of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image is calculated. Based on the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image, and the grayscale value of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, feature point detection is performed on the first grayscale image and the second grayscale image to obtain a first feature point set in the first grayscale image and a second feature point set in the second grayscale image. Feature point matching is performed on the first set of feature points and the second set of feature points to obtain at least two sets of matched feature points; Based on the average pixel coordinate difference corresponding to the at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera, the distance between the logistics transport vehicle and the vehicle in front is calculated. The dynamic safe distance between the logistics transport vehicle and the vehicle in front is determined based on the current speed of the logistics transport vehicle. Based on the vehicle distance and the dynamic safety distance, an abnormal vehicle distance warning is issued for the logistics transportation vehicle.
2. The logistics transportation early warning method based on dynamic thresholds according to claim 1, characterized in that, Based on the grayscale values of each pixel in the first grayscale image and the second grayscale image, and the grayscale values of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, a dynamic grayscale threshold corresponding to each pixel in the first grayscale image and the second grayscale image is calculated, including: Based on the gray values of each pixel in the first grayscale image and the second grayscale image, and the gray values of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image is calculated according to the following formula. in, α Represents dynamic coefficients. n This represents the total number of neighboring pixels. This represents the grayscale value of the i-th neighboring pixel. This represents the maximum grayscale value of the neighboring pixels of the i-th pixel. This represents the minimum gray value of the neighboring pixels of the i-th pixel. It represents the average gray value of all neighboring pixels of the i-th pixel, excluding the pixels corresponding to the maximum and minimum gray values.
3. The logistics transportation early warning method based on dynamic thresholds according to claim 1, characterized in that, Based on the dynamic grayscale thresholds corresponding to each pixel in the first and second grayscale images, and the grayscale values of neighboring pixels in the first and second grayscale images, feature point detection is performed on the first and second grayscale images, including: Iterate through the grayscale values of each pixel in the first grayscale image and the second grayscale image; For any pixel in the first grayscale image and the second grayscale image, the neighboring pixels of the pixel are numbered in a clockwise direction; Select k neighboring pixels at equal intervals from all neighboring pixels of any given pixel in numerical order; If the absolute value of the grayscale difference between any pixel and its k neighboring pixels is greater than the grayscale dynamic threshold corresponding to any pixel, then any pixel is determined to be a candidate feature point. If any pixel is a candidate feature point, then m neighboring pixels are selected from all neighboring pixels of the pixel in numerical order at equal intervals, and there are no duplicate pixels between the m neighboring pixels and the k neighboring pixels. If the absolute value of the grayscale difference between any pixel and its m neighboring pixels is greater than the grayscale dynamic threshold corresponding to any pixel, then any pixel is determined to be a feature point.
4. The logistics transportation early warning method based on dynamic thresholds according to claim 3, characterized in that, The distance between the neighboring pixels of any pixel and any pixel is 2-4 pixel units.
5. The logistics transportation early warning method based on dynamic thresholds according to claim 1, characterized in that, Feature point matching is performed on the first set of feature points and the second set of feature points to obtain at least two sets of matched feature points, including: The feature points in the first feature point set are combined with the feature points in the second feature point set in pairs to obtain multiple sets of candidate feature points; Calculate the Hamming distance between the first feature point and the second feature point in each group of candidate feature points to obtain the Hamming distance between multiple groups of candidate feature points, wherein the first feature point is the feature point in the first set of feature points, and the second feature point is the feature point in the second set of feature points; Sort the Hamming distances of multiple candidate feature points in ascending order; Select the j groups of candidate feature points that are ranked highest; Randomly select q groups of candidate feature points from the j groups of candidate feature points, where q is less than j and q is greater than or equal to 2; For the q groups of candidate feature points, the pixel coordinate transformation matrix between the first and second candidate feature points in the q groups of candidate feature points is calculated based on the pixel coordinates of the two feature points in each group of candidate feature points. Verify whether the pixel coordinates of the first feature point and the second feature point in the multiple sets of candidate feature points conform to the pixel coordinate transformation matrix; Any set of candidate feature points whose pixel coordinates conform to the pixel coordinate transformation matrix of the first feature point and the second feature point are taken as a set of matched feature points, and at least two sets of matched feature points are obtained.
6. The logistics transportation early warning method based on dynamic thresholds according to claim 1, characterized in that, Based on the average pixel coordinate difference corresponding to the at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera, the distance between the logistics transport vehicle and the vehicle in front is calculated, including: Based on the average pixel coordinate difference corresponding to the at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera, the distance between the logistics transport vehicle and the vehicle in front is calculated according to the following formula. Where c represents the focal length of the binocular camera, D represents the optical center distance between the two cameras in the binocular camera, and d represents the average pixel coordinate difference corresponding to the at least two sets of matched feature points.
7. The logistics transportation early warning method based on dynamic thresholds according to claim 1, characterized in that, Based on the vehicle distance and the dynamic safety distance, the logistics transport vehicle is given an abnormal vehicle distance warning, including: If the distance between vehicles is less than the dynamic safe distance, an abnormal distance warning message is generated.
8. A logistics transportation early warning device based on dynamic thresholds, characterized in that, include: The acquisition unit is used to acquire a first image and a second image of the area in front of the logistics transport vehicle through a binocular camera. An extraction unit is used to extract the first vehicle region image from the first image and the second vehicle region image from the second image; The conversion unit is used to convert the first vehicle region image and the second vehicle region image into grayscale images to obtain a first grayscale image corresponding to the first vehicle region image and a second grayscale image corresponding to the second vehicle region image. The first calculation unit is used to calculate the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image based on the grayscale value of each pixel in the first grayscale image and the second grayscale image, as well as the grayscale value of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image. The feature point detection unit is used to perform feature point detection on the first grayscale image and the second grayscale image based on the grayscale dynamic threshold corresponding to each pixel in the first grayscale image and the second grayscale image, as well as the grayscale value of the neighboring pixels of each pixel in the first grayscale image and the second grayscale image, to obtain a first feature point set in the first grayscale image and a second feature point set in the second grayscale image. A feature point matching unit is used to perform feature point matching on the first feature point set and the second feature point set to obtain at least two sets of matched feature points. The second calculation unit is used to calculate the distance between the logistics transport vehicle and the vehicle in front based on the average pixel coordinate difference corresponding to the at least two sets of matched feature points, the focal length of the binocular camera, and the optical center distance between the two cameras in the binocular camera. The determining unit is used to determine the dynamic safe distance between the logistics transport vehicle and the vehicle in front based on the current speed of the logistics transport vehicle; The early warning unit is used to issue an abnormal vehicle distance warning to the logistics transport vehicle based on the vehicle distance and the dynamic safety distance.
9. An electronic device, characterized in that, The system includes a memory, a processor, and a transceiver that are sequentially and communicatively connected. The memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the logistics transportation early warning method based on dynamic thresholds as described in any one of claims 1 to 7.
10. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or the instructions are executed by the computer, they implement the logistics transportation early warning method based on any one of claims 1 to 7.
