Method, apparatus and computer program product for monitoring traffic statistics for an area

By configuring detection boundary and intersection detection algorithms within the monitored area, combined with sub-region division, the problems of false detection and low accuracy in traffic statistics in existing technologies are solved, and accurate identification and efficient statistics of the direction of movement of moving objects are achieved.

CN122391985APending Publication Date: 2026-07-14TP-LINK INT SHENZHEN CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TP-LINK INT SHENZHEN CO LTD
Filing Date
2026-04-14
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing automated traffic statistics technologies suffer from false detections and insufficient robustness when identifying the direction of movement and trajectory of moving objects. In particular, the detection accuracy is low in dense crowds and occlusion situations, and traditional methods cannot effectively distinguish the direction of movement in complex scenarios such as entering, leaving, and passing through a store.

Method used

By configuring detection boundaries in the monitoring area, the intersection of the movement trajectory of a moving object with the detection boundary is detected. Combined with the intersection detection algorithm, the direction of movement of the moving object is identified, and the detection area is divided into sub-areas to determine the entry and exit points, thereby achieving accurate traffic statistics.

Benefits of technology

It achieves fast and accurate recognition of the direction of movement of objects, and can distinguish important directions of movement such as entering the store, leaving the store, and passing through the store. It improves the recognition accuracy and robustness in complex scenarios, and reduces computational complexity and hardware dependence.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122391985A_ABST
    Figure CN122391985A_ABST
Patent Text Reader

Abstract

The present disclosure relates to a traffic statistics method, device and computer program product for monitoring an area. The method comprises: obtaining trajectory coordinate points of a moving object in a monitoring area, the monitoring area comprising a detection area enclosed by a first detection boundary, the detection area being divided into a first sub-area and a second sub-area by a second detection boundary; detecting a first intersection point between a trajectory line formed by the trajectory coordinate points when the moving object enters the detection area and the first detection boundary, and a second intersection point between the trajectory line and the first detection boundary when the moving object leaves the detection area, and in response to detecting the first intersection point and the second intersection point, taking the first intersection point and the second intersection point as an entry point and an exit point of the moving object respectively; determining a passing direction of the moving object based on the sub-area where the entry point and the exit point are located respectively; and classifying and counting the moving object based on the determined passing direction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to image processing and computer vision technologies, and more specifically, to methods, apparatus, and computer program products for traffic statistics in monitored areas. Background Technology

[0002] Traffic flow statistics and analysis of moving objects (e.g., pedestrians) within a specific area have significant application value in scenarios such as commercial operations and public safety. In the commercial operations sector, traffic flow statistics can reflect the popularity and operating status of commercial venues (such as shopping malls and retail stores), providing data support for marketing strategy formulation, staff scheduling, and store layout planning. In the public safety sector, real-time and accurate monitoring is crucial for preventing stampedes and optimizing emergency evacuation routes. Especially in densely populated places such as large events, transportation hubs, and tourist attractions, timely understanding of passenger flow dynamics is an important means to achieve intelligent management, improve operational efficiency, and enhance safety levels.

[0003] Currently, traffic flow statistics technology is undergoing a profound transformation from traditional manual counting to intelligent and digital analysis. With the rapid development of image processing and computer vision technologies, the Internet of Things (IoT), and mobile communication technologies, automated collection and analysis of traffic flow data has been achieved.

[0004] However, existing automated traffic statistics technologies still face many challenges in practical applications. Summary of the Invention

[0005] In view of the above problems, this disclosure provides a traffic statistics method for a monitored area, which determines the direction of movement of a moving object by configuring a detection boundary for the monitored area and detecting the intersection between the movement trajectory of the moving object and the detection boundary, thereby enabling fast and accurate traffic statistics.

[0006] One aspect of this disclosure provides a traffic statistics method for a monitored area, comprising: acquiring the trajectory coordinates of a moving object within the monitored area, the monitored area including a detection area enclosed by a first detection boundary, the detection area being divided into a first sub-area and a second sub-area by a second detection boundary; detecting a first intersection point between the trajectory line formed by the trajectory coordinates of the moving object when it enters the detection area and the first detection boundary, and a second intersection point between the trajectory line of the moving object when it leaves the detection area and the first detection boundary, and in response to detecting the first intersection point and the second intersection point, respectively using the first intersection point and the second intersection point as the entry point and the exit point of the moving object; determining the travel direction of the moving object based on the sub-areas where the entry point and the exit point are respectively located; and classifying and counting the moving objects based on the determined travel direction.

[0007] Another aspect of this disclosure provides a traffic statistics device for monitoring an area, comprising: one or more processors; a memory coupled to at least one of the processors; and a set of computer program instructions stored in the memory, which, when executed by at least one of the processors, perform the traffic statistics method described above performed by an electronic device.

[0008] Another aspect of this disclosure provides a computer program product, including computer program instructions that, when executed by a processor, perform the above-described traffic statistics method. Attached Figure Description

[0009] The aspects, features, and advantages of this disclosure will become clearer and more readily understood from the following description of embodiments in conjunction with the accompanying drawings. The drawings are provided to offer a further understanding of the embodiments of this disclosure and form part of the specification. The drawings, together with the embodiments of this disclosure, are used to explain this disclosure but do not constitute a limitation thereof. In the drawings:

[0010] Figure 1 A scenario diagram of a traffic statistics system according to various embodiments of the present disclosure is shown.

[0011] Figure 2 A flowchart of a traffic statistics method for monitoring an area according to various embodiments of the present disclosure is shown.

[0012] Figure 3 A schematic diagram of an example detection configuration for a monitored area according to various embodiments of the present disclosure is shown.

[0013] Figures 4A to 4E Schematic diagrams of various forms of detection areas according to various embodiments of the present disclosure are shown.

[0014] Figures 5A to 5H A schematic diagram illustrating the identification of the travel direction of a moving object according to various embodiments of the present disclosure is shown.

[0015] Figure 6 A schematic diagram of a grid to which a monitoring area is mapped according to various embodiments of the present disclosure is shown.

[0016] Figure 7 A schematic diagram illustrates an example implementation process for determining whether a trajectory coordinate point is inside or outside a detection area, according to various embodiments of the present disclosure.

[0017] Figure 8 A schematic diagram of another example detection configuration for monitoring an area according to various embodiments of the present disclosure is shown.

[0018] Figure 9A schematic diagram of an example implementation process for determining whether a trajectory line crosses a second detection boundary according to various embodiments of the present disclosure is shown.

[0019] Figure 10 A schematic diagram is shown of a monitoring area mapped to another grid according to various embodiments of the present disclosure.

[0020] Figure 11 A schematic diagram illustrating examples of traffic statistics according to various embodiments of the present disclosure is shown.

[0021] Figure 12 An example block diagram of a traffic statistics device for monitoring an area according to various embodiments of the present disclosure is shown. Detailed Implementation

[0022] The technical solutions of this disclosure will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the protection scope of this disclosure.

[0023] Furthermore, the technical features involved in the different embodiments of this disclosure described below can be combined with each other as long as they do not conflict with each other.

[0024] The terms “exemplary” and / or “example” are used herein to mean “serving as an example, instance, or illustration.” Any aspect described herein as “exemplary” and / or “example” is not necessarily to be construed as superior to or better than other aspects. Similarly, the term “aspects of this disclosure” does not require that all aspects of this disclosure include the features, advantages, or modes of operation discussed.

[0025] Different automated traffic statistics technologies exhibit significant differences. Infrared sensing systems typically employ through-beam or pyroelectric sensors to count the number of moving objects entering their detection range. While simple in structure, this system only records the instantaneous number of moving objects passing through the detection area, failing to continuously track their trajectories. WiFi probe technology identifies and locates wireless communication devices and their users by detecting the MAC addresses broadcast by the devices. However, MAC addresses are personal information, and their collection must comply with strict privacy regulations. Furthermore, the same user may be identified as multiple users due to random MAC address changes, or a user may carry multiple wireless communication devices (e.g., mobile phones, smartwatches, tablets), leading to traffic statistics that significantly deviate from the actual number of users. This results in low reliability and coverage for WiFi probe technology. Traditional video analysis techniques use background subtraction, comparing a blank background image with the current image to determine if a target object appears. However, this traditional video analysis technique suffers from poor robustness to changes in lighting and is prone to false detections in crowded or occluded situations, resulting in low detection accuracy and insufficient adaptability.

