Passenger flow statistics method, system and computer readable storage medium

Through the passenger flow statistics method based on the optical flow algorithm, the existing passenger flow statistics methods have been solved, and the passenger flow statistics effect with high accuracy and low cost are achieved.

CN112102290BActive Publication Date: 2025-02-28SHENZHEN JIMI SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010970214.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-15
Publication Date
2025-02-28
Estimated Expiration
2040-09-15

AI Technical Summary

Technical Problem

The existing passenger flow statistics methods have problems with low accuracy and high cost, especially the high cost of manual statistics, low accuracy of IC card information statistics, high sensor detection costs and inconvenient maintenance, inter-frame differential and background differential statistics rely on the environment and have low accuracy, and machine learning detection has high requirements for computing power, resulting in high equipment costs.

Method used

The passenger flow statistics method based on the optical flow algorithm is adopted, and the optical flow prediction result image is calculated by obtaining video image frames, and the optical flow prediction result image is divided into optical flow diagrams based on the optical flow prediction result image. The optical flow prediction point is set as the foreground pixel point to count the passengers' boarding and getting off the train.

Benefits of technology

It improves the accuracy of passenger flow statistics, reduces equipment costs, and does not require additional equipment and sample data training. The optical flow method is independent of environmental changes, reducing the calculation and operating costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112102290B_ABST
    Figure CN112102290B_ABST
Patent Text Reader

Abstract

The present invention discloses a passenger flow counting method, system and computer-readable storage medium, wherein the passenger flow counting method comprises: obtaining a video image frame, and preprocessing the video image frame to obtain an image frame to be detected; calculating the image frame to be detected according to a preset optical flow algorithm to obtain an optical flow prediction result image; and obtaining a passenger flow counting result according to the optical flow prediction result image. The present invention can improve the accuracy of passenger flow counting and reduce costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a passenger flow counting method, system and computer-readable storage medium. Background Art

[0002] With the rapid development of social economy and technology, more and more places need to count passenger flow, such as public transportation, shopping malls, scenic spots and other places with large passenger flow. For public transportation management, using real-time passenger flow data as the management basis can reasonably dispatch vehicles and efficiently select departure intervals, thereby improving the utilization rate of public resources.

[0003] At present, passenger flow statistics methods include manual statistics, IC (Integrated Circuit) card information statistics, sensor detection statistics, inter-frame difference statistics, background difference statistics, and machine learning detection statistics. Among them, manual statistics have high costs; IC card information statistics cannot count passengers who do not use IC cards, resulting in low accuracy of passenger flow statistics; the sensors required for sensor detection statistics are expensive and inconvenient to maintain; inter-frame difference statistics and background difference statistics are overly dependent on the environment, resulting in low accuracy of passenger flow statistics; machine learning detection statistics require high computing power, resulting in high equipment costs. Therefore, how to improve the accuracy of passenger flow statistics and reduce costs has become a problem that needs to be solved urgently. Summary of the invention

[0004] The main purpose of the present invention is to provide a passenger flow counting method, system and computer-readable storage medium, aiming to improve the accuracy of passenger flow counting and reduce costs.

[0005] To achieve the above object, the present invention provides a passenger flow counting method, which comprises the following steps:

[0006] Acquire a video image frame, and preprocess the video image frame to obtain an image frame to be detected;

[0007] According to a preset optical flow algorithm, the image frame to be detected is calculated to obtain an optical flow prediction result image;

[0008] A passenger flow statistics result is obtained according to the optical flow prediction result image.

[0009] Optionally, the step of obtaining a passenger flow statistics result according to the optical flow prediction result image includes:

[0010] According to the optical flow vector of the optical flow prediction result image, the preset passenger movement area, the preset door entry detection line and the preset door exit detection line, the optical flow prediction result image is divided into a boarding optical flow map and an alighting optical flow map;

[0011] The optical flow prediction point of the current foreground pixel of the boarding optical flow map is set as the boarding foreground pixel, and the optical flow prediction point of the current pixel of the getting-off optical flow map is set as the getting-off foreground pixel;

[0012] A passenger flow statistics result is obtained according to the boarding foreground pixel points and the getting off foreground pixel points.

[0013] Optionally, the step of setting the optical flow prediction point of the current foreground pixel point of the boarding optical flow map as the boarding foreground pixel point, and setting the optical flow prediction point of the current pixel point of the getting-off optical flow map as the getting-off foreground pixel point comprises:

[0014] Generate a moving optical flow map of the same size as the boarding optical flow map or the getting off optical flow map;

[0015] Determine whether the optical flow prediction point of the current foreground pixel point of the boarding optical flow map is in the preset passenger movement area;

[0016] If the optical flow prediction point of the current foreground pixel point of the boarding optical flow map is in the preset passenger movement area, the boarding foreground pixel point is obtained according to the moving optical flow map, the optical flow prediction point of the current foreground pixel point of the boarding optical flow map and the boarding optical flow map;

[0017] Clear the moving optical flow map, and determine whether the optical flow prediction point of the current foreground pixel point of the getting-off optical flow map is in the preset passenger moving area;

[0018] If the optical flow prediction point of the current foreground pixel point of the getting-off optical flow map is in the preset passenger movement area, the getting-off foreground pixel point is obtained according to the moving optical flow map, the optical flow prediction point of the current foreground pixel point of the getting-off optical flow map and the getting-off optical flow map.

[0019] Optionally, the step of obtaining passenger flow statistics results according to the boarding foreground pixel points and the getting off foreground pixel points includes:

[0020] According to the boarding foreground pixel points, the preset boarding touch counting area and the preset passenger standing area, the boarding touch foreground number and the boarding collision line ratio are obtained, and according to the alighting foreground pixel points, the preset alighting touch counting area and the preset passenger standing area, the alighting collision foreground number and the alighting collision line ratio are obtained;

[0021] Determining whether the number of boarding contact prospects is greater than a first preset threshold;

[0022] If the number of vehicle-on-vehicle contact prospects is greater than the first preset threshold, determining whether the vehicle-on-vehicle collision ratio is greater than a second preset threshold;

[0023] If the boarding-line ratio is greater than the second preset threshold, obtaining a passenger boarding count and adding one to the passenger boarding count;

[0024] Determining whether the number of the alighting contact prospects is greater than the first preset threshold;

[0025] If the number of the vehicle-getting-off-the-vehicle-touching-foregrounds is greater than the first preset threshold, determining whether the vehicle-getting-off-the-vehicle-touching-line ratio is greater than the second preset threshold;

[0026] If the passenger getting off the bus and hitting the line ratio is greater than the second preset threshold, obtaining the passenger getting off the bus count and adding one to the passenger getting off the bus count;

