A vehicle tracking method and system based on CMOS dynamic differential edge detection
By using CMOS dynamic differential edge detection, the gray-scale mean of the ROI region is monitored in real time for adaptive exposure control. Combined with the local adaptive thresholding method and the simplified Kalman filter model, the problem of high computational complexity of the vehicle cruise automatic control system under changing illumination is solved, and efficient and stable trajectory extraction and tracking are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- LUOYANG INST OF SCI & TECH
- Filing Date
- 2026-02-09
- Publication Date
- 2026-06-09
AI Technical Summary
Existing vehicle cruise automatic control systems suffer from high computational complexity in edge detection algorithms in environments with drastic changes in lighting, making it difficult to balance real-time performance and accuracy on resource-constrained embedded platforms, thus affecting vehicle control stability.
A CMOS-based dynamic differential edge detection method is adopted, which performs adaptive exposure control by monitoring the gray-scale mean of the ROI region in real time. Combined with the local adaptive thresholding method and the simplified Kalman filter model, the edge map extraction is optimized and the trajectory is tracked, reducing the amount of computation and improving the resistance to light interference.
While reducing computational load, it improves data processing efficiency, enhances robustness to changes in illumination, ensures accurate trajectory extraction and stable tracking, and is suitable for resource-constrained embedded platforms.
Smart Images