[0026] Based on this, this disclosure proposes a traffic statistics mechanism based on the intersection detection of motion trajectories and detection boundaries. This mechanism configures virtual detection boundaries within the monitoring area and detects the intersection of motion trajectories and detection boundaries, which can not only accurately and efficiently identify the direction of movement of moving objects (e.g., entering or leaving), but also simultaneously track the motion trajectory of moving objects.

[0027] Figure 1 A scenario diagram of a traffic statistics system 100 according to various embodiments of the present disclosure is shown.

[0028] The traffic statistics system 100 may include a video acquisition device 101, a processing device 102, and an output device 103.

[0029] The video acquisition device 101 can acquire multiple video segments of the monitored area. For example, it can acquire real-time video segments or receive input video segments, adapting to different monitoring scenarios such as homes, supermarkets, and public safety. The video acquisition device 101 may include, for example, cameras. Cameras may include Internet Protocol (IP) cameras, visible light cameras, infrared cameras, thermal imaging cameras, 3D cameras, ultraviolet cameras, etc. There are many types of cameras, and selection can be made based on scenario requirements (e.g., lighting conditions, accuracy requirements, concealment), technical characteristics (e.g., resolution, sensor type), and system integration capabilities (e.g., artificial intelligence (AI) algorithms, network transmission). Furthermore, the video acquisition device 101 can process the video segments to identify moving objects (such as pedestrians, vehicles, animals, etc.) using image recognition algorithms and obtain the trajectory coordinates of the moving objects. The trajectory coordinates may include points within a head coordinate frame (e.g., the geometric center point or lower boundary center point of the head coordinate frame).

[0030] The processing device 102 can acquire the trajectory coordinates of moving objects within the monitored area. For example, the processing device 102 can receive the trajectory coordinates of moving objects from the video acquisition device 101, or it can receive the trajectory coordinates of moving objects obtained by processing video segments acquired by the video acquisition device 101 from other devices. These trajectory coordinates can be real-time or offline.

[0031] The monitoring area may include a detection area enclosed by a first detection boundary. For example, the monitoring area may include the entrance and exit area of ​​a monitoring station (which includes an entrance and an exit). A monitoring station may refer to a specific monitoring location, such as a shop, shopping mall, etc. A monitoring station may have one or more monitoring areas. The detection area may be divided into a first sub-area and a second sub-area by a second detection boundary. The first sub-area may be located outside the monitoring station, and the second sub-area may be located inside the monitoring station, and vice versa.

[0032] The processing device 102 can detect the first intersection point between the trajectory line formed by the trajectory coordinate points of the moving object entering the detection area and the first detection boundary, and the second intersection point between the trajectory line and the first detection boundary when the moving object leaves the detection area. In response to detecting the first intersection point and the second intersection point, the first intersection point and the second intersection point are respectively used as the entry point and the exit point of the moving object.

[0033] The processing device 102 can determine the travel direction of a moving object based on the sub-regions where the entry point and exit point are located. The processing device 102 can then classify and count the moving objects based on the determined travel direction. The travel direction can include entering a specific monitored area (e.g., entering a store), leaving a specific monitored area (e.g., leaving a store), passing by a specific monitored area (e.g., passing by a store), etc.

[0034] The output device 103 can receive the statistical results output by the processing device 102 and display the statistical results to the user. The output device 103 may include a display device (e.g., a liquid crystal display (LCD) / organic light-emitting diode (OLED) display, etc.). The output device 103 may also include a speaker for broadcasting the statistical results to the user.

[0035] In one embodiment, the video capture device 101 can function as a camera to acquire video, while the processing device 102 can function as a cloud server to perform the following... Figure 2 In the method shown, the output device 103 is deployed on the management side to display statistical results to users. In another embodiment, the video acquisition device 101 and the processing device 102 can be intelligent cameras (e.g., IPCs) with information processing capabilities (e.g., built-in computing power) responsible for video acquisition and analysis as well as the generation of statistical results, while the output device 103 serves as a remote terminal for displaying the statistical results. Those skilled in the art should understand that this disclosure does not limit the hardware form of the traffic statistics system 100.

[0036] Figure 2 A flowchart of a traffic statistics method 200 for monitoring an area according to various embodiments of the present disclosure is shown.

[0037] In step 210, the trajectory coordinates of moving objects within the monitored area can be obtained. The monitored area may include a detection area enclosed by a first detection boundary, which is further divided into a first sub-area and a second sub-area by a second detection boundary. For example, the monitored area may include the entrance / exit area (e.g., the store entrance) of a monitoring station (e.g., a store). The detection area can be divided into a first sub-area and a second sub-area by the second detection boundary. The first sub-area may be located outside the monitoring station (e.g., outside the store), and the second sub-area may be located inside the monitoring station (e.g., inside the store), and vice versa. The detection area may be smaller than the monitored area (e.g., ...). Figure 3 (as shown) or overlaps with the monitored area (such as) Figure 8 (As shown). A monitoring area may include one or more (e.g., three) detection areas. Users can configure the shape, size, and number of detection areas according to actual needs and conditions to accurately align them with the actual location to be detected.

[0038] The coordinates of the trajectory of the moving object can be obtained from, for example Figure 1 The video capture device 101 shown can directly acquire the video, or it can acquire it from other devices. These other devices process the video segments captured by the video capture device 101 to obtain the trajectory coordinates of the moving object. The trajectory coordinates may include points within a head coordinate frame (e.g., the geometric center point or lower boundary center point of the head coordinate frame). In addition to the trajectory coordinates, other information about the moving object can also be acquired, such as identification information (ID), head width, confidence level (a measure of the reliability of the algorithm for identifying the moving object), foreground point, etc.

[0039] According to embodiments of this disclosure, such as Figure 3 As shown, the detection area 301 in the monitoring area 300 can be enclosed by a first detection boundary 302 into a polygon, such as quadrilateral ABCD. The second detection boundary 303 can be a dividing line EF that divides the detection area 301 into two sub-regions. The polygon can have various forms, such as triangles, concave polygons, convex polygons, etc. One or more sides of the polygon can be straight lines, polylines, or curves. The second detection boundary can also have various forms, such as straight lines, polylines, or curves, such as... Figures 4A to 4E As shown. Those skilled in the art will understand that the first detection boundary and the second detection boundary may have other forms, and are not limited thereto.

[0040] In step 220, the first intersection point between the trajectory line formed by the trajectory coordinate points when the moving object enters the detection area (e.g., the trajectory line formed by connecting adjacent trajectory coordinate points) and the first detection boundary can be detected, and the second intersection point between the trajectory line when the moving object leaves the detection area and the first detection boundary can be detected. In response to detecting the first and second intersection points, the first and second intersection points can be used as the entry point and exit point of the moving object, respectively. Figures 5A to 5D As shown, the trajectory line intersects the first detection boundary when entering the monitoring area, and the intersection point (i.e., the first intersection point) serves as the entry point. The trajectory line also intersects the first detection boundary when leaving the monitoring area, and the intersection point (i.e., the second intersection point) serves as the exit point.

[0041] In step 230, the direction of travel for the moving object can be determined based on the sub-regions where the entry and exit points are located. For example, as... Figure 5AAs shown, in response to an entry point located in the first sub-region and an exit point located in the second sub-region, the direction of movement of a moving object can be determined as the first direction. Assuming the first sub-region is located outside the monitoring station (e.g., outside a store) and the second sub-region is located inside the monitoring station (e.g., inside a store), then the first direction represents entering the monitoring station (e.g., entering the store). Taking a store as an example, the monitoring area may include the store entrance, the second sub-region is the entrance location inside the store, and the first sub-region is outside the store. A moving object moving from the first sub-region to the second sub-region represents entering the store from outside the store entrance, and leaving from the second sub-region represents entering the store from the entrance location inside the store.