[0027] The passenger flow statistics result is obtained based on the passenger boarding count after adding one and the passenger getting off count after adding one.

[0028] Optionally, if the boarding-to-line ratio is greater than the second preset threshold, the step of obtaining a passenger boarding count and adding one to the passenger boarding count includes:

[0029] If the boarding-to-collision-line ratio is greater than the second preset threshold, obtaining the regional pixel points of the preset passenger standing area;

[0030] According to the area pixels, the boarding foreground pixels and the preset passenger standing area, the boarding area ratio is obtained;

[0031] Determining whether the boarding area ratio is greater than a third preset threshold;

[0032] If the boarding area ratio is greater than the third preset threshold, obtaining a passenger boarding count and adding one to the passenger boarding count;

[0033] If the passenger getting off the bus and hitting the line ratio is greater than the second preset threshold, the step of obtaining the passenger getting off the bus count and adding one to the passenger getting off the bus count comprises:

[0034] If the getting off the vehicle and hitting the line ratio is greater than the second preset threshold, obtaining the regional pixel points of the preset passenger standing area;

[0035] According to the area pixels, the alighting foreground pixels and the preset passenger standing area, a proportion of the alighting area is obtained;

[0036] Determining whether the proportion of the alighting area is greater than the third preset threshold;

[0037] If the proportion of the alighting area is greater than the third preset threshold, the passenger alighting count is obtained, and the passenger alighting count is increased by one.

[0038] Optionally, if the boarding area proportion is greater than the third preset threshold, the step of obtaining a passenger boarding count and adding one to the passenger boarding count includes:

[0039] If the boarding area ratio is greater than the third preset threshold, the total number of boarding blank rows is obtained according to the boarding optical flow map and the boarding foreground pixel points;

[0040] Determining whether the total number of blank boarding rows is less than a fourth preset threshold;

[0041] If the total number of blank boarding rows is less than the fourth preset threshold, obtaining a passenger boarding count and adding one to the passenger boarding count;

[0042] If the proportion of the alighting area is greater than the third preset threshold, the step of obtaining the passenger alighting count and adding one to the passenger alighting count comprises:

[0043] If the proportion of the getting-off area is greater than the third preset threshold, the total number of blank rows for getting-off is obtained according to the getting-off optical flow map and the getting-off foreground pixel points;

[0044] Determining whether the total number of blank rows for getting off the bus is less than the fourth preset threshold;

[0045] If the total number of the blank rows for getting off the bus is less than the fourth preset threshold, the passenger getting off count is obtained and the passenger getting off count is increased by one.

[0046] Optionally, the step of acquiring a video image frame and preprocessing the video image frame to obtain an image frame to be detected includes:

[0047] Get video image frames;

[0048] The video image frame is reduced according to a preset size, and the reduced image frame is used as the image frame to be detected.

[0049] Optionally, the step of reducing the video image frame according to a preset size and using the reduced image frame as the image frame to be detected includes:

[0050] Reducing the video image frame according to a preset size;

[0051] The reduced image frame is converted into a single-channel grayscale image, and the single-channel grayscale image is used as the image frame to be detected.

[0052] In addition, to achieve the above-mentioned purpose, the present invention also provides a passenger flow counting system, which includes: a memory, a processor, and a passenger flow counting program stored in the memory and executable on the processor, and the passenger flow counting program implements the steps of the passenger flow counting method described above when executed by the processor.

[0053] In addition, to achieve the above-mentioned purpose, the present invention further provides a computer-readable storage medium, on which a passenger flow statistics program is stored, and when the passenger flow statistics program is executed by a processor, the steps of the passenger flow statistics method described above are implemented.

[0054] The present invention provides a passenger flow counting method, system and computer-readable storage medium, which obtain video image frames, and pre-process the video image frames to obtain image frames to be detected; calculate the image frames to be detected according to a preset optical flow algorithm to obtain an optical flow prediction result image; and obtain the passenger flow counting result according to the optical flow prediction result image. The present invention obtains video image frames by only using existing surveillance cameras of buses without the need for additional equipment costs; then, the video image frames are pre-processed to obtain image frames to be detected with less information content to reduce the amount of calculation, so that they can be used on low-cost equipment; finally, the present invention performs passenger flow counting based on the optical flow method, and does not require machine learning, that is, does not require the use of sample data to train a classifier, which can reduce the amount of calculation, and the optical flow method will not be overly dependent on the environment, which can improve the accuracy of passenger flow counting. Therefore, the passenger flow counting method of the present invention can improve the accuracy of passenger flow counting and reduce costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 A schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment of the present invention;

[0056] Figure 2 It is a flow chart of the first embodiment of the passenger flow counting method of the present invention;

[0057] Figure 3 It is a flow chart of the second embodiment of the passenger flow counting method of the present invention;

[0058] Figure 4 Schematic diagram of detailed process of step S32 in the passenger flow counting method of the present invention;

[0059] Figure 5 It is a flow chart of the third embodiment of the passenger flow counting method of the present invention;

[0060] Figure 6 Schematic diagram of the flow chart of the fourth embodiment of the passenger flow counting method of the present invention.

[0061] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0062] 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.

[0063] Reference Figure 1 , Figure 1 The figure is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment of the present invention.

[0064] The terminal in the embodiment of the present invention is a passenger flow counting device, which can be a terminal device with processing function such as a microcomputer, a PC (personal computer), a notebook computer, a server, etc.

[0065] like Figure 1 As shown, the terminal may include: a processor 1001, such as a CPU (Central Processing Unit), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0066] Those skilled in the art will understand that Figure 1 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0067] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a passenger flow statistics program.

[0068] exist Figure 1 In the terminal shown, the processor 1001 can be used to call the passenger flow counting program stored in the memory 1005 and perform the following operations:

[0069] Acquire a video image frame, and preprocess the video image frame to obtain an image frame to be detected;

[0070] According to a preset optical flow algorithm, the image frame to be detected is calculated to obtain an optical flow prediction result image;

[0071] A passenger flow statistics result is obtained according to the optical flow prediction result image.

[0072] Further, the processor 1001 may be used to call the passenger flow counting program stored in the memory 1005, and further perform the following operations:

[0073] According to the optical flow vector of the optical flow prediction result image, the preset passenger movement area, the preset door entry detection line and the preset door exit detection line, the optical flow prediction result image is divided into a boarding optical flow map and an alighting optical flow map;

[0074] The optical flow prediction point of the current foreground pixel of the boarding optical flow map is set as the boarding foreground pixel, and the optical flow prediction point of the current pixel of the getting-off optical flow map is set as the getting-off foreground pixel;

