Video retrieval method and device, electronic equipment and storage medium
By using the target bitmap in the video retrieval system to characterize the existence of video data, the video data moment within the search time range is directly determined, and the problem of multiple searches and acquisition of all video clips in the prior art is solved, and the video retrieval efficiency is improved.
Patent Information
- Application Number
- CN202311783042.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-22
- Publication Date
- 2025-06-24
AI Technical Summary
When the number of video clips retrieved within the limited start and end time of the prior art reaches the upper limit, multiple searches are required to obtain the corresponding video time periods of all video clips, resulting in a decrease in video retrieval efficiency.
By obtaining the search time range, a target bitmap corresponding to the time range is retrieved from the data table. The target bitmap represents whether there is video data at each moment within the time range, and determines at least one first moment in which the video data exists in all moments based on the target bitmap, and determines the search result based on the time.
The bitmap directly retrieves all the time when recording data exists within the search time range, which improves the video retrieval efficiency and increases the search time range input by the user.
Smart Images

Figure CN120196785A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video recording technology, and in particular, to a video retrieval method, apparatus, electronic device, and storage medium. Background Art
[0002] Devices such as IP cameras (IPCs) or NVRs usually store video data on a local hard disk or memory card in a block storage manner. Because block storage can efficiently utilize storage space and can quickly read video data in chronological order for playback.
[0003] In the related art, in order to prevent the number of retrieved video results from being too large, the start and end times of the retrieval are usually restricted. For example, the start and end times are restricted to not exceed 48 hours or 24 hours. If the number of retrieved video segments reaches the upper limit within the restricted start and end times, the retrieved video segments that do not reach the upper limit are returned to the user, and a specific error code is returned. The user is prompted through the specific error code to supplement the retrieval again based on the end time of the last record in order to obtain all the retrieval results.
[0004] However, in the above related art, when the number of retrieved video segments reaches the upper limit within the restricted start and end times, it is necessary to perform multiple retrievals to obtain the video time periods corresponding to all the video segments, thereby reducing the video retrieval efficiency. Summary of the Invention
[0005] In view of the problems existing in the prior art, the present invention provides a video retrieval method, apparatus, electronic device, and storage medium.
[0006] The present invention provides a video retrieval method, including:
[0007] Obtaining a retrieval duration range;
[0008] Retrieving a target bitmap corresponding to the retrieval duration range from a data table; the target bitmap is used to represent whether there is video data at each moment within the retrieval duration range;
[0009] Determining at least one first moment with video data among all moments based on the target bitmap;
[0010] Determining a retrieval result based on each of the first moments.
[0011] According to the video retrieval method provided by the present invention, the retrieving a target bitmap corresponding to the retrieval duration range from a data table includes:
[0012] When the moments within the retrieval duration range do not belong to the same time period, determining at least two target time periods to which the moments within the retrieval duration range belong;
[0013] For each of the target time periods, obtain the bitmap corresponding to the target time period in the data table;
[0014] Obtain the sub-bitmap corresponding to the moment within the retrieval duration range and within the target time period in the bitmap;
[0015] Stitch together each of the sub-bitmaps to obtain the target bitmap.
[0016] According to a video retrieval method provided by the present invention, the obtaining the bitmap corresponding to the target time period in the data table includes:
[0017] When the storage type of the video time period corresponding to the target time period is the video time period storage type, convert all the video time periods corresponding to the target time period in the data table into a second bitmap;
[0018] Determine the second bitmap as the bitmap corresponding to the target time period.
[0019] According to a video retrieval method provided by the present invention, the determining at least one first moment with video data among all moments based on the target bitmap includes:
[0020] When the resolution of the target bitmap is different from the resolution of the time axis, perform downsampling on the resolution of the target bitmap so that the resolution of the downsampled target bitmap matches the resolution of the time axis;
[0021] Based on the downsampled target bitmap, determine at least one second moment with video data among all moments;
[0022] Correspondingly, the determining the retrieval result based on each of the first moments includes:
[0023] Render each of the second moments on the time axis;
[0024] Based on the rendered time axis, determine the retrieval result.
[0025] According to a video retrieval method provided by the present invention, before obtaining the retrieval duration range, the method further includes:
[0026] When the number of video segments obtained within a preset time period is greater than a preset number, store the video time periods corresponding to all the video segments within the preset time period in the target position of the data table based on the bitmap storage type, and the target position is the position corresponding to the preset time period.
[0027] According to a video retrieval method provided by the present invention, the method further includes:
[0028] When the number of video clips obtained within the preset time period is less than or equal to the preset number, store the video time periods corresponding to all the video clips within the preset time period at the target position in the data table based on the video time period storage type.
[0029] The present invention also provides a video retrieval device, including:
[0030] A first acquisition unit, configured to acquire a retrieval duration range;
[0031] A retrieval unit, configured to retrieve a target bitmap corresponding to the retrieval duration range from a data table; the target bitmap is used to represent whether there is video data at each moment within the retrieval duration range;
[0032] A first determination unit, configured to determine at least one first moment with video data among all moments based on the target bitmap;
[0033] A second determination unit, configured to determine a retrieval result based on each of the first moments.
[0034] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the video retrieval method described in any one of the above is implemented.
[0035] The present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the video retrieval method described in any one of the above is implemented.
[0036] The present invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, the video retrieval method described in any one of the above is implemented.
[0037] For the video retrieval method, device, electronic device, and storage medium provided by the present invention, when a retrieval duration range is obtained, a target bitmap corresponding to the retrieval duration range is retrieved from a data table. The target bitmap is used to represent whether there is video data at each moment within the retrieval duration range. At least one first moment with video data among all moments is determined based on the target bitmap, and a retrieval result is determined based on each of the first moments. It can be seen that the present invention uses a bitmap to represent whether there is video data at each moment, and all moments with video data within the retrieval time range can be directly retrieved through the bitmap, thereby improving the video retrieval efficiency. Description of the Drawings
[0038] To more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0039] Figure 1 It is a schematic diagram of video storage provided in the related art;
[0040] Figure 2 It is a schematic diagram of the retrieval result provided in the related art;
[0041] Figure 3 It is a schematic diagram of the rendered timeline provided in the related art;
[0042] Figure 4 It is one of the schematic flowcharts of the video retrieval method provided by the embodiments of the present invention;
[0043] Figure 5 It is a schematic diagram of the structure of the bitmap unit provided by the embodiments of the present invention;
[0044] Figure 6 It is a schematic diagram of the structure of the bitmap provided by the embodiments of the present invention;
[0045] Figure 7 It is another schematic flowchart of the video retrieval method provided by the embodiments of the present invention;
[0046] Figure 8 It is a schematic diagram of the target bitmap provided by the embodiments of the present invention;
[0047] Figure 9 It is yet another schematic flowchart of the video retrieval method provided by the embodiments of the present invention;
[0048] Figure 10 It is a schematic diagram of the downsampling algorithm in the related art;
[0049] Figure 11 It is a schematic diagram of the timeline based on moment rendering provided by the embodiments of the present invention;
[0050] Figure 12 It is yet another schematic flowchart of the video retrieval method provided by the embodiments of the present invention;
[0051] Figure 13 It is a schematic diagram of the data table provided by the embodiments of the present invention;
[0052] Figure 14 It is a schematic diagram of the structure of the video retrieval device provided by the embodiments of the present invention;
[0053] Figure 15 It is a schematic diagram of the physical structure of the electronic device provided by the present invention. Detailed implementation manners
[0054] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without making creative efforts shall fall within the protection scope of the present invention.
[0055] Figure 1 It is a schematic diagram of video storage provided in the related art. As Figure 1 shown, the video is stored in a block storage manner, including a plurality of block storage files. Each block storage file includes file header data and a plurality of video segments. Each video segment includes segment header data and corresponding video segment data. Among them, the file header data is used to identify the start time t1 and end time tn' of all the videos stored in the block storage file. For example, Figure 1 in it, head is used to represent the file header data, the value of head is t1~tn', video 1~video n are used to represent each video segment, and the segment header data in each video segment is used to characterize the video time period corresponding to the video segment. The video time period includes a start time and an end time. For example, Figure 1 in it, head1~head n are used to represent each segment header data, data 1~data n are used to represent each video segment data, the value of head1 can be t1~t1', and the value of head n can be tn~tn'.
[0056] When a user retrieves a video through a client, the user usually inputs a retrieval duration range, and the client retrieves a set of retrieval results represented in the form of video segments based on the retrieval duration range input by the user. Figure 2 It is a schematic diagram of the retrieval result provided in the related art. As Figure 2 shown, the retrieval result includes video segments of multiple video time periods. For example, the video time period corresponding to the video segment video 1 is t1~t1', the video time period corresponding to the video segment video 2 is t2~t2', and the video time period corresponding to the video segment video n is tn~tn'.
[0057] In addition, for the convenience of the user to watch and operate, the client will render these retrieval results on the timeline to show which time points have videos. Figure 3 It is a schematic diagram of the rendered timeline provided in the related art. As Figure 3As shown, the slanted parts between t1 and t1', between t2 and t2', and between tn and tn' all represent corresponding video clips, and the other blank parts represent no video clips.
[0058] When the video clips are extremely fragmented (for example, in the case of only storing alarm videos), the process of retrieving video clips within a specified range from the block storage file takes a long time, and the amount of retrieved result data is also very large. This is not only inconvenient for transmission but also slow to be plotted on the timeline. Therefore, to prevent the number of retrieved video results from being too large, the start and end times of the retrieval are usually restricted. For example, the start and end times are restricted to not exceed 48 hours or 24 hours. If the number of retrieved video clips reaches the upper limit within the restricted start and end times, the retrieved video clips that have not reached the upper limit are returned to the user, and a specific error code is returned. The user is prompted through the specific error code to supplement the retrieval again based on the end time of the last record in order to obtain the video time periods corresponding to all the video clips, thus reducing the video retrieval efficiency.
[0059] Based on this, the present invention provides a video retrieval method. By using a bitmap to represent whether there is video data at each moment, all the moments with video data within the retrieval time range can be directly retrieved through the bitmap, thereby improving the video retrieval efficiency.
[0060] The following combines Figures 4 - 13 to describe the video retrieval method of the present invention. The execution subject of this video retrieval method can be an electronic device such as a terminal, a camera, a computer, or a server, or it can be a video retrieval device set in the electronic device. The video retrieval device can be implemented through software, hardware, or a combination of both.
[0061] Figure 4 is one of the flow diagrams of the video retrieval method provided by an embodiment of the present invention. As Figure 4 shown, the video retrieval method includes the following steps:
[0062] Step 401, obtain the retrieval duration range.
[0063] Exemplarily, when the user needs to view video data, the corresponding retrieval duration range can be input on the relevant interface of the electronic device based on the requirement, so that the electronic device obtains the retrieval duration range. For example, if the user wants to view the video between 8:00 am and 10:00 am on October 3, 2023, the retrieval duration range input by the user can be from 8:00 am to 10:00 am on October 3, 2023. It can be understood that the input method of the retrieval duration range is not limited, and it can also be a retrieval duration of a preset length starting from a specified time point.
[0064] Step 402: Retrieve a target bitmap corresponding to the retrieval duration range from the data table; the target bitmap is used to represent whether there is video data at each moment within the retrieval duration range.
[0065] Among them, based on the block storage file, the present invention adds a new data table. The data table includes multiple bitmaps. Each bitmap can include multiple bitmap units, and each bitmap unit can represent the presence or absence of video data within a time length. For example, the time length can be one hour. Figure 5 It is a schematic structural diagram of a bitmap unit provided by an embodiment of the present invention. As Figure 5 shown, taking each bitmap unit representing the presence or absence of video data within one hour as an example, the horizontal direction of the bitmap unit represents 0 seconds to 59 seconds, and the vertical direction of the bitmap unit represents 0 minutes to 59 minutes. The entire bitmap unit represents the presence or absence of video data within one hour. For example, Figure 5 1 is used to represent the moment when there is video data, and 0 is used to represent the moment when there is no video data in Figure 5 ; the 0 in Figure 6 is not shown. Based on the bitmap unit, the bitmap units can be further combined to obtain bitmaps corresponding to time lengths such as daily, weekly, or monthly. For example, each bitmap in the data table is based on days to count video data. Figure 6 It is a schematic structural diagram of a bitmap provided by an embodiment of the present invention. As Figure 6 shown, taking the daily bitmap as an example, the horizontal direction represents 0 hours to 23 hours, representing the presence or absence of video data within a day,
[0066] Exemplarily, when the retrieval duration range input by the user is obtained, search for the target bitmap corresponding to the retrieval duration range in the data table. The target bitmap is composed of at least one bitmap unit. For example, the retrieval duration range input by the user is from 8:00 am on October 3, 2023 to 10:00 am on October 3, 2023, and each bitmap unit is used to represent the presence or absence of video data within one hour. Then the target bitmap includes a bitmap unit for representing the presence or absence of video data between 8:00 am and 9:00 am on October 3, 2023, and a bitmap unit for representing the presence or absence of video data between 9:00 am and 10:00 am on October 3, 2023.
[0067] Step 403: Determine at least one first moment with video data among all moments based on the target bitmap.
[0068] Exemplarily, when the target bitmap corresponding to the retrieval duration range is retrieved, since the target data represents the presence situation of the video data within the retrieval duration range, there is video data at some moments in the target bitmap and no video data at some moments, so it is necessary to find all the first moments with video data among all the moments corresponding to the target bitmap.
[0069] Step 404: Determine the retrieval result based on each of the first moments.
[0070] Exemplarily, when all the first moments with video data within the retrieval duration range are obtained, all the first moments can be rendered on the timeline, and the rendered timeline is displayed, so that the user can determine the video time period to be viewed based on the displayed timeline, that is, the user can click on the video time period to be viewed on the timeline, and the electronic device searches for the corresponding retrieval result in the block storage file based on the video time period clicked by the user and plays it.
[0071] In the video retrieval method provided by the present invention, when the retrieval duration range is obtained, the target bitmap corresponding to the retrieval duration range is retrieved from the data table. The target bitmap is used to represent whether there is video data at each moment within the retrieval duration range. At least one first moment with video data among all the moments is determined based on the target bitmap, and the retrieval result is determined based on each of the first moments. It can be seen that the present invention uses a bitmap to represent whether there is video data at each moment, and all the moments with video data within the retrieval time range can be directly retrieved through the bitmap, thereby improving the video retrieval efficiency, improving the efficiency of rendering the timeline, and also increasing the retrieval duration range input by the user.
[0072] In one embodiment, Figure 7 is the second flowchart of the video retrieval method provided by the embodiment of the present invention. As Figure 7 shown, the above step 402 can be specifically implemented through the following steps:
[0073] Step 4021: When the moments within the retrieval duration range do not belong to the same time period, determine at least two target time periods to which the moments within the retrieval duration range belong.
[0074] Among them, the time period can be one day or one week, etc. Specifically, the time period can be set based on the actual application scenario. Hereinafter, the time period is taken as one day as an example for illustration.
[0075] Exemplarily, when the retrieval duration range input by the user is obtained, the retrieval duration range is analyzed to determine whether all the moments within the retrieval duration range belong to the same day. When the moments within the retrieval duration range do not belong to the same day, it is determined which day each moment within the retrieval duration range corresponds to. For example, if the retrieval duration range input by the user is from 8:00 am on October 3, 2023 to 10:00 am on October 3, 2023, it indicates that all the moments within the retrieval duration range belong to the same day, that is, they all belong to October 3, 2023; for another example, if the retrieval duration range input by the user is from 8:00 am on October 3, 2023 to 8:00 am on October 4, 2023, it indicates that all the moments within the retrieval duration range do not belong to the same day, that is, the moments between 8:00 am on October 3, 2023 and 0:00 am on October 4, 2023 belong to October 3, 2023, and October 3, 2023 is a target time period; the moments between 0:00 am and 8:00 am on October 4, 2023 belong to October 4, 2023, and October 4, 2023 is also a target time period.
[0076] It should be noted that when the moments within the retrieval duration range belong to the same time period, the bitmap corresponding to this time period is obtained from the data table, and the bitmap corresponding to this time period is determined as the target bitmap corresponding to the retrieval duration range.
[0077] Step 4022: For each of the target time periods, obtain the bitmap corresponding to the target time period from the data table.
[0078] Exemplarily, for each target time period, traverse the data table to find the bitmap used to represent the target time period. For example, if the target time period is October 3, 2023, then find the bitmap used to represent October 3, 2023. The bitmap used to represent October 3, 2023 includes the bitmap units corresponding to each hour from 0:00 on October 3, 2023 to 23:00 on October 3, 2023, that is, the bitmap used to represent October 3, 2023 is composed of 24 bitmap units corresponding to the corresponding moments.
[0079] Step 4023: Obtain the sub-bitmap corresponding to the moment within the retrieval duration range and located in the target time period in the bitmap.
[0080] Exemplarily, taking the target period as one day as an example, since the data represented by the target period reflects the presence of video data within a day, if the retrieval duration range includes all the moment data within this day, then the entire bitmap is the sub-bitmap corresponding to the moments of the target period; if the retrieval duration range includes partial moment data within this day, for example, the user inputs a retrieval duration range from 8:00 am on October 3, 2023 to 8:00 am on October 4, 2023, and the retrieval duration range only includes the time from 8:00 am to 23:00 pm on October 3, 2023, so it is necessary to obtain the sub-bitmap corresponding to the time from 8:00 am to 23:00 pm from the bitmap of October 3, 2023. Similarly, on October 4, 2023, it only includes the data from 0:00 to 8:00 am on this day, and it is necessary to obtain the sub-bitmap corresponding to the time from 0:00 to 8:00 am from the bitmap of October 4, 2023.
[0081] Step 4024: splice each of the sub-bitmaps to obtain the target bitmap.
[0082] Exemplarily, when obtaining the sub-bitmaps corresponding to each target period, splice each sub-bitmap in chronological order to obtain the target bitmap. Figure 8 is a schematic diagram of the target bitmap provided by an embodiment of the present invention, as Figure 8 shown, the horizontal direction of the target bitmap is used to represent the time from 0:00 to 23:00, and the vertical direction of the target bitmap is used to represent the time from 0 day to m days. If m = 2, the target bitmap is used to characterize the presence of video data within 2 days.
[0083] In this embodiment, in the case where the moments within the retrieval duration range do not belong to the same period, determine at least two target periods to which the moments within the retrieval duration range belong. For each target period, obtain the bitmap corresponding to the target period in the data table; obtain the sub-bitmap corresponding to the moments within the retrieval duration range and located in the target period in the bitmap, and splice each sub-bitmap to obtain the target bitmap, realizing the retrieval of bitmaps within different periods and improving the generality of the retrieval.
[0084] In one embodiment, the step of obtaining the bitmap corresponding to the target period in the data table in step 4022 above can be specifically implemented through the following steps:
[0085] In the case where the storage type of the video time period corresponding to the video data within the target period is the video time period storage type, convert all the video time periods corresponding to the target period in the data table into a second bitmap; determine the second bitmap as the bitmap corresponding to the target period.
[0086] Exemplarily, based on the number of video clips, the video time periods corresponding to the target time period in the data table can be divided into two storage types. One storage type is the video time period storage type, and the other storage type is the bitmap storage type. When the storage type of the video time periods corresponding to the target time period is the video time period storage type, in order to improve the retrieval efficiency, all the video time periods corresponding to the target time period in the data table are converted into a second bitmap, and the second bitmap is determined as the bitmap corresponding to the target time period.
[0087] In this embodiment, when the storage type of the video time periods corresponding to the target time period is the video time period storage type, all the video time periods corresponding to the target time period in the data table are converted into a second bitmap. Compared with the video time period storage, the bitmap form storage can improve the retrieval efficiency.
[0088] In one embodiment, Figure 9 is the third schematic flowchart of the video retrieval method provided by the embodiment of the present invention. As Figure 9 shown, the above steps 403 and 404 determine at least one first moment with video data among all moments based on the target bitmap, and determine the retrieval result based on each of the first moments. Specifically, it can be implemented through the following steps:
[0089] Step 4031: When the resolution of the target bitmap is different from the resolution of the time axis, perform downsampling processing on the resolution of the target bitmap so that the resolution of the downsampled target bitmap matches the resolution of the time axis.
[0090] Among them, the resolution of the target bitmap is determined by the time dimension represented horizontally by the target bitmap and the time dimension represented vertically. If the horizontal direction of the target bitmap represents 0 seconds to 59 seconds and the vertical direction represents 0 minutes to 59 minutes, it means that the resolution of the target bitmap is determined by the second dimension horizontally and the minute dimension vertically; if the horizontal direction of the target bitmap represents 0 hours to 23 hours and the vertical direction represents 0 days to 30 days, it means that the resolution of the target bitmap is determined by the hour dimension horizontally and the day dimension vertically. The resolution of the time axis refers to the number of pixel points that the time axis can display.
[0091] Exemplarily, if the time axis can represent the video of one month and the number of pixel points that can be displayed on the time axis is 720, then the number of pixel points corresponding to each day is 24. Therefore, the smallest time dimension that can be displayed on the time axis is the hour; if the horizontal dimension of the target bitmap is the second dimension and the vertical dimension is the minute dimension, it means that the smallest time dimension on the target bitmap is the number of minutes and seconds, then it is determined that the resolution of the target bitmap is different from the resolution of the time axis; if the horizontal dimension of the target bitmap is the day dimension and the vertical dimension is the hour dimension, it means that the smallest time dimension on the target bitmap is the number of days and hours, then it is determined that the resolution of the target bitmap is the same as the resolution of the time axis.
[0092] When the resolution of the target bitmap is different from the resolution of the timeline, it is necessary to downsample the resolution of the target bitmap so that the resolution of the target bitmap after downsampling matches the resolution of the timeline. When downsampling, since a bitmap essentially converts one-dimensional time data into two-dimensional time data, it is not possible to arbitrarily compress both the horizontal and vertical directions simultaneously during downsampling. The basic principle of compression is as follows: First, compress the second dimension, compress the second dimension into the minute dimension, that is, compress 60 seconds into 1 minute, then compress the minute dimension into the hour dimension, that is, compress 60 minutes into 1 hour, then compress the hour dimension into the day dimension, that is, compress 24 hours into 1 day, and then compress the day dimension into the month dimension, that is, compress 30 days into 1 month, etc.
[0093] For example, if the horizontal dimension of the target bitmap is the second dimension and the vertical dimension is the minute dimension, and the smallest time dimension that can be displayed on the timeline is the hour, then during downsampling, it is necessary to first compress the second dimension, compress the second dimension into the minute dimension, then compress the minute dimension into the hour dimension, and then compress the hour dimension into the day dimension, so that the resolution of the target bitmap after downsampling matches the resolution of the timeline.
[0094] It should be noted that when the resolution of the target bitmap is the same as the resolution of the timeline, at least one first moment with video recording data among all moments is directly determined based on the target bitmap, and each first moment is rendered on the timeline.
[0095] It should be noted that the specific downsampling process can adopt the downsampling algorithm in related technologies. The downsampling algorithm can be implemented using Gaussian convolution, and the convolution kernel can use a one-dimensional convolution kernel: double w[5] = {1.0 / 4 - a / 2.0, 1.0 / 4, a, 1.0 / 4, 1.0 / 4 - a / 2.0}, taking a = 0.6. The main idea of downsampling is as Figure 10 shown, Figure 10 The arrows in represent the process of downsampling. First, select a sampling rate, that is, select one data point every how many data points; then, select data points from the original data set according to this sampling rate to generate a new data set; finally, each data point in the new data set is a subset or representative of the corresponding data point in the original data set. By downsampling, the dimension and quantity of data can be reduced, thereby reducing the computational complexity and improving the efficiency of the algorithm.
[0096] Step 4032: Determine at least one second moment with video recording data among all moments based on the downsampled target bitmap.
[0097] Exemplarily, when obtaining the downsampled target bitmap, since the downsampled target data represents the presence of video data within the retrieval duration range, there is video data at some moments and no video data at some moments in the downsampled target bitmap. Therefore, it is necessary to find all the second moments with video data among all the moments corresponding to the downsampled target bitmap.
[0098] Step 4041: Render each of the second moments on the time axis.
[0099] Exemplarily, when obtaining each of the second moments that match the retrieval duration range, render each second moment on the time axis in chronological order; for example, if the time axis can represent a month's worth of video, and the smallest time dimension that can be displayed on the time axis is hours, then the rendered time axis shows which day and hour there is video data. Figure 11 It is a schematic diagram of the time axis based on moment rendering provided by an embodiment of the present invention. As Figure 11 shown, in the downsampled target bitmap 1101, 1 indicates that there is video data at the corresponding moment, and 0 indicates that there is no video data at the corresponding moment. Then, based on the moments corresponding to 1 in the downsampled target bitmap, render the time axis to obtain the rendered time axis 1102. The moments filled with diagonal lines in the rendered time axis 1102 indicate that there is video data, and the blank parts indicate that there is no video data.
[0100] Step 4042: Determine the retrieval result based on the rendered time axis.
[0101] Exemplarily, when obtaining the rendered time axis, display the rendered time axis so that the user can determine the video time period to view based on the displayed rendered time axis. That is, the user can click on the video time period to view on the rendered time axis, and the electronic device searches for the corresponding retrieval result in the block storage file based on the video time period clicked by the user and plays it.
[0102] In this embodiment, when the resolution of the target bitmap is different from the resolution of the time axis, it is necessary to perform downsampling processing on the resolution of the target bitmap so that the resolution of the downsampled target bitmap matches the resolution of the time axis. By means of downsampling processing, the data volume is compressed, so that the moments in the bitmap after downsampling processing can be directly rendered on the time axis, making the data volume of the retrieval result only related to the resolution displayed on the time axis and independent of the number of all moments actually retrieved.
[0103] In one embodiment, Figure 12 It is the fourth flowchart of the video retrieval method provided by an embodiment of the present invention. As Figure 12 shown, before step 401, the video retrieval method further includes the following steps:
[0104] Step 405: When the number of video clips obtained within a preset time period is greater than a preset number, store the video time periods corresponding to all the video clips within the preset time period in the target position of the data table based on the bitmap storage type, where the target position is the position corresponding to the preset time period.
[0105] Among them, the preset number can be set according to requirements. For example, the preset number is 100.
[0106] Exemplarily, in an actual application scenario, corresponding video clips can be generated based on preset conditions. For example, in the field of home anti-theft door monitoring, the preset condition can be to generate a video clip when there are moving people at the door. Each time a video clip is generated, a count is made, and the video time period corresponding to the generated video clip is stored at the position corresponding to the preset time period in the data table. When it is determined that the number of video clips generated within a preset time period is greater than the preset number, it means that there are too many video clips within this preset time period. At this time, the video time periods within this preset time period stored in the data table need to be converted to the bitmap storage type and stored at the position corresponding to this preset time period in the data table.
[0107] Step 406: When the number of video clips obtained within the preset time period is less than or equal to the preset number, store the video time periods corresponding to all the video clips within the preset time period in the target position of the data table based on the video time period storage type.
[0108] Exemplarily, when it is determined that the number of video clips generated within a preset time period is less than or equal to the preset number, it means that there are fewer video clips within this preset time period, and they can be stored based on the video time period storage type because the efficiency of the video time period storage type is relatively high.
[0109] Figure 13 It is a schematic diagram of the data table provided by an embodiment of the present invention. As Figure 13 shown, taking the preset time period as a day as an example, when the number of video clips is less than or equal to the preset number, the video time periods corresponding to all the video clips within that day are stored in the position corresponding to that day in the data table based on the video time period storage type. Figure 13 The storage type of day1 in it is the video time period storage type; when the number of video clips is greater than the preset number, the video time periods corresponding to all the video clips within that day are stored in the position corresponding to that day in the data table based on the bitmap storage type. Figure 13 The storage type of day n in it is the bitmap storage type.
[0110] In this embodiment, when the number of video segments obtained within a preset time period is greater than a preset number, each video time period is stored based on the bitmap storage type; when the number of video segments obtained within the preset time period is less than or equal to the preset number, each video time period is stored based on the video time period storage type, thereby maximizing the storage efficiency of each video time period.
[0111] The video retrieval device provided by the present invention will be described below. The video retrieval device described below can be correspondingly referred to the video retrieval method described above.
[0112] Figure 14 is a schematic structural diagram of the video retrieval device provided by an embodiment of the present invention, as Figure 14 shown, the video retrieval device 1400 includes a first acquisition unit 1401, a retrieval unit 1402, a first determination unit 1403, and a second determination unit 1404; where:
[0113] The first acquisition unit 1401 is configured to acquire a retrieval duration range.
[0114] The retrieval unit 1402 is configured to retrieve a target bitmap corresponding to the retrieval duration range from a data table; the target bitmap is used to represent whether there is video data at each moment within the retrieval duration range.
[0115] The first determination unit 1403 is configured to determine at least one first moment with video data among all moments based on the target bitmap.
[0116] The second determination unit 1404 is configured to determine a retrieval result based on each of the first moments.
[0117] For the video retrieval device provided by the present invention, when a retrieval duration range is obtained, a target bitmap corresponding to the retrieval duration range is retrieved from a data table. The target bitmap is used to represent whether there is video data at each moment within the retrieval duration range. At least one first moment with video data among all moments is determined based on the target bitmap, and a retrieval result is determined based on each of the first moments. It can be seen that the present invention uses a bitmap to represent whether there is video data at each moment, and all moments with video data within the retrieval time range can be directly retrieved through the bitmap, thereby improving the video retrieval efficiency.
[0118] Based on any of the above embodiments, the retrieval unit 1402 is specifically configured to:
[0119] When the moments within the retrieval duration range do not belong to the same time period, determine at least two target time periods to which the moments within the retrieval duration range belong.
[0120] For each of the target time periods, obtain the bitmap corresponding to the target time period from the data table.
[0121] Obtain a sub-bitmap corresponding to the moment within the target time period in the retrieval duration range in the bitmap.
[0122] Stitch together each of the sub-bitmaps to obtain the target bitmap.
[0123] Based on any of the above embodiments, the first obtaining unit 1401 is specifically configured to:
[0124] In the case where the storage type of the video recording time period corresponding to the target time period in the video data is the video recording time period storage type, convert all the video recording time periods corresponding to the target time period in the data table into a second bitmap.
[0125] Determine the bitmap corresponding to the target time period as the second bitmap.
[0126] Based on any of the above embodiments, the first determining unit 1403 is specifically configured to:
[0127] In the case where the resolution of the target bitmap is different from the resolution of the time axis, perform downsampling processing on the resolution of the target bitmap so that the resolution of the target bitmap after downsampling matches the resolution of the time axis.
[0128] Determine at least one second moment with video data among all moments based on the downsampled target bitmap.
[0129] Correspondingly, the second determining unit 1404 is specifically configured to:
[0130] Render each of the second moments on the time axis.
[0131] Determine the retrieval result based on the rendered time axis.
[0132] Based on any of the above embodiments, the video retrieval device 1400 further includes:
[0133] A first storage unit, configured to store the video recording time periods corresponding to all the video recording segments within the preset time period to a target position in the data table based on the bitmap storage type when the number of video recording segments obtained within the preset time period is greater than the preset number, and the target position is the position corresponding to the preset time period.
[0134] Based on any of the above embodiments, the video retrieval device 1400 further includes:
[0135] A second storage unit, configured to store, based on a video recording time period storage type, video recording time periods corresponding to all the video recording segments within the preset time period at a target position in the data table when the number of video recording segments obtained within the preset time period is less than or equal to the preset number.
[0136] Figure 15 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. As Figure 15 shown, the electronic device may include: a processor 1510, a communication interface 1520, a memory 1530, and a communication bus 1540. Among them, the processor 1510, the communication interface 1520, and the memory 1530 communicate with each other through the communication bus 1540. The processor 1510 may call logical instructions in the memory 1530 to execute a video recording retrieval method, and the method includes: obtaining a retrieval duration range;
[0137] retrieving a target bitmap corresponding to the retrieval duration range from the data table; the target bitmap is used to represent whether there is video recording data at each moment within the retrieval duration range;
[0138] determining, based on the target bitmap, at least one first moment with video recording data among all moments;
[0139] determining a retrieval result based on each of the first moments.
[0140] In addition, when the logical instructions in the above-mentioned memory 1530 are implemented in the form of a software functional unit and sold or used as an independent product, they may be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disc that can store program codes.
[0141] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the video retrieval method provided by each of the above methods, and the method includes: obtaining a retrieval duration range;
[0142] Retrieving a target bitmap corresponding to the retrieval duration range from a data table; the target bitmap is used to represent whether there is video data at each moment within the retrieval duration range;
[0143] Determining at least one first moment with video data among all moments based on the target bitmap;
[0144] Determining a retrieval result based on each of the first moments.
[0145] In another aspect, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it realizes the video retrieval method provided by each of the above methods, and the method includes: obtaining a retrieval duration range;
[0146] Retrieving a target bitmap corresponding to the retrieval duration range from a data table; the target bitmap is used to represent whether there is video data at each moment within the retrieval duration range;
[0147] Determining at least one first moment with video data among all moments based on the target bitmap;
[0148] Determining a retrieval result based on each of the first moments.
[0149] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0150] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0151] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A video retrieval method, characterized in that, including: obtaining a retrieval duration range; retrieving a target bitmap corresponding to the retrieval duration range from a data table; the target bitmap is used to represent whether there is video data at each moment within the retrieval duration range; determining at least one first moment with video data among all moments based on the target bitmap; determining a retrieval result based on each of the first moments.
2. The video retrieval method according to claim 1, wherein The retrieving the target bitmap corresponding to the retrieval duration range from the data table includes: when the moments within the retrieval duration range do not belong to the same time period, determining at least two target time periods to which the moments within the retrieval duration range belong; for each of the target time periods, obtaining the bitmap corresponding to the target time period in the data table; obtaining a sub-bitmap corresponding to the moments within the target time period within the retrieval duration range in the bitmap; stitching together each of the sub-bitmaps to obtain the target bitmap.
3. The video retrieval method according to claim 2, wherein The obtaining the bitmap corresponding to the target time period in the data table includes: when the storage type of the video time period corresponding to the video data in the target time period is the video time period storage type, converting all video time periods of the video data corresponding to the target time period in the data table into a second bitmap; determining the second bitmap as the bitmap corresponding to the target time period.
4. The video retrieval method according to claim 1, characterized in that The determining at least one first moment with video data among all moments based on the target bitmap includes: when the resolution of the target bitmap is different from the resolution of the time axis, performing downsampling processing on the resolution of the target bitmap so that the resolution of the downsampled target bitmap matches the resolution of the time axis; determining at least one second moment with video data among all moments based on the downsampled target bitmap; Correspondingly, the determining the retrieval result based on each of the first moments includes: rendering each of the second moments on the time axis; determining the retrieval result based on the rendered time axis.
5. The video retrieval method according to any one of claims 1-4, characterized in that, Before obtaining the retrieval duration range, the method further includes: when the number of video segments obtained within a preset time period is greater than a preset number, storing the video time periods corresponding to all the video segments within the preset time period at a target position of the data table based on a bitmap storage type, and the target position is the position corresponding to the preset time period.
6. The video retrieval method according to claim 5, wherein The method further includes: when the number of video segments obtained within the preset time period is less than or equal to the preset number, storing the video time periods corresponding to all the video segments within the preset time period at the target position of the data table based on a video time period storage type.
7. A video retrieval device, characterized in that, including: a first obtaining unit for obtaining a retrieval duration range; a retrieval unit for retrieving a target bitmap corresponding to the retrieval duration range from a bitmap data table; the target bitmap is used to represent whether there is video data at each moment within the retrieval duration range; a first determining unit for determining at least one first moment with video data among all moments based on the target bitmap; a second determining unit for determining a retrieval result based on each of the first moments.
8. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the video retrieval method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the video retrieval method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the video retrieval method according to any one of claims 1 to 6.