[0042] For example, such as Figure 5B As shown, in response to an entry point located in the second sub-region and an exit point located in the first sub-region, the direction of movement of a moving object can be determined as the second direction. Assuming the first sub-region is outside the monitoring station (e.g., outside a store) and the second sub-region is inside the monitoring station (e.g., inside a store), then the second direction represents leaving the monitoring station (e.g., leaving the store). Taking a store as an example, a moving object entering from the second sub-region means moving from inside the store to the store entrance; entering from the second sub-region into the first sub-region means moving from the store entrance to outside the store. A moving object leaving from the first sub-region means the moving object is no longer at the store entrance.

[0043] For example, such as Figure 5C As shown, in response to both the entry point and the exit point being located in the first sub-region, the direction of travel of the moving object can be determined to be a third direction. Assuming the first sub-region is located outside the monitoring station (e.g., outside the store) and the second sub-region is located inside the monitoring station (e.g., inside the store), then the third direction is represented as passing by but not entering the monitoring station (e.g., passing by the store).

[0044] For example, such as Figure 5D As shown, since both the entry and exit points are located in the second sub-area, the direction of movement of the moving object can be determined as the fourth direction. Assuming the first sub-area is outside the monitoring station (e.g., outside a store) and the second sub-area is inside the monitoring station (e.g., inside a store), the fourth direction represents activity within the monitoring station, such as staff moving around inside the store or customers browsing inside. However, since the moving object does not enter or exit the monitoring station, the fourth direction can be considered invalid if only inbound and outbound traffic statistics are relevant.

[0045] As mentioned above, traffic statistics using trajectory coordinates can not only identify the movement trajectory of moving objects, but also, since the calculation process for trajectory coordinates only requires processing coordinate data and does not rely on specific hardware devices (such as infrared sensors), this calculation process can be executed on any device with basic computing capabilities (such as computers, mobile phones, servers, etc.). Therefore, it can flexibly adapt to various different software and hardware environments and has extremely strong compatibility.

[0046] Furthermore, by dividing the detection area into two sub-regions and combining them with an intersection detection algorithm, the key positional changes of moving objects in space can be accurately captured. Based on the positional relationship between the intersection and the sub-regions, the trajectory and direction of the moving object can be quickly determined, avoiding misjudgments caused by trajectory ambiguity or occlusion in traditional methods. Moreover, traditional traffic statistics methods typically only identify two directions of traffic: entering and leaving the store. This invention, however, can accurately distinguish between three important directions of traffic: entering, leaving, and passing through the store, and effectively eliminates interference from invalid in-store activities, significantly improving the recognition accuracy and robustness in complex scenarios.

