Video storage and retrieval method, device and equipment based on B + tree
By using a video retrieval method based on a B+ tree index structure and composite keys, the problem of low efficiency in existing video retrieval technologies is solved, enabling efficient storage and retrieval of video data. In particular, when dealing with scenarios involving continuous time and dynamic object trajectories, retrieval efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202511293185.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-11
- Publication Date
- 2025-10-17
- 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 B+ tree index structure is constructed. The composite key is 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 effectively screen out dynamic targets that meet duration requirements, meeting the requirements of real-time and scalability.
Smart Images

Figure CN120804347A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data processing, in particular to a video storage and retrieval method, device and equipment based on B+ tree. BACKGROUND
[0002] With the rapid development of applications such as security monitoring, Internet live broadcast, short video socialization, video data is growing explosively at an unprecedented speed. The massive video data brings great challenges to storage and management, especially when specific content needs to be quickly and accurately retrieved from a huge video library, the traditional video file management method exposes obvious defects. At present, most systems still store video as an independent binary file in the file system, and mainly rely on file name, creation time, tag and other external metadata when retrieving. When it is necessary to retrieve according to specific events or objects in the video content, this method often needs to decode and sequentially scan and analyze video files one by one, which is extremely time-consuming and completely unable to meet the real-time and efficiency requirements.
[0003] In order to solve the above-mentioned problem of video content retrieval, some content analysis-based retrieval methods are proposed in the prior art, which extract key frame sequences that can represent video content through frame extraction technology. When a user initiates a content retrieval request, the system will no longer scan the original video file, but directly perform fast matching in the key frame sequence, and the scanning of the video file is converted into the query of structured feature data, which greatly improves the response speed of content retrieval.
[0004] However, the above-mentioned retrieval method based on key frame feature index still has problems when dealing with complex video retrieval scenarios involving time continuity and object dynamic trajectory. Essentially, this method regards video as a collection of static images at a series of discrete time points, and its index structure mainly focuses on the content of single frame, but ignores the time sequence attribute of video data. For example, in intelligent traffic monitoring, one retrieval requirement is to find vehicles that have been continuously staying in the intersection area for more than 30 seconds. This method does not effectively organize and utilize the time sequence continuity information of the object, resulting in low efficiency when facing queries that need to make continuous judgments on the target involving time range. SUMMARY
[0005] The present application provides a video storage and retrieval method, device and equipment based on B+ tree, which improves the retrieval efficiency of video data.
[0006] In a first aspect of the present application, a B+ tree-based video storage and retrieval method is provided, which comprises: obtaining a video data stream to be processed, and dividing the video data stream into a plurality of preset spatial grids according to a preset spatial grid definition; processing the video data stream to identify a dynamic target in continuous motion in the video data stream; determining a target spatial grid in which the dynamic target is located, and generating a space-time trajectory segment with the start time when the dynamic target enters the target spatial grid and the end time when the dynamic target leaves the target spatial grid as boundaries; constructing a B+ tree index structure, taking the space-time trajectory segment as a data record to be indexed, and setting the index key of the B+ tree index structure as a composite key; receiving a retrieval request, and performing range query using the B+ tree index structure and the composite key to obtain a candidate segment set, the retrieval request including a query dynamic target and a target query time range; traversing the target space-time trajectory segment in the candidate segment set, and calculating the overlapping duration of the time interval of the target space-time trajectory segment and the target query time range; based on the query dynamic target, determining the corresponding target identifier, and accumulating all overlapping durations generated by the query dynamic target to obtain the total effective residence duration of the query dynamic target within the target query time range; and filtering out the query dynamic target with a total effective residence duration greater than or equal to a preset duration threshold as the final retrieval result.
[0007] By adopting the above technical solution, the video data stream to be processed is obtained, and the video data stream is divided into a plurality of preset spatial grids according to a preset spatial grid definition. Then, the video data stream is processed to identify a dynamic target in continuous motion therein, and a target spatial grid in which the dynamic target is located is determined, and a space-time trajectory segment with the start time when the dynamic target enters the target spatial grid and the end time when the dynamic target leaves the target spatial grid as boundaries is generated. Next, a B+ tree index structure is constructed, the space-time trajectory segment is taken as a data record 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, range query is performed using the B+ tree index structure and the composite key to obtain a candidate segment set. The target space-time trajectory segment in the candidate segment set is traversed, and the overlapping duration of the time interval of the target space-time trajectory segment and the target query time range is calculated. Based on the query dynamic target, the corresponding target identifier is determined, and all overlapping durations generated by the query dynamic target are accumulated to obtain the total effective residence duration of the query dynamic target within the target query time range. Finally, the query dynamic target with a total effective residence duration greater than or equal to a preset duration threshold is filtered out as the final retrieval result. This method constructs a B+ tree index structure, uses a composite key to implement efficient range query, and filters out dynamic targets meeting the duration requirement by calculating the overlapping duration and the total effective residence duration, thereby improving the efficiency and accuracy of video storage and retrieval.
[0008] Optionally, the spatio-temporal trajectory segment includes a continuous spatio-temporal trajectory segment and a spliced spatio-temporal trajectory segment, and the continuous spatio-temporal trajectory segment is generated in the generating spatio-temporal trajectory segment, and specifically includes: detecting a dynamic target in each video frame in the video data stream, and obtaining a position coordinate of the dynamic target; mapping the position coordinate to the preset spatial grid to determine a target spatial grid in which the dynamic target is located; if the dynamic target appears in the target spatial grid for the first time, taking a timestamp of a current video frame as a starting time, creating a continuous spatio-temporal trajectory segment, and setting the continuous spatio-temporal trajectory segment as an unclosed state; if the dynamic target is detected in the target spatial grid in a first video frame, maintaining the continuous spatio-temporal trajectory segment as the unclosed state, and continuing to track the dynamic target, the first video frame being a subsequent video frame of the current video frame; if the dynamic target is detected to disappear in a second video frame, and the dynamic target is not detected within a preset fault tolerance time threshold, it is determined that the dynamic target leaves the target spatial grid, and a timestamp of the second video frame is taken as an ending time, and the continuous spatio-temporal trajectory segment is closed, the second video frame being one of the first video frames.
[0009] By adopting the technical scheme, the dynamic target in each video frame in the video data stream is detected, and the position coordinate of the dynamic target is obtained. Then, the position coordinate is mapped to the preset spatial grid to determine the target spatial grid in which the dynamic target is located. If the dynamic target appears in the target spatial grid for the first time, a timestamp of a current video frame is taken as a starting time, a continuous spatio-temporal trajectory segment is created, and the continuous spatio-temporal trajectory segment is set as an unclosed state. If the dynamic target is detected in the target spatial grid in a subsequent video frame, the continuous spatio-temporal trajectory segment is maintained as the unclosed state, and the dynamic target is continued to be tracked. If the dynamic target is detected to disappear in a certain video frame, and the dynamic target is not detected within a preset fault tolerance time threshold, it is determined that the dynamic target leaves the target spatial grid, and a timestamp of the video frame is taken as an ending time, and the continuous spatio-temporal trajectory segment is closed. The method detects the position coordinate of the dynamic target, maps the position coordinate to the preset spatial grid, judges the appearance and disappearance of the dynamic target, generates the continuous spatio-temporal trajectory segment, and accurately records the starting time and the ending time of the dynamic target in the target spatial grid, thereby providing basic data for subsequent indexing and querying.
[0010] Optionally, in the generating the spatio-temporal trajectory segment, the spatio-temporal trajectory segment is generated by performing frame-by-frame analysis on the video data stream, and when it is determined that a dynamic target is detected in a target space grid of a third video frame, a temporary segment including the third video frame is generated, the third video frame being one of a plurality of video frames included in the video data stream; within a preset time window, all target temporary segments generated by the dynamic target in the target space grid are acquired; and each of the target temporary segments is sorted according to a timestamp, and a first temporary segment and a second temporary segment are merged into the spatio-temporal trajectory segment, the first temporary segment and the second temporary segment being any two of the plurality of target temporary segments, and a time interval of the first temporary segment and the second temporary segment being less than a preset fusion time threshold.
[0011] By using the above technical solution, when it is determined that a dynamic target is detected in a target space grid of a certain video frame, a temporary segment including the video frame is generated by performing frame-by-frame analysis on the video data stream. Then, within a preset time window, all target temporary segments generated by the dynamic target in the target space grid are acquired. Next, each of the target temporary segments is sorted according to a timestamp, and two temporary segments with a time interval less than a preset fusion time threshold are merged into a spatio-temporal trajectory segment. This method generates target temporary segments by performing frame-by-frame analysis on the video data stream, and sorts and merges the target temporary segments within a preset time window to generate a spatio-temporal trajectory segment. This method can merge temporally dispersed temporary segments to form a continuous spatio-temporal trajectory segment, thereby improving the integrity and continuity of the spatio-temporal trajectory segment and facilitating subsequent indexing and querying.
[0012] Optionally, in the constructing the B+ tree index structure, the spatio-temporal trajectory segment is taken as a data record to be indexed, and a composite key is set as an index key of the B+ tree index structure, specifically including: connecting, in sequence, a space grid identifier, a dynamic target identifier, a start time, and an end time of the spatio-temporal trajectory segment as a string to construct the composite key; inserting the spatio-temporal trajectory segment into a corresponding data page node of the B+ tree index structure according to a lexicographic size relationship of the composite key; storing the composite key in an intermediate node of the B+ tree index structure, and storing the spatio-temporal trajectory segment as a data record to be indexed in a leaf node of the B+ tree index structure, and linking the leaf nodes by means of a pointer chain table.
[0013] By adopting the technical solution, the space grid identifier, the dynamic target identifier, the start time and the end time of the spatio-temporal trajectory segment are connected in sequence as a string to construct a composite key. Then, according to the lexicographical size relationship of the composite key, the spatio-temporal trajectory segment is inserted into the corresponding data page node in the B+ tree index structure. In the middle node of the B+ tree index structure, the composite key is stored; in the leaf node of the B+ tree index structure, the spatio-temporal trajectory segment is stored as a data record to be indexed, and the leaf nodes are linked by a pointer chain table. The method combines multiple attributes of the spatio-temporal trajectory segment into an index key by constructing the composite key, and can realize multi-dimensional indexing. At the same time, by using the hierarchical index structure of the B+ tree and the chain table structure of the leaf node, efficient range query and sequential access can be realized. The design of the index structure improves the retrieval efficiency of the spatio-temporal trajectory segment, and meets the requirements of real-time and scalability.
[0014] Optionally, the B+ tree index structure and the composite key are used to perform range query to obtain a candidate segment set, specifically including: constructing a query range of the B+ tree index structure according to the query dynamic target and the target query time range; converting the query range into a start retrieval key and an end retrieval key in the B+ tree index structure, the start retrieval key including a target identifier and a target start time, and the end retrieval key including a target identifier and a target end time; in the B+ tree index structure, based on the start retrieval key, locating to a start leaf node through the hierarchical index structure of the B+ tree index structure; based on the bidirectional chain table of the start leaf node, forwardly traversing a successor node, comparing the composite key corresponding to the successor node and the end retrieval key in sequence, determining a target node before the end retrieval key, and adding a target spatio-temporal trajectory segment corresponding to the target node to the candidate segment set.
[0015] By adopting the technical scheme, a query range of a B+ tree index structure is constructed according to a query dynamic target and a target query time range. Then, the query range is converted into a starting search key and a terminal search key in the B+ tree index structure, the starting search key including a target identifier and a target starting time, and the terminal search key including a target identifier and a target ending time. Next, in the B+ tree index structure, based on the starting search key, a starting leaf node is located by using a hierarchical index structure of the B+ tree index structure. Finally, based on a bidirectional linked list of the starting leaf node, successor nodes are forwardly traversed, and a composite key corresponding to each successor node is compared with the terminal search key, to determine a target node before the terminal search key, and a target space-time trajectory segment corresponding to the target node is added to a candidate segment set. By using the B+ tree index structure and the composite key, the starting leaf node can be quickly located by constructing the query range and the search key. Then, by using the bidirectional linked list of the leaf node, the target space-time trajectory segment meeting the query condition can be efficiently obtained by traversing and comparing the composite key, to form the candidate segment set. This query method fully utilizes the advantages of the B+ tree index structure, realizes efficient range query, and improves the retrieval efficiency of the space-time trajectory segment.
[0016] Optionally, after the B+ tree index structure is constructed, the space-time trajectory segment is taken as a data record to be indexed, and the index key of the B+ tree index structure is set as a composite key, the method further includes the steps of constructing a first auxiliary index item and a second auxiliary index item, and the construction of the first auxiliary index item and the second auxiliary index item specifically includes: grouping the space-time trajectory segment according to a space grid identifier to obtain a first grouping result; generating a first auxiliary index item corresponding to each space grid identifier based on the first grouping result, the index key of the first auxiliary index item being the space grid identifier, and the index value of the first auxiliary index item being a leaf node set corresponding to all space-time trajectory segments containing the space grid identifier; grouping the space-time trajectory segment according to a dynamic target identifier 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, the index key of the second auxiliary index item being the dynamic target identifier, and the index value of the second auxiliary index item being a leaf node set corresponding to all space-time 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 first and second auxiliary index items to further improve query efficiency. When constructing the first auxiliary index item, the spatiotemporal trajectory segments are grouped according to the spatial grid identifier, obtaining a 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 segments containing the spatial grid identifier. When constructing the second auxiliary index item, the spatiotemporal trajectory segments are grouped according to the dynamic target identifier, obtaining a second grouping result. Then, based on the second grouping result, a second auxiliary index item is generated corresponding to each dynamic target identifier. 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 segments containing the dynamic target identifier. By constructing the first and second auxiliary index items, relevant spatiotemporal trajectory segments can be quickly located based on the spatial grid identifier and dynamic target identifier, avoiding searching the entire B+ tree index structure and improving query efficiency. This auxiliary index item design, combined with the B+ tree main index structure, forms a complete spatiotemporal trajectory index system, which meets the efficient retrieval requirements under different query conditions.
[0018] Optionally, the processing of the video data stream to identify continuously moving dynamic targets in the video data stream specifically includes: performing foreground extraction on each video frame in the video data stream to obtain a foreground binary image; performing connected domain analysis on the foreground binary image to obtain a candidate dynamic target area; calculating feature parameters of the candidate dynamic target area, the feature parameters including area, aspect ratio and motion speed; based on the feature parameters, using a support vector machine classifier to classify the candidate dynamic target area to obtain a dynamic target area; and performing target tracking on the dynamic target area to obtain each dynamic target and the motion trajectory corresponding to each dynamic target.
[0019] By adopting the technical scheme, foreground extraction is performed on each video frame in the video data stream to obtain a foreground binary image. Then, connected domain analysis is performed on the foreground binary image to obtain a candidate dynamic target region. Next, feature parameters of the candidate dynamic target region are calculated, including area, width-height ratio and motion speed. Based on the feature parameters, a support vector machine classifier is used to classify the candidate dynamic target region to obtain a dynamic target region. Finally, target tracking is performed on the dynamic target region to obtain each dynamic target and a motion trajectory corresponding to each dynamic target. The method obtains the candidate dynamic target region through foreground extraction and connected domain analysis, and then classifies the candidate dynamic target region by using the feature parameters and the support vector machine classifier to accurately identify the dynamic target region. Through target tracking, the motion trajectory of the dynamic target is obtained, which provides basic data for subsequent spatio-temporal trajectory segment generation. The dynamic target identification and tracking method can effectively extract continuously moving dynamic targets from the video data stream, thereby laying a foundation for efficient video storage and retrieval.
[0020] In a second aspect of the present application, a B+ tree-based video storage and retrieval device is provided, which comprises a to-be-processed video acquisition module, a video stream processing module, a B+ tree construction module, a retrieval module, and a retrieval result output module. The to-be-processed video acquisition module is configured to acquire a to-be-processed video data stream and divide the video data stream into a plurality of preset spatial grids according to a preset spatial grid definition. The video stream processing module is configured to process the video data stream and identify a continuously moving dynamic target in the video data stream. The video stream processing module is further configured to determine a target spatial grid in which the dynamic target is located and generate a spatio-temporal trajectory segment, with a start time at which the dynamic target enters the target spatial grid and an end time at which the dynamic target leaves the target spatial grid as boundaries. The B+ tree construction module is configured to construct a B+ tree index structure, take the spatio-temporal trajectory segment as a to-be-indexed data record, and set an index key of the B+ tree index structure as a composite key. The retrieval module is configured to receive a retrieval request, perform range query by using the B+ tree index structure and the composite key, and obtain a candidate segment set, wherein the retrieval request comprises a query dynamic target and a target query time range. The retrieval module is further configured to traverse a target spatio-temporal trajectory segment in the candidate segment set, calculate an overlapping duration of a time interval of the target spatio-temporal trajectory segment and the target query time range, and determine a corresponding target identifier based on the query dynamic target. The retrieval module is further configured to accumulate all overlapping durations generated by the query dynamic target to obtain a total effective residence duration of the query dynamic target in the target query time range. The retrieval result output module is configured to filter out a query dynamic target with a total effective residence duration greater than or equal to a preset duration threshold as a final retrieval result.
[0021] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, 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 so that the electronic device performs any of the methods described above.
[0022] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions. When the instructions are executed, any one of the methods described above is executed.
[0023] In summary, one or more technical solutions provided in this application have at least the following technical effects or advantages: 1. This method constructs a B+ tree-based index structure and uses a composite key (composed of a spatial grid identifier, a dynamic target identifier, a start time, and an end time) to efficiently index and manage spatiotemporal trajectory segments. Range queries directly select spatiotemporal trajectory segments that overlap with the target time range, and the overlap duration is calculated for the candidate segment set, improving retrieval efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is a flowchart of a B+ tree-based video storage and retrieval method disclosed in an embodiment of the present application; Figure 2 This is a module diagram of a B+ tree-based video storage and retrieval device disclosed in an embodiment of the present application; Figure 3 This is a structural diagram of an electronic device disclosed in an embodiment of the present application.
[0025] Explanation of the accompanying drawings: 201, module for acquiring video to be processed; 202, module for processing video streams; 203, module for constructing B+ tree; 204, module for searching; 205, module for outputting searching results; 300, electronic device; 301, processor; 302, communication bus; 303, user interface; 304, network interface; 305, memory. DETAILED DESCRIPTION
[0026] In order 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 in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0027] In the description of the embodiments of the present application, the words "for example" or "such as" are used to represent that an example, an illustration or an explanation is given. Any embodiment or design scheme described as "for example" or "such as" in the embodiments of the present application should not be interpreted as being more preferred or having more advantages than other embodiments or design schemes. In fact, the words "for example" or "such as" are used to present the relevant concept in a specific manner.
[0028] In the description of the embodiments of the present application, the term "a plurality of" means two or more. For example, a plurality of systems means two or more systems, and a plurality of screen terminals means two or more screen terminals. In addition, the terms "first", "second" are used only for description purposes and should not be interpreted as indicating or implying relative importance or implicitly indicating the indicated technical features. Therefore, the features defined with "first", "second" can be explicitly or implicitly included one or more features. The terms "include", "contain", "have" and their variants mean "include but are not limited to", unless otherwise specifically emphasized.
[0029] The present application provides a B+ tree-based video storage and retrieval method, referring to Figure 1 , Figure 1 is a flowchart of a B+ tree-based video storage and retrieval method provided by the embodiments of the present application. The method is applied to a server, which is a server executing a B+ tree-based video storage and retrieval program. The server can be a single server, a server cluster composed of multiple servers, or a cloud computing service center. The method includes steps S101 to S108, which are as follows: Step S101: Obtain a video data stream to be processed, and divide the video data stream into a plurality of preset spatial grids according to a preset spatial grid definition.
[0030] In step S101, the server first obtains a video data stream to be processed. The video data stream can come from various video acquisition devices such as surveillance cameras, vehicle-mounted cameras, unmanned aerial vehicle cameras, etc., or from video storage devices such as video servers, cloud storage platforms, etc. The server receives the video data stream through a network interface or a video acquisition interface, and temporarily stores it in a memory buffer or a disk storage for subsequent processing.
[0031] Then, the server divides the video data stream into a plurality of preset spatial grids according to a preset spatial grid definition. The preset spatial grid definition means that the video monitoring scene is divided into a plurality of grid units according to certain spatial division rules, and each grid unit corresponds to a unique spatial grid identifier. The spatial grid division granularity can be set according to actual application requirements, for example, it can be divided according to fixed length and width.
[0032] The server performs spatial grid division on each frame of the video data stream according to a preset spatial grid definition: For fixed-size rectangular grid division, the server first calculates the pixel coordinate range corresponding to each grid unit according to the resolution of the video image and the size of the preset grid unit, then performs pixel-level scanning on the video image, determines which grid unit each pixel belongs to, and marks the pixel with the corresponding spatial grid identifier.
[0033] Through the above steps, the server completes the spatial grid division of the video data stream and obtains the correspondence between each frame of the video data stream and the spatial grid identifier, laying a foundation for subsequent dynamic target recognition and trajectory generation. In the next step, 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.
[0034] For example, in a city road traffic monitoring scenario, the server can perform grid division according to the road network topology, with each road segment and intersection corresponding to a spatial grid unit, and each road segment can be further divided into several 10-meter-square small grids. When a vehicle enters a certain road segment, the server determines its corresponding spatial grid identifier according to the pixel coordinates of the vehicle in the video image, and continuously tracks the spatial grid changes of the vehicle in the subsequent frame images until it exits the monitoring area.
[0035] Step S102: processing the video data stream to identify the continuously moving dynamic targets in the video data stream.
[0036] In step S102, the video data stream is processed to identify the continuously moving dynamic targets in the video data stream, which specifically includes: performing foreground extraction on 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 the feature parameters of the candidate dynamic target regions, including area, aspect ratio, and motion speed; based on the feature parameters, using a support vector machine classifier to classify the candidate dynamic target regions to obtain dynamic target regions; performing target tracking on the dynamic target regions to obtain each dynamic target and the corresponding motion trajectory of each dynamic target.
[0037] Specifically, the server performs foreground extraction on each video frame in the video data stream to obtain a foreground binary image. Foreground extraction refers to distinguishing moving objects from static background in a video frame to generate a binary image containing only moving objects. The foreground extraction algorithm can be frame difference method, background subtraction method, Gaussian mixture background modeling method, etc. The server can select a suitable algorithm according to the scene characteristics and real-time requirements, such as using frame difference method in static background and using Gaussian mixture background modeling method in dynamic background.
[0038] Then, the server performs connected component analysis on the foreground binary image to obtain a candidate dynamic target region. Connected component analysis refers to searching for connected pixel regions in a binary image, and each connected region corresponds to a candidate dynamic target. The server can use region growing algorithm, contour extraction algorithm, etc. to implement connected component analysis to obtain the circumscribed rectangle frame or contour polygon of a set of candidate dynamic target regions. The server calculates the characteristic parameters of the candidate dynamic target region, including area, width-height ratio, and motion speed. The area refers to the number of all pixel points in the candidate dynamic target region; the width-height ratio refers to the ratio of the width to the height of the circumscribed rectangle frame of the candidate dynamic target region; the motion speed refers to the ratio of the displacement to the time interval of the candidate dynamic target region in consecutive video frames. The server can preliminarily determine whether the candidate dynamic target region is a true moving object through these characteristic parameters.
[0039] Next, the server classifies the candidate dynamic target region based on the characteristic parameters using a support vector machine classifier to obtain a dynamic target region. Support vector machine is a binary classification model that can find the optimal classification hyperplane in the feature space to divide the candidate dynamic target region into two categories: moving object and non-moving object. The server pre-trains the support vector machine classifier using a labeled data set to obtain a classification model, and then inputs the characteristic parameters of the candidate dynamic target region into the classification model to obtain its category, thereby determining which candidate regions are true dynamic targets.
[0040] Finally, the server performs target tracking on the dynamic target region to obtain each dynamic target and the motion trajectory corresponding to each dynamic target. Target tracking refers to continuously locating and matching the same dynamic target in consecutive video frames to obtain its motion trajectory. The target tracking algorithm can be Kalman filter, particle filter, correlation filter, etc. The server can select a suitable tracking algorithm according to the motion characteristics of the dynamic target and the scene complexity, such as using Kalman filter in single target and linear motion scene, and using particle filter in multi-target and non-linear motion scene. Through target tracking, the server can obtain the position, size, speed, etc. of each dynamic target in different video frames to form a complete motion trajectory.
[0041] For example, in a monitoring video of a public place, the server first performs background subtraction on the video frames to obtain a foreground binary image containing only moving personnel; then performs connected domain analysis on the binary image to obtain multiple candidate personnel regions; then calculates the area, width-height ratio and motion speed of each candidate personnel region, and uses a support vector machine classifier to determine whether it is a real pedestrian; finally, the server uses a Kalman filter algorithm to track each pedestrian target to obtain its motion trajectory in the scene until the target leaves the monitoring area.
[0042] Step S103: determining the target space grid where the dynamic target is located, and generating a space-time trajectory segment, the space-time trajectory segment taking the starting time when the dynamic target enters the target space grid and the ending time when the dynamic target leaves the target space grid as boundaries.
[0043] In step S103, the space-time trajectory segment includes a continuous space-time trajectory segment and a spliced space-time trajectory segment. In generating the space-time trajectory segment, the continuous space-time trajectory segment is generated, specifically including: detecting a dynamic target in each video frame in the video data stream and obtaining a position coordinate of the dynamic target; mapping the position coordinate to a preset space grid to determine a target space grid where the dynamic target is located; if the dynamic target appears in the target space grid for the first time, taking a timestamp of the current video frame as a starting time, creating a continuous space-time trajectory segment, and setting the continuous space-time trajectory segment as an unclosed state; if the dynamic target is detected in the target space grid in a first video frame, maintaining the continuous space-time trajectory segment as an unclosed state, and continuing to track the dynamic target, the first video frame being a subsequent video frame of the current video frame; if the dynamic target is detected to disappear in a second video frame, and the dynamic target is not detected within a preset fault tolerance time threshold, it is determined that the dynamic target leaves the target space grid, and the timestamp of the second video frame is taken as an ending time, and the continuous space-time trajectory segment is closed, the second video frame being one of the video frames in the first video frame.
[0044] Specifically, the server processes each video frame in the video data stream, detects the dynamic target contained therein, and obtains the position coordinate of each dynamic target. The server can use a target detection algorithm, such as YOLO, SSD, Faster R-CNN based on deep learning, etc., to perform real-time analysis on the video frame to obtain the bounding box coordinates of the dynamic target.
[0045] Then, the server maps the position coordinates of the dynamic target into the preset spatial grid to determine a target spatial grid in which the dynamic target is located. Specifically, the server calculates the spatial grid identifier to which the dynamic target belongs according to the coordinates of each point of the dynamic target bounding box, that is, discretizes the continuous spatial coordinates into grid units. If the dynamic target appears in the target spatial grid for the first time, the server creates a new continuous space-time trajectory segment with the timestamp of the current video frame as the starting time, and sets the state of the trajectory segment as 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.
[0046] In subsequent video frames, if the server detects that the same dynamic target is still in the same target spatial grid, the unclosed state of the continuous space-time trajectory segment is maintained, and the dynamic target is continuously tracked. The server adds the position coordinates, timestamp and other information of the dynamic target in each video frame to the trajectory segment to form a continuous space-time trajectory point sequence.
[0047] If the dynamic target disappears in a video frame (becoming a second video frame) in the subsequent video frames, and the target is not detected again within a preset fault tolerance time threshold, the server determines that the dynamic target has left the target spatial grid. The server closes the continuous space-time trajectory segment with the timestamp of the video frame in which the target is last detected as the ending time. At this time, the trajectory segment contains the complete movement process of the dynamic target in the target spatial grid from entering to leaving, forming a continuous space-time trajectory segment.
[0048] For example, in a monitoring video inside a shopping mall, the server divides the shopping mall plane into a plurality of square spatial grids. When a customer enters a grid unit, the server detects the position coordinates of the customer and creates a new continuous space-time trajectory segment, recording the starting time and the initial position of the customer. In subsequent video frames, the server continuously tracks the movement of the customer in the same grid, and continuously adds the position coordinates and timestamp of the customer to the trajectory segment. If the customer leaves the grid and does not appear again within 2 seconds, the server determines that the customer has left, and closes the continuous space-time trajectory segment with the timestamp of the last time the customer is detected as the ending time. In this way, the server obtains a complete continuous space-time trajectory segment, recording the movement process of the customer in the grid.
[0049] In step S103, the spatio-temporal trajectory segment is generated, specifically including: performing frame-by-frame analysis on the video data stream, when it is determined that a dynamic target is detected in the target space grid of the third video frame, generating a temporary segment including the third video frame, the third video frame being one of the plurality of video frames included in the video data stream; within a preset time window, obtaining all target temporary segments generated by the dynamic target in the target space grid; sorting the target temporary segments according to timestamps, and merging the first temporary segment and the second temporary segment into a spatio-temporal trajectory segment, the first temporary segment and the second temporary segment being any two of the plurality of target temporary segments, and the time interval of the first temporary segment and the second temporary segment being less than a preset fusion time threshold.
[0050] Specifically, the server performs frame-by-frame analysis on the video data stream to detect whether a dynamic target appears in each frame. When a dynamic target is detected in the target space grid of a certain video frame (referred to as the third video frame), the server generates a temporary segment containing the video frame. The temporary segment records the spatial grid identifier, timestamp, position coordinates and other information of the dynamic target in the video frame.
[0051] Within a preset time window, the server continuously tracks the movement of the dynamic target in the target space grid and generates multiple temporary segments. Each temporary segment corresponds to a continuous time window and records the movement segment of the dynamic target in the time window. If the dynamic target leaves the target space grid within the time window, the temporary segment will be interrupted, and a new temporary segment will be generated again when the target reenters the grid.
[0052] After the end of the preset time window, the server obtains all temporary segments generated by the dynamic target in the target space grid, and sorts the temporary segments according to timestamps. The sorted temporary segments are arranged in chronological order, and there may be a time interval between adjacent temporary segments. The server compares the sorted temporary segments two by two, and if the time interval of two temporary segments is less than a preset fusion time threshold, they are merged into a spatio-temporal trajectory segment. The merging operation concatenates the spatio-temporal coordinate point sequences of the two temporary segments to form a longer trajectory segment. The server compares all adjacent temporary segments in turn and merges them until all temporary segments that meet the conditions are merged into spatio-temporal trajectory segments.
[0053] After the above merging operation, the server obtains a plurality of spatio-temporal trajectory segments, each of which is composed of a plurality of temporary segments with a time interval less than the fusion time threshold. These spatio-temporal trajectory segments record the complete movement process of the dynamic target in the target space grid, although there may be short time interruptions, but they still maintain continuity in time and space.
[0054] For example, in a surveillance video of a traffic intersection, the server divides the intersection into several spatial grids, 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 location and timestamp. Over the next 10 seconds, the server continues to track the vehicle and generates multiple temporary segments. If the vehicle leaves the grid during these 10 seconds, the temporary segment is interrupted. When the vehicle reenters the grid, the server generates a new temporary segment. After the 10-second time window expires, the server retrieves all temporary segments and sorts them by timestamp. The server then compares the time intervals between adjacent temporary segments and, if they are less than 2 seconds, merges them into a spliced spatiotemporal trajectory segment. Ultimately, the server obtains several spliced trajectory segments that reflect the vehicle's overall trajectory, even with brief temporal interruptions.
[0055] Step S104: constructing a B+ tree index structure, recording the spatiotemporal trajectory segments as data to be indexed, and setting the index key of the B+ tree index structure as a composite key.
[0056] In step S104, a B+ tree index structure is constructed, the spatiotemporal trajectory fragment is used as the data record to be indexed, and the index key of the B+ tree index structure is set to a composite key, specifically including: the spatial grid identifier, dynamic target identifier, start time and end time of the spatiotemporal trajectory fragment are sequentially connected as a string to construct a composite key; according to the lexicographic order size relationship 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 node of the B+ tree index structure, and the spatiotemporal trajectory fragment is stored as the data record to be indexed in the leaf node of the B+ tree index structure, and the leaf node is linked by a pointer linked list.
[0057] 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 composite key format is "spatial grid identifier_dynamic target identifier_start time_end time", where the different components are separated by underscores.
[0058] Then, the server inserts the spatio-temporal trajectory segment into the corresponding data page node in the B+ tree index structure according to the lexicographical size relationship of the composite key. The B+ tree is a balanced multi-way search tree, and the key values in the nodes are arranged in lexicographical order, with the key values of the left subtree being smaller than the node key value and the key values of the right subtree being larger than the node key value. The server starts from the root node of the B+ tree, compares the size of the composite key and the node key value, recursively searches downward until the appropriate leaf node is found, and inserts the spatio-temporal trajectory segment into the leaf node. If the leaf node is full, node splitting is performed to ensure the balance of the B+ tree.
[0059] In the intermediate nodes of the B+ tree index structure, the server only stores the composite key, but not the actual spatio-temporal trajectory segment data. The intermediate nodes serve as indexes and navigation aids to quickly locate the target leaf node. Each intermediate node contains multiple key values and pointers to child nodes, with the key values being composite keys and the pointers pointing to nodes at the next level. By comparing the key values of the intermediate nodes, the direction of the search can be determined, narrowing the search range.
[0060] In the leaf nodes of the B+ tree index structure, the server stores the spatio-temporal trajectory segment as a data record to be indexed. Each leaf node contains multiple spatio-temporal trajectory segment records, which contain detailed information such as spatial grid identification, dynamic target identification, 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 sequential scans.
[0061] Finally, the server links the leaf nodes of the B+ tree index structure through a pointer chain list. Each leaf node, in addition to storing spatio-temporal trajectory segment records, also contains pointers to the previous and next leaf nodes. Through the pointer chain list, all leaf nodes can be traversed in the order of the composite key, enabling range queries and continuous access.
[0062] For example, assume that the server generates 100 spatio-temporal trajectory segments, each containing information such as spatial grid identification, dynamic target identification, start time, and end time. The server combines these information into a composite key, such as "G10_O25_1622189023_1622189085", and then inserts the trajectory segment into the B+ tree index structure according to the lexicographical size relationship of the composite key. The intermediate nodes of the B+ tree store the composite key for indexing and navigation, and the leaf nodes store complete trajectory segment records and are connected through a pointer chain list. When querying trajectory segments within a certain spatial grid and time range, the server can quickly locate the corresponding leaf node through the index of the B+ tree, and then perform sequential scanning in the leaf node to find the trajectory segments that meet the conditions. The construction and maintenance of the B+ tree index structure greatly improve the query efficiency and retrieval performance of spatio-temporal trajectory data.
[0063] In a possible implementation, after step S104, the method further includes the steps of constructing the first auxiliary index item and the second auxiliary index item, specifically including: grouping the spatio-temporal trajectory segments according to the spatial grid identifier to obtain a first grouping result; generating, based on the first grouping result, a first auxiliary index item corresponding to each spatial grid identifier, the index key of the first auxiliary index item being the spatial grid identifier, and the index value of the first auxiliary index item being a leaf node set corresponding to all spatio-temporal trajectory segments containing the spatial grid identifier; grouping the spatio-temporal trajectory segments according to the dynamic target identifier to obtain a second grouping result; and generating, based on the second grouping result, a second auxiliary index item corresponding to each dynamic target identifier, the index key of the second auxiliary index item being the dynamic target identifier, and the index value of the second auxiliary index item being a leaf node set corresponding to all spatio-temporal trajectory segments containing the dynamic target identifier.
[0064] Specifically, the server groups the spatio-temporal trajectory segments according to the spatial grid identifier to obtain a first grouping result. The first grouping result groups all trajectory segments with the same spatial grid identifier into a group. For example, for trajectory segments with a spatial grid identifier of "G10", the server groups them into a group; and for trajectory segments with a spatial grid identifier of "G20", the server groups them into another group. Based on the first grouping result, the server generates a first auxiliary index item corresponding to each spatial grid identifier. The index key of the first auxiliary index item is the spatial grid identifier, and the index value is a leaf node set corresponding to all spatio-temporal trajectory segments containing the spatial grid identifier. For example, for the spatial grid identifier "G10", the server generates a first auxiliary index item with an index key of "G10" and an index value of a leaf node set containing all trajectory segments with "G10".
[0065] Then, the server groups the spatio-temporal trajectory segments according to the dynamic target identifier to obtain a second grouping result. The second grouping result groups all trajectory segments with the same dynamic target identifier into a group. For example, for trajectory segments with a dynamic target identifier of "O25", the server groups them into a group; and for trajectory segments with a dynamic target identifier of "O30", the server groups them into another group. Based on the second grouping result, the server generates a second auxiliary index item corresponding to each dynamic target identifier. The index key of the second auxiliary index item is the dynamic target identifier, and the index value is a leaf node set corresponding to all spatio-temporal trajectory segments containing the dynamic target identifier. For example, for the dynamic target identifier "O25", the server generates a second auxiliary index item with an index key of "O25" and an index value of a leaf node set containing all trajectory segments with "O25".
[0066] Finally, the server stores the generated first auxiliary index item and the second auxiliary index item in the memory or the disk for subsequent query. The first auxiliary index item and the second auxiliary index item can be organized and stored using a hash table, a B+ tree, or the like, so as to realize fast index lookup. By constructing the first auxiliary index item and the second auxiliary index item, the server can quickly locate the relevant spatio-temporal trajectory segment according to the spatial grid identifier and the dynamic target identifier. When querying the trajectory segment in a certain spatial grid, the server can directly find the corresponding leaf node set through the first auxiliary index item, avoiding searching in the entire B+ tree; when querying the trajectory segment of a certain dynamic target, the server can directly find the corresponding leaf node set through the second auxiliary index item, also avoiding full tree search.
[0067] For example, it is assumed that the server stores 1000 spatio-temporal trajectory segments, involving 30 spatial grids and 20 dynamic targets. The server first groups the trajectory segments according to the spatial grid identifier, generates 30 first auxiliary index items, each index item corresponding to a spatial grid, and the index value being the set of leaf nodes in which the trajectory segments in the spatial grid are located. Then, the server groups the trajectory segments according to the dynamic target identifier, generates 20 second auxiliary index items, each index item corresponding to a dynamic target, and the index value being the set of leaf nodes in which the trajectory segments of the dynamic target are located. When a user queries the trajectory segment in the spatial grid "G1030", the server directly obtains the corresponding leaf node set through the first auxiliary index item, greatly reducing the query range; when the user queries the trajectory segment of the dynamic target "O25", the server directly obtains the corresponding leaf node set through the second auxiliary index item, avoiding unnecessary search overhead.
[0068] Step S105: receiving a retrieval request, and performing a range query by using the B+ tree index structure and the composite key to obtain a candidate segment set, the retrieval request including a query dynamic target and a target query time range.
[0069] In step S105, the range query is performed by using the B+ tree index structure and the composite key to obtain the candidate segment set, specifically including: constructing a query range of the B+ tree index structure according to the query dynamic target and the target query time range; converting the query range into a starting retrieval key and an ending retrieval key in the B+ tree index structure, the starting retrieval key including the target identifier and the target start time, and the ending retrieval key including the target identifier and the target end time; in the B+ tree index structure, locating to the starting leaf node based on the starting retrieval key through the hierarchical index structure of the B+ tree index structure; based on the bidirectional linked list of the starting leaf node, forwardly traversing the successor nodes, and sequentially comparing the composite key corresponding to the successor nodes with the ending retrieval key to determine the target node before the ending retrieval key, and adding the target spatio-temporal trajectory segment corresponding to the target node to the candidate segment set.
[0070] Specifically, the server constructs a query range of the B+ tree index structure according to the query dynamic target and the target query time range. The query range is determined by a start retrieval key and an end retrieval key, where the start retrieval key includes the target identifier and the target start time, and the end retrieval key includes the target identifier and the target end time. For example, if the query dynamic target is "025" and the target query time range is "2023-05-01 10:00:00" to "2023-05-01 11:00:00", the start retrieval key is "025_2023-05-01 10:00:00" and the end retrieval key is "025_2023-05-01 11:00:00".
[0071] Then, the server converts the query range into the start retrieval key and the end retrieval key in the B+ tree index structure. According to the construction rule of the composite key, the server combines the target identifier and the timestamp into the format of the retrieval key. The start retrieval key and the end retrieval key respectively represent the lower bound and the upper bound of the query range, which are used for range query in the B+ tree.
[0072] Next, the server locates the start leaf node in the B+ tree index structure based on the start retrieval key through the hierarchical index structure of the B+ tree. The server starts from the root node of the B+ tree, compares the start retrieval key with the node key value, recursively searches downward until the first leaf node greater than or equal to the start retrieval key is found, which is the start leaf node. The start leaf node is the starting point of the range query and contains the first spatiotemporal trajectory segment of the query range.
[0073] Next, the server traverses the successor nodes in the forward direction based on the bidirectional linked list of the start leaf node, and compares the composite key corresponding to each successor node with the end retrieval key in turn. The server traverses the leaf nodes in the order of the composite key from small to large through the bidirectional linked list of the leaf nodes until the first leaf node greater than the end retrieval key is encountered. At the same time, in order to capture the trajectories starting before the target query time range but overlapping with it, the server also performs a backtracking check on the previous leaf nodes of the located start leaf node; if the previous node exists and the recorded spatiotemporal trajectory segment has an end time greater than or equal to the start time of the target query time range, the segment is also considered to meet the condition and is added to the candidate segment set.
[0074] Finally, the server adds the spatiotemporal trajectory segment corresponding to the target node determined in the traversal process to the candidate segment set. The candidate segment set contains all spatiotemporal trajectory segments that meet the query condition, i.e., the trajectory segments that belong to the query dynamic target and have a time range within the target query time range. The server returns the candidate segment set as the result of the range query to the requester.
[0075] For example, suppose the server receives a search request for the dynamic target "O25" and the target query time range is "2023-05-01 10:00:00" to "2023-05-01 11:00:00." Based on the request, the server constructs a starting search key "O25_2023-05-01 10:00:00" and an ending search key "O25_2023-05-01 11:00:00," and then searches within the B+ tree index structure. The server first locates the starting leaf node using the B+ tree's hierarchical index structure, where the composite key is greater than or equal to the starting search key. The server then traverses backward along the doubly linked list of leaf nodes, comparing the composite keys of successive nodes with the ending search key. The server adds the spatiotemporal trajectory segments corresponding to the target node that meet the requirements to the candidate segment set, until it encounters the first leaf node with a value greater than the ending search key. Finally, the server returns the candidate segment set as the query result, which contains all trajectory segments that belong to the query dynamic target within the specified time range.
[0076] Through the above steps, the server utilizes a B+ tree index structure and composite keys to implement efficient range queries. The B+ tree's hierarchical index structure allows for rapid location of the starting leaf node, while the doubly linked list of leaf nodes allows for sequential traversal of target nodes that meet the criteria, avoiding unnecessary node accesses. The composite key design encodes both temporal and spatial information within the index key, enabling range queries to be performed directly on the index without requiring additional data filtering. This index structure and query approach significantly improves the retrieval efficiency of spatiotemporal trajectory data, meeting real-time and scalability requirements.
[0077] Step S106: traverse the target spatiotemporal trajectory segments in the candidate segment set, and calculate the overlapping duration of the time interval of the target spatiotemporal trajectory segment and the target query time range.
[0078] In step S106, the server traverses each target spatiotemporal trajectory segment in the candidate segment set. The candidate segment set is obtained by performing a range query using a B+ tree index structure and a composite key in step S105 and contains trajectory segments that meet the query criteria. The server sequentially accesses each trajectory segment in the candidate segment set and calculates the overlap of its time interval.
[0079] For each target spatiotemporal trajectory segment, the server extracts its start and end times to obtain the segment's time interval. This time interval represents the time span of the trajectory segment, that is, the duration of the dynamic target's motion within the segment. The server can directly obtain the start and end time information from the trajectory segment's metadata or composite key.
[0080] Then, the server compares the time interval of the target spatio-temporal trajectory segment with the target query time range and calculates the overlapping duration between them. The overlapping duration represents the length of time that the trajectory segment overlaps with the query time range, which is used to measure the relevance of the trajectory segment to the query condition. The server determines the overlapping part between them by comparing the start time and end time of the trajectory segment with the start time and end time of the query time range, and calculates the time length of the overlapping part.
[0081] Next, the server associates the calculated overlapping duration with the corresponding target spatio-temporal trajectory segment to form an overlapping duration record. The overlapping duration record contains the identification information of the trajectory segment and the overlapping duration value, which is used for subsequent result sorting and returning. The server can store the overlapping duration record in a data structure in memory, such as an array, a list, or a hash table, for fast access and processing. Finally, the server updates the query result set according to the overlapping duration record. The server sorts the trajectory segments that meet the conditions in chronological order to form the sorted query result set.
[0082] For example, assume that the candidate segment set contains the following three target spatio-temporal trajectory segments: Segment A: start time "2023-05-01 09:30:00", end time "2023-05-01 10:10:00".
[0083] Segment B: start time "2023-05-01 10:30:00", end time "2023-05-01 11:15:00".
[0084] Segment C: start time "2023-05-01 11:00:00", end time "2023-05-01 12:00:00".
[0085] The target query time range is "2023-05-01 10:00:00" to "2023-05-01 11:00:00".
[0086] The server iterates through the candidate segment set and calculates the overlapping duration of each segment with the query time range in turn: The time interval of Segment A is [09:30:00, 10:10:00], and the overlapping duration with the query time range is 10 minutes.
[0087] The time interval of Segment B is [10:30:00, 11:15:00], and the overlapping duration with the query time range is 30 minutes.
[0088] The time interval of Segment C is [11:00:00, 12:00:00], and the overlapping duration with the query time range is 0 minutes.
[0089] 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].
[0090] Step S107: Based on the query dynamic target, determine the corresponding target identifier, and accumulate all overlapping durations generated by the query dynamic target to obtain the total effective stay duration of the query dynamic target within the target query time range.
[0091] 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 user-provided search request, which can be a specific person, vehicle or other mobile entity. The server finds the corresponding target identifier in the target identifier mapping table of the system through the target description information in the query request, such as name, ID, features, etc. The target identifier is a unique identifier used to identify and track dynamic targets within the system, usually in the form of numbers or strings.
[0092] The server extracts all overlapping duration records generated by the query dynamic target in the candidate segment set. In step S106, the server has calculated the overlapping duration of each target spatio-temporal trajectory segment in the candidate segment set with the target query time range, and generated the overlapping duration record. The server finds the records related to the query dynamic target in the overlapping duration record through the target identifier, and extracts the overlapping duration values of the target on different trajectory segments.
[0093] Then, the server accumulates all the extracted overlapping durations to obtain the total effective stay duration of the query dynamic target within the target query time range. The server adds the overlapping duration values belonging to the same query dynamic target to obtain the total stay time of the target within the specified time range. The total effective stay duration reflects the total activity time of the query dynamic target within the time period of interest, which can be used to analyze the behavior patterns and spatio-temporal distribution characteristics of the target.
[0094] Next, the server generates a result record for the target identifier and the corresponding total effective stay duration of the query dynamic target. The result record is represented in the form of 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 record in a data structure in memory, such as a hash table or an array, for fast query and access.
[0095] Finally, the server adds the generated result record to the query result set. The query result set is the final data set returned to the user, containing the dwell time information of the dynamic target of interest within the target query time range. The server merges the result record with the previously generated query result set to form the complete query response data. The user can understand the activity of the dynamic target of interest within the specified time range through the query result set.
[0096] For example, assume that a user submits a search request, querying for the dynamic target "John Doe" within the time range "2023-05-01 09:00:00" to "2023-05-01 12:00:00". The server first looks up the corresponding target identifier "U1001" in the target identifier mapping table based on the name "John Doe". Then, the server looks up the records with the target identifier "U1001" in the intersection duration record set of candidate segments, and assumes that the following three intersection durations are obtained: Segment A: intersection duration of 30 minutes.
[0097] Segment B: intersection duration of 45 minutes.
[0098] Segment C: intersection duration of 20 minutes.
[0099] The server accumulates the three intersection durations to obtain a total effective dwell time of 95 minutes.
[0100] The server generates a result record with the key "U1001" and the value 95 minutes. The server adds the result record to the query result set and outputs it.
[0101] Step S108: Filter out the query dynamic target with a total effective dwell time greater than or equal to the preset duration threshold as the final search result output.
[0102] In step S108, the server obtains the preset duration threshold. The preset duration threshold is a set value of a time length, used to determine whether the dwell time of the query dynamic target within the target query time range meets the user's needs. The threshold can be configured according to the specific application scenario and user preferences, such as 30 minutes, 1 hour, etc. 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 is generated in step S107 and contains the target identifier of the query dynamic target and the corresponding total effective dwell time. The server accesses each result record in the query result set in turn, extracts the total effective dwell time value, and compares it with the duration threshold.
[0103] The server then compares the total effective dwell time of each query dynamic target with the preset duration threshold. The server determines whether the total effective dwell time in the result record is greater than or equal to the duration threshold. If the dwell time meets the threshold condition, it indicates that the query dynamic target has a long enough active time within the target query time range, meeting the user's search requirements.
[0104] Next, the server filters out the query dynamic targets that meet the duration threshold condition as the final search results. The server creates a new data set to store the filtered target information. For each query dynamic target that meets the threshold condition, the server adds its target identifier and total effective dwell time to the new data set, forming the final search result set. The filtered search result set only contains targets with long enough dwell time, filtering out targets with short dwell time or not meeting user requirements.
[0105] Finally, the server outputs the final search result set to the user. The server formats the filtered target information into a form that is easy for the user to understand and use, such as JSON, XML, or table, etc. The output search results include target identifiers and corresponding total effective dwell times, allowing users to understand the activity of dynamic targets of interest within the specified time range and make further analysis and decisions.
[0106] In addition to filtering out query dynamic targets that meet the duration threshold condition as the final search results, the corresponding video frames can also be filtered out according to the overlap duration, and the video frames containing the query dynamic target within the target query time range can be obtained.
[0107] For example, assume that the user submits a search request, querying for "Vehicle A" within the time range "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 "Vehicle A" has a total effective dwell time of 20 minutes within the time range, which is greater than the preset duration threshold, so "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: 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.
[0108] Segment 2: start time is "2023-05-01 09:50:00", end time is "2023-05-01 10:05:00", and the overlap duration is 10 minutes.
[0109] Since the overlap durations of the two segments are both greater than or equal to the overlap duration threshold of 5 minutes, the server filters them out. The server extracts the corresponding video frame sequences in the original video data stream as additional search results according to the time ranges of Segment 1 and Segment 2.
[0110] Finally, the server outputs the target identification of "Vehicle A", the total effective stay duration, and the two video segments containing "Vehicle A" to the user. The user can understand the overall activity of "Vehicle A" in the specified time range through the total effective stay duration, and intuitively grasp the specific motion trajectory and stay position of "Vehicle A" by watching the video segments.
[0111] With reference to Figure 2 , the application also provides a B+ tree-based video storage and retrieval device, which is a server, and the server comprises a to-be-processed video acquisition module 201, a video stream processing module 202, a B+ tree construction module 203, a search module 204, and a search result output module 205. The to-be-processed video acquisition module 201 is configured to acquire a to-be-processed video data stream and divide the video data stream into a plurality of preset spatial grids according to a preset spatial grid definition. The video stream processing module 202 is configured to process the video data stream and identify a dynamic target that continuously moves in the video data stream. The video stream processing module 202 is further configured to determine a target spatial grid in which the dynamic target is located and generate a space-time trajectory segment, with the space-time trajectory segment taking a start time at which the dynamic target enters the target spatial grid and an end time at which the dynamic target leaves the target spatial grid as boundaries. The B+ tree construction module 203 is configured to construct a B+ tree index structure, take the space-time trajectory segment as a to-be-indexed data record, and set an index key of the B+ tree index structure as a composite key. The search module 204 is configured to receive a search request, perform a range query by using the B+ tree index structure and the composite key, and obtain a candidate segment set, wherein the search request comprises a query dynamic target and a target search time range. The search module 204 is further configured to traverse the target space-time trajectory segment in the candidate segment set, calculate an overlap duration between a time interval of the target space-time trajectory segment and the target search time range, and determine a corresponding target identification based on the query dynamic target. The search module 204 is further configured to accumulate all overlap durations generated by the query dynamic target to obtain a total effective stay duration of the query dynamic target in the target search time range. The search result output module 205 is configured to filter out the query dynamic target whose total effective stay duration is greater than or equal to a preset duration threshold as a final search result.
[0112] In a possible implementation, the spatio-temporal trajectory segment includes a continuous spatio-temporal trajectory segment and a spliced spatio-temporal trajectory segment, and the video stream processing module 202 generates the spatio-temporal trajectory segment, the video stream processing module 202 generates the continuous spatio-temporal trajectory segment, specifically including: the video stream processing module 202 detects a dynamic target in each video frame in the video data stream, and obtains a position coordinate of the dynamic target; the video stream processing module 202 maps the position coordinate to a preset spatial grid, and determines a target spatial grid in which the dynamic target is located; if the dynamic target appears in the target spatial grid for the first time, the video stream processing module 202 creates a continuous spatio-temporal trajectory segment with a timestamp of a current video frame as a starting time, and sets the continuous spatio-temporal trajectory segment as an unclosed state; if the dynamic target is detected in the target spatial grid in a first video frame, the video stream processing module 202 maintains the continuous spatio-temporal trajectory segment as the unclosed state, and continues to track the dynamic target, the first video frame being a subsequent video frame of the current video frame; if the dynamic target is detected to disappear in a second video frame, and the dynamic target is not detected within a preset fault tolerance time threshold, the video stream processing module 202 determines that the dynamic target leaves the target spatial grid, and closes the continuous spatio-temporal trajectory segment with a timestamp of the second video frame as an ending time, the second video frame being one of the video frames in the first video frame.
[0113] In a possible implementation, the video stream processing module 202 generates the spatio-temporal trajectory segment, and generates the spliced spatio-temporal trajectory segment, specifically including: the video stream processing module 202 performs frame-by-frame analysis on the video data stream, and generates a temporary segment including a third video frame when determining that a dynamic target is detected in a target spatial grid of the third video frame, the third video frame being one of a plurality of video frames included in the video data stream; the video stream processing module 202 obtains all target temporary segments generated by the dynamic target in the target spatial grid within a preset time window; the video stream processing module 202 sorts each target temporary segment according to a timestamp, and merges a first temporary segment and a second temporary segment into a spliced spatio-temporal trajectory segment, the first temporary segment and the second temporary segment being any two of a plurality of target temporary segments, and a time interval between the first temporary segment and the second temporary segment being less than a preset fusion time threshold.
[0114] In a possible implementation, the B+ tree construction module 203 constructs a B+ tree index structure, takes the spatio-temporal trajectory segment as a data record 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 connects the space grid identifier, the dynamic target identifier, the start time, and the end time of the spatio-temporal trajectory segment in sequence as a string to construct the composite key. The B+ tree construction module 203 inserts the spatio-temporal trajectory segment into a corresponding data page node in the B+ tree index structure according to the lexicographical size relationship of the composite key. The B+ tree construction module 203 stores the composite key in the middle node of the B+ tree index structure, and stores the spatio-temporal trajectory segment as the data record to be indexed in the leaf node of the B+ tree index structure, and links the leaf nodes by means of a pointer chain table.
[0115] In a possible implementation, the retrieval module 204 performs range query by using the B+ tree index structure and the composite key to obtain a candidate segment set. Specifically, the retrieval module 204 constructs a query range of the B+ tree index structure according to the query dynamic target and the target query time range. The query range is converted into a start retrieval key and an end retrieval key in the B+ tree index structure. The start retrieval key includes the target identifier and the target start time, and the end retrieval key includes the target identifier and the target end time. The retrieval module 204 locates to a start leaf node in the B+ tree index structure based on the start retrieval key by using the hierarchical index structure of the B+ tree index structure. The retrieval module 204 traverses the successor nodes in the forward direction based on the bidirectional chain table of the start leaf node, compares the composite key corresponding to each successor node with the end retrieval key in sequence, determines a target node before the end retrieval key, and adds the target spatio-temporal trajectory segment corresponding to the target node to the candidate segment set.
[0116] In a possible implementation, after the B+ tree construction module 203 constructs the B+ tree index structure, takes the spatio-temporal trajectory segment as the data record to be indexed, and sets the index key of the B+ tree index structure as the composite key, the method further includes the following steps performed by the B+ tree construction module 203: constructing a first auxiliary index item and a second auxiliary index item, which specifically includes: grouping the spatio-temporal trajectory segments according to the spatial grid identifier to obtain a first grouping result; generating, based on the first grouping result, a first auxiliary index item corresponding to each spatial grid identifier, the index key of the first auxiliary index item being the spatial grid identifier, and the index value of the first auxiliary index item being a leaf node set corresponding to all spatio-temporal trajectory segments containing the spatial grid identifier; grouping the spatio-temporal trajectory segments according to the dynamic target identifier to obtain a second grouping result; and generating, based on the second grouping result, a second auxiliary index item corresponding to each dynamic target identifier, the index key of the second auxiliary index item being the dynamic target identifier, and the index value of the second auxiliary index item being a leaf node set corresponding to all spatio-temporal trajectory segments containing the dynamic target identifier.
[0117] In a possible implementation, the video stream processing module 202 processes the video data stream, and identifies the dynamic targets in continuous motion in the video data stream, specifically including: performing foreground extraction on each video frame in the video data stream to obtain a foreground binary image; performing connected domain analysis on the foreground binary image to obtain a candidate dynamic target region; calculating a feature parameter of the candidate dynamic target region, the feature parameter including an area, an aspect ratio, and a motion speed; classifying the candidate dynamic target region based on the feature parameter, by using a support vector machine classifier, to obtain a dynamic target region; and performing target tracking on the dynamic target region to obtain each dynamic target and a motion trajectory corresponding to each dynamic target.
[0118] It should be noted that the apparatus provided in the above embodiments is used to implement its functions, and the above division of the functional modules is used as an example. In actual applications, the above functions can be completed by different functional modules according to actual needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the above functions. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process is described in the method embodiments, which will not be repeated here.
[0119] The present application also provides an electronic device. Referring to Figure 3 , Figure 3is a structural schematic diagram of an electronic device provided by an embodiment of the present application. The electronic device 300 can 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.
[0120] The communication bus 302 is configured to realize connection and communication between the components.
[0121] The user interface 303 can include a display and a camera. Optionally, the user interface 303 can further include a standard wired interface and a wireless interface.
[0122] The network interface 304 can include a standard wired interface and a wireless interface (e.g., a Wi-Fi interface).
[0123] The processor 301 can include one or more processing cores. The processor 301 is connected to various parts of the server through various interfaces and lines, and performs various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Optionally, the processor 301 can be implemented in at least one of a digital signal processing (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 301 can be integrated with a combination of one or more of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU is mainly used to process an operating system, a user interface, and an application program. The GPU is used to render and draw the content to be displayed on the display. The modem is used to process wireless communication. It can be understood that the above-mentioned modem can also not be integrated into the processor 301, but can be implemented by a separate chip.
[0124] Among them, the memory 305 may include a random access memory (RAM) or a read-only memory (Read-Only Memory). Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, codes, 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 a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may also optionally be at least one storage device located away from the aforementioned processor 301. Refer to Figure 3 , as a computer storage medium, the memory 305 may include an operating system, a network communication module, a user interface module, and an application program of a video storage and retrieval method based on a B+ tree.
[0125] exist Figure 3 In the electronic device 300 shown, the user interface 303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 301 can be used to call an application program stored in the memory 305 that stores a video storage and retrieval method based on a B+ tree. When executed by one or more processors 301, the electronic device 300 executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that this application is not limited to the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for this application.
[0126] The present application further provides a computer-readable storage medium storing instructions, which, when executed by one or more processors 301 , enable the electronic device 300 to perform one or more of the methods described in the above embodiments.
[0127] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0128] In several embodiments provided in the present application, it should be understood that the disclosed apparatus can be implemented in other manners. For example, the division of the apparatus embodiments is merely illustrative, and the division of units can be changed according to actual conditions, such as a combination or integration of some units, or a deletion of some features, or an addition of some features. In addition, the coupling or direct coupling or communication connection between the shown or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, and can be in electrical, mechanical or other forms.
[0129] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one place or distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0130] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0131] If the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable memory. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a memory and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the embodiments of the present application. The aforementioned memory includes: a U disk, a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0132] The above is only exemplary embodiments of the present disclosure, which cannot limit the scope of the present disclosure. Any equivalent changes and modifications made in accordance with the teachings of the present disclosure are still within the scope of the present disclosure. Other embodiments of the present disclosure will be readily apparent to those skilled in the art upon considering the specification and practicing the true principles of the present disclosure.
[0133] The present application is intended to cover any variations, uses or adaptive changes of the present disclosure that follow the general principles of the present disclosure and include common knowledge or conventional technical means in the technical field not described in the present disclosure. The specification and examples are only considered as exemplary, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A video storage and retrieval method based on B+ tree, characterized in that: The method comprises: Obtaining a video data stream to be processed, and dividing the video data stream into a plurality of preset spatial grids according to a preset spatial grid definition; Processing the video data stream to identify a continuously moving dynamic target in the video data stream; 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 a start time when the dynamic target enters the target space grid and an end time when the dynamic target leaves the target space grid; Constructing a B+ tree index structure, recording the spatiotemporal trajectory fragment as data to be indexed, and setting the index key of the B+ tree index structure to a composite key; receiving a search request, and performing a range query using the B+ tree index structure and the composite key to obtain a set of candidate fragments, wherein the search request includes a query dynamic target and a target query time range; Traversing the target spatiotemporal trajectory segments in the candidate segment set, and calculating the overlapping duration of the time interval of the target spatiotemporal trajectory segment and the target query time range; Determine a corresponding target identifier based on the query dynamic target, and accumulate all overlapping durations generated by the query dynamic target to obtain a total effective stay duration of the query dynamic target within the target query time range; The query dynamic targets whose total effective stay time is greater than or equal to the preset duration threshold are screened out and output as the final retrieval result.
2. The method according to claim 1, characterized in that The spatiotemporal trajectory segments include continuous spatiotemporal trajectory segments and spliced spatiotemporal trajectory segments. The generating of the spatiotemporal trajectory segments specifically includes: Detecting a dynamic target in each video frame in the video data stream and obtaining 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 appears in the target space grid for the first time, creating a continuous space-time trajectory segment with the timestamp of the current video frame as the starting moment, and setting the continuous space-time trajectory segment to an unclosed state; If the dynamic target is detected in the target space grid in the first video frame, maintaining the spliced spatiotemporal trajectory segment in the unclosed state and continuing to track the dynamic target, the first video frame being a subsequent video frame of the current video frame; If the dynamic target is detected to disappear in the second video frame and is not detected within a preset fault tolerance time threshold, it is determined that the dynamic target has left the target space grid, and the continuous space-time trajectory segment is closed with the timestamp of the second video frame as the end moment, and the second video frame is a video frame in the first video frame.
3. The method according to claim 2, characterized in that In the generating of the spatiotemporal trajectory segments, generating the spliced spatiotemporal trajectory segments specifically includes: performing frame-by-frame analysis on the video data stream, and generating a temporary segment including the third video frame when it is determined that a dynamic target is detected within the target space grid of the third video frame, where the third video frame is one of the plurality of video frames included in the video data stream; Acquire all target temporary segments generated by the dynamic target in the target space grid within a preset time window; The target temporary segments are sorted by timestamp, and the first temporary segment and the second temporary segment are merged into the 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.
4. The method according to claim 1, wherein The step of constructing a B+ tree index structure, recording the spatiotemporal trajectory segments as data 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 space-time trajectory segment are sequentially connected as character strings to construct the composite key; Inserting the spatiotemporal trajectory segments into corresponding data page nodes in the B+ tree index structure according to the lexicographic order of the composite key; The composite key is stored in the intermediate node of the B+ tree index structure, the spatiotemporal trajectory fragment is stored as a data record to be indexed in the leaf node of the B+ tree index structure, and the leaf nodes are linked in a pointer linked list.
5. The method according to claim 1, wherein The method of performing a range query using the B+ tree index structure and the composite key to obtain a set of candidate fragments specifically includes: Constructing a query range of the B+ tree index structure according to the query dynamic target and the target query time range; Converting the query range into a start search key and an end search key in a B+ tree index structure, wherein the start search key includes a target identifier and a target start time, and the end search key includes a target identifier and a target end time; In the B+ tree index structure, based on the starting search key, locate the starting leaf node through the hierarchical index structure of the B+ tree index structure; Based on the bidirectional linked list of the starting leaf node, the successor nodes are traversed forward, the composite keys corresponding to the successor nodes are compared with the terminating search key in turn, the target node before the terminating search key is determined, and 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, recording the spatiotemporal trajectory segment as the data to be indexed, and setting the index key of the B+ tree index structure to a composite key, the method further includes the steps of constructing a first auxiliary index item and a second auxiliary index item. The constructing of the first auxiliary index item and the second auxiliary index item specifically includes: Grouping the space-time trajectory segments according to the spatial grid identifiers to obtain a first grouping result; Based on the first grouping result, generating a first auxiliary index item corresponding to each of the spatial grid identifiers, where an index key of the first auxiliary index item is the spatial grid identifier, and an index value of the first auxiliary index item is a set of leaf nodes corresponding to all spatiotemporal trajectory segments containing the spatial grid identifier; Grouping the spatiotemporal trajectory segments according to the dynamic target identifiers to obtain a second grouping result; 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 of the second auxiliary index item is a 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 processing of the video data stream to identify a continuously moving dynamic target in the video data stream specifically includes: Performing foreground extraction on each video frame in the video data stream to obtain a foreground binary image; Performing connected domain analysis on the foreground binary image to obtain candidate dynamic target regions; Calculating characteristic parameters of the candidate dynamic target region, wherein the characteristic parameters include area, aspect ratio, and motion speed; Based on the characteristic parameters, the candidate dynamic target regions are classified using a support vector machine classifier to obtain dynamic target regions; Target tracking is performed on the dynamic target area to obtain each dynamic target and a motion track corresponding to each dynamic target.
8. A video storage and retrieval device based on B+ tree, characterized in that: The device comprises a to-be-processed 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 to-be-processed video acquisition module (201) is used to acquire a to-be-processed video data stream and divide the video data stream into a plurality of preset spatial grids according to a preset spatial grid definition; The video stream processing module (202) is used to process the video data stream and identify dynamic targets that are continuously moving 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 a start time when the dynamic target enters the target space grid and an 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, record the spatiotemporal trajectory segments as 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 a retrieval request and perform a range query using the B+ tree index structure and the composite key to obtain a set of candidate fragments, wherein the retrieval request includes a query dynamic target and a target query time range; The retrieval module (204) is further configured 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 further configured to determine a corresponding target identifier based on the query dynamic target, accumulate all overlapping durations generated by the query dynamic target, and obtain a total effective stay duration 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 stay time is greater than or equal to a preset duration threshold and output them as final retrieval results.
9. An electronic device, characterized in that: The electronic device (300) comprises a processor (301), a memory (305), a user interface (303) and a network interface (304), wherein the memory (305) is used to store instructions, the user interface (303) and the network interface (304) are used to communicate with other devices, and the processor (301) is used to execute the instructions stored in the memory (305) so that the electronic device (300) executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is executed.
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
Interactive video target space-time retrieval system based on visual similarity
CN120492672A
Spatial-temporal index construction method, track point query method, device, equipment and product
CN120492702A
Method and system for quickly searching and positioning target in surveillance video
CN120508677A
Cited By
Video space-time quantization range retrieval method and system based on distance constraint
CN121502033A
Combined fragment retrieval method and apparatus
CN122432361A