[0075] A passenger flow statistics result is obtained according to the boarding foreground pixel points and the getting off foreground pixel points.

[0076] Further, the processor 1001 may be used to call the passenger flow counting program stored in the memory 1005, and further perform the following operations:

[0077] Generate a moving optical flow map of the same size as the boarding optical flow map or the getting off optical flow map;

[0078] Determine whether the optical flow prediction point of the current foreground pixel point of the boarding optical flow map is in the preset passenger movement area;

[0079] If the optical flow prediction point of the current foreground pixel point of the boarding optical flow map is in the preset passenger movement area, the boarding foreground pixel point is obtained according to the moving optical flow map, the optical flow prediction point of the current foreground pixel point of the boarding optical flow map and the boarding optical flow map;

[0080] Clear the moving optical flow map, and determine whether the optical flow prediction point of the current foreground pixel point of the getting-off optical flow map is in the preset passenger moving area;

[0081] If the optical flow prediction point of the current foreground pixel point of the getting-off optical flow map is in the preset passenger movement area, the getting-off foreground pixel point is obtained according to the moving optical flow map, the optical flow prediction point of the current foreground pixel point of the getting-off optical flow map and the getting-off optical flow map.

[0082] Further, the processor 1001 may be used to call the passenger flow counting program stored in the memory 1005, and further perform the following operations:

[0083] According to the boarding foreground pixel points, the preset boarding touch counting area and the preset passenger standing area, the boarding touch foreground number and the boarding collision line ratio are obtained, and according to the alighting foreground pixel points, the preset alighting touch counting area and the preset passenger standing area, the alighting collision foreground number and the alighting collision line ratio are obtained;

[0084] Determining whether the number of boarding contact prospects is greater than a first preset threshold;

[0085] If the number of vehicle-on-vehicle contact prospects is greater than the first preset threshold, determining whether the vehicle-on-vehicle collision ratio is greater than a second preset threshold;

[0086] If the boarding-line ratio is greater than the second preset threshold, obtaining a passenger boarding count and adding one to the passenger boarding count;

[0087] Determining whether the number of the alighting contact prospects is greater than the first preset threshold;

[0088] If the number of the vehicle-getting-off-the-vehicle-touching-foregrounds is greater than the first preset threshold, determining whether the vehicle-getting-off-the-vehicle-touching-line ratio is greater than the second preset threshold;

[0089] If the passenger getting off the bus and hitting the line ratio is greater than the second preset threshold, obtaining the passenger getting off the bus count and adding one to the passenger getting off the bus count;

[0090] The passenger flow statistics result is obtained based on the passenger boarding count after adding one and the passenger getting off count after adding one.

[0091] Further, the processor 1001 may be used to call the passenger flow counting program stored in the memory 1005, and further perform the following operations:

[0092] If the boarding-to-collision-line ratio is greater than the second preset threshold, obtaining the regional pixel points of the preset passenger standing area;

[0093] According to the area pixels, the boarding foreground pixels and the preset passenger standing area, the boarding area ratio is obtained;

[0094] Determining whether the boarding area ratio is greater than a third preset threshold;

[0095] If the boarding area ratio is greater than the third preset threshold, obtaining a passenger boarding count and adding one to the passenger boarding count;

[0096] If the passenger getting off the bus and hitting the line ratio is greater than the second preset threshold, the step of obtaining the passenger getting off the bus count and adding one to the passenger getting off the bus count comprises:

[0097] If the getting off the vehicle and hitting the line ratio is greater than the second preset threshold, obtaining the regional pixel points of the preset passenger standing area;

[0098] According to the area pixels, the alighting foreground pixels and the preset passenger standing area, a proportion of the alighting area is obtained;

[0099] Determining whether the proportion of the alighting area is greater than the third preset threshold;

[0100] If the proportion of the alighting area is greater than the third preset threshold, the passenger alighting count is obtained, and the passenger alighting count is increased by one.

[0101] Further, the processor 1001 may be used to call the passenger flow counting program stored in the memory 1005, and further perform the following operations:

[0102] If the boarding area ratio is greater than the third preset threshold, the total number of boarding blank rows is obtained according to the boarding optical flow map and the boarding foreground pixel points;

[0103] Determining whether the total number of blank boarding rows is less than a fourth preset threshold;

[0104] If the total number of blank boarding rows is less than the fourth preset threshold, obtaining a passenger boarding count and adding one to the passenger boarding count;

[0105] If the proportion of the alighting area is greater than the third preset threshold, the step of obtaining the passenger alighting count and adding one to the passenger alighting count comprises:

[0106] If the proportion of the getting-off area is greater than the third preset threshold, the total number of blank rows for getting-off is obtained according to the getting-off optical flow map and the getting-off foreground pixel points;

[0107] Determining whether the total number of blank rows for getting off the bus is less than the fourth preset threshold;

[0108] If the total number of the blank rows for getting off the bus is less than the fourth preset threshold, the passenger getting off count is obtained and the passenger getting off count is increased by one.

[0109] Further, the processor 1001 may be used to call the passenger flow counting program stored in the memory 1005, and further perform the following operations:

[0110] Get video image frames;

[0111] The video image frame is reduced according to a preset size, and the reduced image frame is used as the image frame to be detected.

[0112] Further, the processor 1001 may be used to call the passenger flow counting program stored in the memory 1005, and further perform the following operations:

[0113] Reducing the video image frame according to a preset size;

[0114] The reduced image frame is converted into a single-channel grayscale image, and the single-channel grayscale image is used as the image frame to be detected.

[0115] Based on the above hardware structure, various embodiments of the passenger flow counting method of the present invention are proposed.

[0116] The invention provides a passenger flow statistics method.

[0117] Reference Figure 2 , Figure 2 It is a flow chart of the first embodiment of the passenger flow counting method of the present invention.

[0118] In this embodiment, the passenger flow counting method includes:

[0119] Step S10, acquiring a video image frame, and preprocessing the video image frame to obtain an image frame to be detected;

[0120] In this embodiment, the passenger flow counting method is implemented by a passenger flow counting device, which can be a terminal device with processing functions such as a microcomputer, PC, notebook computer, server, etc. The application of the passenger flow counting of the present invention is described by taking public transportation as an example.

[0121] In this embodiment, a video image frame is obtained, and the video image frame is preprocessed to obtain an image frame to be detected. Specifically, a video of the bus door position is obtained through a camera, and then a video image frame is obtained through the video according to image processing technology. Finally, the video image frame is preprocessed to obtain an image frame to be detected. Among them, the camera is installed above the bus door and aimed at the bus door to obtain the video of the bus door position. Of course, the camera can also be installed at other positions.