[0047] According to embodiments of this disclosure, various factors may cause the intersection between the trajectory line and the first detection boundary to be undetected. For example, such as Figure 5E As shown, the trajectory line never enters the detection area, indicating that the moving object did not enter the entrance / exit area of ​​the monitoring station. This situation can be disregarded when performing traffic statistics. However, due to line-of-sight obstruction or recognition accuracy issues, the start and / or end points of the trajectory line may appear directly within the detection area. For example, as... Figure 5F As shown, the starting point of the trajectory line appears out of nowhere within the detection area, resulting in the failure to detect the first intersection point between the trajectory line and the first detection boundary. For example, as... Figure 5G As shown, the endpoint of the trajectory line disappears into the detection area, resulting in the failure to detect the second intersection point between the trajectory line and the first detection boundary. For example, as... Figure 5H As shown, the starting point of the trajectory line appears out of nowhere within the detection area, and the ending point disappears out of nowhere within the detection area, resulting in the failure to detect the first and second intersection points between the trajectory line and the first detection boundary. Therefore, in the case where the first intersection point is not detected, it can be determined whether the starting point of the trajectory line is inside the detection area. In response to determining that the starting point is inside the detection area, the starting point can be determined as the entry point (e.g., ...). Figure 5F and Figure 5H As shown). If no second intersection point is detected, it can be determined whether the endpoint of the trajectory line is inside the detection area. In response to determining that the endpoint is inside the detection area, the endpoint can be designated as the departure point (e.g., ...). Figure 5G and Figure 5HAs shown). In response to determining that the start and end points are not inside the detection area, it is determined that the trajectory line has never entered the detection area from beginning to end (e.g. Figure 5E (As shown).

[0048] Specifically, regarding the case where the starting point of the trajectory line appears out of nowhere within the detection area, if the starting point is located inside the first sub-region (i.e., the entry point is located inside the first sub-region) and the second intersection point is located in the second sub-region (i.e., the exit point is located in the second sub-region), then the above applies. Figure 5A Similarly, the direction of travel for the moving object is determined as the first direction (e.g., entering the store). If the starting point is located within the first sub-region (i.e., the entry point is located within the first sub-region), and the second intersection point is located within the first sub-region (i.e., the exit point is located within the first sub-region), then the situation is similar to the above. Figure 5C Similarly, the direction of travel for the moving object is determined to be a third direction (e.g., across a store). If the starting point is located within the second sub-region (i.e., the entry point is located within the second sub-region), and the second intersection point is located within the first sub-region (i.e., the exit point is located within the first sub-region), then the situation is similar to the above. Figure 5B Similarly, the direction of travel for the moving object is determined as the second direction (e.g., leaving the store). If the starting point is located within the second sub-region (i.e., the entry point is located within the second sub-region), and the second intersection point is located within the second sub-region (i.e., the exit point is located within the second sub-region), then the situation is similar to the above. Figure 5D Similarly, in the case described above, the direction of travel for a moving object is determined to be the fourth direction (e.g., invalid).

[0049] If the endpoint of the trajectory line disappears out of the detection area, and if the first intersection point is located in the first sub-region (i.e., the entry point is located in the first sub-region) and the endpoint is located inside the second sub-region (i.e., the exit point is located inside the second sub-region), then the above applies. Figure 5A Similarly, the direction of travel for the moving object is determined as the first direction (e.g., entering the store). If the first intersection point is located within the first sub-region (i.e., the entry point is located within the first sub-region), and the endpoint is located within the first sub-region (i.e., the exit point is located within the first sub-region), then the situation is similar to the above. Figure 5C Similarly, the direction of travel for the moving object is determined to be a third direction (e.g., across a store). If the first intersection point is located in the second sub-region (i.e., the entry point is located in the second sub-region), and the endpoint is located within the first sub-region (i.e., the exit point is located within the first sub-region), then the situation is similar to the above. Figure 5B Similarly, the direction of travel for the moving object is determined to be the second direction (e.g., leaving the store). If the first intersection point is located in the second sub-region (i.e., the entry point is located in the second sub-region), and the endpoint is located within the second sub-region (i.e., the exit point is located within the second sub-region), then the situation is similar to the above. Figure 5DSimilarly, in the case described above, the direction of travel for a moving object is determined to be the fourth direction (e.g., invalid).

[0050] If the starting point of the trajectory line appears out of nowhere within the detection area and the ending point disappears out of nowhere within the detection area, and if the starting point is located inside the first sub-region (i.e., the entry point is located inside the first sub-region) and the ending point is located inside the second sub-region (i.e., the exit point is located inside the second sub-region), then the above applies. Figure 5A Similarly, the direction of travel for the moving object is determined as the first direction (e.g., entering the store). If the starting point is located within the first sub-region (i.e., the entry point is located within the first sub-region) and the ending point is located within the first sub-region (i.e., the exit point is located within the first sub-region), then the above applies. Figure 5C Similarly, the direction of travel for the moving object is determined to be a third direction (e.g., across a store). If the starting point is located within the second sub-region (i.e., the entry point is located within the second sub-region) and the ending point is located within the first sub-region (i.e., the exit point is located within the first sub-region), then the above applies. Figure 5B Similarly, the direction of travel for the moving object is determined to be the second direction (e.g., leaving the store). If the starting point is located within the second sub-region (i.e., the entry point is located within the second sub-region) and the ending point is located within the second sub-region (i.e., the exit point is located within the second sub-region), then the situation is similar to the above. Figure 5D Similarly, in the case described above, the direction of travel for a moving object is determined to be the fourth direction (e.g., invalid).

[0051] As mentioned above, defining the start point and / or end point as the entry point and / or exit point is a fault-tolerant compensation measure for intersection detection. It can capture and process the trajectory coordinates of all moving objects appearing in the field of view, avoiding missed detections due to special starting positions, and ensuring the integrity of traffic statistics.

[0052] In step 240, moving objects can be categorized and counted based on the determined travel direction. For example, the travel direction of all moving objects appearing in the monitored area during a certain time period can be determined, and then the moving objects can be counted according to the travel direction. For example, the number of moving objects in the first direction (e.g., entering the store) is 20, the number of moving objects in the second direction (e.g., leaving the store) is 15, and the number of moving objects in the third direction (e.g., passing by the store) is 6.

[0053] According to embodiments of this disclosure, determining whether a trajectory line intersects with a first detection boundary can be done by determining whether one trajectory coordinate point on the trajectory line is located inside the detection area and the other trajectory coordinate point is located outside the detection area. For example, a first intersection point between the trajectory line and the first detection boundary can be determined based on the fact that a first trajectory coordinate point on the trajectory line is located outside the detection area and a second trajectory coordinate point later than the first trajectory coordinate point is located inside the detection area. The second trajectory coordinate point may be adjacent to the first trajectory coordinate point. Similarly, a second intersection point between the trajectory line and the first detection boundary can be determined based on the fact that a third trajectory coordinate point on the trajectory line is located inside the detection area and a fourth trajectory coordinate point later than the third trajectory coordinate point is located outside the detection area. The fourth trajectory coordinate point may be adjacent to the third trajectory coordinate point.

[0054] According to embodiments of this disclosure, a ray-mapping method can be used to determine whether a trajectory coordinate point is located inside or outside the detection area. For example, the location of the trajectory coordinate point can be determined based on whether the number of intersections between the ray emanating from the trajectory coordinate point and the first detection boundary is odd or even. If the number of intersections is odd, the trajectory coordinate point is determined to be inside the detection area; if the number of intersections is even (including 0), the trajectory coordinate point is determined to be outside the detection area.

[0055] Compared to calculating the precise geometric intersection of the trajectory line and the first detection boundary (which typically involves solving a system of linear equations), algorithms that determine whether a point is inside or outside a polygon (e.g., ray casting) are computationally lighter, thus reducing computational overhead and improving detection efficiency.

[0056] If a moving object merely lingers near the first detection boundary or briefly crosses it before quickly turning back (i.e., "false passage"), this behavior means the moving object has not actually entered or left the detection area. Including such behavior in traffic statistics will generate false alarms, thus affecting the accuracy of the count. To avoid false alarms, this disclosure introduces a debouncing mechanism. When a moving object enters or leaves the detection area, it is only considered truly located inside or outside the detection area if it is sufficiently far away from the first detection boundary. "Sufficiently far away" can be defined as the shortest distance between the trajectory coordinate point and the first detection boundary exceeding a certain distance threshold. For example, when a moving object enters the detection area, the shortest distance between the second trajectory coordinate point or other trajectory coordinate points later than the second trajectory coordinate point and the first detection boundary can be determined to be inside the detection area based on the shortest distance being greater than a first preset threshold. Similarly, when a moving object leaves the detection area, the shortest distance between the fourth trajectory coordinate point or other trajectory coordinate points later than the fourth trajectory coordinate point and the first detection boundary can be determined to be outside the detection area based on the shortest distance being greater than a second preset threshold. The first and second preset thresholds can be set to half or several times the width of the moving object's head. For example, if the trajectory coordinate point is the geometric center or lower boundary center of the head coordinate frame, the first and second preset thresholds can be set to half the head width. In this way, only when the shortest distance between the trajectory coordinate point and the first detection boundary exceeds half the head width will the entire head coordinate frame exceed the first detection boundary; otherwise, the head coordinate frame partially overlaps with the first detection boundary and does not completely leave it. The first and second preset thresholds can be set to the same or different. Because the size of the moving object varies depending on its distance from the camera, moving objects farther from the camera are smaller, and moving objects closer to the camera are larger. The size of the moving object can be represented by the size of the head coordinate frame. When the size of the head coordinate frame is different, the first and second preset thresholds can be set differently.

[0057] In this way, if the condition of "sufficient distance" is not met, it will not be counted as a valid transaction. This helps to distinguish between "false passage" and "real passage," ensuring that the count reflects the actual traffic flow.

[0058] For example, when tracking a moving object, several key trajectory coordinate points can be determined based on the positional relationship between the trajectory coordinate points and the first detection boundary to identify the first and second intersection points. For instance, as the moving object moves from outside the detection area towards the detection area, the trajectory coordinate point outside the detection area and closest to the first detection boundary (referred to as the first point), the first trajectory coordinate point entering the detection area (referred to as the second point), and the trajectory coordinate point sufficiently far from the first detection boundary after entering the detection area (referred to as the third point) can be identified. When the third point is identified, the line connecting the first and second points intersects the first detection boundary, and this intersection point is designated as the first intersection point. Similarly, as the moving object moves from within the detection area towards outside the detection area, the trajectory coordinate point inside the detection area and closest to the first detection boundary (referred to as the fourth point), the first trajectory coordinate point leaving the detection area (referred to as the fifth point), and the trajectory coordinate point sufficiently far from the first detection boundary after leaving the detection area (referred to as the sixth point) can be identified. When the sixth point is identified, the line connecting the fourth and fifth points intersects the first detection boundary, and this intersection point is designated as the second intersection point. After determining the above six points, the direction of travel of the moving object can be immediately identified.

[0059] As described above, for each trajectory coordinate point, it is necessary to calculate the shortest distance between it and the first detection boundary, determine whether the shortest distance exceeds a first preset threshold or a second preset threshold, and determine whether the trajectory coordinate point is located inside or outside the detection area. When there are a large number of trajectory coordinate points, this process involves a huge amount of computation and requires a large amount of memory to store the trajectory coordinate point information.

[0060] To save computational resources and memory, and to more quickly determine the positional relationship between the trajectory coordinates and the second detection boundary, a grid pattern can be used. For example... Figure 6 As shown, the monitoring area can be pre-mapped to a grid 600 comprising multiple grid cells, and the grid cells in grid 600 can be classified. Multiple grid cells can be classified into a first set of grid cells located outside the detection area 606 (e.g., ...). Figure 6 The dark gray grid cell set shown includes one or more grid cells, and the second type of grid cell set 602 located inside the detection area 606 (such as...) Figure 6 The light gray grid cell set shown includes one or more grid cells), and the third type of grid cell set overlapping the first detection boundary 601 (such as...). Figure 6 The white grid cell set shown comprises one or more grid cells. Each grid cell in the third type of grid cell set can be subdivided into the next level of grid (e.g., as shown in the image). Figure 6 The small grid shown is 602). For the sake of simplicity, Figure 6Only one small grid, 602, is shown in the image. The next level of grid (e.g., Figure 6 The small grid shown (602) can also be classified into the three types of grid cell sets mentioned above. Subdivision can be performed iteratively until the smallest grid granularity is reached. The above division and classification of the grid can be stored in memory as mapping information. For example, the mapping information can be in the form of a table, but is not limited to this.

[0061] For example, in response to determining whether the trajectory coordinate point belongs to the first or second type of grid cell set, it can be determined whether the trajectory coordinate point is located inside or outside the detection area. In response to determining whether the trajectory coordinate point belongs to the third type of grid cell set, a ray method can be used, that is, by determining whether the number of intersections between the ray emanating from the trajectory coordinate point as the starting point and the first detection boundary 601 is odd or even, it can be determined whether the trajectory coordinate point is located inside or outside the detection area.

[0062] The process of tracking a moving object to identify the position of each trajectory coordinate point is as follows: Figure 7 As shown. Figure 7 As shown, firstly, in step S1, it is determined whether a grid exists. If no grid exists (e.g., "No" in step S1), then in step S2, the ray casting method described above can be used to determine whether the trajectory coordinates are located outside or inside the detection area, and the determination result can be output in step S3. If a grid exists (e.g., "Yes" in step S1), grid information (e.g., grid size and grid cell size, for example, ...) can be obtained in step S4. Figure 6 The 6×4 grid shown has each cell measuring 100×100 pixels. In step S5, it can be determined which grid cell the trajectory coordinate point belongs to. For example, dividing the coordinates of the trajectory point by the side length of the grid cell yields the grid key. The grid key can identify a grid cell within the grid, for example, the vertex coordinates and side length of the grid cell, or the grid cell index. For example, for a grid cell like... Figure 6The 6×4 grid shown has each grid cell measuring 100×100 pixels. Dividing the coordinates of the trajectory point (250, 350) by the side length of the grid cell (100) yields the grid cell row number = floor(250 / 100) = 2 and the grid cell column number = floor(350 / 100) = 3, i.e., the grid cell index (2, 3), which is the grid cell in the 2nd row and 3rd column. Then, mapping information can be looked up to determine which of the three grid cell sets the trajectory point belongs to: the first, the second, or the third. Those skilled in the art should understand that there are other ways to determine which grid cell a trajectory point belongs to based on its coordinates, and this is not limited to these methods. In response to determining which of the first or second grid cell sets the trajectory point belongs to, in step S6, it can be determined whether the trajectory point is located inside or outside the detection area, and the determination result is output. For example, in response to determining that the trajectory coordinate point belongs to a first type of grid cell set, it is determined that the trajectory coordinate point is outside the detection area; and in response to determining that the trajectory coordinate point belongs to a second type of grid cell set, it is determined that the trajectory coordinate point is inside the detection area. In response to determining that the trajectory coordinate point belongs to a third type of grid cell set, the next level of grid (e.g., ...) can be obtained in step S7. Figure 6 The small grid 604 shown is then used, and the process returns to step S1. If the grid cannot be further divided, it can be determined in step S1 that no grid exists, and in step S2, the ray casting method described above is used to determine whether the trajectory coordinate points are located outside or inside the detection area.

[0063] As described above, by dividing the mesh into three types and iteratively subdividing the third type of mesh cell set, geometric determinations (e.g., ray casting) can be limited to areas that truly require high-precision determination. For the first and second types of mesh cell sets, only a simple mesh key lookup is needed. This coarse-grained + fine-grained meshing mode avoids point-by-point geometric calculations across the entire monitored area, greatly reducing computational complexity and saving computation time and memory usage.

[0064] Apart from Figure 3 In addition to the detection configuration of the monitoring area shown (i.e., when the detection area and the monitoring area do not overlap and the first detection boundary is used to detect the first intersection point and the second intersection point), other configurations can also be used as follows: Figure 8 Another detection configuration for the monitored area shown (i.e., when the detection area overlaps with the monitored area and the first detection boundary is not used to detect the first and second intersections). For example... Figure 8 The other detection configuration shown is compared to Figure 3 The detection configuration shown is simpler and suitable for scenarios with limited hardware or low requirements for counting accuracy.

[0065] like Figure 8 As shown, the first detection area boundary may not be configured (i.e., the detection area overlaps with the monitoring area and the first detection boundary is not used to detect the first and second intersections). The monitoring area 800 is divided into a first sub-area and a second sub-area by the second detection boundary 801. In this case, it can be determined whether the trajectory line 802 crosses the second detection boundary 801, and in response to determining that the trajectory line crosses the second detection boundary 801, the travel direction of the moving object can be determined based on the sub-areas where the trajectory coordinate points on both sides of the second detection boundary 801 are located. The second detection boundary 801 may include a straight line, a polyline, or a curve.

[0066] For example, in response to a fifth trajectory coordinate point on one side of the second detection boundary 801 being located in a first sub-region 801 (e.g., outside the store) and a sixth trajectory coordinate point on the other side of the second detection boundary 801, which is later than the fifth trajectory coordinate point, being located in a second sub-region (e.g., inside the store), the direction of travel of the moving object can be determined to be a first direction (e.g., entering the store). Similarly, in response to a fifth trajectory coordinate point on one side of the second detection boundary 801 being located in a second sub-region (e.g., inside the store) and a sixth trajectory coordinate point on the other side of the second detection boundary 801, which is later than the fifth trajectory coordinate point, being located in a first sub-region (e.g., outside the store), the direction of travel of the moving object can be determined to be a second direction (e.g., leaving the store).

[0067] As mentioned above, with only simple detection configuration required, there's no need to configure polygonal detection boundaries; instead, only a second detection boundary (e.g., a straight line, curve, or polyline) is needed for boundary crossing detection, reducing configuration time and complexity. For scenarios where only total traffic or inbound / outbound traffic needs to be counted without distinguishing between complex behaviors like entering / leaving / passing through the store, this simple detection can provide sufficiently accurate traffic statistics. Users can flexibly choose simple detection configurations (e.g., ...) based on their actual needs and constraints. Figure 8 (as shown) or requires a more sophisticated detection configuration (such as...) Figure 3 As shown). Simple detection configuration (such as...) Figure 8 (as shown) or requires a more sophisticated detection configuration (such as...) Figure 3 (As shown) can be pre-configured by the system or user, or it can be dynamically configured by the system or user after the monitoring area appears.

[0068] If a moving object merely lingers near the first detection boundary or briefly crosses it before quickly turning back (i.e., "false passage"), this behavior means the moving object hasn't actually entered or left the detection area. Including such behavior in traffic statistics will generate false alarms, thus affecting the accuracy of the count. To avoid false alarms, a combination of the above methods should be used... Figure 3The anti-shake mechanism of the monitoring area's detection configuration ensures that when a moving object crosses the second detection boundary, it is only considered to have truly entered the other side of the second detection boundary when the moving object is sufficiently far away from the second detection boundary. "Sufficiently far away" can be defined as the shortest distance between the trajectory coordinate point and the second detection boundary exceeding a certain distance threshold. For example, the sixth trajectory coordinate point can be determined to be located in the first or second sub-region (i.e., the sub-region on the other side of the second detection boundary) based on the shortest distance between the sixth trajectory coordinate point or other trajectory coordinate points later than the sixth trajectory coordinate point and the second detection boundary being greater than a third preset threshold. The third preset threshold can be set to half or several times the width of the moving object's head. For example, if the trajectory coordinate point is the geometric center point or the lower boundary center point of the head coordinate frame, the third preset threshold can be set to half the head width. In this way, only when the shortest distance between the trajectory coordinate point and the second detection boundary exceeds half the head width can the entire head coordinate frame cross the second detection boundary; otherwise, the head coordinate frame partially overlaps with the second detection boundary and has not completely left the second detection boundary.

[0069] In this way, if the condition of "sufficient distance" is not met, it will not be counted as a valid transaction. This helps to distinguish between "false passage" and "real passage," ensuring that the count reflects the actual traffic flow.

[0070] For example, when tracking a moving object, several key trajectory coordinate points can be determined based on the positional relationship between the trajectory coordinate points and the second detection boundary to confirm whether the moving object has actually crossed the second detection boundary. For instance, as the moving object moves towards the second detection boundary, the trajectory coordinate point closest to the first detection boundary on one side of the second detection boundary (referred to as the first point), the first trajectory coordinate point entering the other side of the second detection boundary (referred to as the second point), and the trajectory coordinate point sufficiently far away from the second detection boundary on the other side (referred to as the third point) can be identified. When the existence of the third point is confirmed, the line connecting the first and second points intersects the second detection boundary, indicating that the object has crossed the second detection boundary.

[0071] The process of tracking a moving object to identify the position of each trajectory coordinate point is as follows: Figure 9 As shown. Figure 9As shown, firstly, in step S1, the shortest distance between the current trajectory coordinate point and the second detection boundary can be determined. In step S2, it is determined whether the shortest distance is equal to 0. If the shortest distance is equal to 0 (e.g., "yes" in step S2), then in step S3, it is determined that the trajectory coordinate point is located on the second detection boundary. If the shortest distance is not equal to 0 (e.g., "no" in step S2), then in step S4, it is determined whether there is a previous trajectory coordinate point for the current trajectory coordinate point, that is, whether the current trajectory coordinate point is the initial trajectory coordinate point. The current trajectory coordinate point is connected to the previous trajectory coordinate point to form a line between the two points, and in step S5, it is determined whether this line intersects the second detection boundary. If the line intersects the second detection boundary (e.g., "yes" in step S5), then in step S6, the intersection count is set to 1. Then, in step S7, it is determined whether the shortest distance between the current trajectory coordinate point and the second detection boundary exceeds a third preset threshold. If the shortest distance exceeds a third preset threshold (e.g., "Yes" in step S7), then in step S8 it is determined whether the number of intersections is odd (i.e., whether it is 1). If the number of intersections is odd (i.e., 1), then the moving objects are classified and counted according to the direction of travel in step S9. After classification and counting, the number of intersections is reset to zero in step S10. The position identification of the trajectory coordinate point is completed, and then in step S11 the current trajectory coordinate point is used as the previous trajectory coordinate point to identify the position of the next trajectory coordinate point.

[0072] As described above, for each trajectory coordinate point, it is necessary to calculate the shortest distance between it and the second detection boundary, determine whether the shortest distance exceeds a third preset threshold, and determine whether the line connecting the current trajectory coordinate point and the previous trajectory coordinate point intersects the second detection boundary. When there are a large number of trajectory coordinate points, the above process involves a huge amount of computation and requires a large amount of memory to store the trajectory coordinate point information.

[0073] To save computation and memory, and to more quickly determine the positional relationship between the trajectory coordinates and the second detection boundary, a grid pattern can be used (which, along with... Figure 6 (The grid patterns shown are different). For example... Figure 10 As shown, the monitoring area can be pre-mapped to a grid 1000 containing multiple grid cells, and the grid cells in grid 1000 can be classified. Multiple grid cells can be classified into a fourth set of grid cells that do not overlap with the second detection boundary 1001 (e.g., ...). Figure 10 The white grid cell set shown includes one or more grid cells), and the fifth type of grid cell set overlapping with the second detection boundary 1001 (such as...). Figure 10 The light gray set of mesh cells shown comprises one or more mesh cells. Each mesh cell in the fifth type of mesh cell set can be subdivided into the next level of mesh (e.g., as shown in the image). Figure 10The small grid shown is 1002). The next level grid (e.g., Figure 10 The small grid (1002) shown can also be classified into the two types of grid cell sets mentioned above. Subdivision can be performed iteratively until the smallest grid granularity is reached. The above division and classification of the grid can be stored in memory as mapping information. For example, the mapping information can be in the form of a table, but is not limited to this.

[0074] According to embodiments of this disclosure, in response to determining that a trajectory coordinate point belongs to a fourth type of grid cell set, the trajectory coordinate point can be ignored. That is, it is unnecessary to calculate the shortest distance between the trajectory coordinate point and the second detection boundary, nor is it necessary to determine whether the line connecting the current trajectory coordinate point and the previous trajectory coordinate point intersects the second detection boundary, because a trajectory coordinate point within the fourth type of grid cell set will inevitably not intersect the second detection boundary with the previous trajectory coordinate point. In response to determining that a trajectory coordinate point belongs to a fifth type of grid cell set 1002, it can be determined whether the line connecting the trajectory coordinate point and an adjacent trajectory coordinate point (e.g., the previous trajectory coordinate point) intersects the second detection boundary, and in response to the line intersecting the second detection boundary, it can be determined that the trajectory line crosses the second detection boundary. In this way, only the trajectory coordinate points belonging to the fifth type of grid cell set 1002 need to be calculated and determined, which can significantly reduce the overhead of calculation and determination operations and the need to store calculation and determination results.

[0075] As described above, by dividing the mesh into two types and iteratively subdividing the fifth type of mesh cell set, geometric determinations (e.g., intersection detection) can be limited to areas that truly require high-precision determination. The fourth type of mesh cell set is directly ignored, requiring no further calculation. This coarse-grained + fine-grained meshing pattern avoids point-by-point geometric calculations across the entire monitored area, significantly reducing computational complexity and saving computation time and memory usage.

[0076] The traffic statistics method described above can be executed by a server (e.g., a cloud server), which can obtain trajectory coordinates from terminal devices (e.g., IP cameras or other devices). In this way, edge devices with limited computing power (i.e., terminal devices) are only used for processing video streams and obtaining trajectory coordinates, while complex processing such as intersection detection, traffic direction recognition, and image stabilization is distributed to the server. This effectively avoids the data processing backlog and high latency problems caused by the limited computing power of edge devices. Furthermore, the server can handle a large number of processing tasks from edge devices. Simultaneously, it breaks through the performance bottleneck of front-end hardware, enabling low-cost, low-power edge devices to support complex statistical algorithms, thereby significantly reducing the overall system deployment cost.

[0077] After classifying and counting moving objects based on the determined direction of travel, the counting information can be visually presented according to embodiments of this disclosure. Figure 11 A schematic diagram illustrating example presentation 1100 of traffic statistics according to various embodiments of the present disclosure is shown.

[0078] For example, the counting information may include statistical information 1101 and real-time information 1102. Statistical information 1101 may include categorized counting results within a preset time period. For example, the categorized counting results may include the number of moving objects in a first direction (e.g., number of people entering the store), the number of moving objects in a second direction (e.g., number of people leaving the store), the number of moving objects in a third direction (e.g., number of people passing through the store), relevant ratios (e.g., store entry rate = (number of people entering the store ÷ (number of people entering the store + number of people passing through the store)) × 100%), and the month-on-month comparison results of the above values. The preset time period may be, for example, within a year, within a month, within a week, within a day, etc., or it may be a custom time period. For example, for a specific store, the preset time period may be set to its business hours so that only data from business hours is counted.

[0079] The classification count results can include the total classification count results (1101-1) for a preset time period. For example... Figure 11 As shown, statistical information 1101 can be displayed in the middle area of ​​example presentation 1100 as data showing the total number of customers entering the store within a week: 139, the total number of customers leaving the store: 99, the total number of visits to the store: 53, and the total store entry rate: 72.4%. In addition, the category count results can also include separate category count results 1101-2 for each preset time period to show changes in the data. For example... Figure 11 As shown, statistics 1101 can be displayed in the area below example presentation 1100 in the form of a trend chart or table, showing the number of customers entering, leaving, passing through, and the customer entry rate for each day of the aforementioned week (e.g., 2025 / 10 / 19, ..., 2025 / 10 / 25). The trend chart can be switched to a table format, and the table can be exported in CSV and XLSX formats. The entries in the table include: a preset time period, and the number of customers entering, leaving, passing through, and the customer entry rate during the corresponding preset time period.

[0080] Statistical information 1101 may include category count results for a preset time period for a monitored site (e.g., a store), as described above. Furthermore, statistical information 1101 may also include category count results for a preset time period grouped by monitored site level (e.g., such as...). Figure 11(See "Traffic statistics by site"). For example, monitored sites can be grouped from top to bottom as: national level, provincial / municipal level, county level, etc. When a user wants to view the national category count results for a specific store, shopping mall, or venue, they can select the national level to display the total national category count results for that store, shopping mall, or venue. The monitoring site levels can be displayed in a tree structure.

[0081] Real-time information 1102 may include the current time's classification count result 1102-1 and the current time's number of moving objects within the monitored area 1102-2. The current time's classification count result 1102-1 may be data collected at predetermined time intervals starting from a preset time point. For example, such as... Figure 11 As shown, the classification count result 1102-1 for the current time can be the classification count result for today (for example, from 00:00 to the current time 22:10:39). The count is performed every 15 minutes, and the data is automatically refreshed every 15 minutes.

[0082] The number of moving objects within the monitored area at the current time (1102-2) can include both the current number and the maximum number. For example, as... Figure 11 As shown, the current quantity can be the number of people entering the store per minute today (e.g., from 00:00 to the current time 22:12:42) minus the number leaving the store, which is the number of people remaining in the store. For example, 15 people. The data is automatically refreshed every minute. For example, the current quantity It can be calculated using the following formula (1).

[0083] (1)

[0084] Where x represents the current minute, x-1 represents the previous minute, and m(x) in Let n(x) represent the number of customers entering the store. out Indicates the number of departures. This represents the sum of data from one or more monitoring sites. The number of moving objects in the store can be reset to zero at a fixed time (e.g., 00:00), even if moving objects that remained overnight in the store subsequently leave. If the current number is negative (which could be due to moving objects that remained at 00:00 only now leaving), the negative number can be forced to 0.

[0085] By intuitively displaying real-time information, physical store managers can take timely measures such as traffic restrictions and optimization to prevent safety incidents (e.g., in public places, cultural and tourist attractions, transportation hubs, etc.) or adjust the layout of goods in a timely manner to optimize product promotion strategies (e.g., in shopping malls, stores, etc.).

[0086] The traffic statistics method described in the embodiments of this disclosure can obtain the classification and counting results of moving objects and display them to the user. Users can optimize monitoring sites by knowing the classification and counting results. For example, in shopping malls and stores, by analyzing information such as store entry rate and average transaction value (i.e., total sales ÷ total number of customers), customer behavior patterns can be understood to rationally arrange promotional activities and employee scheduling; by analyzing traffic conditions in hot areas, merchandise displays and shelf layouts can be adjusted to improve customer dwell time and purchase conversion rates. In public places and cultural and tourism scenic spots, the density of people in the venue can be monitored, and timely warnings can be issued when the traffic approaches the capacity limit to assist in traffic management and safety management; based on peak traffic periods, security, cleaning, and other service personnel and facility resources can be rationally allocated; and by analyzing tourists' tour routes and dwell time in scenic areas, attraction planning and guided tour services can be optimized. In transportation hubs, traffic monitoring can be conducted at hubs such as subway stations, train stations, and airports to optimize train schedules and passenger flow guidance.

[0087] According to embodiments of this disclosure, a user can, in real time, on a display device (e.g., such as...) Figure 1 View the video stream of the monitored area on the output device 103 shown, and at the same time view the classification count results displayed below the video stream or in other locations, so as to intuitively observe the changes in the flow count.

[0088] According to embodiments of this disclosure, in order to ensure the video capture device (e.g., such as...) Figure 1 The output device 103 shown has an optimal shooting angle, which can optimize the video capture device (e.g., such as...). Figure 1 The installation method of the output device 103 shown, such as installation height, tilt angle, installation position, and compatibility. For example, a video acquisition device (e.g., such as...) Figure 1 The vertical distance (i.e., installation height) from the output device 103 shown to the ground can be set between 3 and 6 meters. Video capture devices (e.g., such as...) Figure 1 The downward viewing angle (i.e., tilt angle) between the line of sight of the output device 103 shown and the horizontal plane can be set between 30° and 80°. Video capture devices (e.g., such as...) Figure 1 The output device 103 shown can be installed directly facing the entrance / exit area of ​​the monitoring station (i.e., the installation location) to avoid tilting the monitoring screen. Video acquisition devices (e.g., such as...) Figure 1 The installation height, tilt angle and installation position of the output device 103 shown must be coordinated to minimize mutual obstruction between moving objects in the monitoring screen, so as to avoid false alarms and missed alarms.

[0089] Figure 12 An example block diagram of a traffic statistics device 1200 for monitoring an area according to various embodiments of the present disclosure is shown.

[0090] like Figure 12 As shown, the flow statistics device 1200 may include one or more processors 1210 and a memory 1220. The processor 1210 is communicatively coupled to the memory 1220 and is configured to perform the methods described above.

[0091] A set of computer program instructions stored in memory, when executed by at least one processor, performs any step of the above method, including: acquiring the trajectory coordinates of a moving object within a monitoring area, the monitoring area including a detection area enclosed by a first detection boundary, the detection area being divided into a first sub-region and a second sub-region by a second detection boundary; detecting a first intersection point between the trajectory line formed by the trajectory coordinates of the moving object when it enters the detection area and the first detection boundary, and a second intersection point between the trajectory line formed by the trajectory coordinates of the moving object when it leaves the detection area and the first detection boundary, and, in response to detecting the first intersection point and the second intersection point, designating the first intersection point and the second intersection point as the entry point and exit point of the moving object, respectively; determining the travel direction of the moving object based on the sub-regions where the entry point and exit point are located, respectively; and classifying and counting the moving objects based on the determined travel direction. The above pertains to... Figures 2 to 11 The details described in the method shown also apply here.

[0092] Examples of processor 1210 include microprocessors, microcontrollers, digital signal processors (DSPs), field-programmable gate arrays (FPGAs), programmable logic devices (PLDs), state machines, gated logic, discrete hardware circuits, and other suitable hardware configured to perform various functionalities throughout the present disclosure.

[0093] Processor 1210 can execute software. Whether referred to as software, firmware, middleware, microcode, hardware description language, or other terms, software should be broadly interpreted to mean instructions, instruction sets, code, code segments, program code, programs, subroutines, software modules, applications, software applications, software packages, routines, subroutines, objects, executable files, execution threads, procedures, functions, etc. Software can reside on memory 1220.

[0094] Memory 1220 may be a non-transitory computer-readable medium. As examples, non-transitory computer-readable media include magnetic storage devices (e.g., hard disks, floppy disks, magnetic stripes), optical disks (e.g., compact discs (CDs) or digital versatile discs (DVDs)), smart cards, flash memory devices (e.g., cards, sticks, or key drives), random access memory (RAM), read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), registers, removable disks, erasable PROMs (EEPROMs), and any other suitable medium for storing software and / or instructions that can be accessed and read by a computer. Memory 1220 may reside in processor 1210, be external to processor 1210, or be distributed across multiple entities including processor 1210. Memory 1220 may be embodied in a computer program product. For example, a computer program product may include a computer-readable medium in encapsulation material. Those skilled in the art will recognize how the functionality described herein can be implemented depending on the specific application and the overall design constraints imposed on the system as a whole.