Figure CN122176014A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of vehicle cruise automatic control technology, specifically relating to a vehicle tracking method and system based on CMOS dynamic differential edge detection. Background Technology
[0002] Vehicle cruise control systems have stringent requirements for the accuracy and real-time performance of road information extraction. In applications such as automated transportation and intelligent inspection, vehicles need to achieve autonomous navigation through accurate identification of predetermined trajectories. Current mainstream line-following solutions mostly employ visual sensors, with linear CMOS cameras being the preferred choice due to their low cost, high resolution, and good foresight.
[0003] Dynamic changes in illumination intensity in real-world applications pose significant challenges to visual tracking systems. Drastic fluctuations in lighting conditions can degrade image quality, directly impacting the accuracy of track edge feature extraction and consequently affecting vehicle control stability. Existing technologies employ methods such as adaptive exposure time adjustment and Kalman filtering to address illumination variations. While these methods can achieve some success under specific conditions, they suffer from high computational complexity and cumbersome processing flows, making it difficult to balance real-time performance and accuracy on resource-constrained embedded platforms. Particularly in applications where a microcontroller serves as the core processor, complex edge detection algorithms consume substantial computational resources, hindering the system's ability to simultaneously handle other critical tasks such as communication and control. Summary of the Invention
[0004] In view of the aforementioned deficiencies in existing vehicle cruise automatic control, the purpose of this invention is to propose a vehicle tracking method and system based on CMOS dynamic differential edge detection.
[0005] To achieve the aforementioned objectives, the technical solution adopted by this invention is: a vehicle tracking system based on CMOS dynamic differential edge detection, comprising:
[0006] The acquisition module is used to calculate the average gray value of the ROI region in the CMOS in real time and perform adaptive exposure control based on the average gray value;
[0007] The first processing module is used to convert the RGB image captured by the CMOS camera into a single-channel grayscale image, perform inter-frame difference, and use the local adaptive thresholding method to binarize the difference image to obtain a binarized edge map.
[0008] The second processing module optimizes the binary edge map obtained from the first processing module to obtain an optimized edge map. It then uses a contour detection algorithm to process the optimized edge map and extract its center coordinates. and tilt angle Wherein, the center coordinates are the center point of the trajectory in the current frame;
[0009] The third processing module uses a simplified Kalman filter model to track the trajectory center point. Using the observed values and the trajectory coordinates of the previous 3 frames, the center point of the trajectory in the next frame is predicted. The deviation between the predicted point and the actual point is calculated, and the deviation signal is output as a control signal for tracking.
[0010] The first judgment module is used to determine whether vehicle tracking has ended;
[0011] The second judgment module is used to determine whether the average grayscale value exceeds the preset threshold range.
[0012] This invention also provides a vehicle tracking method based on CMOS dynamic differential edge detection, comprising:
[0013] S1. Real-time monitoring of the average grayscale value of the ROI area of the CMOS camera, and adaptive exposure control based on the average grayscale value;
[0014] S2. The RGB image captured by the CMOS camera is converted to grayscale and transformed into a single-channel grayscale image. Inter-frame difference is performed, and the difference image is binarized using the local adaptive thresholding method to obtain a binarized edge image.
[0015] S3. Optimize the binarized edge map obtained in step S2 to obtain an optimized edge map. Use a contour detection algorithm to process the optimized edge map and extract its center coordinates. and tilt angle Wherein, the center coordinates are the center point of the trajectory in the current frame;
[0016] S4. A simplified Kalman filter model is used to track the trajectory center point, in order to Using the observed values and the trajectory coordinates of the previous 3 frames, the center point of the trajectory in the next frame is predicted. The deviation between the predicted point and the actual point is calculated, and the deviation signal is output as a control signal for tracking.
[0017] S5. Determine if the vehicle tracking has ended. If not, repeat S1-S4 until the vehicle completes tracking.
[0018] Furthermore, prior to step S1, the method also includes setting the frame rate and resolution of the preset CMOS, and setting the ROI region.
[0019] Furthermore, step S1 includes:
[0020] S11. Calculate the average gray value of the ROI region in real time:
[0021]
[0022] Among them, G avgIt is the current grayscale mean. This represents the number of pixels in the ROI region. The coordinate pixel grayscale value of the ROI region;
[0023] S12. Determine whether the real-time calculated average grayscale value exceeds the preset threshold. If not, the exposure time of the CMOS camera remains unchanged; if so, proceed to step S13.
[0024] S13. Determine whether the real-time calculated average grayscale value exceeds the preset threshold. If it is lower than the minimum threshold, increase the exposure time; if it is higher than the maximum threshold, decrease the exposure time.
[0025] Furthermore, step 2 includes:
[0026] S21. Convert the acquired RGB image into a single-channel grayscale image;
[0027] S22. Perform inter-frame differencing on the single-channel grayscale image to obtain a difference image;
[0028] S23. Divide the difference image into multiple sub-blocks and calculate the local features of each sub-block;
[0029] S24. Calculate the dynamic threshold for each sub-block;
[0030] S25. For each pixel in the difference image, perform binarization judgment based on the dynamic threshold of its sub-block to obtain a binarized edge map.
[0031] Furthermore, step S22 specifically includes:
[0032]
[0033] in, For the current frame grayscale value at that location This is the grayscale value of the previous frame at the same coordinate. These are the pixel values of the difference image.
[0034] Furthermore, step S23 includes calculating the mean and variance of the grayscale for each sub-block:
[0035]
[0036]
[0037] in, These represent the length and width of each sub-block within the sub-block. For the first Coordinates within each sub-block Pixel value at, variance Used to determine whether there are edges within a sub-block; the larger the variance, the higher the edge probability.
[0038] Furthermore, step S24 specifically involves:
[0039]
[0040] in The dynamic threshold for each sub-block, For adjustment coefficients,
[0041] .
[0042] The aforementioned vehicle tracking method and system based on CMOS dynamic differential edge detection can achieve the following beneficial effects:
[0043] 1. During data processing, reducing the amount of computation and improving data processing efficiency allows the microcontroller to reserve more computing power to handle other tasks.
[0044] 2. Through dual optimization of adaptive exposure control and local adaptive thresholding, it has strong resistance to strong light interference and good robustness to changes in illumination.
[0045] 3. Through multi-stage optimization, the trajectory extraction is accurate and the tracking stability is high.
[0046] 4. The solution is simple to implement and highly practical.
[0047] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0048] Figure 1 This is a flowchart illustrating a vehicle tracking method based on CMOS dynamic differential edge detection according to the present invention.
[0049] Figure 2 This is a schematic diagram of the process for obtaining exposure time in this invention;
[0050] Figure 3 This is a schematic diagram of the binarization process in this invention;
[0051] Figure 4 The trajectory direction in this invention A comparison chart of Kalman predictions and actual detections;
[0052] Figure 5 It is the midpoint of the trajectory in this invention. A comparison chart of Kalman predictions and actual detections;
[0053] Figure 6 It is the midpoint of the trajectory in this invention. A comparison chart of Kalman predictions and actual detections. Detailed Implementation
[0054] The features and exemplary embodiments of various aspects of the present invention will now be described in detail. In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the invention. However, it will be apparent to those skilled in the art that the invention may be practiced without requiring some of these specific details. The following description of embodiments is merely intended to provide a better understanding of the invention by illustrating examples of the invention.
[0055] Please see Figure 1 This embodiment provides a vehicle tracking system based on CMOS dynamic differential edge detection, including:
[0056] The acquisition module is used to calculate the average gray value of the ROI region in the CMOS in real time and perform adaptive exposure control based on the average gray value;
[0057] The first processing module is used to convert the RGB image captured by the CMOS camera into a single-channel grayscale image, perform inter-frame difference, and use the local adaptive thresholding method to binarize the difference image to obtain a binarized edge map.
[0058] The second processing module optimizes the binary edge map obtained from the first processing module to obtain an optimized edge map. It then uses a contour detection algorithm to process the optimized edge map and extract its center coordinates. and tilt angle Wherein, the center coordinates are the center point of the current frame trajectory;
[0059] The third processing module uses a simplified Kalman filter model to track the trajectory center point. Using the observed values and the trajectory coordinates of the previous 3 frames, the center point of the trajectory in the next frame is predicted. The deviation between the predicted point and the actual point is calculated, and the deviation signal is output as a control signal for tracking.
[0060] The first judgment module is used to determine whether vehicle tracking has ended;
[0061] The second judgment module is used to determine whether the average grayscale value exceeds the preset threshold range.
[0062] The system also includes a third judgment module, used to determine whether the pixel value of the differential image is greater than the dynamic threshold of each sub-block.
[0063] This embodiment also provides a vehicle tracking method based on CMOS dynamic differential edge detection, including:
[0064] S1. Monitor the average grayscale value of the ROI area of the CMOS camera in real time, and perform adaptive exposure control based on the average grayscale value.
[0065] Furthermore, prior to step S1, the method also includes setting the frame rate and resolution of the preset CMOS, and setting the ROI region.
[0066] Specifically, the ROI region is defined in the image captured by the CMOS camera, and only this region is processed to remove irrelevant areas such as the sky and obstacles, thereby reducing the amount of computation.
[0067] Specifically, existing methods for adjusting exposure time are cumbersome and complex, and cannot meet the needs of widespread equipment applications. This embodiment finds a suitable feedback quantity and uses a simple closed-loop control to adjust the exposure time in real time.
[0068] First, a fixed exposure time is set. Then, the actual exposure of the CMOS camera is obtained by adjusting the exposure time in real time. The exposure parameter adjustment is based on the gray-scale average value of the current ROI region. However, most existing methods use the average pixel value of the global image as the exposure feedback. But when the target area and the background lighting are strongly contrasted, the global average value may mask the brightness changes of the target area, resulting in a lag in exposure adjustment response, or even overexposure or underexposure of the target. In contrast, the gray-scale average value of the ROI region used in this embodiment can focus on the lighting state of the key area. Once the target brightness changes, the feedback value changes sensitively. Therefore, this embodiment selects the real-time calculated gray-scale average value of the ROI as the exposure feedback, and combines it with a lightweight PI control algorithm to dynamically calculate the exposure adjustment, thereby stably and accurately obtaining the exposure time of the CMOS camera.
[0069] Please see Figure 2 The method for obtaining the exposure time in this embodiment specifically includes:
[0070] S11. Calculate the average gray value of the ROI region in real time:
[0071]
[0072] Among them, G avg It is the current grayscale mean. This represents the number of pixels in the ROI region. The coordinate pixel grayscale value of the ROI region;
[0073] S12. Determine whether the real-time calculated average grayscale value exceeds the preset threshold. If not, the exposure time of the CMOS camera remains unchanged; if so, proceed to step S13.
[0074] In this embodiment, exposure is controlled by calculating the average grayscale value in real time to determine if it exceeds a preset threshold. This improves accuracy. In this embodiment, the highest threshold is selected as 141, and the lowest as 115.
[0075] S13. Determine whether the real-time calculated average grayscale value exceeds the preset threshold. If it is lower than the minimum threshold, increase the exposure time; if it is higher than the maximum threshold, decrease the exposure time.
[0076] Furthermore, step S12 specifically includes:
[0077]
[0078] in The lower limit of the threshold. This represents the upper limit of the threshold.
[0079] Furthermore, step S13 specifically includes:
[0080] Exposure time is calculated using a lightweight PI controller:
[0081]
[0082] in, Brightness deviation ( For the target grayscale value, take )
[0083] This is a proportionality coefficient used for rapid response (empirical values are 0.02-0.05). This is the integral coefficient, used to eliminate bias (empirical value is 0.001-0.005). This is the amount of time adjustment for exposure.
[0084] This embodiment follows the principle of threshold first, then PI parameter:
[0085] If the system oscillates: first widen the threshold interval. If that doesn't work, reduce the PI controller's... ;
[0086] If the response is too slow: first narrow the threshold range. If that's still not enough, increase the PI controller's voltage appropriately. .
[0087] Step S2. The RGB image captured by the CMOS camera is converted to grayscale and transformed into a single-channel grayscale image. Inter-frame difference is performed, and the difference image is binarized using the local adaptive thresholding method to obtain a binarized edge map.
[0088] Specifically, the effectiveness of binarization largely depends on the quality of the selected threshold. In most motion edge detection binarization methods for CMOS cameras, threshold selection is often based on the global statistical features of the entire image (such as mean, maximum / minimum values). This ignores the detailed changes in local areas of the image. In environments with uneven lighting or complex backgrounds, the binarization effect is easily interfered with, resulting in incomplete edge extraction or significant noise. Furthermore, since the contrast difference between moving and stationary areas in an image can be significant, a single global threshold is insufficient to adapt to the true edge characteristics of different regions. Therefore, this embodiment optimizes local adaptation in image processing. The thresholding method employs a dynamic threshold calculation strategy based on sub-block statistical features. It calculates the dynamic threshold for each image sub-block, thereby more accurately separating moving edges from background noise. This embodiment divides the differential image into multiple sub-blocks and calculates the grayscale mean and variance of each sub-block. The variance characterizes the dispersion of pixel values within the region, i.e., edge probability. Based on this, the threshold coefficient is dynamically adjusted according to the strength of the variance to achieve adaptive calculation of the local threshold. Finally, the pixels are binarized based on the dynamic threshold of each sub-block, resulting in a clear, coherent, and well-suppressed binarized edge map.
[0089] For details, please refer to Figure 3 Step S2 includes:
[0090] S21. Convert the acquired RGB image into a single-channel grayscale image.
[0091] Specifically, step S21 is as follows: based on the Bayer array design of the CMOS camera, the green channel is twice the value of the red and blue channels, and the green channel is selected.
[0092] S22. Perform inter-frame difference on the single-channel grayscale image to obtain the difference image.
[0093] Specifically, step S22 is as follows:
[0094]
[0095] in, For the current frame grayscale value at that location This is the grayscale value of the previous frame at the same coordinate. These are the pixel values of the difference image.
[0096] Furthermore, to meet real-time requirements, a local threshold adaptive method is used for binarization:
[0097] S23. Divide the difference image into multiple sub-blocks and calculate the local features of each sub-block.
[0098] Specifically, step S23 includes calculating the mean and variance of the grayscale for each sub-block:
[0099]
[0100]
[0101] in, These represent the length and width of each sub-block within the sub-block. For the first Coordinates within each sub-block Pixel value at, variance Used to determine whether there are edges within a sub-block; the larger the variance, the higher the edge probability.
[0102] S24. Calculate the dynamic threshold for each sub-block.
[0103] Specifically, S24 is as follows:
[0104]
[0105] in The dynamic threshold for each sub-block, For adjustment coefficients,
[0106] .
[0107] S25. For each pixel in the difference image, perform binarization judgment based on the dynamic threshold of its sub-block to obtain a binarized edge map.
[0108] Specifically, step S25 is as follows:
[0109] like It is determined to be a pixel on the edge of the trajectory and is assigned a value of 225.
[0110] like If a pixel is identified as background or noise, it is assigned a value of 0.
[0111] S3. Optimize the binarized edge map obtained in step S2 to obtain an optimized edge map. Use a contour detection algorithm to process the optimized edge map and extract its center coordinates. and tilt angle ; where the center coordinates are the center point of the current frame trajectory.
[0112] Specifically, morphological operations performed on the binarized edge map to obtain the optimized edge map include:
[0113] by The rectangular structuring element is eroded to eliminate isolated noise points; then, the same structuring element is expanded to link the edges of the broken trajectory, resulting in an optimized edge map.
[0114] First, define the structural element. Select a rectangular structural element, for example... A matrix of all 1s. (The size of the rectangular structuring element is adjusted according to the scale of noise and breaks in the image.)
[0115] Next, erosion is performed to shrink the foreground and eliminate isolated noise points and small particles: Each pixel in the input binary edge map is traversed (0 represents background, 1 represents foreground). The center of the structuring element is aligned with the current pixel, and it is checked whether all pixels within the structuring element's coverage area are 1. If so, the pixel is set to 1 in the output image; otherwise, it is set to 0. Image boundaries are then padded with 0 (black).
[0116] Finally, dilation is performed to expand the foreground and connect edges that were broken or discontinuous due to erosion: Each pixel in the eroded image is traversed. The center of the structuring element is aligned with the current pixel, and it is checked whether there is at least one pixel with a value of 1 within the area covered by the structuring element. If so, that pixel is set to 1 in the output image; otherwise, it is set to 0. Image boundaries are also handled (filled with 0).
[0117] In road recognition tasks, morphological operations on the binarized edge map are a crucial post-processing step. First, erosion effectively filters out isolated false edges caused by scattered salt-and-pepper noise, tire tracks, etc., thus purifying the initial detection results. Subsequent dilation reconnects broken lane lines and blurred road boundaries caused by road wear, shadow occlusion, or limitations of the detection algorithm, forming a continuous and complete contour. This processing enhances the linear structure and regional coherence of the road, providing clearer and more reliable foundational data for subsequent steps, significantly improving the stability and accuracy of the entire recognition system in complex real-world scenarios.
[0118] In this embodiment, a contour detection algorithm is used to extract connected regions from the optimized edge map: First, contours with areas within a preset range are selected to exclude excessively small or large interference contours; second, minimum bounding rectangle fitting is performed; and finally, the center coordinates of the rectangle are extracted. and tilt angle The center coordinates are the center point of the trajectory in the current frame. The trajectory of the reaction.
[0119] In this example, the median of the area of all contours is calculated. Minimum outline area Maximum outline area .
[0120] S4. A simplified Kalman filter model is used to track the trajectory center point, in order to Using the observed values, the trajectory center point of the next frame is predicted by combining the trajectory coordinates of the previous 3 frames. The deviation between the predicted point and the actual point is calculated, and the deviation signal is output as a control signal for tracking.
[0121] Please see Figures 4-6 The trajectory directions are respectively Comparison of Kalman predictions and actual detections, and the midpoint of the trajectory. Comparison of Kalman predictions and actual detections, and the midpoint of the trajectory. The Kalman prediction and actual detection are compared. Based on the deviation between the predicted point and the actual point, the deviation signal is output as a control signal for tracking.
[0122] S5. Determine if the vehicle tracking has ended. If not, repeat S1-S4 until the vehicle completes tracking.
[0123] The implementation process in this embodiment is divided into the following three stages, specifically:
[0124] 1. Parameter Settings: In the parameter settings interface, input the following parameters: Set the ROI area: left boundary pixels 200, right boundary pixels 650, top boundary pixels 210, and bottom boundary pixels 300. The preset threshold for grayscale mean is set to a maximum of 141 and a minimum of 115. The initial exposure time (Time) of the CMOS camera is set to 10ms. Take 0.03, The value is set to 0.002, and the host computer sends the setting data into the microcontroller's RAM for storage.
[0125] 2. Offline Debugging: Connect the data transmission interface of the microcontroller to the host computer via a data cable. Click the "Go" button on the host computer to enter the debugging interface. Start the CPU of the main control microcontroller and call the pre-downloaded "tracking program" to obtain the tracking results. The specific implementation process is as follows:
[0126] (1) Calculate the average gray value of the ROI area in real time and make a judgment. When the average gray value is greater than 141 or less than 115, start adaptive exposure control.
[0127] (2) The lightweight PI control algorithm calculates the current exposure time.
[0128] (3) Convert the acquired RGB image to grayscale, transform it into a single-channel grayscale image, cache the previous frame's grayscale image, and calculate the difference image between the current frame and the previous frame. First, use... Erosion of rectangular structuring elements eliminates isolated noise points; then dilation using the same structuring element links the broken trajectory edges to process the difference image, resulting in a binarized edge map; for the binarized edge map, select... Morphological operations of erosion followed by dilation are performed on the rectangular structuring elements of a matrix of all 1s.
[0129] (4) Calculate the median of the area of all contours. Minimum outline area Maximum outline area First, excessively small and excessively large interference contours are eliminated. Then, minimum bounding rectangle fitting is performed. Finally, the center point of the current trajectory is extracted. and trajectory .
[0130] (5) with Using the observed values, the trajectory center point of the next frame is predicted by combining the trajectory coordinates of the previous 3 frames. The deviation between the predicted point and the actual point is calculated, and the deviation signal is output as a control signal for tracking.
[0131] (6) Save the calculation results to the microcontroller's RAM.
[0132] 3. Online operation: The CPU of the main control microcontroller reads parameters, performs grayscale processing on the RGB image obtained from the previous data acquisition and converts it into a single-channel grayscale image, calculates the difference image between the current frame and the previous frame, and finally uses the local adaptive thresholding method to binarize the difference image to obtain a binarized edge map.
[0133] After performing morphological operations on the binarized edge map, a contour detection algorithm is used to extract connected regions from the optimized edge map. Finally, a simplified Kalman filter model is used to track the trajectory center point. Using the observed values, the trajectory center point of the next frame is predicted by combining the trajectory coordinates of the previous 3 frames. The deviation between the predicted point and the actual point is calculated, and the deviation signal is output as a control signal for tracking.
[0134] The above description is merely a preferred embodiment of the present invention. Any simple modifications, equivalent changes, and alterations made by those skilled in the art to the above embodiments without departing from the scope of the present invention and based on the technical essence of the present invention shall still fall within the scope of the present invention.
Claims
1. A vehicle following system based on CMOS dynamic differential edge detection, characterized in that, include: The acquisition module is used to calculate the average gray value of the ROI region in the CMOS in real time and perform adaptive exposure control based on the average gray value; The first processing module is used to convert the RGB image captured by the CMOS camera into a single-channel grayscale image, perform inter-frame difference, and use the local adaptive thresholding method to binarize the difference image to obtain a binarized edge map. The second processing module optimizes the binarized edge graph obtained by the first processing module to obtain an optimized edge graph, adopts a contour detection algorithm to process the optimized edge graph, and extracts a center coordinate of the optimized edge graph and the tilt angle ; wherein the center coordinate is a current frame trajectory center point; The third processing module uses a simplified Kalman filter model to track the trajectory center point. Using the observed values and the trajectory coordinates of the previous 3 frames, the center point of the trajectory in the next frame is predicted. The deviation between the predicted point and the actual point is calculated, and the deviation signal is output as a control signal for tracking. The first judgment module is used to determine whether vehicle tracking has ended; The second judgment module is used to determine whether the average grayscale value exceeds the preset threshold range.
2. A vehicle tracking method based on CMOS dynamic differential edge detection, characterized in that, include: S1. Real-time monitoring of the average grayscale value of the ROI area of the CMOS camera, and adaptive exposure control based on the average grayscale value; S2. The RGB image captured by the CMOS camera is converted to grayscale and transformed into a single-channel grayscale image. Inter-frame difference is performed, and the difference image is binarized using the local adaptive thresholding method to obtain a binarized edge image. S3. Optimize the binarized edge map obtained in step S2 to obtain an optimized edge map. Use a contour detection algorithm to process the optimized edge map and extract its center coordinates. and tilt angle Wherein, the center coordinates are the center point of the trajectory in the current frame; S4. A simplified Kalman filter model is used to track the trajectory center point, in order to Using the observed values and the trajectory coordinates of the previous 3 frames, the center point of the trajectory in the next frame is predicted. The deviation between the predicted point and the actual point is calculated, and the deviation signal is output as a control signal for tracking. S5. Determine if the vehicle tracking has ended. If not, repeat S1-S4 until the vehicle completes tracking.
3. The vehicle tracking method based on CMOS dynamic differential edge detection according to claim 2, characterized in that, Before step S1, the method also includes setting the frame rate and resolution of the preset CMOS, and setting the ROI region.
4. The vehicle tracking method based on CMOS dynamic differential edge detection according to claim 2, characterized in that, Step S1 includes: S11. Calculate the average gray value of the ROI region in real time: , Among them, G avg It is the current grayscale mean. This represents the number of pixels in the ROI region. The coordinate pixel grayscale value of the ROI region; S12. Determine whether the real-time calculated average grayscale value exceeds the preset threshold. If not, the exposure time of the CMOS camera remains unchanged; if so, proceed to step S13. S13. Determine whether the real-time calculated average grayscale value exceeds the preset threshold. If it is lower than the minimum threshold, increase the exposure time; if it is higher than the maximum threshold, decrease the exposure time.
5. The vehicle tracking method based on CMOS dynamic differential edge detection according to claim 2, characterized in that, Step 2 includes: S21. Convert the acquired RGB image into a single-channel grayscale image; S22. Perform inter-frame differencing on the single-channel grayscale image to obtain a difference image; S23. Divide the difference image into multiple sub-blocks and calculate the local features of each sub-block; S24. Calculate the dynamic threshold for each sub-block; S25. For each pixel in the difference image, perform binarization judgment based on the dynamic threshold of its sub-block to obtain a binarized edge map.
6. The vehicle tracking method based on CMOS dynamic differential edge detection according to claim 5, characterized in that, Step S22 is as follows: , in, For the current frame grayscale value at that location This is the grayscale value of the previous frame at the same coordinate. These are the pixel values of the difference image.
7. The vehicle tracking method based on CMOS dynamic differential edge detection according to claim 5, characterized in that, Step S23 includes calculating the mean and variance of the grayscale for each sub-block: , , in, These represent the length and width of each sub-block within the sub-block. For the first Coordinates within each sub-block Pixel value at, variance Used to determine whether there are edges within a sub-block.
8. The vehicle tracking method based on CMOS dynamic differential edge detection according to claim 5, characterized in that, Step S24 is as follows: , in The dynamic threshold for each sub-block, For adjustment coefficients, 。