[0122] It should be noted that the preprocessing methods include reducing the video image frames to a uniform size, converting the color video image frames into a single-channel grayscale image, and the like.

[0123] Specifically, step S10 includes:

[0124] Step a11, acquiring a video image frame;

[0125] Step a12, reducing the video image frame according to a preset size, and using the reduced image frame as the image frame to be detected.

[0126] In this embodiment, a video image frame is obtained, the video image frame is reduced according to a preset size, and the reduced image frame is used as an image frame to be detected. The preset size is set according to actual needs, and the value standard of the preset size is as small as possible and ensures that the video image frame can be accurately identified and calculated. In addition, the preset size of each video image frame is the same to ensure that the reference standard of the pixel points in the video image frame is consistent.

[0127] It can be understood that detecting image frames with smaller sizes can reduce the amount of calculation, so that it can be used on low-cost devices. Of course, the color image frame can also be converted into a single-channel grayscale image to further reduce the amount of calculation.

[0128] Specifically, step a12 includes:

[0129] Step a121, reducing the video image frame according to a preset size;

[0130] Step a122, converting the reduced image frame into a single-channel grayscale image, and using the single-channel grayscale image as the image frame to be detected.

[0131] In this embodiment, the video image frame is reduced according to a preset size, the reduced image frame is converted into a single-channel grayscale image, and the single-channel grayscale image is used as the image frame to be detected.

[0132] It should be noted that video image frames are usually color images, such as three-channel (RGB) color images or four-channel (RGBA) color images. The color images are converted into single-channel grayscale images, that is, each pixel of the image frame has only one color value. Therefore, the single-channel grayscale image occupies less memory and has less information content, which can further reduce the amount of calculation.

[0133] Step S20, calculating the image frame to be detected according to a preset optical flow algorithm to obtain an optical flow prediction result image;

[0134] In this embodiment, the image frame to be detected is calculated according to a preset optical flow algorithm to obtain an optical flow prediction result image. Specifically, the dense optical flow of the image frame to be detected is calculated using the Horn-Schunck algorithm, and then the optical flow prediction points are obtained according to the dense optical flow, and finally, the optical flow prediction result image is obtained according to the optical flow prediction points.

[0135] It should be noted that the Horn-Schunck algorithm needs to calculate the optical flow value for each pixel of the image frame to be detected. Therefore, the optical flow prediction result image calculated by the Horn-Schunck algorithm has high accuracy. Of course, optical flow methods such as the Lukas-Kanade algorithm and the image pyramid introduction method can also be used for calculation to obtain the optical flow prediction result image.

[0136] In addition, it should be noted that in a continuous video image, the changed part is regarded as the moving part of the image, and the pixel points that have undergone motion changes and have a trend of motion changes are regarded as moving pixel points. Among them, the moving pixel points include the origin and the prediction point. Specifically, the position to which the pixel point will move in the next frame of the video image can be obtained through the optical flow vector of the optical flow map, and this position is regarded as the prediction point. It can be understood that the pixel points in the image frame have corresponding prediction points, and the deviation between the position of the prediction point and the origin is the offset, which reflects the motion trend of the pixel point.

[0137] Step S30, obtaining passenger flow statistics results according to the optical flow prediction result image.

[0138] After obtaining the optical flow prediction result image, the passenger flow statistics result is obtained according to the optical flow prediction result image. The optical flow prediction result image includes the boarding optical flow map and the getting off optical flow map; the passenger flow statistics result includes information such as the number of boardings, the number of getting offs, the current passenger capacity, and of course, the person's characteristic information, such as age, body shape, height, etc.

[0139] Specifically, according to the moving pixel points in the optical flow prediction result image, the optical flow vector of the moving pixel points is obtained; according to the optical flow vector, the preset door entry detection line and the preset door exit detection line, the optical flow prediction result image is divided into a boarding optical flow map and an alighting optical flow map; according to the boarding optical flow map, the boarding optical flow prediction point is obtained, and according to the alighting optical flow map, the alighting optical flow prediction point is obtained; the boarding optical flow prediction point and the alighting optical flow prediction point are set as foreground pixel points; according to the foreground pixel points, the collision line ratio is obtained, and the passenger flow statistics result is obtained by judging the size of the collision line ratio. The specific execution process is described in the second embodiment below and will not be repeated here.

[0140] The embodiment of the present invention provides a passenger flow counting method, which obtains video image frames, and pre-processes the video image frames to obtain image frames to be detected; calculates the image frames to be detected according to a preset optical flow algorithm to obtain an optical flow prediction result image; and obtains passenger flow counting results according to the optical flow prediction result image. The embodiment of the present invention obtains video image frames by simply obtaining them through existing surveillance cameras of buses without the need for additional equipment costs; then, the video image frames are pre-processed to obtain image frames to be detected with less information content to reduce the amount of calculation, so that they can be used on low-cost equipment; finally, the embodiment of the present invention performs passenger flow counting based on the optical flow method, and does not require machine learning, that is, it does not require the use of sample data to train the classifier, which can reduce the amount of calculation, and the optical flow method will not be overly dependent on the environment, which can improve the accuracy of passenger flow counting. Therefore, the passenger flow counting method of the embodiment of the present invention can improve the accuracy of passenger flow counting and reduce costs.

[0141] Furthermore, based on the above-mentioned first embodiment, a second embodiment of the passenger flow counting method of the present invention is proposed.

[0142] Reference Figure 3 , Figure 3 Schematic diagram of the flow chart of the second embodiment of the passenger flow counting method of the present invention.

[0143] In this embodiment, the above step S30 includes:

[0144] Step S31, dividing the optical flow prediction result image into a boarding optical flow map and an alighting optical flow map according to the optical flow vector of the optical flow prediction result image, the preset passenger movement area, the preset door entry detection line, and the preset door exit detection line;

[0145] In this embodiment, the optical flow prediction result image is divided into a boarding optical flow map and a disembarking optical flow map according to the optical flow vector, the preset passenger movement area, the preset door entry detection line, and the preset exit detection line of the optical flow prediction result image. Specifically, the optical flow vector of the moving pixel point is obtained according to the moving pixel point in the optical flow prediction result image; the optical flow prediction result image is divided into a boarding optical flow map and a disembarking optical flow map according to the optical flow vector, the preset passenger movement area, the preset door entry detection line, and the preset exit detection line.

[0146] Among them, the preset passenger movement area is the union of the preset passenger standing area, the preset boarding touch counting area and the preset getting off touch counting area. The preset passenger standing area is between the preset exit detection line and the preset entry detection line, and is in the area from one quarter from the left to three quarters from the left of the optical flow map.