[0095] Additionally, according to another embodiment of this disclosure, a computer program product for an electronic device is disclosed. As an example, the computer program product includes a non-transitory computer-readable storage medium having program instructions embodied therein, and the program instructions are executable by a processor. When executed, the program instructions cause the processor to perform one or more of the processes described above, and details are omitted herein for brevity.

[0096] This disclosure can be a system, method, and / or computer program product at any possible level of technical detail integration. A computer program product may include a computer-readable storage medium (or medium) having computer-readable program instructions thereon for causing a processor to perform aspects of this disclosure.

[0097] The above description, with reference to the accompanying drawings, outlines a traffic statistics method, apparatus, computer program product, and system according to embodiments of the present disclosure. This disclosure utilizes the intersection detection of trajectory coordinate points and detection boundaries for traffic statistics, enabling rapid and accurate determination of the movement trajectory and direction of travel (including the three important directions of entering, leaving, and passing through the store), significantly improving the real-time performance and accuracy of traffic statistics. Furthermore, it allows for flexible selection of detection modes (simple or sophisticated). Additionally, the grid pattern significantly reduces computational complexity, computation time, and memory usage.

[0098] Unless otherwise expressly stated, expressions such as “according to,” “based on,” “depending on,” etc., as used in this disclosure do not mean “according to only,” “based on only,” or “depending on only.” In other words, in this disclosure, such expressions generally mean “at least according to,” “at least based on,” or “at least depending on.”

