A Portable Vehicle Video Target Recognition and Tracking Method and System
Through the portable vehicle video target recognition and tracking method, the video target recognition and tracking system of the ARM platform is used to solve the accuracy and efficiency of traffic statistics in traffic surveys, and a high accuracy and portability traffic flow survey is achieved.
Patent Information
- Application Number
- CN202111079249.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-15
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2041-09-15
AI Technical Summary
The existing traffic statistics methods in traffic surveys have problems such as high labor intensity, high manpower investment, and low data accuracy. Common vehicle detection technology has the disadvantages of damage to the road surface, easy damage, and reduced accuracy.
A portable vehicle video object recognition and tracking method is provided, and vehicle identification, tracking and counting are realized by setting hyperparameters, foreground extraction, morphological processing and vehicle counting, and using a video object recognition and tracking system based on the ARM platform.
It realizes traffic flow survey equipment with low energy consumption, portability, strong environmental adaptability and high accuracy, and can achieve more than 95% accuracy in different time periods and multiple environments.
Smart Images

Figure CN115410161B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of vehicle identification and tracking, and particularly relates to a portable vehicle video target identification and tracking method and system. Background Art
[0002] In order to solve traffic congestion, more and more attention is paid to traffic planning and management by scientific and refined means. Understanding and mastering the distribution and change of urban road traffic flow is an important basis for traffic planning, design, and management. There are many methods to obtain traffic flow, such as using road checkpoints, electronic police, geomagnetic coils, road monitoring, etc. in urban roads, which can obtain the road traffic flow status more accurately and timely. However, the data obtained by the above facilities is often owned by the traffic management department and is restricted by data protection and usage rights. Engineers or designers in professional traffic planning and design institutes use the method of roadside manual investigation to collect traffic flow data. This method is time-consuming and laborious, and the counting results are easily affected by human, weather, time, etc.
[0003] Flow statistics in traffic surveys is an important basic work for studying traffic problems. Flow statistics generally adopt manual methods, which have problems such as high labor intensity, high manpower input, and low data accuracy. At the same time, even if the data of the traffic management department can be obtained, due to the existence of various complex scenarios, the difficulty of data processing is doubled, making most data need to be cleaned before use. The advantages and disadvantages of various commonly used vehicle detection technologies are shown in Table 1.
[0004] Table 1 Commonly Used Vehicle Detection Technologies
[0005]
[0006]
[0007] In summary, there is an urgent need for a portable, easy-to-obtain, and low-cost vehicle counting and statistics tool for the use of traffic planning and design practitioners, providing convenience for scientific research, analysis of traffic problems, and traffic planning and design.
[0008] Through the above analysis, the problems and defects existing in the prior art are as follows:
[0009] (1) The existing flow statistics methods in traffic surveys have problems such as high labor intensity, high manpower input, low data accuracy, and the counting results are easily affected by human, weather, time, etc.
[0010] (2) The traffic flow statistics method based on inductive loop detectors has a damaging effect on the road surface, affecting the road surface life. The inductive loops are easily damaged, affecting transportation, resulting in increased costs, and the maintenance workload is also very large. Limited by the measurement principle of the inductive loop itself, when the traffic flow is congested and the vehicle spacing is small, the detection accuracy is greatly reduced.
[0011] (3) In the existing microwave (radar) detection method, the speed measurement accuracy is poor in the case of small traffic flow and large speed differences. The installation accuracy requirements are high, and the detection accuracy is affected by the surrounding terrain conditions. It needs to be installed on a flat section of the roadside without hills or other obstacles. When the road has an iron separator, the detection accuracy decreases.
[0012] (4) In the existing traffic flow statistics method based on infrared detectors, the performance of the infrared detectors will decrease with the influence of environmental temperature and air flow, and the passage of non-vehicle objects will affect the normal operation of the detectors.
[0013] (5) In the existing traffic flow statistics method based on ultrasonic detectors, the ultrasonic detectors are easily affected by the surrounding environment, such as temperature, rain and snow, etc.; secondly, the detection range is limited, the detection accuracy is not high, and false detections are very likely to occur when people or other animals pass by. Summary of the Invention
[0014] Aiming at the problems existing in the prior art, the present invention provides a portable vehicle video target recognition and tracking method and system, especially a portable vehicle video target recognition and tracking method and system based on a non-fixed perspective.
[0015] The present invention is implemented as follows. A portable vehicle video target recognition and tracking method, the portable vehicle video target recognition and tracking method includes the following steps:
[0016] Step 1, set hyperparameters;
[0017] Step 2, perform foreground extraction;
[0018] Step 3, perform morphological processing;
[0019] Step 4, perform vehicle counting.
[0020] Further, in step 1, the hyperparameters include the linear parameter of the connected component threshold and the inlet and outlet coil positions for vehicle counting; wherein, setting the hyperparameters includes:
[0021] (1) Set a reference vehicle;
[0022] (2) Calculate the connected component screening threshold;
[0023] (3) Set the inlet and outlet coils.
[0024] Further, in step one, setting the hyperparameters further includes:
[0025] Before starting the detection, the user manually circles the smallest observed vehicles at two different positions; the filtering thresholds for the vehicles at different positions are calculated based on the areas, lengths, and widths of these two vehicles.
[0026] At any observation angle, the filtering thresholds for vehicles at different positions have a linear relationship FT(p) = kp + b, where FT(x) represents the filtering threshold and p represents the position in the coordinate system where the vehicle is located. Therefore, only k and b need to be obtained to determine this linear relationship; according to the two regions [x 1 , y 1 , w 1 , h 1 , [x 2 , y 2 , w 2 , h 2 manually circled by the user, due to the linear relationship, the parameters in the filtering threshold for the x coordinate system are as shown in the following formula:
[0027]
[0028] And for the parameters in the filtering threshold for the y coordinate system, they are as shown in the following formula:
[0029]
[0030] Define FT x (p): = k x p + b x , FT y (p): = k y p + b y ; The user sets the virtual coil at the entrance and exit. Assuming the coil position is Coil(x, y, w, h), when the center point of the detected vehicle car(cx, cy) satisfies cx > x, cx < x + w, cy > y, and cy < y + h, it is considered that the vehicle passes through the virtual coil.
[0031] Further, in step two, the foreground extraction includes:
[0032] (1) Median filtering to smooth the noise and display the obtained binary image;
[0033] (2) Grayscale conversion;
[0034] (3) Gaussian mixture.
[0035] Further, in step three, the morphological processing includes:
[0036] (1) Erosion filtering for denoising;
[0037] (2) Expansion filtering restoration.
[0038] Furthermore, in step four, the vehicle counting includes:
[0039] (1) Finding connected regions;
[0040] (2) Screening connected regions;
[0041] (3) Conducting entrance coil detection; if yes, add it to the tracking list; if no, find the vehicle that meets the moving distance from the list;
[0042] (4) Conducting exit coil detection, if yes, remove it from the tracking list, record the system time, and add it to the statistical list; if no, update the vehicle position.
[0043] Furthermore, in step four, the vehicle counting also includes:
[0044] (1) Using techniques such as contour detection, object tracking, and virtual coils, set the entrance virtual coil and exit virtual coil by the user; in the binary morphological processed image, detect the closed contours and filter out other dynamic objects by area, length, and width.
[0045] (2) The filtered dynamic vehicles are the detection targets. Add the vehicles entering the entrance virtual coil to the tracking list with the center point. For each frame, find the nearest target whose vertical and horizontal distances are less than the length and width as the updated position. When the center point enters the exit virtual coil, mark the vehicle and count.
[0046] (3) Cut the detected contours at the entrance coil according to the filtering size and count them as multiple vehicles; if the target splits during the detection process, track them separately. When multiple vehicles are occluded or connected during tracking, set the targets as the same target, that is, the connected targets; if they remain connected until passing through the exit coil, count; if they separate during this period, track them separately.
[0047] (4) Generate a traffic flow statistics report with the counting results; design an entrance virtual coil and multiple exit virtual coils; count the Passenger Car Unit (PCU) in the traffic flow statistics report and design for converting the detection records to PCU records. Just count through simple union operations.
[0048] Another object of the present invention is to provide a portable vehicle video target recognition and tracking system applying the described portable vehicle video target recognition and tracking method. The portable vehicle video target recognition and tracking system includes a main control module, a camera module, a power module, a display module, and a housing. The combined size of all the devices is 8 cm * 4.6 cm * 5 cm.
[0049] Another object of the present invention is to provide a computer device, which includes a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the processor performs the following steps:
[0050] (1) Set hyperparameters: Set a reference vehicle, calculate the connected region screening threshold, and set the entrance and exit coils;
[0051] (2) Foreground extraction: Median filtering to remove noise, grayscale conversion, and Gaussian mixture;
[0052] (3) Morphological processing: Erosion filtering to remove noise, and dilation filtering to restore;
[0053] (4) Vehicle counting: Find connected regions; Screen connected regions; Perform entrance coil detection; If so, add to the tracking list; If not, find the vehicle that meets the moving distance from the list; Perform exit coil detection; If so, remove from the tracking list, record the system time, and add to the statistical list; If not, update the vehicle position.
[0054] Another object of the present invention is to provide an information data processing terminal, which is used to implement the portable vehicle video target recognition and tracking system described above.
[0055] Combining all the above technical solutions, the advantages and positive effects of the present invention are as follows: The portable vehicle video target recognition and tracking system provided by the present invention, especially relates to a traffic flow survey device with low energy consumption, portability, strong environmental adaptability, and high accuracy.
[0056] The present invention proposes a solution for video target recognition and tracking based on the ARM platform. In the aspect of the moving target tracking algorithm, it focuses on researching the contour-based tracking algorithm, and on this basis, it proposes improvements according to the actual traffic flow statistics scenario. For the problems of vehicle connectivity occlusion and vehicle perspective change, it proposes solutions such as setting hyperparameters according to the vehicle pixel size and using target filtering technology to improve accuracy. The present invention finds the recognition algorithm and tracking algorithm with the highest matching degree with the ARM platform through analysis and comparison, and finally realizes the recognition, tracking, and counting of video moving targets on the ARM platform. The present invention has been tested in different time periods and multiple environments, and can achieve an accuracy of more than 95%.
[0057] The present invention proposes a solution for video target recognition and tracking based on the Raspberry Pi embedded platform, mainly researching how to combine the ARM embedded platform and the moving target recognition and tracking system. The implementation of the present invention includes the following aspects:
[0058] (1) After setting up the platform and inputting the image into the ARM platform, first, the present invention needs to solve the problem of different vehicle sizes at different perspectives by setting a reference vehicle and entrance and exit coils.
[0059] (2) Then, the Gaussian mixture model is used to reduce the noise in the picture to obtain a stable foreground image, and the image is binarized and grayscaled to reduce the computational difficulty.
[0060] (3) Finally, the present invention uses means such as dilation filtering and erosion filtering to exclude the influence of obstacles in the video, such as swaying leaves, etc., so that the present invention can capture the dynamics of the vehicle.
[0061] (4) Finally, the present invention uses technologies such as contour detection, target tracking, and setting virtual coils to implement vehicle technology.
[0062] The key point of the technical solution of the present invention is to design a traffic flow survey device with low energy consumption, portability, strong environmental adaptability, and high accuracy. The present invention loads the algorithms for vehicle recognition, tracking, and counting on the ARM platform. Deep learning algorithms can also implement the above functions, but the relatively inexpensive ARM platform has low computing power and cannot process pictures quickly. Therefore, the present invention uses traditional algorithms to implement the above functions and realizes them on the Raspberry Pi, for example: manually defining the vehicle size to prevent lens distortion from causing errors in vehicle recognition; binarizing the image to reduce the computational amount; using the filtering method to exclude obstacle interference; using the manually defined exit coil and entrance coil for counting. Brief Description of the Drawings
[0063] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required to be used in the embodiments of the present invention. Obviously, the following described drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0064] Figure 1 is the flowchart of the portable vehicle video target recognition and tracking method provided by the embodiment of the present invention.
[0065] Figure 2 is the schematic diagram of the principle of the portable vehicle video target recognition and tracking method provided by the embodiment of the present invention.
[0066] Figure 3 is the schematic diagram of the placement perspective and observable range provided by the embodiment of the present invention.
[0067] Figure 4 is the schematic diagram of median filtering provided by the embodiment of the present invention.
[0068] Figure 5It is a schematic diagram of corrosion filtering provided by an embodiment of the present invention.
[0069] Figure 6 It is a schematic diagram of dilation filtering provided by an embodiment of the present invention.
[0070] Figure 7 It is a flowchart of a counting algorithm provided by an embodiment of the present invention.
[0071] Figure 8 It is a flowchart of software operation provided by an embodiment of the present invention.
[0072] Figure 9 It is a static video image provided by an embodiment of the present invention.
[0073] Figure 10 It is a foreground extraction test image provided by an embodiment of the present invention.
[0074] Figure 11 It is a morphological processing test image provided by an embodiment of the present invention.
[0075] Figure 12 It is a vehicle counting test image provided by an embodiment of the present invention. Detailed implementation manners
[0076] In order to make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below in conjunction with embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0077] In view of the problems existing in the prior art, the present invention provides a portable vehicle video target recognition and tracking method and system. The present invention will be described in detail below with reference to the accompanying drawings.
[0078] As Figure 1 shown, the portable vehicle video target recognition and tracking method provided by the embodiment of the present invention includes the following steps:
[0079] S101, setting hyperparameters: setting a reference vehicle, calculating a connected region screening threshold, and setting entrance and exit coils;
[0080] S102, foreground extraction: median filtering to remove noise, grayscale conversion, and Gaussian mixture;
[0081] S103, morphological processing: corrosion filtering to remove noise, and dilation filtering to restore;
[0082] S104, Vehicle counting: Find connected regions; Filter connected regions; Perform entrance coil detection; If yes, add to the tracking list; If no, find the vehicle that meets the moving distance from the list and perform exit coil detection. If yes, remove it from the tracking list, record the system time, and add it to the statistical list; If no, update the vehicle position.
[0083] The principle of the portable vehicle video target recognition and tracking method provided by the embodiments of the present invention is as Figure 2 shown.
[0084] The portable vehicle video target recognition and tracking system provided by the embodiments of the present invention includes a main control module, a camera module, a power supply module, a display module, and a housing. The combined size of all the devices is 8cm * 4.6cm * 5cm.
[0085] The technical solution of the present invention will be further described below in conjunction with specific embodiments.
[0086] The present invention proposes a solution for video target recognition and tracking based on the Raspberry Pi embedded platform, mainly researching how to combine the ARM embedded platform with the moving target recognition and tracking system. The implementation of the present invention includes the following aspects:
[0087] (1) After building the platform and inputting the image into the ARM platform, first, the present invention needs to solve the problem of different vehicle sizes under different perspectives by setting a reference vehicle and entrance and exit coils.
[0088] (2) Then, the Gaussian mixture model is used to reduce the noise in the picture to obtain a stable foreground image, and the image is binarized and grayscaled to reduce the computational difficulty.
[0089] (3) Finally, the present invention uses means such as dilation filtering and erosion filtering to exclude the influence of obstacles in the video, such as swaying leaves, etc., so that the present invention can capture the dynamics of the vehicle.
[0090] (4) Finally, the present invention uses techniques such as contour detection, target tracking, and setting virtual coils to achieve vehicle counting.
[0091] The present invention is applicable to all ARM platforms. In the verification process, the Raspberry Pi is selected. The hardware is mainly divided into a main control module, a camera module, a power supply module, a display module, and a housing. The combined size of all the above devices is 8cm * 4.6cm * 5cm, achieving the purpose of portability. In terms of the implementation technology, the overall technical roadmap is as Figure 2 shown, and it is divided into four steps.
[0092] First, the implementation of the algorithm requires setting hyperparameters, including the linear parameter of the connected component threshold and the positions of the entrance and exit coils for vehicle counting. Although the viewing angle that the camera can observe is fixed, due to different placement angles, the pixel sizes of vehicles of the same size in the image are different, as Figure 3 shown. This requires the present invention to make a conversion. Before starting the detection, the user is required to manually circle the smallest observed vehicles at two different positions, and then calculate the filtering thresholds for vehicles at different positions based on the areas, lengths, and widths of these two vehicles.
[0093] At any viewing angle, the filtering thresholds for vehicles at different positions actually have a linear relationship FT(p) = kp + b, where FT(x) represents the filtering threshold and p represents the position in the coordinate system where the vehicle is located. Therefore, only by finding k and b can this linear relationship be determined. According to the two regions [x 1 y 1 ,ω 1 ,h 1 and [x 2 y 2 ,w 2 ,h 2 manually circled by the user, since there is a linear relationship, the parameters in the filtering threshold for the x coordinate system are as shown in formula (1):
[0094]
[0095] And for the parameters in the filtering threshold for the y coordinate system, they are formula (2):
[0096]
[0097] The present invention defines FT x (p): = k x p + b x ,FTy(p): = k y p + b y . The present invention also requires the user to set the virtual entrance and exit coils. Assuming the coil position is Coil(x, y, w, h), when the center point of the detected vehicle car(cx, cy) satisfies cx > x, cx < x + w, cy > y, and cy < y + h, it is considered that the vehicle passes through the virtual coil.
[0098] Next, the present invention needs to preprocess the video frames. Still limited by the relatively weak performance of the ARM, due to the need for timely detection, it is difficult for the present invention to stably obtain a stable interval between two adjacent frames. As a result, the sizes of the blurs of the dynamic images obtained by the frame difference method are inconsistent, which will seriously affect the detection effect. At this time, the present invention can only obtain the images of moving objects by reducing the frame rate or other methods. The Gaussian mixture model is an algorithm that can perform background subtraction. It is considered that within a certain period of time, each background pixel will show a certain randomness over time, and its distribution is within a certain mean μ and variance σ range in the Gaussian distribution. Values greater than this range are considered foreground. Through this algorithm, after preprocessing and modeling for a certain period of time, the present invention can obtain a relatively stable foreground for subsequent processing. The present invention also binarizes the obtained foreground, which is beneficial to saving computational costs. Before performing the Gaussian mixture model modeling, the present invention grayscales the image. In this way, when modeling, only the pixels of one channel need to be processed, saving computational costs without affecting performance.
[0099] After obtaining the binarized foreground, the present invention performs filtering processing, which is mainly to solve the problem of noise. Since the target application of the present invention is in a real scene, the flashing lights in the commercial street, the swaying branches in the wind, etc. may all be considered dynamic objects. At this time, the present invention needs to filter these noises, such as median filtering (this is performed before MOG) as Figure 4 shown, erosion filtering as Figure 5 shown, dilation filtering as Figure 6 shown, etc. After the filtering processing, the present invention can obtain a binary image that can display the relatively clear outlines of vehicles and other dynamic objects after filtering out small noises.
[0100] In the vehicle counting function, the present invention uses technologies such as contour detection, target tracking, and virtual coils. The present invention requires the user to set an entrance virtual coil and an exit virtual coil. In the image after the morphological processing of binarization, the present invention first detects the closed contours and filters out other dynamic objects through area, length, and width. Its algorithm flow is as Figure 7 shown.
[0101] The filtered dynamic vehicles are the targets to be detected by the present invention. At this time, the present invention adds the vehicles entering the entrance virtual coil to the tracking list with their center points. For each frame, it searches for the nearest target whose vertical and horizontal distances are less than the length and width as the updated position. When the center point enters the exit virtual coil, the vehicle is marked and counted, as Figure 7 shown. At this time, the present invention has completed the preliminary counting, but there are still some problems.
[0102] In the test version of the present invention, due to observation problems, there will be issues such as large vehicles blocking small vehicles and vehicles being too close resulting in connectivity problems. Thanks to the above-mentioned target filtering technology, the present invention cuts the detected contours at the entrance coil according to the filtering size, counts them as multiple vehicles, and then, if the target splits during the subsequent detection process, tracks them separately. Similarly, when multiple vehicles are blocked or connected during tracking, the present invention sets these possible targets as the same target (connected target). If they remain connected until passing through the exit coil, they are counted; if they separate during this period, they are tracked separately. In this way, the accuracy is improved in terms of occlusion and connectivity problems within an acceptable error range.
[0103] Finally, the present invention needs to generate a traffic flow statistics report based on the counting results. In software design, the present invention designs an entrance virtual coil and multiple exit virtual coils to facilitate detection at one exit. Usually, in the traffic flow statistics report, it is necessary to count the standard passenger car unit (PCU). The present invention also designs for converting the detection records into PCU records, and it can achieve the effect through simple union operation counting.
[0104] There are two types of generated reports. One is the time when each vehicle passes through the exit virtual coil as shown in Table 2, and the other is the output traffic flow statistics table as shown in Table 3. When generating the traffic flow statistics table, it is necessary to input the experiment time, experiment location, observation window, and experiment personnel.
[0105] Table 2 Record of Vehicles Passing through the Exit Coil
[0106] Vehicles Passed Date of Passage Time of Passage 1 2020 / 7 / 14 19:55:39 2 2020 / 7 / 14 19:55:44 3 2020 / 7 / 14 19:55:45 4 2020 / 7 / 14 19:55:45 5 2020 / 7 / 14 19:55:46 6 2020 / 7 / 14 19:55:47 7 2020 / 7 / 14 19:55:47 8 2020 / 7 / 14 19:55:47 9 2020 / 7 / 14 19:55:48 10 2020 / 7 / 14 19:55:48 11 2020 / 7 / 14 19:55:49 12 2020 / 7 / 14 19:55:50 13 2020 / 7 / 14 19:55:51
[0107] Table 3 Traffic Flow Statistics Table
[0108]
[0109] The usage process of the present invention is shown as Figure 8 follows. First, the user places the device at a high place, then opens the software. The software application gives the user a static picture through the camera. The user sets the virtual coils at the entrance and exit, and then asks the user to circle two or more reference vehicles in the static picture. After setting the above content, click the start detection button to start the vehicle counting work. After the vehicle counting is completed, the software will automatically generate a record of vehicles passing through the exit coil, and the user can generate a traffic flow statistics table according to the needs.
[0110] The key point of the technical solution of this invention is to design a traffic flow survey device with low energy consumption, portability, strong environmental adaptability and high accuracy. The present invention carries the algorithm for realizing vehicle identification, tracking and counting on the ARM platform. The deep learning algorithm can also realize the above functions, but the relatively cheap ARM platform has low computing power and cannot process images quickly. Therefore, the present invention uses traditional algorithms to realize the above functions and implements them on the Raspberry Pi, for example: manually circling the size of the vehicle to prevent lens distortion from causing errors in identifying the vehicle; binarizing the image to reduce the amount of calculation; using filtering to eliminate interference from obstacles; and using manually circumscribed exit coils and entrance coils for counting.
[0111] 1. The system testing and verification of the invention can be divided into the following aspects: first, the unit test algorithm is used to test the effect of each module in the work; the hardware test is used to test the stability of the work; and the black box test is used to test whether the work has achieved the expected effect.
[0112] (1) Video frame preprocessing unit test
[0113] We obtained the foreground from several adjacent frames in the video and then binarized it. The test results are as follows: Figure 9 , Figure 10 From the figure, we can see that we have extracted the dynamic foreground objects in the video, and after binarization, we can distinguish the contours of the dynamic objects.
[0114] (2) Morphological processing unit test
[0115] The foreground image extracted after video frame processing has a lot of noise. We hope to remove the noise and retain the original connected area after morphological processing. For this reason, morphological processing is proposed and tested. The effect after morphological processing in the above picture is as follows: Figure 11 As can be seen from the figure, the noise has disappeared and the outline of the vehicle has been preserved.
[0116] (3) Vehicle counting unit test
[0117] We need to count the vehicles after they pass through the entry coil and then the exit coil. Here we test the vehicles after they pass through the two coils in sequence. The software successfully counts the vehicles that enter the exit coil, such as Figure 12 .
[0118] (4) Traffic flow statistics report unit test
[0119] After stopping the vehicle counting, the traffic flow during the entire statistical time was counted. First, it was necessary to set the content of the table, including the experiment time (automatically generated according to the system time), experiment location, observation window, experiment personnel, etc. Then, a record table of vehicles passing through the exit coil and a traffic flow statistics table were automatically generated. The implemented reports are shown in Table 2 and Table 3 respectively. In summary, we conducted unit tests on the functions of all core algorithm parts in the software and eliminated potential problems.
[0120] 2. Black-box testing
[0121] We designed black-box test cases based on the software requirements. The black-box test table is shown in Table 4.
[0122] Table 4 Black-box test table
[0123]
[0124] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in whole or in part in the form of a computer program product, the computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state drive (SSD)).
[0125] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention shall cover any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention within the protection scope of the present invention.
Claims
1. A portable vehicle video target recognition and tracking method, characterized in that, the portable vehicle video target recognition and tracking method comprises the following steps: Step 1, set hyperparameters; Step 2, perform foreground extraction; Step 3, perform morphological processing; Step 4, perform vehicle counting; In Step 1, the hyperparameters include the linear parameter of the connected region threshold and the entry and exit coil positions for vehicle counting; wherein, setting the hyperparameters includes: (1) Set a reference vehicle; (2) Calculate the connected region screening threshold; (3) Set the entry and exit coils; In Step 1, setting the hyperparameters further includes: Before starting the detection, the user manually circles the smallest observed vehicles at two different positions; according to the areas, lengths, and widths of these two vehicles, calculate the filtering thresholds for vehicles at different positions; At any observation angle, the filtering thresholds of vehicles at different positions have a linear relationship FT(p) = kp + b, where FT(x) represents the filtering threshold and p represents the position in the coordinate system where the vehicle is located. Therefore, only k and b need to be obtained to determine this linear relationship; according to the two regions [x 1 y 1 , w 1 , h 1 and [x 2 y 2 , w 2 h 2 manually circled by the user, due to the linear relationship, the parameters in the filtering threshold in the x coordinate system are as shown in the following formula: And for the parameters in the filtering threshold in the y coordinate system, they are as shown in the following formula: Define FT x (p) := k x p + b x , FT y (p) := k y p + b y ; The user sets the entrance and exit virtual coils. Assume the coil position is Coil(x, y, w, h). When the center point of the detected vehicle car(cx, cy) satisfies cx > x, cx < x + w, cy > y, and cy < y + h, it is considered that the vehicle has passed through the virtual coil; In Step 4, the vehicle counting further includes: (1) Use the technologies of contour detection, target tracking, and virtual coils. The user sets the entry virtual coil and the exit virtual coil; in the binary morphological processed image, detect the closed contours and filter out other dynamic objects through area, length, and width; (2) The filtered dynamic vehicles are the detection targets. Add the vehicles entering the entry virtual coil to the tracking list with the center point. For each frame, find the nearest target with vertical and horizontal distances less than the length and width as the updated position. When the center point enters the exit virtual coil, mark the vehicle and count; (3) Cut the detected contours at the entry coil according to the filtering size and count them as multiple vehicles; during the detection process, if the target splits, track them separately. When multiple vehicles are occluded or connected during tracking, set the targets as the same target, that is, the connected targets; if they remain connected until passing through the exit coil, count them. If they separate during this period, track them separately; (4) Generate a traffic flow statistics report for the counting result; design an entry virtual coil and multiple exit virtual coils; in the traffic flow statistics report, count the passenger car unit (PCU) number of standard vehicles. Design for converting the detection record into a PCU record, and count through simple union operations.
2. The portable vehicle video target recognition and tracking method according to claim 1, characterized in that, in Step 2, the foreground extraction includes: (1) Median filtering to smooth the noise and display the binary image, which is beneficial to saving the calculation cost; (2) Grayscale conversion, so that only one channel of pixels needs to be processed during modeling, saving the calculation cost without affecting the performance; (3) Establish a Gaussian model.
3. The portable vehicle video target recognition and tracking method according to claim 1, characterized in that, in Step 3, the morphological processing includes: (1) Erosion filtering to remove noise points and eliminate other dynamic objects except vehicles; (2) Dilation filtering for restoration, filtering out small noise points and finally displaying the clear contours of vehicles and other dynamic objects.
4. The portable vehicle video target recognition and tracking method according to claim 1, characterized in that, in Step 4, the vehicle counting includes: (1) Find connected regions; (2) Screen connected regions to make the vehicle counting structure accurate; (3) Perform entrance coil detection; if yes, add it to the tracking list; if not, find the vehicle that meets the moving distance from the list; (4) Perform exit coil detection; if yes, remove the tracking list, record the system time, and add it to the statistical list; if not, update the vehicle position.
5. A portable vehicle video target recognition and tracking system applying the portable vehicle video target recognition and tracking method according to any one of claims 1 to 4, characterized in that the portable vehicle video target recognition and tracking system includes a main control module, a camera module, a power supply module, a display module and a housing, and the overall combined size is 8 cm * 4.6 cm * 5 cm.
6. An information data processing terminal, characterized in that the information data processing terminal is used to implement the portable vehicle video target recognition and tracking system according to claim 5.
Citation Information
Patent Citations
Method for traffic flow statistics based on video monitoring
CN104599502A
Road vehicle detection method and apparatus, and traffic parameter detection method and apparatus
CN107945523A