[0147] It should be noted that the preset door entry detection line and the preset exit detection line are set according to actual needs. For example, the preset door entry detection line is all pixel points in the 15th row of the optical flow prediction result image, and the preset exit detection line is all pixel points in the 113th row of the optical flow prediction result image. No specific limitation is made here. In addition, the preset door entry detection line and the preset exit detection line are both set as foreground pixels.

[0148] In addition, it should be noted that in a continuous video image, the part that changes is regarded as the moving part of the image, and the pixels that have undergone motion changes and have a tendency to change are regarded as moving pixels. Therefore, based on the moving pixels, that is, based on the moving trajectory of the person, it can be known whether the person is getting on or off the bus, and the optical flow prediction result image is divided into the optical flow map of getting on the bus and the optical flow map of getting off the bus.

[0149] Step S32, setting the optical flow prediction point of the current foreground pixel point of the boarding optical flow map as the boarding foreground pixel point, and setting the optical flow prediction point of the current pixel point of the getting-off optical flow map as the getting-off foreground pixel point;

[0150] In this embodiment, the optical flow prediction point of the current foreground pixel point of the boarding optical flow map is set as the boarding foreground pixel point, and the optical flow prediction point of the current foreground pixel point of the getting off optical flow map is set as the getting off foreground pixel point.

[0151] It should be noted that each pixel of the boarding optical flow map is traversed, and each pixel has its corresponding horizontal coordinate x and vertical coordinate y. The value of each coordinate point in the optical flow map represents the motion offset of the pixel point. A value of zero indicates that the pixel point has not been offset, that is, no motion change has occurred. When the pixel on the (x, y) coordinate of the boarding optical flow map is not 0, and the (x, y) coordinate prediction offset value of the optical flow prediction result image is (fx, fy), the (x+fx, y+fy) coordinate point is the optical flow prediction point of the coordinate origin (x, y). If (x+fx, y+fy) is included in the preset passenger standing area, the predicted point (x+fx, y+fy) coordinate pixel point of the boarding optical flow map is set as the foreground pixel point. Correspondingly, the same processing is performed on the disembarkation optical flow map. Among them, the preset passenger standing area is between the preset exit detection line and the preset entry detection line, and in the area from the left quarter of the optical flow map to the left three quarters of the optical flow map.

[0152] Further, refer to Figure 4 , Figure 4 FIG. 5 is a detailed flow chart of step S32 in the passenger flow counting method of the present invention. Step S32 includes:

[0153] Step S321, generating a moving optical flow map of the same size as the boarding optical flow map or the getting off optical flow map;

[0154] Step S322, determining whether the optical flow prediction point of the current foreground pixel point of the boarding optical flow map is in the preset passenger movement area;

[0155] Step S323, if the optical flow prediction point of the current foreground pixel point of the boarding optical flow map is in the preset passenger movement area, then obtaining the boarding foreground pixel point according to the moving optical flow map, the optical flow prediction point of the current foreground pixel point of the boarding optical flow map and the boarding optical flow map;

[0156] Step S324, clearing the moving optical flow map, and determining whether the optical flow prediction point of the current foreground pixel point of the getting-off optical flow map is in the preset passenger moving area;

[0157] Step S325, if the optical flow prediction point of the current foreground pixel point of the getting-off optical flow map is in the preset passenger movement area, the getting-off foreground pixel point is obtained according to the moving optical flow map, the optical flow prediction point of the current foreground pixel point of the getting-off optical flow map and the getting-off optical flow map.

[0158] In this embodiment, first, a moving optical flow map of the same size as the boarding optical flow map or the alighting optical flow map is generated, and then, it is determined whether the optical flow prediction point of the current foreground pixel of the boarding optical flow map is in the preset passenger movement area. If the optical flow prediction point of the current foreground pixel of the boarding optical flow map is in the preset passenger movement area, the boarding foreground pixel is obtained according to the moving optical flow map, the optical flow prediction point of the current foreground pixel of the boarding optical flow map, and the boarding optical flow map. Finally, the moving optical flow map is cleared, and it is determined whether the optical flow prediction point of the current foreground pixel of the alighting optical flow map is in the preset passenger movement area. If the optical flow prediction point of the current foreground pixel of the alighting optical flow map is in the preset passenger movement area, the alighting foreground pixel is obtained according to the moving optical flow map, the optical flow prediction point of the current foreground pixel of the alighting optical flow map, and the alighting optical flow map.

[0159] Specifically, generate an empty image of the same size as the image to be detected (boarding optical flow map or alighting optical flow map), which is called a moving optical flow map. Determine whether the optical flow prediction points corresponding to the foreground pixels of the boarding optical flow map are within the moving area, and set the coordinates of the prediction points of the moving optical flow map corresponding to these points within the moving area as foreground pixels, thereby setting the foreground pixels of the moving optical flow map. Then clear the foreground pixels of the boarding optical flow map, and set a row of the door entry detection line of the boarding optical flow map as foreground pixels. Then merge the foreground pixels of the moving optical flow map into the boarding optical flow map to complete the update of the foreground pixels of the boarding optical flow map.

[0160] Correspondingly, the process of updating the foreground pixels of getting off the bus is as follows: first clear the moving optical flow map, determine whether the optical flow prediction points corresponding to the foreground pixels of the getting off optical flow map are in the moving area, set the coordinates of the prediction points of the moving optical flow map corresponding to these predicted points in the moving area as foreground pixels, and thus set the foreground pixels of the moving optical flow map. Then clear the foreground pixels of the getting off optical flow map, and set a row of the exit detection line of the getting off optical flow map as foreground pixels. Then merge the foreground pixels of the moving optical flow map into the getting off optical flow map, and complete the update of the foreground pixels of the getting off optical flow map.

[0161] Step S33, obtaining passenger flow statistics results according to the boarding foreground pixel points and the getting off foreground pixel points.

[0162] In this embodiment, the passenger flow statistics result is obtained according to the foreground pixel points of boarding and the foreground pixel points of getting off. Specifically, the boarding line-hitting ratio is obtained according to the foreground pixel points of boarding, and the size of the boarding line-hitting ratio is judged. At the same time, the getting off line-hitting ratio is obtained according to the foreground pixel points of getting off, and the passenger flow statistics result is obtained by judging the size of the getting off line-hitting ratio.

[0163] It should be noted that the boarding collision line ratio is the ratio of the number of pixel points in the boarding foreground pixels that pass the preset door entry detection line to the number of pixel points in the boarding foreground pixels that are located in the preset passenger standing area; the getting off the bus collision line ratio is the ratio of the number of pixel points in the getting off foreground pixels that pass the preset exit detection line to the number of pixel points in the getting off foreground pixels that are located in the preset passenger standing area.

[0164] Specifically, step S33 includes:

[0165] Step a331, obtaining the boarding touch foreground number and the boarding collision line ratio according to the boarding foreground pixel points, the preset boarding touch counting area and the preset passenger standing area, and obtaining the getting-off collision foreground number and the getting-off collision line ratio according to the getting-off foreground pixel points, the preset getting-off touch counting area and the preset passenger standing area;

[0166] In this embodiment, the collision line ratio is obtained according to the foreground pixel points, the preset touch counting area and the preset passenger standing area, and the alighting collision line ratio is obtained according to the alighting foreground pixel points, the preset alighting touch counting area and the preset passenger standing area. Specifically, the number of boarding foreground pixel points in the preset boarding touch counting area is counted, and the statistical result is used as the boarding touch number, and the number of boarding foreground pixel points in the preset passenger standing area is counted, and the statistical result is used as the boarding movement number, and then, the boarding touch number is divided by the boarding movement number, and the calculated quotient is used as the boarding collision line ratio. Correspondingly, the same process is performed to obtain the alighting collision line ratio. In addition, according to the boarding foreground pixel points and the preset boarding touch counting area, the boarding touch foreground number is obtained, and accordingly, according to the alighting foreground pixel points and the preset alighting touch counting area, the alighting touch foreground number is obtained.

[0167] Step a332, determining whether the number of vehicle contact prospects is greater than a first preset threshold;

[0168] In this embodiment, it is determined whether the number of vehicle contact prospects is greater than a first preset threshold value. The first preset threshold value is set according to actual conditions and is not specifically limited here.

[0169] Step a333, if the number of vehicle-on-vehicle contact prospects is greater than the first preset threshold, determining whether the vehicle-on-vehicle collision line ratio is greater than a second preset threshold;

[0170] Step a334, if the boarding-to-line ratio is greater than the second preset threshold, obtaining a passenger boarding count and adding one to the passenger boarding count;

[0171] In this embodiment, when the number of boarding touch prospects is greater than the first preset threshold, it is determined whether the boarding line ratio is greater than the second preset threshold. If the boarding line ratio is greater than the second preset threshold, the passenger boarding count is obtained and the passenger boarding count is increased by one. The second preset threshold can be set according to actual conditions, such as 0.1, 0.15, 0.5, etc., and is not specifically limited here. It should be noted that the passenger boarding count counts the number of boardings through a counter.

[0172] Step a335, determining whether the number of the getting-off-the-vehicle contact prospects is greater than the first preset threshold;

[0173] Step a336, determining whether the vehicle getting off the vehicle and hitting the line ratio is greater than the second preset threshold;

[0174] Step a337, if the passenger getting off the bus and hitting the line ratio is greater than the second preset threshold, obtaining the passenger getting off the bus count and adding one to the passenger getting off the bus count;

[0175] In this embodiment, when the number of getting off and touching the foreground is greater than the first preset threshold, it is determined whether the ratio of getting off and hitting the line is greater than the second preset threshold. If the ratio of getting off and hitting the line is greater than the second preset threshold, the passenger getting off count is obtained, and the passenger getting off count is increased by one. Among them, the second preset threshold can be set according to actual conditions, such as 0.1, 0.15, 0.5, etc., which is not specifically limited here. It should be noted that the passenger getting off count is counted by a counter to count the number of people getting off.

[0176] Step a338, obtaining passenger flow statistics results based on the passenger boarding count after adding one and the passenger alighting count after adding one.

[0177] Finally, the passenger flow statistics result is obtained based on the passenger boarding count after adding one and the passenger getting off count after adding one. The passenger flow statistics result includes information such as the number of passengers getting on the bus, the number of passengers getting off the bus, the current passenger capacity, and of course, it can also include personal characteristics information, such as age, body shape, height, etc.

[0178] In this embodiment, the optical flow prediction result image is divided into a boarding optical flow map and an alighting optical flow map, so that the embodiment can realize the counting of boarding passengers and alighting passengers. Compared with the prior art in which boarding passengers and alighting passengers are not distinguished, the embodiment can further improve the accuracy of passenger flow counting. At the same time, the optical flow prediction points of the optical flow map are set as foreground pixels to distinguish them from background pixels, thereby reducing the amount of calculation.

[0179] Furthermore, based on the above second embodiment, a third embodiment of the passenger flow counting method of the present invention is proposed.

[0180] Reference Figure 5 , Figure 5Schematic diagram of the flow chart of the third embodiment of the passenger flow counting method of the present invention.

[0181] In this embodiment, the above step a334 includes:

[0182] Step S3341, if the boarding-to-collision-line ratio is greater than the second preset threshold, obtaining the regional pixel points of the preset passenger standing area;

[0183] In this embodiment, if the boarding collision line ratio is greater than the second preset threshold, the regional pixel points of the preset passenger standing area are obtained, wherein the regional pixel points are the pixel points in the preset passenger standing area.

[0184] Step S3342, obtaining the boarding area ratio according to the area pixels, the boarding foreground pixels and the preset passenger standing area;

[0185] In this embodiment, the boarding area ratio is obtained according to the regional pixels, the boarding foreground pixels and the preset passenger standing area. Specifically, the number of regional pixels is counted, and the result obtained is used as the denominator. Then, the number of boarding foreground pixels in the preset passenger standing area is counted, and the result obtained is used as the numerator. Finally, the numerator and the denominator are divided, and the calculated result is used as the boarding area ratio.

[0186] Step S3343, determining whether the boarding area ratio is greater than a third preset threshold;

[0187] Step S3344: if the boarding area ratio is greater than the third preset threshold, obtain the passenger boarding count and increase the passenger boarding count by one;

[0188] In this embodiment, it is determined whether the boarding area ratio is greater than a third preset threshold value. If the boarding area ratio is greater than the third preset threshold value, a passenger boarding count is obtained and the passenger boarding count is increased by 1. The passenger boarding count is used to count the number of boarding persons by a counter.

[0189] It should be noted that when a passenger gets on the bus, some parts of the body (feet, hands, etc.) or items carried by the passenger (schoolbags, luggage, etc.) may not be in the preset passenger standing area, but the passenger has already gotten on the bus, so the second preset threshold is set to remove the above interference. The third preset threshold can be set according to actual conditions and is not specifically limited here.

[0190] In this embodiment, the above step a337 includes:

[0191] Step a3371, if the getting off and hitting the line ratio is greater than the second preset threshold, obtaining the regional pixel points of the preset passenger standing area;

[0192] In this embodiment, if the ratio of getting off the bus and hitting the line is greater than the second preset threshold, the regional pixel points of the preset passenger standing area are obtained, wherein the regional pixel points are the pixel points in the preset passenger standing area.