[0099] Any references to elements in this disclosure, such as the names "first," "second," etc., are not intended to comprehensively limit the number or order of these elements. These expressions may be used in this disclosure as a convenient way to distinguish two or more units. Therefore, references to the first unit and the second unit do not imply that only two units may be used, or that the first unit must precede the second unit in some form.

[0100] As used in this disclosure, the term "determine" can include a variety of operations. For example, "determine," calculation, operation, processing, derivation, investigation, search (e.g., searching in a table, database, or other data structure), and ascertainment are all considered "determine." Additionally, "determine" also refers to receiving (e.g., receiving information), sending (e.g., sending information), inputting, outputting, and accessing (e.g., accessing data in memory). Furthermore, "determine" can also refer to parsing, selecting, picking, building, and comparing. In other words, several actions can be considered "determine."

[0101] As used in this disclosure, terms such as “connection,” “coupling,” or any variation thereof refer to any direct or indirect connection or combination between two or more units, which may include situations where one or more intermediate units exist between two units that are “connected” or “coupled” to each other. The coupling or connection between units may be physical or logical, or a combination of both. As used in this disclosure, two units may be considered electrically connected by means of one or more wires, cables, and / or printing, and as numerous non-limiting and non-exhaustive examples, may be “connected” or “coupled” to each other by means of electromagnetic energy in the radio frequency region, microwave region, and / or light (visible and invisible) region, etc.

