Bus passenger flow statistical method and system based on thermal imaging human body characteristics
Through image processing and Kalman filtering technology based on thermal imaging monocular cameras, the complexity and accuracy of binocular vision system are solved, and efficient and accurate counting of bus passenger flow statistics is achieved, which is suitable for passengers in bus scenarios monitor.
Patent Information
- Application Number
- CN202411203826.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-11-22
AI Technical Summary
The existing bus passenger flow statistics method based on binocular vision has complex structure, high cost and large calculations, resulting in many noise and hollows in the depth map, making it difficult to meet practical requirements.
Using the image processing method based on the thermal imaging monocular camera, the connection domain is calculated and merged through grayscale, filtering, corrosion and expansion processing, and the passenger matching and statistics are performed in combination with Kalman filtering to achieve accurate tracking and counting of passengers' boarding and getting off the vehicle. .
This method is simple and practical, with a small amount of calculation, which can improve the accuracy of passenger flow statistics, and the identification of the human body's thermal radiation sources under masks, hats, sunglasses, etc. is not disturbed, which improves the statistical accuracy.
Smart Images

Figure CN119007117A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of passenger flow statistics management in public transportation vehicles, in particular to a bus passenger flow statistics method and system based on thermal imaging human body features. Background Art
[0002] The existing bus passenger flow counting method mainly collects the video stream of passengers getting on and off the bus at the front and rear doors based on image processing methods, and analyzes the video stream to achieve the purpose of counting the number of people getting on and off the bus. This method is mainly divided into two parts: pedestrian target recognition and tracking. The existing image processing method is based on binocular vision. This method performs background difference on the video stream and integrates depth information to extract pedestrian targets. Finally, the movement trajectory of pedestrians is mathematically statistically modeled and tracked, and the trajectory of pedestrians is analyzed and judged to calculate the number of pedestrians.
[0003] The main disadvantages of binocular vision systems are complex structures, high costs, large amounts of computation, and very high performance requirements for computing units, which makes it difficult to miniaturize products based on binocular systems. At present, the depth map calculated by binocular vision-based solutions has many noise points and holes, which can easily cause missed detection and false detection of pedestrians, making it difficult to achieve practical accuracy. Summary of the invention
[0004] In view of the above problems, the present invention provides a bus passenger flow counting method based on thermal imaging human body features, which uses the video stream generated by a thermal imaging monocular camera to perform image processing and feature tracking to count and record the number of passengers getting on and off the bus. The method is simple and practical, and requires little calculation.
[0005] The technical solution adopted by the present invention is: A bus passenger flow counting method based on thermal imaging human body features, characterized by comprising the following steps: Step S1, collecting images, using a thermal imaging monocular camera installed on a bus to obtain a frame of image as a collected image, and converting it into an RGB image; Step S2, image processing, grayscale, filtering, corrosion and expansion processing are performed on the RGB image, connected domains are calculated, and two adjacent connected domains whose centers are on the same vertical coordinate are merged to obtain a new image; Step S3, comparative analysis, traversing the new image obtained in step S2, fitting the circumscribed rectangle of each connected domain, and directly discarding it when the aspect ratio of the rectangle does not meet the set aspect ratio threshold range; when the aspect ratio of the rectangle meets the set aspect ratio threshold range, it is marked as a passenger and assigned a temporary ID; Step S4, passenger matching, using Kalman filtering, matching the passenger obtained in step S3 with the passenger in the previous frame image, if the match is successful, updating the rectangular position and size of the old passenger; if the match is unsuccessful, marking the new passenger, giving it a unique ID, and updating the rectangular position and size of the passenger; Step S5, statistics and analysis, statistics and analysis are performed on the movement behaviors of the passenger rectangles of the continuous frames obtained in step S4. When the number of continuous frames of the passenger meets the set frame number threshold, if the center of gravity of the passenger rectangle moves from bottom to top and to the right, and the area of the rectangle tends to increase from small to large, it is considered that the passenger is getting on the bus, and the number of passengers getting on the bus is increased by 1. If the center of gravity of the passenger rectangle moves from top to bottom, and the area of the rectangle tends to decrease from large to small, it is considered that the passenger is getting off the bus, and the number of passengers getting off the bus is increased by 1.
[0006] Preferably, in step S1, the thermal imaging monocular camera installed on the bus can cover the highest drop to the lowest drop formed between the scene when the passenger stands outside the bus door and the scene after the passenger completely enters the bus.
[0007] Preferably, step S2 specifically includes the following steps: Step S2.1, grayscale processing, selecting the R channel value of the RGB image as the image source to obtain a grayscale image; Step S2.2, denoising, setting the scanning kernel to 3, performing median filtering on the grayscale image obtained in step S2.1 to obtain a filtered image; Step S2.3, image binarization, adjusting the threshold of the filtered image obtained in step S2.2 to obtain a binarized image; Step S2.4, image erosion, set the scan kernel to 7, use the erosion operation of image processing, traverse the binary image obtained in step S2.3, and obtain the eroded image; Step S2.5, image expansion, set the scanning kernel to 5, use the expansion operation of image processing, traverse the eroded image obtained in step S2.4, and obtain the expanded image; Step S2.6, calculate the connected domain, use "8-domain" to find the connected domain, traverse the expanded image obtained in step S2.5, mark the connected domain, calculate the area and center of the connected domain, when the calculated connected area is less than the set minimum area threshold, or greater than the set maximum area threshold, directly filter to obtain the image after filtering the connected domain area; Step S2.7, connected domain merging, traverse the image obtained in step 2.6 from top to bottom, and when the centers of two connected domains in the image are close to the same vertical coordinate and the nearest edge distance is less than the set edge distance threshold, merge them to obtain a new image.
[0008] Preferably, in step S2.6, within the 800x600 image range, the minimum area threshold is 4000 and the maximum area threshold is 30000.
[0009] Preferably, in step S2.7, within the 800x600 image range, the edge distance threshold is 30.
[0010] Preferably, in step S3, the aspect ratio threshold range is 0.55-0.78.
[0011] Preferably, in step S4, the frame number threshold is set to 60.
[0012] The present invention also provides a bus passenger flow counting system based on thermal imaging human body features, comprising: An image acquisition module uses a frame of image acquired by a thermal imaging monocular camera as an acquisition image; An image processing module processes the collected image to obtain an image with a connected domain; The analysis and comparison module fits a circumscribed rectangle to each connected domain in the image, compares the rectangular aspect ratio of the connected domain in the image with a preset aspect ratio threshold range, marks those within the preset aspect ratio threshold range as passengers, and assigns a temporary ID; The passenger matching module matches the passenger assigned with the temporary ID with the passenger in the previous frame image. If the match is successful, the rectangular position and size of the old passenger are updated; if the match is unsuccessful, the new passenger is marked and assigned a unique ID. The statistics and analysis module counts and analyzes the movement behavior of the passenger rectangle in consecutive frames. When the number of consecutive frames of the passenger meets the set frame number threshold, if the center of gravity of the passenger rectangle moves from bottom to top and to the right, and the area of the rectangle tends to increase from small to large, it is considered that the passenger is getting on the bus, and the number of passengers getting on the bus is increased by 1. If the center of gravity of the passenger rectangle moves from top to bottom, and the area of the rectangle tends to decrease from large to small, it is considered that the passenger is getting off the bus, and the number of passengers getting off the bus is increased by 1.
[0013] Preferably, the thermal imaging monocular camera in the image acquisition module is installed on the bus, and the thermal imaging monocular camera can cover the highest drop to the lowest drop formed between the scene of passengers standing outside the bus door and the scene after the passengers completely enter the bus; in the image processing module, the collected images are processed in sequence by grayscale, noise reduction, binarization, corrosion and expansion, and the "8-domain" is used to find the marked connected domain, calculate the area and center of the connected domain, filter the connected domains that exceed the minimum area threshold and the maximum area threshold, and merge when the centers of the two connected domains are close to the same vertical coordinate and the nearest edge distance is less than the set edge distance threshold; in the analysis and comparison module, when the aspect ratio of the connected domain fitting rectangle does not meet the set aspect ratio threshold range, it is directly discarded.
[0014] More preferably, within the range of 800x600 images, the minimum area threshold is 4000, the maximum area threshold is 30000, the edge distance threshold is 30, the aspect ratio threshold is 0.55-0.78; and the frame number threshold is 60.
[0015] Compared with the prior art, the beneficial effects of the present invention are: the present invention provides a bus passenger flow counting method based on thermal imaging human body features, which uses the video stream generated by a thermal imaging monocular camera to perform image processing and feature tracking to count and record the number of passengers getting on and off the bus. The method is simple and practical, with low calculation amount. In the bus scene, the human body is an ideal thermal radiation source compared to the surrounding objects. Wearing a mask, a hat, sunglasses, or partial occlusion will not interfere with the thermal imaging, thereby improving the accuracy of passenger flow statistics. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 , which is a block diagram of a bus passenger flow statistics method based on thermal imaging human body features provided by the present invention; Figure 2 , which is a block diagram of step S2 in a bus passenger flow counting method based on thermal imaging human body features provided by the present invention; Figure 3 , which is a flow chart of a bus passenger flow statistics method based on thermal imaging human body features provided by the present invention. DETAILED DESCRIPTION
[0017] The preferred embodiments of the present invention are described in detail with reference to the accompanying drawings.
[0018] The present invention provides a bus passenger flow counting method based on thermal imaging human body features, comprising the following steps: Step S1, collecting images, using a thermal imaging monocular camera installed on a bus to obtain a frame of image as a collected image, and converting it into an RGB image; Step S2, image processing, grayscale, filtering, corrosion and expansion processing are performed on the RGB image, connected domains are calculated, and two adjacent connected domains whose centers are on the same vertical coordinate are merged to obtain a new image; Step S3, comparative analysis, traversing the new image obtained in step S2, fitting the circumscribed rectangle of each connected domain, and directly discarding it when the aspect ratio of the rectangle does not meet the set aspect ratio threshold range; when the aspect ratio of the rectangle meets the set aspect ratio threshold range, it is marked as a passenger and assigned a temporary ID; Step S4, passenger matching, using Kalman filtering, matching the passenger obtained in step S3 with the passenger in the previous frame image, if the match is successful, updating the rectangular position and size of the old passenger; if the match is unsuccessful, marking the new passenger, giving it a unique ID, and updating the rectangular position and size of the passenger; Step S5, statistics and analysis, statistics and analysis of the movement behavior of the passenger rectangle of the continuous frames obtained in step S4, when the number of continuous frames of the passenger meets the set frame number threshold, if the center of gravity of the passenger rectangle moves from bottom to top and right, and the rectangular area tends to increase from small to large, it is considered that the passenger is getting on the bus, and the number of passengers getting on the bus is increased by 1; if the center of the passenger rectangle moves from top to bottom, and the rectangular area tends to decrease from large to small, it is considered that the passenger is getting off the bus, and the number of passengers getting off the bus is increased by 1. In step S4, the aspect ratio threshold range is 0.55~0.78; in step S5, the set frame number threshold is 60.
[0019] In step S1, the thermal imaging monocular camera installed on the bus can cover the highest drop to the lowest drop between the scene of passengers standing outside the bus door and the scene of passengers completely entering the bus. Since passengers get on and off the bus, there will be two height difference scenes, one is standing outside the bus door, and the other is completely entering the bus. The installed thermal imaging monocular camera should try to illuminate the door horizontally, just enough to cover the highest drop to the lowest drop.
[0020] Step S2 specifically includes the following steps: Step S2.1, grayscale processing, selecting the R channel value of the RGB image as the image source to obtain a grayscale image; Step S2.2, denoising, setting the scanning kernel to 3, performing median filtering on the grayscale image obtained in step S2.1 to obtain a filtered image; Step S2.3, image binarization, adjusting the threshold of the filtered image obtained in step S2.2 to obtain a binarized image; Step S2.4, image erosion, set the scan kernel to 7, use the erosion operation of image processing, traverse the binary image obtained in step S2.3, and obtain the eroded image; Step S2.5, image expansion, set the scanning kernel to 5, use the expansion operation of image processing, traverse the eroded image obtained in step S2.4, and obtain the expanded image; Step S2.6, calculate the connected domain, use "8-domain" to find the connected domain, traverse the expanded image obtained in step S2.5, mark the connected domain, calculate the area and center of the connected domain, when the calculated connected area is less than the set minimum area threshold, or greater than the set maximum area threshold, directly filter to obtain the image after filtering the connected domain area; Step S2.7, traverse the image obtained in step 2.6 from top to bottom. When the centers of two connected domains in the image are close to the same vertical coordinate and the nearest edge distance is less than the set edge distance threshold, merge them to obtain a new image.
[0021] Among them, step S2 processes the image to form an image area of a person in the image. Step S2.2, median filtering the image is to remove all noise without affecting the original image. Step S2.3, select a threshold of 200 to binarize the image; the threshold can be slightly adjusted according to the actual situation. Step S2.4, corrosion operation, traverse the image obtained in step 4, to remove small spots regarded as noise, and obtain the corroded image. The expansion operation in step S2.5 is used to slightly expand the features to facilitate the supplement of connection details. In step S2.6, each connected domain is independent of each other, and the area of the connected domain needs to be between the minimum area threshold and the maximum area threshold. Within the 800x600 image range, the minimum area threshold is 4000 and the maximum area threshold is 30000; when the area of the connected domain exceeds the preset area threshold, the connected domain is filtered. In step S2.7, two adjacent connected domains whose centers are on the same vertical coordinate are merged, and the edge distance threshold between the two connected domains is required to be 30; for example, the connected domain corresponding to the human head is merged with the connected domain corresponding to the human body to form a human image area. In steps S2.2, S2.4 and S2.5, the scanning kernel usually refers to the convolution kernel (filter) used in image processing or convolution operations; for example, a scanning kernel of 3 means using a 3x3 convolution kernel (filter). The 3x3 kernel is used to process image data, and by sliding the kernel on the image, weighted averaging of pixel values or other operations are performed to achieve blurring, sharpening and other effects.
[0022] The present invention also provides a bus passenger flow counting system based on thermal imaging human body features, comprising: An image acquisition module uses a frame of image acquired by a thermal imaging monocular camera as an acquisition image; An image processing module processes the collected image to obtain an image with a connected domain; The analysis and comparison module fits a circumscribed rectangle to each connected domain in the image, compares the rectangular aspect ratio of the connected domain in the image with a preset aspect ratio threshold range, marks those within the preset aspect ratio threshold range as passengers, and assigns a temporary ID; The passenger matching module matches the passenger assigned with the temporary ID with the passenger in the previous frame image. If the match is successful, the rectangular position and size of the old passenger are updated; if the match is unsuccessful, the new passenger is marked and assigned a unique ID. The statistics and analysis module counts and analyzes the movement behavior of the passenger rectangle in consecutive frames. When the number of consecutive frames of the passenger meets the set frame number threshold, if the center of gravity of the passenger rectangle moves from bottom to top and to the right, and the area of the rectangle tends to increase from small to large, it is considered that the passenger is getting on the bus, and the number of passengers getting on the bus is increased by 1. If the center of gravity of the passenger rectangle moves from top to bottom, and the area of the rectangle tends to decrease from large to small, it is considered that the passenger is getting off the bus, and the number of passengers getting off the bus is increased by 1.
[0023] In the image acquisition module, the thermal imaging monocular camera is installed on the bus. The thermal imaging monocular camera can cover the highest drop to the lowest drop between the scene of passengers standing outside the bus door and the scene after the passengers completely enter the bus. In the image processing module, the collected images are processed in grayscale, noise reduction, binarization, corrosion and expansion in turn. The "8-domain" is used to find the marked connected domain, calculate the area and center of the connected domain, filter the connected domains that exceed the minimum area threshold and the maximum area threshold, and merge when the centers of the two adjacent connected domains are close to the same vertical coordinate and the nearest edge distance is less than the set edge distance threshold. In the analysis and comparison module, when the aspect ratio of the connected domain fitting rectangle does not meet the set aspect ratio threshold range, it is directly discarded. Among them, in the 800x600 image range, the minimum area threshold is 4000, the maximum area threshold is 30000, the edge distance threshold is 30, the aspect ratio threshold is 0.55~0.78; the frame number threshold is 60.
[0024] The present invention provides a passenger flow counting method based on thermal imaging human body features, which uses a video stream generated by a thermal imaging monocular camera to perform image processing and feature tracking to count and record the number of passengers getting on and off the bus. The method is simple and practical, with low calculation amount. In the bus scene, the human body is an ideal thermal radiation source compared to the surrounding objects. Wearing a mask, a hat, sunglasses, or partial occlusion will not interfere with the thermal imaging, thereby improving the accuracy of passenger flow counting.
[0025] In summary, the technical solution of the present invention can fully and effectively achieve the above-mentioned invention purpose, and the structure and functional principle of the present invention have been fully verified in the embodiments, and can achieve the expected effect and purpose. Without departing from the principle and essence of the present invention, various changes or modifications can be made to the embodiments of the invention. Therefore, the present invention includes all replacement contents within the scope mentioned in the scope of the patent application, and any equivalent changes made within the scope of the patent application of the present invention are within the scope of the patent application of this case.
Claims
1. A bus passenger flow statistics method based on thermal imaging human features, It is characterized in that The following steps are involved: Step S1, collecting images, using a thermal imaging monocular camera installed on the bus to obtain a frame of image as a collected image, and converting it into an RGB image; Step S2, image processing, grayscale, filtering, corrosion and expansion processing are performed on the RGB image, connected domains are calculated, and two adjacent connected domains whose centers are on the same vertical coordinate are merged to obtain a new image; Step S3, comparative analysis, traversing the new image obtained in step S2, fitting the circumscribed rectangle of each connected domain, and directly discarding it when the aspect ratio of the rectangle does not meet the set aspect ratio threshold range; when the aspect ratio of the rectangle meets the set aspect ratio threshold range, it is marked as a passenger and assigned a temporary ID; Step S4, passenger matching, using Kalman filtering, matching the passenger obtained in step S3 with the passenger in the previous frame image, if the match is successful, updating the rectangular position and size of the old passenger; if the match is unsuccessful, marking the new passenger, giving it a unique ID, and updating the rectangular position and size of the passenger; Step S5, statistics and analysis, statistics and analysis are performed on the movement behaviors of the passenger rectangles of the continuous frames obtained in step S4. When the number of continuous frames of the passenger meets the set frame number threshold, if the center of gravity of the passenger rectangle moves from bottom to top and to the right, and the area of the rectangle tends to increase from small to large, it is considered that the passenger is getting on the bus, and the number of passengers getting on the bus is increased by 1. If the center of gravity of the passenger rectangle moves from top to bottom, and the area of the rectangle tends to decrease from large to small, it is considered that the passenger is getting off the bus, and the number of passengers getting off the bus is increased by 1.
2. The bus passenger flow counting method based on thermal imaging human features according to claim 1, Features: In step S1, the thermal imaging monocular camera installed on the bus can cover the highest drop to the lowest drop between the scene when the passenger stands outside the bus door and the scene after the passenger completely enters the bus.
3. The bus passenger flow counting method based on thermal imaging human features according to claim 1, Features: Step S2 specifically includes the following steps: Step S2.1, grayscale processing, selecting the R channel value of the RGB image as the image source to obtain a grayscale image; Step S2.2, denoising, setting the scanning kernel to 3, performing median filtering on the grayscale image obtained in step S2.1 to obtain a filtered image; Step S2.3, image binarization, adjusting the threshold of the filtered image obtained in step S2.2 to obtain a binarized image; Step S2.4, image erosion, set the scan kernel to 7, use the erosion operation of image processing, traverse the binary image obtained in step S2.3, and obtain the eroded image; Step S2.5, image expansion, set the scanning kernel to 5, use the expansion operation of image processing, traverse the eroded image obtained in step S2.4, and obtain the expanded image; Step S2.6, calculate the connected domain, use "8-domain" to find the connected domain, traverse the expanded image obtained in step S2.5, mark the connected domain, calculate the area and center of the connected domain, when the calculated connected domain area is less than the set minimum area threshold, or greater than the set maximum area threshold, directly filter to obtain the image after filtering the connected domain area; Step S2.7, connected domain merging, traverse the image obtained in step 2.6 from top to bottom, and when the centers of two connected domains in the image are close to the same vertical coordinate and the nearest edge distance is less than the set edge distance threshold, merge them to obtain a new image.
4. The bus passenger flow counting method based on thermal imaging human features according to claim 3, Features: In step S2.6, within the 800x600 image range, the minimum area threshold is 4000 and the maximum area threshold is 30000.
5. The bus passenger flow counting method based on thermal imaging human features according to claim 3, Features: In step S2.7, within the 800x600 image range, the edge distance threshold is 30.
6. The bus passenger flow counting method based on thermal imaging human features according to claim 1, Features: In step S3, the aspect ratio threshold range is 0.55-0.
78.
7. The bus passenger flow counting method based on thermal imaging human features according to claim 1, Features: In step S4, the frame number threshold is set to 60.
8. A statistical system for bus passenger flow statistics based on thermal imaging human features, Features: include: An image acquisition module uses a frame of image acquired by a thermal imaging monocular camera as an acquisition image; An image processing module processes the collected image to obtain an image with a connected domain; The analysis and comparison module fits a circumscribed rectangle to each connected domain in the image, compares the rectangular aspect ratio of the connected domain in the image with a preset aspect ratio threshold range, marks those within the preset aspect ratio threshold range as passengers, and assigns a temporary ID; The passenger matching module matches the passenger assigned with the temporary ID with the passenger in the previous frame image. If the match is successful, the rectangular position and size of the old passenger are updated; if the match is unsuccessful, the new passenger is marked and assigned a unique ID. The statistics and analysis module counts and analyzes the movement behavior of the passenger rectangle in consecutive frames. When the number of consecutive frames of the passenger meets the set frame number threshold, if the center of gravity of the passenger rectangle moves from bottom to top and to the right, and the area of the rectangle tends to increase from small to large, it is considered that the passenger is getting on the bus, and the number of passengers getting on the bus is increased by 1. If the center of gravity of the passenger rectangle moves from top to bottom, and the area of the rectangle tends to decrease from large to small, it is considered that the passenger is getting off the bus, and the number of passengers getting off the bus is increased by 1.
9. The statistical system of the bus passenger flow statistical method based on thermal imaging human features according to claim 8, Features: In the image acquisition module, a thermal imaging monocular camera is installed on the bus. The thermal imaging monocular camera can cover the highest drop to the lowest drop between the scene of passengers standing outside the bus door and the scene after the passengers completely enter the bus. In the image processing module, the collected images are processed in grayscale, noise reduction, binarization, corrosion and expansion in turn, and the "8-domain" is used to find the marked connected domain, calculate the area and center of the connected domain, filter the connected domains that exceed the minimum area threshold and the maximum area threshold, and merge them when the centers of the two connected domains are close to the same vertical coordinate and the nearest edge distance is less than the set edge distance threshold. In the analysis and comparison module, when the aspect ratio of the connected domain fitting rectangle does not meet the set aspect ratio threshold, it is directly discarded.
10. The statistical system of the bus passenger flow statistical method based on thermal imaging human features according to claim 9, Features: In the 800x600 image range, the minimum area threshold is 4000, the maximum area threshold is 30000, the edge distance threshold is 30, the aspect ratio threshold is 0.55~0.78; the frame number threshold is 60.
Citation Information
Patent Citations
Method for counting passenger flow of buses in real time
CN101794382A
Bus passenger flow statistics method based on multi-motion passenger behavior analysis
CN103646253A
Multi-scene pedestrian volume counting method and system based on stereoscopic vision and binocular camera
CN104902258A
Thermal-imaging-based night passenger flow statistic method and system of bus station
CN106934356A
Bus monocular passenger flow statistical method and system
CN114255430A
Cited By
Public transport passenger flow monitoring method and system based on human body detection
CN120451915A
A method and system for monitoring public transportation passenger flow based on human body detection
CN120451915B
A waiting passenger flow counting method based on UWB radar
CN122754940A