[0193] Step a3372, obtaining the proportion of the getting-off area according to the area pixels, the getting-off foreground pixels and the preset passenger standing area;

[0194] In this embodiment, the proportion of the alighting area is obtained according to the regional pixels, the alighting foreground pixels and the preset passenger standing area. Specifically, the number of regional pixels is counted, and the result obtained is used as the denominator. Then, the number of alighting foreground pixels in the preset passenger standing area is counted, and the result obtained is used as the numerator. Finally, the numerator and the denominator are divided, and the calculated result is used as the alighting area proportion.

[0195] Step a3373, determining whether the proportion of the alighting area is greater than the third preset threshold;

[0196] Step a3374: If the proportion of the disembarkation area is greater than the third preset threshold, obtain the passenger disembarkation count and increase the passenger disembarkation count by one.

[0197] In this embodiment, it is determined whether the proportion of the alighting area is greater than the third preset threshold value. If the proportion of the alighting area is greater than the third preset threshold value, the passenger alighting count is obtained and the passenger alighting count is increased by 1. The passenger alighting count is counted by a counter to count the number of alighting persons.

[0198] It should be noted that when a passenger gets off the bus, some parts of the body (feet, hands, etc.) or items carried by the passenger (schoolbags, luggage, etc.) may not be in the preset passenger standing area, but the passenger has already boarded the bus. Therefore, the second preset threshold is set to eliminate the above interference. The third preset threshold can be set according to actual conditions and is not specifically limited here.

[0199] In this embodiment, by calculating the proportion of the boarding area and judging whether the proportion of the boarding area is greater than the second preset threshold, the interference of certain parts of the body (feet, hands, etc.) or passenger's belongings (schoolbags, luggage, etc.) is reduced, and correspondingly, the proportion of the alighting area is also processed in the same way. Therefore, this embodiment can further improve the accuracy of passenger flow statistics.

[0200] Furthermore, based on the third embodiment described above, a fourth embodiment of the passenger flow counting method of the present invention is proposed.

[0201] Reference Figure 6 , Figure 6 Schematic diagram of the flow chart of the fourth embodiment of the passenger flow counting method of the present invention.

[0202] In this embodiment, the above step S3344 includes:

[0203] Step S33441: if the boarding area ratio is greater than the third preset threshold, the total number of boarding blank rows is obtained according to the boarding optical flow map and the boarding foreground pixel points;

[0204] In this embodiment, if the proportion of the boarding area is greater than the third preset threshold, the total number of blank rows for boarding is obtained according to the boarding optical flow map and the boarding foreground pixels. Specifically, the boarding optical flow map is traversed row by row, and the number of foreground pixels in each row is calculated, and then the number of rows with the number of foreground pixels less than the preset blank threshold is taken as blank rows, and finally the total number of blank rows for boarding is counted.

[0205] Step S33442, determining whether the total number of blank boarding rows is less than a fourth preset threshold;

[0206] Step S33443: if the total number of blank boarding rows is less than the fourth preset threshold, obtain the passenger boarding count and add one to the passenger boarding count;

[0207] In this embodiment, it is determined whether the total number of blank rows for boarding is less than a fourth preset threshold value. If the total number of blank rows for boarding is less than the fourth preset threshold value, a passenger boarding count is obtained and the passenger boarding count is increased by 1. The passenger boarding count counts the number of boarding persons through a counter.

[0208] It should be noted that, since some parts of the passenger's body (feet, hands, etc.) or the passenger's belongings (schoolbags, luggage, etc.) are within the video image frame, but no passenger has boarded the bus, a fourth preset threshold is set to remove the above interference. The fourth preset threshold can be set according to actual conditions and is not specifically limited here.

[0209] In this embodiment, the above step a3374 includes:

[0210] Step a33741, if the proportion of the getting-off area is greater than the third preset threshold, the total number of blank rows for getting-off is obtained according to the getting-off optical flow map and the getting-off foreground pixel points;

[0211] In this embodiment, if the proportion of the getting-off area is greater than the third preset threshold, the total number of blank getting-off rows is obtained according to the getting-off optical flow map and the getting-off foreground pixels. Specifically, the getting-off optical flow map is traversed row by row, and the number of foreground pixels in each row is calculated, and then the number of rows with the number of foreground pixels less than the preset blank threshold is taken as blank rows, and finally the total number of blank getting-off rows is counted.

[0212] Step a33742, determining whether the total number of the blank rows for getting off the bus is less than the fourth preset threshold;

[0213] Step a33743, if the total number of blank rows for getting off the bus is less than the fourth preset threshold, obtain the passenger getting off count and add one to the passenger getting off count.

[0214] In this embodiment, it is determined whether the total number of blank rows for getting off is less than a fourth preset threshold value. If the total number of blank rows for getting off is less than the fourth preset threshold value, the passenger getting off count is obtained, and the passenger getting off count is increased by 1. The passenger getting off count is counted by a counter to count the number of people getting off.

[0215] It should be noted that, since some parts of the passenger's body (feet, hands, etc.) or the passenger's belongings (school bags, luggage, etc.) are within the video image frame, but no passenger gets off the bus, the fourth preset threshold is set to remove the above interference. The fourth preset threshold can be set according to actual conditions and is not specifically limited here.

[0216] In this embodiment, by calculating the total number of blank rows for boarding and judging whether the total number of blank rows for boarding is less than the fourth preset threshold, interference from certain parts of the body (feet, hands, etc.) or passenger belongings (school bags, luggage, etc.) is reduced, and correspondingly, the blank rows for getting off are also processed in the same way. Therefore, this embodiment can further improve the accuracy of passenger flow statistics.

[0217] The present invention also provides a passenger flow counting system, which includes: a memory, a processor, and a passenger flow counting program stored in the memory and executable on the processor, wherein the passenger flow counting program implements the steps of the passenger flow counting method described in any of the above embodiments when executed by the processor.

[0218] The specific embodiments of the passenger flow counting system of the present invention are basically the same as the embodiments of the above-mentioned passenger flow counting method, and will not be described in detail here.

[0219] The present invention also provides a computer-readable storage medium on which a passenger flow counting program is stored. When the passenger flow counting program is executed by a processor, the steps of the passenger flow counting method described in any of the above embodiments are implemented.

[0220] The specific embodiments of the computer-readable storage medium of the present invention are basically the same as the embodiments of the above-mentioned passenger flow counting method, and will not be described in detail here.