[0102] When the terms “comprising,” “including,” and variations thereof are used in this disclosure or claims, these terms are open-ended, just like the term “having.” Furthermore, the term “or” as used in this disclosure or claims is not an exclusive “or.”

[0103] Those skilled in the art will understand that many changes and / or modifications can be made to the present disclosure shown in the specific embodiments without departing from the spirit or scope of the present disclosure as broadly described. Therefore, the embodiments are to be considered illustrative rather than restrictive in all respects.

Claims

1. A method for traffic statistics in a monitored area, comprising: The trajectory coordinates of a moving object within the monitoring area are obtained. The monitoring area includes a detection area enclosed by a first detection boundary, and the detection area is divided into a first sub-region and a second sub-region by a second detection boundary. The system detects the first intersection point between the trajectory line formed by the trajectory coordinate points when the moving object enters the detection area and the first detection boundary, and the second intersection point between the trajectory line and the first detection boundary when the moving object leaves the detection area. In response to detecting the first intersection point and the second intersection point, the system uses the first intersection point and the second intersection point as the entry point and exit point of the moving object, respectively. Based on the sub-regions where the entry point and exit point are located, the travel direction of the moving object is determined; and Based on the determined direction of travel, the moving objects are classified and counted.

2. The method according to claim 1, wherein, Determining the travel direction of the moving object based on the sub-region locations where the entry point and exit point are respectively located includes one of the following: In response to the fact that the entry point is located in the first sub-region and the exit point is located in the second sub-region, the travel direction of the moving object is determined to be the first direction; In response to the fact that the entry point is located in the second sub-region and the exit point is located in the first sub-region, the travel direction of the moving object is determined to be the second direction; In response to the fact that both the entry point and the exit point are located in the first sub-region, the travel direction of the moving object is determined to be a third direction; and Since both the entry point and the exit point are located in the second sub-region, the travel direction of the moving object is determined to be the fourth direction.

