A B+ tree-based video storage and retrieval method, device and equipment
By using a B+ tree-based index structure and composite key technology, the low efficiency of existing video retrieval methods in handling scenarios with continuous time and dynamic object trajectories is solved, achieving efficient video storage and retrieval. In particular, it can quickly filter out dynamic targets that meet the time range in scenarios such as intelligent traffic monitoring.
Patent Information
- Application Number
- CN202511293185.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-11
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-09-11
AI Technical Summary
Existing video retrieval methods are inefficient when dealing with complex scenarios involving temporal continuity and dynamic object trajectories. They cannot effectively organize and utilize the temporal attributes of video data, resulting in low efficiency when it is necessary to perform queries to determine the continuity of a target over a time range.
By adopting a B+ tree-based index structure, the video data stream is divided into a preset spatial grid, continuously moving dynamic targets are identified, spatiotemporal trajectory segments are generated, and a composite key index structure is constructed. The B+ tree index structure and composite keys are used to perform range queries and filter out dynamic targets that meet the duration requirements.
It improves the efficiency and accuracy of video storage and retrieval, and can efficiently filter out dynamic targets that meet the duration requirements, thus satisfying the requirements of real-time performance and scalability.
Smart Images

Figure CN120804347B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, specifically to a video storage and retrieval method, apparatus, and device based on B+ trees. Background Technology
[0002] With the rapid development of applications such as security monitoring, live streaming, and short video social media, video data is exploding at an unprecedented rate. This massive amount of video data presents enormous challenges to storage and management, especially when it comes to quickly and accurately retrieving specific content from a vast video library. Traditional video file management methods have revealed significant shortcomings. Currently, most systems still store videos as independent binary files in the file system, relying primarily on external metadata such as filename, creation time, and tags for retrieval. When searching based on specific events or objects within the video content, this approach often requires decoding and sequentially scanning the video files one by one, making the retrieval process extremely time-consuming and completely failing to meet real-time and efficiency requirements.
[0003] To address the challenges of video content retrieval, existing technologies have proposed content analysis-based retrieval methods that extract keyframe sequences representative of the video content using frame extraction techniques. When a user initiates a content retrieval request, the system no longer scans the original video file but instead performs rapid matching directly within the keyframe sequence. This transforms video file scanning into a query of structured feature data, significantly improving the response speed of content retrieval.
[0004] However, this keyframe feature indexing-based retrieval method still has problems when dealing with complex video retrieval scenarios involving temporal continuity and dynamic object trajectories. Essentially, this method treats video as a collection of static images at discrete time points, and its index structure primarily focuses on the content of a single frame, neglecting the temporal attributes of the video data. For example, in intelligent traffic monitoring, a retrieval requirement is to find vehicles that have remained stationary at intersections for more than 30 seconds. This method fails to effectively organize and utilize the temporal continuity information of objects, resulting in low efficiency when faced with queries requiring continuous judgments of the target over a time range. Summary of the Invention
[0005] This application provides a video storage and retrieval method, apparatus, and device based on B+ tree, which improves the retrieval efficiency of video data.
[0006] The first aspect of this application provides a video storage and retrieval method based on a B+ tree. The method includes: acquiring a video data stream to be processed, and dividing the video data stream into multiple preset spatial grids according to a preset spatial grid definition; processing the video data stream to identify continuously moving dynamic targets in the video data stream; determining the target spatial grid where the dynamic target is located, and generating a spatiotemporal trajectory segment, the spatiotemporal trajectory segment having a boundary between the start time of the dynamic target entering the target spatial grid and the end time of the dynamic target leaving the target spatial grid; constructing a B+ tree index structure, using the spatiotemporal trajectory segment as a data record to be indexed, and setting the index key of the B+ tree index structure as... The system receives a retrieval request and uses the B+ tree index structure and the composite key to perform a range query to obtain a candidate segment set. The retrieval request includes a query dynamic target and a target query time range. It then traverses the target spatiotemporal trajectory segments in the candidate segment set and calculates the overlap duration between the time interval of the target spatiotemporal trajectory segment and the target query time range. Based on the query dynamic target, it determines the corresponding target identifier and accumulates all overlap durations generated by the query dynamic target to obtain the total effective dwell time of the query dynamic target within the target query time range. Finally, it filters out query dynamic targets whose total effective dwell time is greater than or equal to a preset duration threshold and outputs them as the final retrieval result.
[0007] By employing the above technical solution, the video data stream to be processed is acquired and divided into multiple preset spatial grids according to a preset spatial grid definition. Then, the video data stream is processed to identify continuously moving dynamic targets and determine the target spatial grid where the dynamic targets reside, generating spatiotemporal trajectory segments with the start and end times of the dynamic targets entering and leaving the target spatial grids as boundaries. Next, a B+ tree index structure is constructed, with the spatiotemporal trajectory segments as the data records to be indexed, and the index key of the B+ tree index structure is set as a composite key. When a retrieval request is received, a range query is performed using the B+ tree index structure and the composite key to obtain a candidate segment set. The target spatiotemporal trajectory segments in the candidate segment set are traversed, and the overlap duration between the time interval of the target spatiotemporal trajectory segment and the target query time range is calculated. Based on the queried dynamic target, the corresponding target identifier is determined, and all overlap durations generated by the queried dynamic target are accumulated to obtain the total effective dwell time of the queried dynamic target within the target query time range. Finally, queried dynamic targets with a total effective dwell time greater than or equal to a preset duration threshold are filtered out and output as the final retrieval result. This method improves the efficiency and accuracy of video storage and retrieval by constructing a B+ tree index structure, using composite keys to achieve efficient range queries, and filtering out dynamic targets that meet the duration requirements by calculating the overlap duration and total effective dwell time.
[0008] Optionally, the spatiotemporal trajectory segment includes continuous spatiotemporal trajectory segments and spliced spatiotemporal trajectory segments. Generating the continuous spatiotemporal trajectory segment specifically includes: detecting a dynamic target within each video frame of the video data stream and obtaining the position coordinates of the dynamic target; mapping the position coordinates to the preset spatial grid to determine the target spatial grid where the dynamic target is located; if the dynamic target is appearing in the target spatial grid for the first time, then creating a continuous spatiotemporal trajectory segment with the timestamp of the current video frame as the starting time, and setting the continuous spatiotemporal trajectory segment to an unclosed state; if the dynamic target is detected within the target spatial grid in the first video frame, then maintaining the continuous spatiotemporal trajectory segment in the unclosed state and continuing to track the dynamic target, where the first video frame is a subsequent video frame of the current video frame; if the dynamic target is detected to disappear in the second video frame, and the dynamic target is not detected within a preset fault tolerance time threshold, then determining that the dynamic target has left the target spatial grid, and closing the continuous spatiotemporal trajectory segment with the timestamp of the second video frame as the ending time, where the second video frame is a video frame within the first video frame.
[0009] By employing the above technical solution, dynamic targets within each video frame of the video data stream are detected, and their position coordinates are obtained. Then, these position coordinates are mapped to a preset spatial grid to determine the target spatial grid where the dynamic target resides. If the dynamic target is appearing in the target spatial grid for the first time, a continuous spatiotemporal trajectory segment is created starting with the timestamp of the current video frame, and this segment is set to an unclosed state. If the dynamic target is detected within the target spatial grid in subsequent video frames, the unclosed spatiotemporal trajectory segment is maintained, and tracking of the dynamic target continues. If the dynamic target disappears in a video frame, and no further dynamic target is detected within a preset fault tolerance time threshold, the dynamic target is determined to have left the target spatial grid, and the continuous spatiotemporal trajectory segment is closed, ending with the timestamp of that video frame. This method, by detecting the position coordinates of dynamic targets, mapping them to a preset spatial grid, determining the appearance and disappearance of dynamic targets, generating continuous spatiotemporal trajectory segments, and accurately recording the start and end times of the dynamic target within the target spatial grid, provides fundamental data for subsequent indexing and querying.
[0010] Optionally, generating the spatiotemporal trajectory segment specifically includes: performing frame-by-frame analysis on the video data stream; when a dynamic target is detected within the target space grid of the third video frame, generating a temporary segment including the third video frame, wherein the third video frame is one of the multiple video frames included in the video data stream; within a preset time window, acquiring all target temporary segments generated by the dynamic target within the target space grid; sorting each target temporary segment by timestamp; merging the first temporary segment and the second temporary segment into the spatiotemporal trajectory segment, wherein the first temporary segment and the second temporary segment are any two of the multiple target temporary segments, and the time interval between the first temporary segment and the second temporary segment is less than a preset fusion time threshold.
[0011] By employing the above technical solution, frame-by-frame analysis of the video data stream is performed. When a dynamic target is detected within the target space grid of a video frame, a temporary segment including that video frame is generated. Then, within a preset time window, all target temporary segments generated by the dynamic target within the target space grid are acquired. Next, each target temporary segment is sorted by timestamp, and two temporary segments with a time interval less than a preset fusion time threshold are merged into a spliced spatiotemporal trajectory segment. This method generates target temporary segments by performing frame-by-frame analysis of the video data stream, and sorts and merges these target temporary segments within a preset time window to generate spliced spatiotemporal trajectory segments. This method can merge temporally dispersed temporary segments to form continuous spatiotemporal trajectory segments, improving the integrity and continuity of the spatiotemporal trajectory segments and facilitating subsequent indexing and querying.
[0012] Optionally, constructing the B+ tree index structure, using the spatiotemporal trajectory segment as the data record to be indexed, and setting the index key of the B+ tree index structure as a composite key, specifically includes: concatenating the spatial grid identifier, dynamic target identifier, start time, and end time of the spatiotemporal trajectory segment as strings in sequence to construct the composite key; inserting the spatiotemporal trajectory segment into the corresponding data page node in the B+ tree index structure according to the lexicographical order of the composite key; storing the composite key in the intermediate nodes of the B+ tree index structure; storing the spatiotemporal trajectory segment as the data record to be indexed in the leaf nodes of the B+ tree index structure; and linking the leaf nodes using a pointer linked list.
[0013] By employing the aforementioned technical solution, the spatial grid identifier, dynamic target identifier, start time, and end time of the spatiotemporal trajectory fragment are sequentially concatenated as strings to construct a composite key. Then, based on the lexicographical order of the composite key, the spatiotemporal trajectory fragment is inserted into the corresponding data page node in the B+ tree index structure. The composite key is stored in the intermediate nodes of the B+ tree index structure; the spatiotemporal trajectory fragment is stored as the data record to be indexed in the leaf nodes of the B+ tree index structure, and the leaf nodes are linked using a pointer linked list. This method, by constructing a composite key, combines multiple attributes of the spatiotemporal trajectory fragment into a single index key, enabling multi-dimensional indexing. Simultaneously, utilizing the hierarchical index structure of the B+ tree and the linked list structure of the leaf nodes, efficient range queries and sequential access can be achieved. This index structure design improves the retrieval efficiency of spatiotemporal trajectory fragments and meets the requirements of real-time performance and scalability.
[0014] Optionally, the step of using the B+ tree index structure and the composite key to perform a range query and obtain a candidate segment set specifically includes: constructing a query range for the B+ tree index structure based on the query dynamic target and the target query time range; converting the query range into a start retrieval key and a stop retrieval key in the B+ tree index structure, wherein the start retrieval key includes a target identifier and a target start time, and the stop retrieval key includes a target identifier and a target end time; locating the starting leaf node in the B+ tree index structure based on the start retrieval key and through the hierarchical index structure of the B+ tree index structure; traversing the successor nodes in a forward direction based on the doubly linked list of the starting leaf node, sequentially comparing the composite key corresponding to the successor node with the stop retrieval key to determine the target node before the stop retrieval key, and adding the target spatiotemporal trajectory segment corresponding to the target node to the candidate segment set.
[0015] By employing the above technical solution, a query range is constructed using a B+ tree index structure based on the dynamic target and the target query time range. Then, the query range is transformed into a start search key and a stop search key in the B+ tree index structure. The start search key includes the target identifier and the target start time, while the stop search key includes the target identifier and the target end time. Next, in the B+ tree index structure, based on the start search key, the starting leaf node is located using the hierarchical index structure of the B+ tree. Finally, based on the doubly linked list of the starting leaf node, successor nodes are traversed forward, and the composite key corresponding to each successor node is compared with the stop search key to determine the target node before the stop search key. The target spatiotemporal trajectory fragment corresponding to the target node is then added to the candidate fragment set. This method utilizes the B+ tree index structure and composite keys to quickly locate the starting leaf node by constructing the query range and search key. Then, using the doubly linked list of the leaf nodes, target spatiotemporal trajectory fragments that meet the query conditions can be efficiently obtained by traversing and comparing composite keys, forming a candidate fragment set. This query method fully utilizes the advantages of the B+ tree index structure, achieving efficient range queries and improving the retrieval efficiency of spatiotemporal trajectory fragments.
[0016] Optionally, after constructing the B+ tree index structure, using the spatiotemporal trajectory segments as data records to be indexed, and setting the index key of the B+ tree index structure as a composite key, the method further includes the steps of constructing a first auxiliary index item and a second auxiliary index item. The construction of the first and second auxiliary index items specifically includes: grouping the spatiotemporal trajectory segments according to spatial grid identifiers to obtain a first grouping result; generating a first auxiliary index item corresponding to each spatial grid identifier based on the first grouping result, where the index key of the first auxiliary index item is the spatial grid identifier, and the index value of the first auxiliary index item is the set of leaf nodes corresponding to all spatiotemporal trajectory segments containing the spatial grid identifier; grouping the spatiotemporal trajectory segments according to dynamic target identifiers to obtain a second grouping result; and generating a second auxiliary index item corresponding to each dynamic target identifier based on the second grouping result, where the index key of the second auxiliary index item is the dynamic target identifier, and the index value of the second auxiliary index item is the set of leaf nodes corresponding to all spatiotemporal trajectory segments containing the dynamic target identifier.
[0017] By adopting the above technical solution, after constructing the B+ tree index structure, this solution also constructs a first auxiliary index item and a second auxiliary index item to further improve query efficiency. When constructing the first auxiliary index item, spatiotemporal trajectory fragments are grouped according to spatial grid identifiers to obtain the first grouping result. Then, based on the first grouping result, a first auxiliary index item corresponding to each spatial grid identifier is generated. The index key of the first auxiliary index item is the spatial grid identifier, and the index value is the set of leaf nodes corresponding to all spatiotemporal trajectory fragments containing that spatial grid identifier. When constructing the second auxiliary index item, spatiotemporal trajectory fragments are grouped according to dynamic target identifiers to obtain the second grouping result. Then, based on the second grouping result, a second auxiliary index item corresponding to each dynamic target identifier is generated. The index key of the second auxiliary index item is the dynamic target identifier, and the index value is the set of leaf nodes corresponding to all spatiotemporal trajectory fragments containing that dynamic target identifier. By constructing the first and second auxiliary index items, relevant spatiotemporal trajectory fragments can be quickly located based on the spatial grid identifier and the dynamic target identifier, avoiding searching throughout the entire B+ tree index structure and improving query efficiency. This auxiliary index design, combined with the B+ tree main index structure, forms a complete spatiotemporal trajectory index system, meeting the needs of efficient retrieval under different query conditions.
[0018] Optionally, the step of processing the video data stream to identify continuously moving dynamic targets in the video data stream specifically includes: extracting the foreground from each video frame in the video data stream to obtain a foreground binary image; performing connected component analysis on the foreground binary image to obtain candidate dynamic target regions; calculating feature parameters of the candidate dynamic target regions, the feature parameters including area, aspect ratio, and motion speed; classifying the candidate dynamic target regions based on the feature parameters using a support vector machine classifier to obtain dynamic target regions; and tracking the dynamic target regions to obtain each dynamic target and its corresponding motion trajectory.
[0019] By employing the aforementioned technical solution, foreground is extracted from each video frame in the video data stream to obtain a binary foreground image. Then, connected component analysis is performed on the binary foreground image to obtain candidate dynamic target regions. Next, feature parameters of the candidate dynamic target regions are calculated, including area, aspect ratio, and motion speed. Based on these feature parameters, a support vector machine classifier is used to classify the candidate dynamic target regions, thus obtaining the dynamic target regions. Finally, target tracking is performed on the dynamic target regions to obtain each dynamic target and its corresponding motion trajectory. This method, through foreground extraction and connected component analysis, obtains candidate dynamic target regions, and then uses feature parameters and a support vector machine classifier for classification, accurately identifying the dynamic target regions. Target tracking yields the motion trajectories of the dynamic targets, providing foundational data for subsequent spatiotemporal trajectory segment generation. This dynamic target recognition and tracking method can effectively extract continuously moving dynamic targets from video data streams, laying the foundation for efficient video storage and retrieval.
[0020] A second aspect of this application provides a video storage and retrieval device based on a B+ tree. The device includes a video acquisition module, a video stream processing module, a B+ tree construction module, a retrieval module, and a retrieval result output module. The video acquisition module acquires the video data stream and divides it into multiple preset spatial grids according to a preset spatial grid definition. The video stream processing module processes the video data stream and identifies continuously moving dynamic targets within it. The video stream processing module further determines the target spatial grid where the dynamic target is located and generates a spatiotemporal trajectory segment, the spatiotemporal trajectory segment having boundaries between the start time of the dynamic target entering the target spatial grid and the end time of the dynamic target leaving the target spatial grid. The B+ tree construction module constructs a B+ tree index structure, using the spatiotemporal trajectory segment as... The system records data to be indexed and sets the index key of the B+ tree index structure as a composite key. The retrieval module receives retrieval requests and performs range queries using the B+ tree index structure and the composite key to obtain a candidate segment set. The retrieval request includes a query dynamic target and a target query time range. The retrieval module also iterates through the target spatiotemporal trajectory segments in the candidate segment set and calculates the overlap duration between the time interval of the target spatiotemporal trajectory segment and the target query time range. Furthermore, the retrieval module determines the corresponding target identifier based on the query dynamic target and accumulates all overlap durations generated by the query dynamic target to obtain the total effective dwell time of the query dynamic target within the target query time range. The retrieval result output module filters out query dynamic targets whose total effective dwell time is greater than or equal to a preset duration threshold and outputs them as the final retrieval result.
[0021] A third aspect of this application provides an electronic device including a processor, a memory, a user interface, and a network interface, wherein the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any of the foregoing.
[0022] A fourth aspect of this application provides a computer-readable storage medium storing instructions that, when executed, perform the method described in any of the preceding descriptions.
[0023] In summary, one or more technical solutions provided in this application have at least the following technical effects or advantages:
[0024] 1. This method constructs a B+ tree-based index structure and uses composite keys (composed of spatial grid identifier, dynamic target identifier, start time, and end time) for efficient index management of spatiotemporal trajectory segments. It directly filters spatiotemporal trajectory segments that overlap with the target time range through range queries, and calculates the overlap duration of the candidate segment set, thereby improving retrieval efficiency. Attached Figure Description
[0025] Figure 1 This is a flowchart illustrating a video storage and retrieval method based on a B+ tree disclosed in an embodiment of this application;
[0026] Figure 2 This is a schematic diagram of a video storage and retrieval device based on a B+ tree disclosed in an embodiment of this application;
[0027] Figure 3 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application.
[0028] Explanation of reference numerals in the attached diagram: 201, Video acquisition module; 202, Video stream processing module; 203, B+ tree construction module; 204, Retrieval module; 205, Retrieval result output module; 300, Electronic device; 301, Processor; 302, Communication bus; 303, User interface; 304, Network interface; 305, Memory. Detailed Implementation
[0029] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0030] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.
[0031] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0032] This application provides a video storage and retrieval method based on a B+ tree, referring to... Figure 1 , Figure 1 This is a flowchart illustrating a video storage and retrieval method based on a B+ tree, provided in an embodiment of this application. The method is applied to a server, which executes the B+ tree video storage and retrieval program. The server can be a single server, a server cluster consisting of multiple servers, or a cloud computing service center. The method includes steps S101 to S108, as follows:
[0033] Step S101: Obtain the video data stream to be processed, and divide the video data stream into multiple preset spatial grids according to the preset spatial grid definition.
[0034] In step S101, the server first acquires the video data stream to be processed. The video data stream can come from various video acquisition devices, such as surveillance cameras, vehicle cameras, and drone cameras, or from video storage devices, such as video servers and cloud storage platforms. The server receives the video data stream through a network interface or video acquisition interface and temporarily stores it in a memory buffer or on disk for subsequent processing.
[0035] Next, the server divides the video data stream into multiple preset spatial grids according to the preset spatial grid definition. The preset spatial grid definition refers to dividing the video surveillance scene into several grid units according to certain spatial division rules, with each grid unit corresponding to a unique spatial grid identifier. The granularity of the spatial grid division can be set according to actual application needs; for example, it can be divided according to fixed length and width.
[0036] The server divides each frame of the video data stream into a spatial grid according to a preset spatial grid definition:
[0037] For a fixed-size rectangular grid, the server first calculates the pixel coordinate range corresponding to each grid cell based on the resolution of the video image and the size of the preset grid cell. Then, it performs a pixel-level scan of the video image to determine which grid cell each pixel belongs to and marks the pixel as the corresponding spatial grid identifier.
[0038] Through the above steps, the server has completed the spatial grid division of the video data stream, obtaining the correspondence between each frame image and the spatial grid identifier, laying the foundation for subsequent dynamic target recognition and trajectory generation. Next, the server will detect and track dynamic targets within each spatial grid, extract the spatiotemporal trajectory segments of the targets, and establish a spatiotemporal index.
[0039] For example, in an urban road traffic monitoring scenario, the server can divide the road network into grids according to its topology. Each road segment and intersection corresponds to a spatial grid unit, and each road segment is further divided into several small grids of 10 meters each. When a vehicle enters a road segment, the server determines the spatial grid identifier to which it belongs based on the vehicle's pixel coordinates in the video image, and continuously tracks the changes in the spatial grid of the vehicle in subsequent frames until it leaves the monitoring area.
[0040] Step S102: Process the video data stream to identify continuously moving dynamic targets in the video data stream.
[0041] In step S102, the video data stream is processed to identify continuously moving dynamic targets in the video data stream. Specifically, this includes: extracting the foreground from each video frame in the video data stream to obtain a binary foreground image; performing connected component analysis on the binary foreground image to obtain candidate dynamic target regions; calculating the feature parameters of the candidate dynamic target regions, including area, aspect ratio, and motion speed; classifying the candidate dynamic target regions based on the feature parameters using a support vector machine classifier to obtain dynamic target regions; and tracking the dynamic target regions to obtain each dynamic target and its corresponding motion trajectory.
[0042] Specifically, the server extracts the foreground from each video frame in the video data stream, obtaining a binary foreground image. Foreground extraction refers to distinguishing moving objects in a video frame from the static background, generating a binary image containing only the moving objects. Foreground extraction algorithms can include frame differencing, background subtraction, and Gaussian mixture modeling (Gaussian mixture) background modeling. The server can choose an appropriate algorithm based on scene characteristics and real-time requirements; for example, frame differencing can be used against static backgrounds, while Gaussian mixture modeling can be used against dynamic backgrounds.
[0043] Then, the server performs connected component analysis on the foreground binary image to obtain candidate dynamic target regions. Connected component analysis refers to searching for connected pixel regions in a binary image, with each connected region corresponding to a candidate dynamic target. The server can use region growing algorithms, contour extraction algorithms, etc., to perform connected component analysis, obtaining a set of bounding rectangles or contour polygons for the candidate dynamic target regions. The server calculates the feature parameters of the candidate dynamic target regions, including area, aspect ratio, and motion velocity. Area refers to the number of pixels in the candidate dynamic target region; aspect ratio refers to the ratio of the width to the height of the bounding rectangle of the candidate dynamic target region; motion velocity refers to the ratio of the displacement to the time interval of the candidate dynamic target region in consecutive video frames. Using these feature parameters, the server can preliminarily determine whether the candidate dynamic target region is a real moving object.
[0044] Next, the server uses a Support Vector Machine (SVM) classifier to classify the candidate dynamic target regions based on the feature parameters, thus obtaining the dynamic target regions. SVM is a binary classification model that finds the optimal classifying hyperplane in the feature space, dividing the candidate dynamic target regions into moving and non-moving objects. The server pre-trains the SVM classifier using a labeled dataset to obtain the classification model, and then inputs the feature parameters of the candidate dynamic target regions into the classification model to obtain their category, thereby determining which candidate regions are truly dynamic targets.
[0045] Finally, the server performs target tracking on the dynamic target region, obtaining each dynamic target and its corresponding motion trajectory. Target tracking refers to continuously locating and matching the same dynamic target in consecutive video frames to obtain its motion trajectory. Target tracking algorithms can include Kalman filtering, particle filtering, correlation filtering, etc. The server can select an appropriate tracking algorithm based on the motion characteristics of the dynamic target and the complexity of the scene. For example, Kalman filtering can be used in single-target, linear motion scenes, while particle filtering can be used in multi-target, nonlinear motion scenes. Through target tracking, the server can obtain information such as the position, size, and velocity of each dynamic target in different video frames, forming a complete motion trajectory.
[0046] For example, in a surveillance video of a public place, the server first performs background subtraction on the video frames to obtain a binary image containing only moving people in the foreground; then, it performs connected component analysis on the binary image to obtain multiple candidate person regions; next, it calculates the area, aspect ratio, and movement speed of each candidate person region and uses a support vector machine classifier to determine whether it is a real pedestrian; finally, the server uses the Kalman filter algorithm to track each pedestrian target to obtain its movement trajectory in the scene until the target leaves the monitoring area.
[0047] Step S103: Determine the target space grid where the dynamic target is located, and generate a spatiotemporal trajectory segment. The spatiotemporal trajectory segment is bounded by the start time when the dynamic target enters the target space grid and the end time when the dynamic target leaves the target space grid.
[0048] In step S103, the spatiotemporal trajectory segment includes a continuous spatiotemporal trajectory segment and a spliced spatiotemporal trajectory segment. Generating a continuous spatiotemporal trajectory segment specifically includes: detecting a dynamic target within each video frame of the video data stream and obtaining the position coordinates of the dynamic target; mapping the position coordinates to a preset spatial grid to determine the target spatial grid where the dynamic target is located; if the dynamic target is appearing in the target spatial grid for the first time, a continuous spatiotemporal trajectory segment is created starting from the timestamp of the current video frame, and the continuous spatiotemporal trajectory segment is set to an unclosed state; if a dynamic target is detected within the target spatial grid in the first video frame, the continuous spatiotemporal trajectory segment remains unclosed, and the tracking of the dynamic target continues, with the first video frame being a subsequent video frame of the current video frame; if the dynamic target disappears in the second video frame, and no dynamic target is detected within a preset fault tolerance time threshold, it is determined that the dynamic target has left the target spatial grid, and the continuous spatiotemporal trajectory segment is closed with the timestamp of the second video frame as the end time, with the second video frame being a video frame within the first video frame.
[0049] Specifically, the server processes each video frame in the video data stream, detects moving targets contained within them, and obtains the position coordinates of each moving target. The server can use target detection algorithms, such as deep learning-based YOLO, SSD, Faster R-CNN, etc., to perform real-time analysis of the video frames and obtain the bounding box coordinates of the moving targets.
[0050] Then, the server maps the position coordinates of the dynamic target to a preset spatial grid, determining the target spatial grid where the dynamic target resides. Specifically, the server calculates the spatial grid identifier based on the coordinates of each point in the dynamic target's bounding box, discretizing the continuous spatial coordinates into grid cells. If the dynamic target is appearing in the target spatial grid for the first time, the server creates a new continuous spatiotemporal trajectory segment starting from the timestamp of the current video frame and sets the state of this trajectory segment to unclosed. The server records the spatial grid identifier, timestamp, position coordinates, and other information of the dynamic target as the starting node of the trajectory segment.
[0051] In subsequent video frames, if the server detects that the same dynamic target is still within the same target space grid, it maintains the unclosed state of the continuous spatiotemporal trajectory segment and continues to track the dynamic target. The server adds the dynamic target's position coordinates, timestamps, and other information in each video frame to the trajectory segment, forming a continuous sequence of spatiotemporal trajectory points.
[0052] If a moving target is detected to have disappeared in a subsequent video frame (the second video frame), and is not detected again within a preset fault tolerance time threshold, the server determines that the moving target has left the target space grid. The server closes the continuous spatiotemporal trajectory segment using the timestamp of the last video frame in which the target was detected as the end time. At this point, the trajectory segment contains the complete motion process of the moving target within the target space grid, from entry to exit, forming a continuous spatiotemporal trajectory segment.
[0053] For example, in a surveillance video of a shopping mall, the server divides the mall's floor into several square spatial grids. When a customer enters a grid cell, the server detects the customer's coordinates and creates a new continuous spatiotemporal trajectory segment, recording the start time and the customer's initial position. In subsequent video frames, the server continuously tracks the customer's movement within the same grid, adding their coordinates and timestamps to the trajectory segment. If the customer leaves the grid and does not reappear within 2 seconds, the server determines that the customer has left, using the timestamp of the last detected customer as the end time, and closes the continuous spatiotemporal trajectory segment. In this way, the server obtains a complete continuous spatiotemporal trajectory segment, recording the customer's movement within the grid.
[0054] In step S103, generating a spatiotemporal trajectory segment involves generating a spliced spatiotemporal trajectory segment, specifically including: performing frame-by-frame analysis on the video data stream; when a dynamic target is detected within the target space grid of the third video frame, generating a temporary segment including the third video frame, where the third video frame is one of the multiple video frames included in the video data stream; within a preset time window, acquiring all target temporary segments generated by the dynamic target within the target space grid; sorting each target temporary segment by timestamp; merging the first temporary segment and the second temporary segment into a spliced spatiotemporal trajectory segment, where the first temporary segment and the second temporary segment are any two of the multiple target temporary segments, and the time interval between the first temporary segment and the second temporary segment is less than a preset fusion time threshold.
[0055] Specifically, the server analyzes the video data stream frame by frame, detecting whether a moving target appears in each frame. When a moving target is detected within the target space grid of a certain video frame (called the third video frame), the server generates a temporary segment containing that video frame. The temporary segment records information such as the spatial grid identifier, timestamp, and location coordinates of the moving target within that video frame.
[0056] Within a preset time window, the server continuously tracks the movement of the dynamic target within the target space grid and generates multiple temporary segments. Each temporary segment corresponds to a continuous time window, recording a segment of the dynamic target's movement within that time window. If the dynamic target leaves the target space grid within the time window, the temporary segment is interrupted until the target re-enters the grid, at which point a new temporary segment is generated.
[0057] After the preset time window ends, the server acquires all temporary fragments generated by the dynamic target within the target space grid and sorts these temporary fragments according to their timestamps. The sorted temporary fragments are arranged sequentially in chronological order, with possible time intervals between adjacent fragments. The server compares each pair of sorted temporary fragments; if the time interval between two temporary fragments is less than a preset fusion time threshold, they are merged into a single spatiotemporal trajectory fragment. The merging operation stitches together the spatiotemporal coordinate sequence of the two temporary fragments to form a longer trajectory fragment. The server sequentially compares all adjacent temporary fragments and merges them until all temporary fragments meeting the conditions are merged into a single spatiotemporal trajectory fragment.
[0058] After the above merging operation, the server obtains several spliced spatiotemporal trajectory segments. Each spliced trajectory segment consists of multiple temporary segments with time intervals less than the fusion time threshold. These spliced trajectory segments record the complete motion process of the dynamic target within the target space grid. Although there may be brief time interruptions, it still maintains continuity in both time and space.
[0059] For example, in a traffic intersection surveillance video, the server divides the intersection into several spatial grids and sets a time window of 10 seconds and a fusion time threshold of 2 seconds. When a vehicle enters a grid cell, the server generates the first temporary segment, recording the vehicle's position and timestamp. Over the next 10 seconds, the server continuously tracks the vehicle and generates multiple temporary segments. If the vehicle leaves the grid within these 10 seconds, the temporary segment is interrupted. When the vehicle re-enters the grid, the server generates a new temporary segment. After the 10-second time window ends, the server acquires all temporary segments and sorts them by timestamp. Then, the server compares the time intervals of adjacent temporary segments; if they are less than 2 seconds, they are merged into a single spatiotemporal trajectory segment. Ultimately, the server obtains several spliced trajectory segments that reflect the vehicle's overall trajectory even with brief time interruptions.
[0060] Step S104: Construct a B+ tree index structure, take the spatiotemporal trajectory fragment as the data record to be indexed, and set the index key of the B+ tree index structure as a composite key.
[0061] In step S104, a B+ tree index structure is constructed, with the spatiotemporal trajectory segment as the data record to be indexed, and the index key of the B+ tree index structure is set as a composite key. Specifically, this includes: concatenating the spatial grid identifier, dynamic target identifier, start time, and end time of the spatiotemporal trajectory segment as strings in sequence to construct a composite key; inserting the spatiotemporal trajectory segment into the corresponding data page node in the B+ tree index structure according to the lexicographical order of the composite key; storing the composite key in the intermediate nodes of the B+ tree index structure, storing the spatiotemporal trajectory segment as the data record to be indexed in the leaf nodes of the B+ tree index structure, and linking the leaf nodes using a pointer linked list.
[0062] Specifically, the server extracts the spatial grid identifier, dynamic target identifier, start time, and end time of each spatiotemporal trajectory segment, and concatenates them as strings to construct a composite key. The format of the composite key is "spatial grid identifier_dynamic target identifier_start time_end time", where different parts are separated by underscores.
[0063] Then, the server inserts the spatiotemporal trajectory fragment into the corresponding data page node in the B+ tree index structure according to the lexicographical order of the composite key. A B+ tree is a balanced multi-way search tree where the keys in a node are arranged lexicographically, with the key value of the left subtree being less than the node key value, and the key value of the right subtree being greater than the node key value. Starting from the root node of the B+ tree, the server compares the composite key with the node key value, recursively searching downwards until a suitable leaf node is found, at which point the spatiotemporal trajectory fragment is inserted. If a leaf node is full, the node is split to ensure the balance of the B+ tree.
[0064] In the intermediate nodes of a B+ tree index structure, the server only stores composite keys, not the actual spatiotemporal trajectory fragment data. These intermediate nodes act as indexes and navigation points, helping to quickly locate the target leaf node. Each intermediate node contains multiple key-value pairs and pointers to its child nodes; the key-value pairs are composite keys, and the pointers point to nodes at the next level. By comparing the key-value pairs in the intermediate nodes, the search direction can be determined, narrowing the search range.
[0065] In the leaf nodes of the B+ tree index structure, the server stores spatiotemporal trajectory fragments as data records to be indexed. Each leaf node contains multiple spatiotemporal trajectory fragment records, which include detailed information about the trajectory fragment, such as spatial grid identifier, dynamic target identifier, start time, end time, and trajectory coordinate point sequence. The records in the leaf nodes are arranged in lexicographical order according to the composite key, facilitating range queries and sequence scans.
[0066] Finally, the server links the leaf nodes of the B+ tree index structure using a linked list of pointers. Each leaf node, in addition to storing a spatiotemporal trajectory fragment record, also contains pointers to the previous and next leaf nodes. Using the linked list, all leaf nodes can be traversed in the order of the composite key, enabling range queries and sequential access.
[0067] For example, suppose a server generates 100 spatiotemporal trajectory fragments, each containing information such as a spatial grid identifier, a dynamic target identifier, a start time, and an end time. The server combines this information into a composite key, such as "G10_O25_1622189023_1622189085", and then inserts the trajectory fragments into a B+ tree index structure according to the lexicographical order of the composite key. The intermediate nodes of the B+ tree store the composite key for indexing and navigation; the leaf nodes store complete trajectory fragment records and are connected by a linked list of pointers. When it is necessary to query trajectory fragments within a specific time range within a spatial grid, the server can quickly locate the corresponding leaf node through the B+ tree index, and then perform a sequence scan in the leaf node to find the trajectory fragments that meet the conditions. The construction and maintenance of the B+ tree index structure greatly improves the query efficiency and retrieval performance of spatiotemporal trajectory data.
[0068] In one possible implementation, after step S104, the method further includes: constructing a first auxiliary index item and a second auxiliary index item. Constructing the first and second auxiliary index items specifically includes: grouping spatiotemporal trajectory segments according to spatial grid identifiers to obtain a first grouping result; generating a first auxiliary index item corresponding to each spatial grid identifier based on the first grouping result, where the index key of the first auxiliary index item is the spatial grid identifier, and the index value of the first auxiliary index item is the set of leaf nodes corresponding to all spatiotemporal trajectory segments containing the spatial grid identifier; grouping spatiotemporal trajectory segments according to dynamic target identifiers to obtain a second grouping result; and generating a second auxiliary index item corresponding to each dynamic target identifier based on the second grouping result, where the index key of the second auxiliary index item is the dynamic target identifier, and the index value of the second auxiliary index item is the set of leaf nodes corresponding to all spatiotemporal trajectory segments containing the dynamic target identifier.
[0069] Specifically, the server groups spatiotemporal trajectory segments according to spatial grid identifiers, obtaining a first grouping result. The first grouping result groups all trajectory segments with the same spatial grid identifier into one group. For example, for trajectory segments with the spatial grid identifier "G10", the server groups them into one group; for trajectory segments with the spatial grid identifier "G20", the server groups them into another group. Based on the first grouping result, the server generates a first auxiliary index entry corresponding to each spatial grid identifier. The index key of the first auxiliary index entry is the spatial grid identifier, and the index value is the set of leaf nodes corresponding to all spatiotemporal trajectory segments containing that spatial grid identifier. For example, for the spatial grid identifier "G10", the server generates a first auxiliary index entry with the index key "G10" and the index value is the set of leaf nodes containing all trajectory segments with "G10".
[0070] Then, the server groups the spatiotemporal trajectory segments according to their dynamic target identifiers, resulting in a second grouping result. This second grouping result groups all trajectory segments with the same dynamic target identifier together. For example, trajectory segments with the dynamic target identifier "O25" are grouped into one group; trajectory segments with the dynamic target identifier "O30" are grouped into another. Based on the second grouping result, the server generates a second auxiliary index entry for each dynamic target identifier. The index key of the second auxiliary index entry is the dynamic target identifier, and the index value is the set of leaf nodes corresponding to all spatiotemporal trajectory segments containing that dynamic target identifier. For example, for the dynamic target identifier "O25", the server generates a second auxiliary index entry with the index key "O25" and the index value is the set of leaf nodes containing all trajectory segments with "O25".
[0071] Finally, the server stores the generated first and second auxiliary index entries in memory or on disk for use in subsequent queries. The first and second auxiliary index entries can be organized and stored using data structures such as hash tables and B+ trees to achieve fast index lookups. By constructing the first and second auxiliary index entries, the server can quickly locate relevant spatiotemporal trajectory segments based on spatial grid identifiers and dynamic target identifiers. When querying a trajectory segment within a specific spatial grid, the server can directly find the corresponding set of leaf nodes through the first auxiliary index entry, avoiding a search throughout the entire B+ tree; similarly, when querying a trajectory segment of a specific dynamic target, the server can directly find the corresponding set of leaf nodes through the second auxiliary index entry, again avoiding a full tree search.
[0072] For example, suppose a server stores 1000 spatiotemporal trajectory fragments, involving 30 spatial grids and 20 dynamic targets. The server first groups the trajectory fragments according to the spatial grid identifiers, generating 30 first auxiliary index entries. Each index entry corresponds to a spatial grid, and its index value is the set of leaf nodes containing the trajectory fragment within that spatial grid. Then, the server groups the trajectory fragments according to the dynamic target identifiers, generating 20 second auxiliary index entries. Each index entry corresponds to a dynamic target, and its index value is the set of leaf nodes containing the trajectory fragment of that dynamic target. When a user queries a trajectory fragment within spatial grid "G1030", the server directly retrieves the corresponding set of leaf nodes using the first auxiliary index entries, significantly narrowing the query scope. When a user queries a trajectory fragment for dynamic target "O25", the server directly retrieves the corresponding set of leaf nodes using the second auxiliary index entries, avoiding unnecessary search overhead.
[0073] Step S105: Receive the retrieval request and use the B+ tree index structure and composite key to perform a range query to obtain a candidate fragment set. The retrieval request includes querying the dynamic target and the target query time range.
[0074] In step S105, a range query is performed using a B+ tree index structure and a composite key to obtain a candidate segment set. Specifically, this includes: constructing a query range for the B+ tree index structure based on the query dynamic target and the target query time range; converting the query range into a start retrieval key and a stop retrieval key in the B+ tree index structure, where the start retrieval key includes the target identifier and the target start time, and the stop retrieval key includes the target identifier and the target end time; locating the starting leaf node in the B+ tree index structure based on the start retrieval key and through the hierarchical index structure of the B+ tree index structure; traversing the successor nodes in a forward direction based on the doubly linked list of the starting leaf node, comparing the composite key corresponding to the successor node with the stop retrieval key in turn, determining the target node before the stop retrieval key, and adding the target spatiotemporal trajectory segment corresponding to the target node to the candidate segment set.
[0075] Specifically, the server constructs a B+ tree index structure for the query range based on the dynamic target and the target query time range. The query range is determined by a start key and a stop key. The start key includes the target identifier and the target start time, while the stop key includes the target identifier and the target end time. For example, if the dynamic target is "O25" and the target query time range is from "2023-05-01 10:00:00" to "2023-05-01 11:00:00", then the start key is "O25_2023-05-01 10:00:00" and the stop key is "O25_2023-05-01 11:00:00".
[0076] The server then transforms the query range into a start and end search key in the B+ tree index structure. Following the rules for constructing composite keys, the server combines the target identifier and timestamp into the search key format. The start and end search keys represent the lower and upper bounds of the query range, respectively, and are used for range queries within the B+ tree.
[0077] Next, the server locates the starting leaf node in the B+ tree index structure, based on the initial search key and utilizing the hierarchical index structure of the B+ tree. Starting from the root node of the B+ tree, the server compares the initial search key with the node key value, recursively searching downwards until it finds the first leaf node greater than or equal to the initial search key; this is the starting leaf node. The starting leaf node is the starting point of the range query and contains the first spatiotemporal trajectory segment of the query range.
[0078] Next, the server traverses the successor nodes forward based on the doubly linked list of the starting leaf node, comparing the composite key corresponding to each successor node with the termination search key in turn. The server traverses the leaf nodes in ascending order of the composite key using the doubly linked list, until it encounters the first leaf node with a key greater than the termination search key. Simultaneously, to capture trajectories that begin before but overlap with the target query time range, the server also performs a backtracking check on the leaf nodes preceding the located starting leaf node; if the preceding node exists and the end time of its recorded spatiotemporal trajectory segment is greater than or equal to the start time of the target query time range, then that segment is also considered to meet the condition and added to the candidate segment set.
[0079] Finally, the server adds the spatiotemporal trajectory segments corresponding to the target nodes identified during the traversal to the candidate segment set. The candidate segment set contains all spatiotemporal trajectory segments that meet the query conditions; that is, trajectory segments belonging to the queried dynamic target and whose time range falls within the target query time range. The server returns the candidate segment set as the result of the range query to the requester.
[0080] For example, suppose the server receives a search request with the dynamic target "O25" and the target time range from "2023-05-01 10:00:00" to "2023-05-01 11:00:00". The server constructs a starting search key "O25_2023-05-01 10:00:00" and a ending search key "O25_2023-05-01 11:00:00" based on the request, and then searches in a B+ tree index structure. The server first locates the starting leaf node using the hierarchical index structure of the B+ tree; the composite key of this node is greater than or equal to the starting search key. Then, the server traverses the doubly linked list of the leaf node, comparing the composite key of each successor node with the ending search key, adding the spatiotemporal trajectory fragments corresponding to the target nodes that meet the conditions to the candidate fragment set, until it encounters the first leaf node with a value greater than the ending search key. Finally, the server returns the set of candidate segments as the query result, which includes all trajectory segments that belong to the query dynamic target within the specified time range.
[0081] Through the above steps, the server utilizes a B+ tree index structure and composite keys to achieve efficient range queries. The hierarchical index structure of the B+ tree can quickly locate the starting leaf node, while the doubly linked list of the leaf nodes can sequentially traverse the target nodes that meet the conditions, avoiding unnecessary node access. The composite key design encodes time and spatial information in the index key, allowing range queries to be completed directly on the index without additional data filtering. This index structure and query method significantly improve the retrieval efficiency of spatiotemporal trajectory data, meeting the requirements of real-time performance and scalability.
[0082] Step S106: Traverse the target spatiotemporal trajectory segments in the candidate segment set and calculate the overlap duration between the time interval of the target spatiotemporal trajectory segment and the target query time range.
[0083] In step S106, the server traverses each target spatiotemporal trajectory segment in the candidate segment set. The candidate segment set is obtained in step S105 through a range query using a B+ tree index structure and a composite key, and contains trajectory segments that meet the query conditions. The server sequentially accesses each trajectory segment in the candidate segment set and performs time interval overlap calculations on it.
[0084] For each target spatiotemporal trajectory segment, the server extracts its start and end times to obtain the time interval of the trajectory segment. The time interval represents the time span of the trajectory segment, that is, the duration of the dynamic target's motion within that segment. The server can directly obtain the start and end time information from the trajectory segment's metadata or composite key.
[0085] The server then compares the time interval of the target spatiotemporal trajectory segment with the target query time range, calculating the overlap duration. The overlap duration represents the length of time the trajectory segment overlaps with the query time range, and is used to measure the relevance of the trajectory segment to the query conditions. The server determines the overlapping portion by comparing the start and end times of the trajectory segment with the start and end times of the query time range, and calculates the length of the overlapping portion.
[0086] Next, the server associates the calculated overlap duration with the corresponding target spatiotemporal trajectory segment, forming an overlap duration record. This record contains the trajectory segment's identifier and the overlap duration value, used for subsequent result sorting and return. The server can store the overlap duration record in an in-memory data structure, such as an array, list, or hash table, for fast access and processing. Finally, the server updates the query result set based on the overlap duration record. The server then sorts the trajectory segments that meet the criteria in chronological order, forming a sorted query result set.
[0087] For example, suppose the candidate fragment set contains the following three target spatiotemporal trajectory fragments:
[0088] Segment A: Start time is "2023-05-01 09:30:00", end time is "2023-05-01 10:10:00".
[0089] Segment B: The start time is "2023-05-01 10:30:00" and the end time is "2023-05-01 11:15:00".
[0090] Segment C: The start time is "2023-05-01 11:00:00" and the end time is "2023-05-01 12:00:00".
[0091] The target query time range is from "2023-05-01 10:00:00" to "2023-05-01 11:00:00".
[0092] The server iterates through the candidate segment set and calculates the overlap duration between each segment and the query time range:
[0093] The time range of segment A is [09:30:00, 10:10:00], and the overlap time with the query time range is 10 minutes.
[0094] The time range of segment B is [10:30:00, 11:15:00], and the overlap with the query time range is 30 minutes.
[0095] The time range of segment C is [11:00:00, 12:00:00], and the overlap time with the query time range is 0 minutes.
[0096] The server associates the overlapping duration records with the corresponding trajectory segments and connects them in chronological order. The final query result set contains segment B and segment A, sorted in chronological order as [segment A, segment B].
[0097] Step S107: Determine the corresponding target identifier based on the query dynamic target, and sum up all the overlapping durations generated by the query dynamic target to obtain the total effective dwell time of the query dynamic target within the target query time range.
[0098] In step S107, the server determines the corresponding target identifier based on the query dynamic target. The query dynamic target is the target object specified in the retrieval request provided by the user, which can be a specific person, vehicle, or other mobile entity. The server searches for the corresponding target identifier in the system's target identifier mapping table using the target description information in the query request, such as name, ID, and characteristics. The target identifier is an internal identifier used by the system to uniquely identify and track dynamic targets, and is usually in numeric or string format.
[0099] The server extracts all overlapping duration records generated by the queried dynamic target in the candidate segment set. In step S106, the server has calculated the overlap duration between each target spatiotemporal trajectory segment in the candidate segment set and the target query time range, and generated overlapping duration records. The server searches for records related to the queried dynamic target in the overlapping duration records by using the target identifier, and extracts the overlap duration values of the target on different trajectory segments.
[0100] The server then sums up all the extracted overlapping durations to obtain the total effective dwell time of the queried dynamic target within the target query time range. The server adds up the overlapping duration values belonging to the same queried dynamic target to obtain the total dwell time of that target within the specified time range. The total effective dwell time reflects the total activity time of the queried dynamic target within the time period of interest and can be used to analyze the target's behavioral patterns and spatiotemporal distribution characteristics.
[0101] Next, the server queries the target identifier of the dynamic target and the corresponding total effective stay duration to generate result records. The result records are represented as key-value pairs, where the key is the target identifier and the value is the total effective stay duration. The server can store the result records in an in-memory data structure, such as a hash table or array, for fast querying and access.
[0102] Finally, the server adds the generated result records to the query result set. The query result set is the final data collection returned to the user, containing information about the duration of the queried dynamic target's stay within the target query time range. The server merges the result records with the previously generated query result set to form the complete query response data. Users can use the query result set to understand the activity of the dynamic target of interest within the specified time range.
[0103] For example, suppose a user submits a search request with the dynamic target "John Doe" and the target search time range from "2023-05-01 09:00:00" to "2023-05-01 12:00:00". The server first looks up the corresponding target identifier in the target identifier mapping table based on the name "John Doe", let's say the identifier obtained is "U1001". Then, the server searches for the record with the target identifier "U1001" in the overlap duration records of the candidate fragment set, assuming it obtains the following three overlap duration values:
[0104] Segment A: The overlap lasts for 30 minutes.
[0105] Segment B: The overlap duration is 45 minutes.
[0106] Segment C: The overlap duration is 20 minutes.
[0107] The server sums up these three overlapping durations to obtain a total effective stay time of 95 minutes.
[0108] The server generates a result record with the key "U1001" and the value 95 minutes. The server adds this result record to the query result set and outputs it.
[0109] Step S108: Filter out the dynamic targets of the query whose total effective dwell time is greater than or equal to the preset duration threshold, and output them as the final search results.
[0110] In step S108, the server obtains a preset duration threshold. The preset duration threshold is a set value for a specific time period used to determine whether the dwell time of the queried dynamic target within the target query time range meets the user's needs. This threshold can be configured according to specific application scenarios and user preferences, such as being set to 30 minutes or 1 hour. The server can read the preset duration threshold from a configuration file or system parameters. The server iterates through each result record in the query result set. The query result set, generated in step S107, contains the target identifier of the queried dynamic target and its corresponding total effective dwell time. The server sequentially accesses each result record in the query result set, extracts the total effective dwell time value, and compares it with the duration threshold.
[0111] Next, the server compares the total effective dwell time for each query target with a preset duration threshold. The server determines whether the total effective dwell time in the result records is greater than or equal to the duration threshold. If the dwell time meets the threshold condition, it means that the query target has a sufficiently long activity time within the target query time range, meeting the user's search requirements.
[0112] Next, the server filters out the dynamic targets of the query that meet the duration threshold, and these are used as the final search results. The server creates a new dataset to store the filtered target information. For each dynamic target of the query that meets the threshold, the server adds its target identifier and total effective dwell time to the new dataset, forming the final search result set. The filtered search result set only includes targets with sufficiently long dwell times, filtering out targets with short dwell times or those that do not meet the user's needs.
[0113] Finally, the server outputs the final search results set to the user. The server formats the filtered target information into a user-friendly and easy-to-understand format, such as JSON, XML, or tables. The output search results include target identifiers and corresponding total effective dwell time, allowing users to understand the activity of dynamic targets of interest within a specified time range and to conduct further analysis and decision-making.
[0114] In addition to filtering out the query dynamic targets that meet the duration threshold as the final retrieval result output, the corresponding video frames can be further filtered out based on the overlap duration, thereby obtaining video frames that contain the query dynamic targets within the target query time range.
[0115] For example, suppose a user submits a search request for "vehicle A" within a time range from "2023-05-01 09:00:00" to "2023-05-01 10:00:00", with a duration threshold of 15 minutes and an overlap threshold of 5 minutes. The server calculates that the total effective dwell time of "vehicle A" within this time range is 20 minutes, which is greater than the preset duration threshold. Therefore, "vehicle A" is output as the final search result. Next, the server iterates through the candidate segment set and finds two target spatiotemporal trajectory segments that overlap with the target query time range:
[0116] Segment 1: The start time is "2023-05-01 09:15:00" and the end time is "2023-05-01 09:25:00", with an overlap duration of 10 minutes.
[0117] Segment 2: The start time is "2023-05-01 09:50:00" and the end time is "2023-05-01 10:05:00", with an overlap duration of 10 minutes.
[0118] Since the overlap duration of both segments is greater than or equal to the overlap duration threshold of 5 minutes, the server filters them both out. Based on the time range of segment 1 and segment 2, the server extracts the corresponding video frame sequences from the original video data stream as additional search results.
[0119] Finally, the server outputs the target identifier of "Vehicle A", the total effective dwell time, and two video clips containing "Vehicle A" to the user. The user can understand the overall activity of "Vehicle A" within the specified time range through the total effective dwell time, and intuitively grasp the specific movement trajectory and dwell position of "Vehicle A" by watching the video clips.
[0120] Reference Figure 2 This application also provides a video storage and retrieval device based on a B+ tree. This device is a server, comprising a video acquisition module 201, a video stream processing module 202, a B+ tree construction module 203, a retrieval module 204, and a retrieval result output module 205. Specifically: the video acquisition module 201 acquires the video data stream to be processed and divides it into multiple preset spatial grids according to a preset spatial grid definition; the video stream processing module 202 processes the video data stream and identifies continuously moving dynamic targets in the video data stream; the video stream processing module 202 also determines the target spatial grid where the dynamic target is located and generates a spatiotemporal trajectory segment, the spatiotemporal trajectory segment having the start time of the dynamic target entering the target spatial grid and the end time of the dynamic target leaving the target spatial grid as boundaries; the B+ tree construction module 203 constructs a B+ tree index. The system uses a B+ tree index structure to index spatiotemporal trajectory segments as data records to be indexed, and sets the index key of the B+ tree index structure as a composite key. A retrieval module 204 receives retrieval requests and performs range queries using the B+ tree index structure and composite key to obtain a candidate segment set. The retrieval request includes a query dynamic target and a target query time range. The retrieval module 204 also iterates through the target spatiotemporal trajectory segments in the candidate segment set and calculates the overlap duration between the time interval of the target spatiotemporal trajectory segment and the target query time range. Furthermore, the retrieval module 204 determines the corresponding target identifier based on the query dynamic target, accumulates all overlap durations generated by the query dynamic target, and obtains the total effective dwell time of the query dynamic target within the target query time range. A retrieval result output module 205 filters out query dynamic targets whose total effective dwell time is greater than or equal to a preset duration threshold and outputs them as the final retrieval result.
[0121] In one possible implementation, the spatiotemporal trajectory segment includes continuous spatiotemporal trajectory segments and spliced spatiotemporal trajectory segments. In the generation of spatiotemporal trajectory segments by the video stream processing module 202, the generation of continuous spatiotemporal trajectory segments specifically includes: the video stream processing module 202 detecting dynamic targets within each video frame of the video data stream and obtaining the position coordinates of the dynamic targets; the video stream processing module 202 mapping the position coordinates to a preset spatial grid to determine the target spatial grid where the dynamic target is located; if the dynamic target is appearing in the target spatial grid for the first time, the video stream processing module 202 creating a continuous spatiotemporal trajectory segment starting from the timestamp of the current video frame. The video stream processing module 202 continues the spatiotemporal trajectory segment and sets the continuous spatiotemporal trajectory segment to an unclosed state. If a dynamic target is detected within the target space grid in the first video frame, the video stream processing module 202 maintains the continuous spatiotemporal trajectory segment in an unclosed state and continues to track the dynamic target. The first video frame is a subsequent video frame of the current video frame. If the dynamic target is detected to disappear in the second video frame, and no dynamic target is detected within the preset fault tolerance time threshold, the video stream processing module 202 determines that the dynamic target has left the target space grid, and closes the continuous spatiotemporal trajectory segment with the timestamp of the second video frame as the end time. The second video frame is a video frame in the first video frame.
[0122] In one possible implementation, the video stream processing module 202 generates a spatiotemporal trajectory segment by generating a spliced spatiotemporal trajectory segment. Specifically, this includes: the video stream processing module 202 performing frame-by-frame analysis of the video data stream; when it determines that a dynamic target is detected within the target space grid of the third video frame, generating a temporary segment including the third video frame, where the third video frame is one of the multiple video frames included in the video data stream; the video stream processing module 202 acquiring all target temporary segments generated by the dynamic target within the target space grid within a preset time window; the video stream processing module 202 sorting each target temporary segment by timestamp, merging the first temporary segment and the second temporary segment into a spliced spatiotemporal trajectory segment, where the first temporary segment and the second temporary segment are any two of the multiple target temporary segments, and the time interval between the first temporary segment and the second temporary segment is less than a preset fusion time threshold.
[0123] In one possible implementation, the B+ tree construction module 203 constructs a B+ tree index structure, using spatiotemporal trajectory fragments as data records to be indexed, and sets the index key of the B+ tree index structure as a composite key. Specifically, the B+ tree construction module 203 concatenates the spatial grid identifier, dynamic target identifier, start time, and end time of the spatiotemporal trajectory fragment as strings to construct a composite key; the B+ tree construction module 203 inserts the spatiotemporal trajectory fragment into the corresponding data page node in the B+ tree index structure according to the lexicographical order of the composite key; the B+ tree construction module 203 stores the composite key in the intermediate nodes of the B+ tree index structure, stores the spatiotemporal trajectory fragment as data records to be indexed in the leaf nodes of the B+ tree index structure, and links the leaf nodes using a pointer linked list.
[0124] In one possible implementation, the retrieval module 204 utilizes a B+ tree index structure and composite keys to perform a range query and obtain a candidate fragment set. Specifically, the retrieval module 204 constructs a query range for the B+ tree index structure based on the query dynamic target and the target query time range; it converts the query range into a start retrieval key and a stop retrieval key in the B+ tree index structure, where the start retrieval key includes the target identifier and the target start time, and the stop retrieval key includes the target identifier and the target end time; in the B+ tree index structure, based on the start retrieval key, the retrieval module 204 locates the starting leaf node through the hierarchical index structure of the B+ tree index structure; based on the doubly linked list of the starting leaf node, the retrieval module 204 traverses the successor nodes in a forward direction, sequentially comparing the composite key corresponding to the successor node with the stop retrieval key, determining the target node before the stop retrieval key, and adding the target spatiotemporal trajectory fragment corresponding to the target node to the candidate fragment set.
[0125] In one possible implementation, after the B+ tree construction module 203 constructs the B+ tree index structure, uses the spatiotemporal trajectory fragments as data records to be indexed, and sets the index key of the B+ tree index structure as a composite key, the method further includes: the B+ tree construction module 203 constructing a first auxiliary index item and a second auxiliary index item. Specifically, constructing the first and second auxiliary index items includes: the B+ tree construction module 203 grouping the spatiotemporal trajectory fragments according to spatial grid identifiers to obtain a first grouping result; based on the first grouping result, the B+ tree construction module 203 generating a first auxiliary index item corresponding to each spatial grid identifier, where the index key of the first auxiliary index item is the spatial grid identifier, and the index value of the first auxiliary index item is the set of leaf nodes corresponding to all spatiotemporal trajectory fragments containing the spatial grid identifier; the B+ tree construction module 203 grouping the spatiotemporal trajectory fragments according to dynamic target identifiers to obtain a second grouping result; and based on the second grouping result, the B+ tree construction module 203 generating a second auxiliary index item corresponding to each dynamic target identifier, where the index key of the second auxiliary index item is the dynamic target identifier, and the index value of the second auxiliary index item is the set of leaf nodes corresponding to all spatiotemporal trajectory fragments containing the dynamic target identifier.
[0126] In one possible implementation, the video stream processing module 202 processes the video data stream to identify continuously moving dynamic targets in the video data stream. Specifically, this includes: the video stream processing module 202 extracting the foreground from each video frame in the video data stream to obtain a binary foreground image; the video stream processing module 202 performing connected component analysis on the binary foreground image to obtain candidate dynamic target regions; the video stream processing module 202 calculating feature parameters of the candidate dynamic target regions, including area, aspect ratio, and motion speed; the video stream processing module 202 classifying the candidate dynamic target regions based on the feature parameters using a support vector machine classifier to obtain dynamic target regions; and the video stream processing module 202 tracking the dynamic target regions to obtain each dynamic target and its corresponding motion trajectory.
[0127] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0128] This application also provides an electronic device. (See reference...) Figure 3 , Figure 3This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 300 may include: at least one processor 301, at least one network interface 304, a user interface 303, a memory 305, and at least one communication bus 302.
[0129] The communication bus 302 is used to enable communication between these components.
[0130] The user interface 303 may include a display screen and a camera. Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.
[0131] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0132] The processor 301 may include one or more processing cores. The processor 301 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 305, and by calling data stored in memory 305. Optionally, the processor 301 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 301 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 301 and may be implemented as a separate chip.
[0133] The memory 305 may include random access memory (RAM) or read-only memory. Optionally, the memory 305 may include a non-transitory computer-readable storage medium. The memory 305 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 305 may also be at least one storage device located remotely from the aforementioned processor 301. (Refer to...) Figure 3 The memory 305, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for a video storage and retrieval method based on a B+ tree.
[0134] exist Figure 3 In the illustrated electronic device 300, the user interface 303 is mainly used to provide an input interface for the user and to acquire user input data; while the processor 301 can be used to call an application program stored in the memory 305 that is a B+ tree-based video storage and retrieval method. When executed by one or more processors 301, the electronic device 300 performs one or more of the methods described in the above embodiments. It should be noted that, for the foregoing method embodiments, for the sake of simplicity, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0135] This application also provides a computer-readable storage medium storing instructions. When executed by one or more processors 301, these instructions cause an electronic device 300 to perform one or more of the methods described in the above embodiments.
[0136] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0137] In the various embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some service interface; the indirect coupling or communication connection between apparatuses or units may be electrical or other forms.
[0138] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0139] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0140] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.
[0141] The above description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Other embodiments of this disclosure will be readily apparent to those skilled in the art upon consideration of the specification and the disclosure of practical truths.
[0142] This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.
Claims
1. A video storage and retrieval method based on B+ trees, characterized in that, The method includes: The video data stream to be processed is acquired, and the video data stream is divided into multiple preset spatial grids according to the preset spatial grid definition; The video data stream is processed to identify continuously moving dynamic targets in the video data stream; The target space grid where the dynamic target is located is determined, and a spatiotemporal trajectory segment is generated, wherein the spatiotemporal trajectory segment is bounded by the start time when the dynamic target enters the target space grid and the end time when the dynamic target leaves the target space grid; Construct a B+ tree index structure, use the spatiotemporal trajectory segment as the data record to be indexed, and set the index key of the B+ tree index structure as a composite key; The system receives a retrieval request and uses the B+ tree index structure and the composite key to perform a range query to obtain a set of candidate segments. The retrieval request includes querying a dynamic target and a target query time range. Traverse the target spatiotemporal trajectory segments in the candidate segment set and calculate the overlap duration between the time interval of the target spatiotemporal trajectory segment and the target query time range; Based on the query dynamic target, the corresponding target identifier is determined, and all overlapping durations generated by the query dynamic target are summed to obtain the total effective dwell time of the query dynamic target within the target query time range; The query dynamic targets whose total effective dwell time is greater than or equal to the preset duration threshold are filtered out and output as the final search results.
2. The method according to claim 1, characterized in that, The spatiotemporal trajectory segment includes continuous spatiotemporal trajectory segments and spliced spatiotemporal trajectory segments. Specifically, generating the continuous spatiotemporal trajectory segment involves: Detect dynamic targets within each video frame of the video data stream and obtain the position coordinates of the dynamic targets; The location coordinates are mapped onto the preset spatial grid to determine the target spatial grid where the dynamic target is located; If the dynamic target is appearing in the target space grid for the first time, a continuous spatiotemporal trajectory segment is created with the timestamp of the current video frame as the starting time, and the continuous spatiotemporal trajectory segment is set to an unclosed state. If the dynamic target is detected to be within the target space grid in the first video frame, the spliced spatiotemporal trajectory segment is maintained in the unclosed state, and the dynamic target is continued to be tracked. The first video frame is a subsequent video frame of the current video frame. If the disappearance of the dynamic target is detected in the second video frame, and the dynamic target is not detected within the preset fault tolerance time threshold, it is determined that the dynamic target has left the target space grid, and the continuous spatiotemporal trajectory segment is closed with the timestamp of the second video frame as the end time. The second video frame is a video frame in the first video frame.
3. The method according to claim 2, characterized in that, The generation of the spliced spatiotemporal trajectory fragment specifically includes: The video data stream is analyzed frame by frame. When a dynamic target is detected in the target space grid of the third video frame, a temporary segment including the third video frame is generated. The third video frame is one of the multiple video frames included in the video data stream. Within a preset time window, acquire all temporary fragments of the target generated by the dynamic target within the target space grid; Each of the target temporary segments is sorted by timestamp, and the first temporary segment and the second temporary segment are merged into the spliced spatiotemporal trajectory segment. The first temporary segment and the second temporary segment are any two of the multiple target temporary segments, and the time interval between the first temporary segment and the second temporary segment is less than a preset fusion time threshold.
4. The method according to claim 1, characterized in that, The construction of the B+ tree index structure, using the spatiotemporal trajectory segment as the data record to be indexed, and setting the index key of the B+ tree index structure as a composite key, specifically includes: The spatial grid identifier, dynamic target identifier, start time, and end time of the spatiotemporal trajectory segment are sequentially concatenated as strings to construct the composite key; Based on the lexicographical order of the composite key, the spatiotemporal trajectory fragment is inserted into the corresponding data page node in the B+ tree index structure; The composite key is stored in the intermediate nodes of the B+ tree index structure, and the spatiotemporal trajectory fragment is stored as the data record to be indexed in the leaf nodes of the B+ tree index structure. The leaf nodes are linked by a pointer list.
5. The method according to claim 1, characterized in that, The step of using the B+ tree index structure and the composite key to perform a range query and obtain a candidate fragment set specifically includes: Based on the dynamic target of the query and the target query time range, construct the query range of the B+ tree index structure; The query range is converted into a start search key and an end search key in a B+ tree index structure. The start search key includes the target identifier and the target start time, and the end search key includes the target identifier and the target end time. In the B+ tree index structure, based on the starting retrieval key, the starting leaf node is located through the hierarchical index structure of the B+ tree index structure; Based on the doubly linked list of the starting leaf node, the successor nodes are traversed in a forward direction. The composite key corresponding to the successor node is compared with the termination search key in turn to determine the target node before the termination search key. The target spatiotemporal trajectory segment corresponding to the target node is added to the candidate segment set.
6. The method according to claim 1, characterized in that, After constructing the B+ tree index structure, using the spatiotemporal trajectory segment as the data record to be indexed, and setting the index key of the B+ tree index structure as a composite key, the method further includes the steps of constructing a first auxiliary index item and a second auxiliary index item. The construction of the first auxiliary index item and the second auxiliary index item specifically includes: The spatiotemporal trajectory segments are grouped according to spatial grid identifiers to obtain the first grouping result; Based on the first grouping result, a first auxiliary index item is generated for each spatial grid identifier. The index key of the first auxiliary index item is the spatial grid identifier, and the index value of the first auxiliary index item is the set of leaf nodes corresponding to all spatiotemporal trajectory segments containing the spatial grid identifier. The spatiotemporal trajectory segments are grouped according to dynamic target identifiers to obtain a second grouping result; Based on the second grouping result, a second auxiliary index item is generated for each dynamic target identifier. The index key of the second auxiliary index item is the dynamic target identifier, and the index value of the second auxiliary index item is the set of leaf nodes corresponding to all spatiotemporal trajectory segments containing the dynamic target identifier.
7. The method according to claim 1, characterized in that, The process of processing the video data stream to identify continuously moving dynamic targets within the video data stream specifically includes: Foreground is extracted from each video frame in the video data stream to obtain a binary foreground image; Connectivity analysis is performed on the foreground binary image to obtain candidate dynamic target regions; Calculate the feature parameters of the candidate dynamic target region, including area, aspect ratio, and motion speed; Based on the aforementioned feature parameters, a support vector machine classifier is used to classify the candidate dynamic target region to obtain the dynamic target region. Target tracking is performed on the dynamic target area to obtain each dynamic target and its corresponding motion trajectory.
8. A video storage and retrieval device based on a B+ tree, characterized in that, The device includes a video acquisition module (201), a video stream processing module (202), a B+ tree construction module (203), a retrieval module (204), and a retrieval result output module (205), wherein: The video acquisition module (201) is used to acquire the video data stream to be processed and divide the video data stream into multiple preset spatial grids according to the preset spatial grid definition. The video stream processing module (202) is used to process the video data stream and identify continuously moving dynamic targets in the video data stream; The video stream processing module (202) is further configured to determine the target space grid where the dynamic target is located and generate a spatiotemporal trajectory segment, wherein the spatiotemporal trajectory segment is bounded by the start time when the dynamic target enters the target space grid and the end time when the dynamic target leaves the target space grid; The B+ tree construction module (203) is used to construct a B+ tree index structure, take the spatiotemporal trajectory fragment as the data to be indexed, and set the index key of the B+ tree index structure as a composite key. The retrieval module (204) is used to receive retrieval requests and, using the B+ tree index structure and the composite key, perform range queries to obtain a set of candidate fragments. The retrieval request includes querying dynamic targets and target query time ranges. The retrieval module (204) is also used to traverse the target spatiotemporal trajectory segments in the candidate segment set and calculate the overlap duration between the time interval of the target spatiotemporal trajectory segment and the target query time range; The retrieval module (204) is also used to determine the corresponding target identifier based on the query dynamic target, and to accumulate all the overlapping durations generated by the query dynamic target to obtain the total effective dwell time of the query dynamic target within the target query time range; The retrieval result output module (205) is used to filter out the query dynamic targets whose total effective dwell time is greater than or equal to the preset duration threshold, and output them as the final retrieval result.
9. An electronic device, characterized in that, The device includes a processor (301), a memory (305), a user interface (303), and a network interface (304). The memory (305) is used to store instructions. The user interface (303) and the network interface (304) are used to communicate with other devices. The processor (301) is used to execute the instructions stored in the memory (305) to cause the electronic device (300) to perform the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed, perform the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Moving target-based video retrieval method for track in map
CN106446002A
Video data storage and analysis method, device and system, communication equipment and storage medium
CN115618050A