[0221] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0222] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0223] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0224] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A passenger flow counting method, characterized in that: The passenger flow counting method comprises the following steps: Acquire a video image frame, and preprocess the video image frame to obtain an image frame to be detected; According to a preset optical flow algorithm, the image frame to be detected is calculated to obtain an optical flow prediction result image; Obtaining passenger flow statistics results according to the optical flow prediction result image; The step of obtaining the passenger flow statistics result according to the optical flow prediction result image comprises: According to the optical flow vector of the optical flow prediction result image, the preset passenger movement area, the preset door entry detection line and the preset door exit detection line, the optical flow prediction result image is divided into a boarding optical flow map and an alighting optical flow map; The optical flow prediction point of the current foreground pixel of the boarding optical flow map is set as the boarding foreground pixel, and the optical flow prediction point of the current pixel of the getting-off optical flow map is set as the getting-off foreground pixel; A passenger flow statistics result is obtained according to the boarding foreground pixel points and the getting off foreground pixel points.

2. The passenger flow counting method according to claim 1, characterized in that: The step of setting the optical flow prediction point of the current foreground pixel point of the boarding optical flow map as the boarding foreground pixel point, and setting the optical flow prediction point of the current pixel point of the getting-off optical flow map as the getting-off foreground pixel point comprises: Generate a moving optical flow map of the same size as the boarding optical flow map or the getting off optical flow map; Determine whether the optical flow prediction point of the current foreground pixel point of the boarding optical flow map is in the preset passenger movement area; If the optical flow prediction point of the current foreground pixel point of the boarding optical flow map is in the preset passenger movement area, the boarding foreground pixel point is obtained according to the moving optical flow map, the optical flow prediction point of the current foreground pixel point of the boarding optical flow map and the boarding optical flow map; Clear the moving optical flow map, and determine whether the optical flow prediction point of the current foreground pixel point of the getting-off optical flow map is in the preset passenger moving area; If the optical flow prediction point of the current foreground pixel point of the getting-off optical flow map is in the preset passenger movement area, the getting-off foreground pixel point is obtained according to the moving optical flow map, the optical flow prediction point of the current foreground pixel point of the getting-off optical flow map and the getting-off optical flow map.

3. The passenger flow counting method according to claim 1, characterized in that: The step of obtaining the passenger flow statistics result according to the boarding foreground pixel points and the getting off foreground pixel points comprises: According to the boarding foreground pixel points, the preset boarding touch counting area and the preset passenger standing area, the boarding touch foreground number and the boarding collision line ratio are obtained, and according to the alighting foreground pixel points, the preset alighting touch counting area and the preset passenger standing area, the alighting collision foreground number and the alighting collision line ratio are obtained; Determining whether the number of boarding contact prospects is greater than a first preset threshold; If the number of vehicle-on-vehicle contact prospects is greater than the first preset threshold, determining whether the vehicle-on-vehicle collision ratio is greater than a second preset threshold; If the boarding-line ratio is greater than the second preset threshold, obtaining a passenger boarding count and adding one to the passenger boarding count; Determining whether the number of the alighting contact prospects is greater than the first preset threshold; If the number of the vehicle-getting-off-the-vehicle-touching-foregrounds is greater than the first preset threshold, determining whether the vehicle-getting-off-the-vehicle-touching-line ratio is greater than the second preset threshold; If the passenger getting off the bus and hitting the line ratio is greater than the second preset threshold, obtaining the passenger getting off the bus count and adding one to the passenger getting off the bus count; The passenger flow statistics result is obtained based on the passenger boarding count after adding one and the passenger getting off count after adding one.

4. The passenger flow counting method according to claim 3, characterized in that: If the boarding-line-collision ratio is greater than the second preset threshold, the step of obtaining a passenger boarding count and adding one to the passenger boarding count comprises: If the boarding-to-collision-line ratio is greater than the second preset threshold, obtaining the regional pixel points of the preset passenger standing area; According to the area pixels, the boarding foreground pixels and the preset passenger standing area, the boarding area ratio is obtained; Determining whether the boarding area ratio is greater than a third preset threshold; If the boarding area ratio is greater than the third preset threshold, obtaining a passenger boarding count and adding one to the passenger boarding count; If the passenger getting off the bus and hitting the line ratio is greater than the second preset threshold, the step of obtaining the passenger getting off the bus count and adding one to the passenger getting off the bus count comprises: If the getting off the vehicle and hitting the line ratio is greater than the second preset threshold, obtaining the regional pixel points of the preset passenger standing area; According to the area pixels, the alighting foreground pixels and the preset passenger standing area, a proportion of the alighting area is obtained; Determining whether the proportion of the alighting area is greater than the third preset threshold; If the proportion of the alighting area is greater than the third preset threshold, the passenger alighting count is obtained, and the passenger alighting count is increased by one.

5. The passenger flow counting method according to claim 4, characterized in that: If the boarding area ratio is greater than the third preset threshold, the step of obtaining a passenger boarding count and adding one to the passenger boarding count includes: If the boarding area ratio is greater than the third preset threshold, the total number of boarding blank rows is obtained according to the boarding optical flow map and the boarding foreground pixel points; Determining whether the total number of blank boarding rows is less than a fourth preset threshold; If the total number of blank boarding rows is less than the fourth preset threshold, obtaining a passenger boarding count and adding one to the passenger boarding count; If the proportion of the alighting area is greater than the third preset threshold, the step of obtaining the passenger alighting count and adding one to the passenger alighting count comprises: If the proportion of the getting-off area is greater than the third preset threshold, the total number of blank rows for getting-off is obtained according to the getting-off optical flow map and the getting-off foreground pixel points; Determining whether the total number of blank rows for getting off the bus is less than the fourth preset threshold; If the total number of the blank rows for getting off the bus is less than the fourth preset threshold, the passenger getting off count is obtained and the passenger getting off count is increased by one.

6. The passenger flow counting method according to any one of claims 1 to 5, characterized in that: The step of acquiring a video image frame and preprocessing the video image frame to obtain an image frame to be detected comprises: Get video image frames; The video image frame is reduced according to a preset size, and the reduced image frame is used as the image frame to be detected.

7. The passenger flow counting method according to claim 6, characterized in that: The step of reducing the video image frame according to a preset size and using the reduced image frame as the image frame to be detected comprises: Reducing the video image frame according to a preset size; The reduced image frame is converted into a single-channel grayscale image, and the single-channel grayscale image is used as the image frame to be detected.

8. A passenger flow counting system, characterized in that: The passenger flow counting system comprises: a memory, a processor and a passenger flow counting program stored in the memory and executable on the processor. When the passenger flow counting program is executed by the processor, the steps of the passenger flow counting method according to any one of claims 1 to 7 are implemented.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a passenger flow counting program, and when the passenger flow counting program is executed by a processor, the steps of the passenger flow counting method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Bus passenger flow statistical method, device and electronic apparatus

    CN108241844A