3. The method according to claim 1, further comprising: If the first intersection point is not detected: Determine whether the starting point of the trajectory line is inside the detection area; as well as In response to determining that the starting point is inside the detection area, the starting point is determined as the entry point; and / or In the case where the second intersection point is not detected: Determine whether the endpoint of the trajectory line is inside the detection area; as well as In response to determining that the endpoint is inside the detection area, the endpoint is determined as the departure point.

4. The method according to claim 1, wherein: The first intersection point is determined in the following way: Based on the fact that a first trajectory coordinate point on the trajectory line is located outside the detection area, and a second trajectory coordinate point later than the first trajectory coordinate point is located inside the detection area, it is determined that a first intersection point exists between the trajectory line and the first detection boundary. The second intersection point is determined in the following way: Based on the fact that the third trajectory coordinate point among the trajectory coordinate points on the trajectory line is located inside the detection area and the fourth trajectory coordinate point, which is later than the third trajectory coordinate point, is located outside the detection area, it is determined that the trajectory line and the first detection boundary have a second intersection point.

5. The method according to claim 4, wherein, Whether the trajectory coordinates of the moving object are located inside or outside the detection area is determined based on whether the number of intersections between the ray emanating from the trajectory coordinates and the first detection boundary is odd or even.

6. The method according to claim 4, wherein, The monitoring area is mapped to a grid comprising multiple grid cells, and these grid cells are classified into a first set of grid cells located outside the detection area, a second set of grid cells located inside the detection area, and a third set of grid cells overlapping the first detection boundary. Each grid cell in the third set of grid cells is further subdivided into a next-level grid. Whether the trajectory coordinates of the moving object are located inside or outside the detection area is determined by the following method: In response to determining which of the first type of grid cell set and the second type of grid cell set the trajectory coordinate point belongs to, it is determined whether the trajectory coordinate point is located inside or outside the detection area; as well as In response to determining that the trajectory coordinate point belongs to the third type of grid cell set, the location of the trajectory coordinate point inside or outside the detection area is determined by whether the number of intersections between the ray emanating from the trajectory coordinate point as the starting point and the first detection boundary is odd or even.

7. The method according to claim 4, wherein: The determination that the second trajectory coordinate point is located inside the detection area is based on the fact that the shortest distance between the second trajectory coordinate point or other trajectory coordinate points later than the second trajectory coordinate point and the first detection boundary is greater than a first preset threshold, and The determination that the fourth trajectory coordinate point is located outside the detection area is based on the fact that the shortest distance between the fourth trajectory coordinate point or other trajectory coordinate points later than the fourth trajectory coordinate point and the first detection boundary is greater than a second preset threshold.

8. The method according to claim 1, wherein, When the detection area and the monitoring area do not overlap and the first detection boundary is used to detect the first intersection point and the second intersection point, the first intersection point and the second intersection point are detected. The method further includes: When the detection area overlaps with the monitoring area and the first detection boundary is not used to detect the first intersection and the second intersection: Determine whether the trajectory line crosses the second detection boundary; and In response to determining that the trajectory line crosses the second detection boundary, the travel direction of the moving object is determined based on the sub-regions where the trajectory coordinate points on both sides of the second detection boundary are located.

9. The method according to claim 8, wherein, In response to the trajectory line crossing the second detection boundary, determining the travel direction of the moving object based on the sub-regions where the trajectory coordinate points on both sides of the second detection boundary are located includes: In response to the fact that a fifth trajectory coordinate point on one side of the second detection boundary is located in the first sub-region and a sixth trajectory coordinate point later than the fifth trajectory coordinate point on the other side of the second detection boundary is located in the second sub-region, the travel direction of the moving object is determined to be the first direction; or In response to the fact that a fifth trajectory coordinate point on one side of the second detection boundary is located in the second sub-region and a sixth trajectory coordinate point on the other side of the second detection boundary, which is later than the fifth trajectory coordinate point, is located in the first sub-region, the travel direction of the moving object is determined to be the second direction.

10. The method according to claim 9, wherein, The determination that the sixth trajectory coordinate point is located in the first sub-region or the second sub-region is based on the fact that the shortest distance between the sixth trajectory coordinate point or other trajectory coordinate points later than the sixth trajectory coordinate point and the second detection boundary is greater than a third preset threshold.

11. The method according to claim 8, wherein, The monitoring area is mapped to a grid comprising multiple grid cells, and these grid cells are classified into a fourth set of grid cells that do not overlap with the second detection boundary and a fifth set of grid cells that overlap with the second detection boundary. Each grid cell in the fifth set of grid cells is further subdivided into a next-level grid, and whether the trajectory line crosses the second detection boundary is determined by the following method: In response to determining that the trajectory coordinate point belongs to the fourth type of grid cell set, the trajectory coordinate point is ignored; as well as In response to determining that the trajectory coordinate point belongs to the fifth type of grid cell set, it is determined whether the line connecting the trajectory coordinate point and the adjacent trajectory coordinate point intersects the second detection boundary, and in response to the line intersecting the second detection boundary, it is determined that the trajectory line crosses the second detection boundary.

12. The method according to claim 1, wherein, The first detection boundary includes polygons.

13. The method according to claim 1, wherein, The second detection boundary includes a straight line, a broken line, or a curve.

14. The method according to claim 1, wherein, The monitoring area is the entrance and exit area of ​​the monitoring station. The first sub-area is located outside the monitoring station, and the second sub-area is located inside the monitoring station.

15. The method according to claim 1, further comprising: The counting information is presented visually, including statistical information and real-time information. The statistical information includes the classification counting results within a preset time period, and the real-time information includes the classification counting results at the current time and the number of moving objects in the monitored area at the current time.

16. The method according to claim 1, wherein, The method is executed by a server, and the server obtains the trajectory coordinates from the terminal device.

17. A traffic flow statistics device for monitoring an area, comprising: One or more processors; Memory coupled to at least one of the processors in the processor; as well as A set of computer program instructions stored in the memory, which, when executed by at least one of the processors, perform the method as described in any one of claims 1-16.

18. A computer program product comprising computer program instructions that, when executed by a processor, perform the method as described in any one of claims 1-16.