Video key frame extraction method, device, computer equipment and storage medium
By calculating the Laplacian information evaluation value of the pixels in the image frame, the stagnation period in the drone inspection video is screened and key frames are extracted, which solves the problem of low extraction efficiency in the existing technology and achieves high efficiency. Keyframe filtering and video detection.
Patent Information
- Application Number
- CN202110204975.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-24
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2041-02-24
AI Technical Summary
In the existing technology, the efficiency of extracting key frames from drone inspection videos is low, and non-key frames cannot be effectively eliminated.
The information amount evaluation value is obtained by calculating the Laplacian operator of each pixel in the image frame, and the stagnation period is filtered out and key frames are extracted from it. The information amount evaluation value and the preset threshold are used to filter the frames, which improves the accuracy of the key frames. Extraction efficiency.
Effectively filtering out non-key frames improves the efficiency of extracting key frames from videos and reduces the time required for target detection. Only a small number of key frames are required for image target detection to complete target detection for the entire video.
Smart Images

Figure CN113096064B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method, device, computer equipment and storage medium for extracting video key frames. Background Art
[0002] With the popularization of drone applications and the rapid development of deep learning image recognition technology, "drone inspection + intelligent image recognition" has become the mainstream of line inspection. In order to detect targets from inspection videos, it is necessary to obtain key frames containing targets from the inspection videos. However, the videos obtained by drone inspections contain a large number of non-key frames that do not capture the targets. In the process of obtaining key frames from drone inspection videos, these non-key frames need to be removed.
[0003] In traditional technology, the method of extracting key frames from videos is to extract key frames through color feature algorithms. This method has the technical defect of low extraction efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a video key frame extraction method, device, computer equipment and storage medium that can improve the extraction efficiency in response to the above technical problems.
[0005] A video key frame extraction method, the method comprising:
[0006] According to the Laplacian operator of each pixel point in each image frame in the target video, an information amount evaluation value of each image frame is obtained; the information amount evaluation value is a parameter used to characterize the richness of information in the image frame;
[0007] According to the information amount evaluation value of each image frame, a stagnant period in the target video is obtained; the stagnant period is a video segment containing a key frame in the target video;
[0008] According to the stagnant period in the target video, a key frame in the target video is obtained.
[0009] In one of the embodiments, the method further includes: acquiring each image frame in the target video;
[0010] Performing grayscale processing on each image frame to obtain the grayscale value of each pixel in each image frame;
[0011] According to the grayscale value of each pixel in each image frame, the Laplacian operator of each pixel in each image frame is obtained.
[0012] In one of the embodiments, the method further includes: obtaining the Laplacian operator of each image frame according to the Laplacian operator of each pixel point in each image frame in the target video;
[0013] The variance of the Laplacian operator of each image frame is calculated as an information amount evaluation value of each image frame.
[0014] In one of the embodiments, the method further includes: dividing each image frame in the target video into at least one group of video segments according to a preset first time interval;
[0015] Calculate the information evaluation value of each image frame in each video segment respectively, and take the image frame with the largest information evaluation value in each video segment as the candidate frame;
[0016] According to the candidate frames, the stagnation period of the target video is obtained.
[0017] In one of the embodiments, the method further includes: comparing the information volume evaluation value of the candidate frame with a preset information volume evaluation threshold value, and if the information volume evaluation value of the current candidate frame is less than the information volume evaluation threshold value, and the information volume evaluation value of the previous candidate frame of the current candidate frame is greater than or equal to the information volume evaluation threshold value, taking the time corresponding to the current candidate frame as the starting time; wherein, if the current candidate frame has no previous candidate frame, determining that the information volume evaluation value of the previous candidate frame of the current candidate frame is greater than the information volume evaluation threshold value;
[0018] If the information volume evaluation value of the current candidate frame is greater than or equal to the information volume evaluation threshold, and the information volume evaluation value of the previous candidate frame of the current candidate frame is less than the information volume evaluation threshold, the time corresponding to the current candidate frame is used as the end time;
[0019] Acquire the image frames between each start time and the corresponding end time as candidate stagnation periods;
[0020] According to a preset stagnation time threshold, the stagnation period of the target video is obtained from the candidate stagnation periods.
[0021] In one of the embodiments, the method further includes: obtaining the duration of each candidate stagnation period;
[0022] Determine whether the duration of each candidate stagnation period exceeds a preset stagnation duration threshold;
[0023] The candidate stagnation period whose duration exceeds a preset stagnation duration threshold is used as the stagnation period of the target video.
[0024] In one of the embodiments, the method further includes: dividing the stagnant period into at least one group of key video segments according to a preset second time interval;
[0025] The image frames with the smallest information evaluation value are extracted from each key video clip as the key frames of the target video.
[0026] A video key frame extraction device, the device comprising:
[0027] A first acquisition module is used to acquire an information amount evaluation value of each image frame according to the Laplacian operator of each pixel point in each image frame in the target video; the information amount evaluation value is a parameter used to characterize the richness of information in the image frame;
[0028] A second acquisition module is used to acquire a stagnant period in the target video according to the information amount evaluation value of each image frame; the stagnant period is a video segment containing a key frame in the target video;
[0029] The extraction module is used to obtain key frames in the target video according to the stagnant period in the target video.
[0030] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0031] According to the Laplacian operator of each pixel point in each image frame in the target video, an information amount evaluation value of each image frame is obtained; the information amount evaluation value is a parameter used to characterize the richness of information in the image frame;
[0032] According to the information amount evaluation value of each image frame, a stagnant period in the target video is obtained; the stagnant period is a video segment containing a key frame in the target video;
[0033] According to the stagnant period in the target video, a key frame in the target video is obtained.
[0034] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0035] According to the Laplacian operator of each pixel point in each image frame in the target video, an information amount evaluation value of each image frame is obtained; the information amount evaluation value is a parameter used to characterize the richness of information in the image frame;
[0036] According to the information amount evaluation value of each image frame, a stagnant period in the target video is obtained; the stagnant period is a video segment containing a key frame in the target video;
[0037] According to the stagnant period in the target video, a key frame in the target video is obtained.
[0038] The above-mentioned video key frame extraction method, device, computer equipment and storage medium obtain the information volume evaluation value of each image frame through the Laplace operator of each pixel point in each image frame in the target video. And further obtain the stagnant period in the target video through the information volume evaluation value of each image frame, and finally filter out the key frame of the target video from the stagnant period. Non-key image frames are filtered out through the information volume evaluation value, thereby improving the efficiency of extracting key frames from the target video. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A diagram showing an application environment of a method for extracting key frames of a video in an embodiment;
[0040] Figure 2 1 is a flow chart of a method for extracting key frames of a video in one embodiment;
[0041] Figure 3 A schematic diagram of a flow chart of a step of obtaining a stagnant period of a target video in one embodiment;
[0042] Figure 4 A line graph showing changes in information volume evaluation values of image frames in a target video over time in one embodiment;
[0043] Figure 5 is a structural block diagram of a video key frame extraction device in one embodiment;
[0044] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0046] The video key frame extraction method provided in this application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The terminal 102 and the server 104 can be used separately to execute the video key frame extraction method provided in the present application. The terminal 102 and the server 104 can also be used to collaboratively execute the video key frame extraction method provided in the present application. For example, the server 104 is used to obtain the information amount evaluation value of each image frame according to the Laplace operator of each pixel point in each image frame in the target video; the information amount evaluation value is a parameter used to characterize the richness of the information in the image frame; according to the information amount evaluation value of each image frame, the stagnation period in the target video is obtained; the stagnation period is a video segment containing key frames in the target video; according to the stagnation period in the target video, the key frames in the target video are obtained.
[0047] The terminal 102 may be, but is not limited to, a device including an image acquisition device, and the server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0048] In one embodiment, Figure 2 As shown, a video key frame extraction method is provided, and the method is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0049] Step 202, obtaining an information amount evaluation value of each image frame according to the Laplacian operator of each pixel point in each image frame in the target video; the information amount evaluation value is a parameter used to characterize the richness of information in the image frame.
[0050] Among them, the target video is the video of the key frame to be extracted; the image frame is the smallest unit that makes up the video; the Laplace operator of each pixel is the second-order differential of the grayscale value of each pixel; the information evaluation value of each image frame is a parameter used to characterize the richness of information in each image frame. The larger the information evaluation value, the richer the content information of the corresponding image frame; the smaller the information evaluation value, the simpler the content information of the corresponding image frame.
[0051] Specifically, the Laplace operator of each pixel in each image frame in the target video is first calculated, and the Laplace operator of each image frame is obtained according to the Laplace operator of each pixel; the Laplace operator of each image frame is the average value of the Laplace operator of each pixel in each image frame. The information amount evaluation value of each image frame is obtained according to the Laplace operator of each image frame. In this embodiment, how to obtain the information amount evaluation value of each image frame according to the Laplace operator of each image frame is not specifically limited.
[0052] Step 204: acquiring a stagnant period in the target video according to the information amount evaluation value of each image frame; the stagnant period is a video segment containing a key frame in the target video.
[0053] The stagnation period refers to the period in the drone inspection video or other similar videos when the drone finds a target during the inspection process and stops and zooms in to shoot the target; therefore, the image frame containing the target in the stagnation period is the key frame that needs to be extracted.
[0054] Specifically, since the stagnant period in the target video contains key frames to be extracted, the image frames in the stagnant period have a relatively lower information evaluation value than normal image frames. Therefore, according to the information evaluation value of each image frame, by screening out the information evaluation value exceeding the preset threshold, the stagnant period in the target video can be obtained.
[0055] Step 206: Acquire key frames in the target video according to the stagnant period in the target video.
[0056] Specifically, the stagnant period is composed of image frames including key frames, so the required key frames can be obtained by simply extracting from the stagnant period. For the key frames in the stagnant period, all can be extracted, or further screened to extract the most suitable key frames.
[0057] In the above-mentioned video key frame extraction method, the information amount evaluation value of each image frame is obtained by the Laplacian operator of each pixel point in each image frame in the target video. And according to the information amount evaluation value of each image frame, the stagnant period is screened and obtained, and finally the key frame of the target video is obtained from the stagnant period. The non-key image frames are screened by the information amount evaluation value, which improves the efficiency of extracting key frames from the target video.
[0058] In one embodiment, the step of obtaining the information amount evaluation value of each image frame according to the Laplacian operator of each pixel point in each image frame in the target video further includes:
[0059] Get each image frame in the target video.
[0060] Specifically, an image frame is a basic component unit of a target video and is also a basic unit for extracting the target video.
[0061] The image frames are grayscaled to obtain the grayscale value of each pixel in the image frames.
[0062] Specifically, grayscale processing is performed on each image frame to obtain the grayscale value of each pixel in each image frame, which is a pre-processing step for calculating and obtaining the Laplacian operator of each pixel in each image frame.
[0063] According to the grayscale value of each pixel in each image frame, the Laplacian operator of each pixel in each image frame is obtained.
[0064] Specifically, the Laplacian operator of each pixel in each image frame is the second-order differential of the grayscale value of each pixel in each image frame; for example, f(x, y) represents the grayscale value of the pixel at position (x, y), which is equivalent to the convolution of the 3*3 matrix composed of the pixel and the surrounding points with the convolution kernel.
[0065]
[0066] in, is the Laplacian operator of the pixel at f(x,y).
[0067] In this embodiment, by graying each image frame and obtaining the Laplacian operator of each pixel in each image frame through the gray value of each pixel in each image frame, the Laplacian operator of each image frame can be obtained according to the Laplacian operator of each pixel in each image frame, and then the information evaluation value of each image frame can be obtained. This creates the prerequisite for selecting key frames from the target video and improves the efficiency of extracting key frames.
[0068] In one embodiment, obtaining the information amount evaluation value of each image frame according to the Laplacian operator of each pixel point in each image frame in the target video includes:
[0069] The Laplacian operator of each image frame is obtained according to the Laplacian operator of each pixel point in each image frame in the target video.
[0070] Specifically, the average value of the Laplace operator of each pixel in each image frame is obtained as the Laplace operator of each image frame. For example, the Laplace operator of each image frame is calculated by the following formula:
[0071]
[0072] Where, μ is the Laplacian operator of the image frame; W is the pixel width of the image frame; H is the pixel height of the image frame; is the Laplacian operator of the pixel at position (i, j).
[0073] The variance of the Laplacian operator of each image frame is calculated as an information amount evaluation value of each image frame.
[0074] Specifically, the information evaluation value of each image frame is the variance of the Laplace operator of each image frame, and its calculation formula is:
[0075]
[0076] Among them, σ 2is the variance of the Laplacian of the image frame.
[0077] In this implementation, the Laplace operator of each image frame is obtained through the Laplace operator of each pixel in each image frame, and the variance of the Laplace operator of each image frame is obtained as the information evaluation value of each image frame. This creates conditions for further screening image frames in the target video according to the information evaluation value of each image frame, and improves the efficiency of extracting key frames.
[0078] In one embodiment, obtaining the stagnant period in the target video according to the information amount evaluation value of each image frame includes:
[0079] According to a preset first time interval, each image frame in the target video is divided into at least one group of video segments.
[0080] Specifically, the target video is divided into several groups of video segments according to a first time interval; if the first time interval can divide the target video into equal parts, then each video segment contains an equal number of image frames; if the first time interval cannot divide the target video into equal parts, then except for the last video segment, the numbers of image frames in other video segments are equal.
[0081] For example, if the total length of the target video is N seconds and 24 frames per second, if the first time interval is 30 seconds and N is an integer multiple of 30, then the number of image frames contained in each video segment is image frames; if N is not an integer multiple of 30, then The video clips include The quotient of * 24 image frames; there is 1 video clip containing The remainder of * 24 image frames.
[0082] The information evaluation value of each image frame in each video segment is calculated respectively, and the image frame with the largest information evaluation value in each video segment is taken as the candidate frame.
[0083] Specifically, the candidate frame is the clearest frame of image selected from each video clip in order to select the stagnant period of the target video. When the image frame is blurred, the information evaluation value of the image frame will be reduced. Therefore, in order to obtain the clearest image frame in each video clip, the image frame with the largest information evaluation value is selected from each video clip as the candidate frame. Therefore, when selecting the candidate frame, the image frame with the largest information evaluation value in each video clip is selected as the candidate frame.
[0084] For example, in a video clip, there are 24 image frames, and an image frame with the largest information evaluation value is selected as a candidate frame.
[0085] According to the candidate frames, the stagnation period of the target video is obtained.
[0086] In this embodiment, according to the first time interval, the target video is divided into several video segments, and candidate frames are selected from each video segment according to the information quantity evaluation value. Since the candidate frames are all image frames selected according to the information quantity evaluation value, the stagnant period can be selected only according to the candidate frames. This embodiment can save workload and improve the efficiency of selecting the stagnant period.
[0087] In one embodiment, as Figure 3 shown, the obtaining of the stagnant period of the target video according to the candidate frames includes:
[0088] Step 302: Compare the information quantity evaluation value of the candidate frame with a preset information quantity evaluation threshold. If the information quantity evaluation value of the current candidate frame is less than the information quantity evaluation threshold, and the information quantity evaluation value of the previous candidate frame of the current candidate frame is greater than or equal to the information quantity evaluation threshold, the moment corresponding to the current candidate frame is used as the start moment; wherein, if the current candidate frame has no previous candidate frame, it is determined that the information quantity evaluation value of the previous candidate frame of the current candidate frame is greater than the information quantity evaluation threshold.
[0089] Specifically, the information quantity evaluation threshold is D, the information quantity evaluation value of the current candidate frame is S(t), when S(t) < D and S(t - 1) ≥ D, it is initially considered that a drone stagnant period appears at the current moment; S(t - 1) is the information quantity evaluation value of the previous candidate frame of the current candidate frame; record this moment as the start moment of the i-th time the drone appears in the stagnant period, that is, T start (i) = t;
[0090] Step 304: If the information quantity evaluation value of the current candidate frame is greater than or equal to the information quantity evaluation threshold, and the information quantity evaluation value of the previous candidate frame of the current candidate frame is less than the information quantity evaluation threshold, the moment corresponding to the current candidate frame is used as the end moment.
[0091] Specifically, when S(t) ≥ D and S(t - 1) < D, it is initially considered that the stagnant period is exited at the current moment, and record this moment as the end moment of the i-th time the drone appears in the stagnant period; that is, T end (i) = t.
[0092] For example, as Figure 4 shown, it is a line chart of the change of the information quantity evaluation value of the image frames in the target video in one embodiment over time; wherein, the information quantity evaluation threshold D = 400; it can be seen from the figure that the target object appears around the 160s and 320s moments.
[0093] Step 306: Obtain the image frames between each start moment and the corresponding end moment as the candidate stagnant period.
[0094] Specifically, the image frames between the start time and the corresponding end time form an alternative stagnant period. The information quantity evaluation values of the image frames in the alternative stagnant period are continuous and do not exceed the information quantity evaluation threshold.
[0095] Step 308, obtain the stagnant period of the target video from the alternative stagnant periods according to a preset stagnant duration threshold.
[0096] Specifically, the stagnant duration of the alternative stagnant period = T end (i) - T start (i), the stagnant duration threshold is T. Screen out the stagnant period of the target video from the alternative stagnant periods according to the stagnant duration threshold.
[0097] For example, Table 1 is Figure 4 the distribution table of the stagnant periods in the target video in the embodiment; among them, the stagnant duration threshold T is 10 seconds;
[0098] Table 1 Distribution Table of Stagnant Periods
[0099] Stagnation period 1 2 3 4 5 Start time / s 145 218 322 341 401 End time / s 182 231 335 356 419
[0100] It can be seen from Table 1 that the periods around 160s and 320s are included in the stagnant period, so it can be considered that the target object is found. A total of 5 stagnant periods are obtained in Table 1.
[0101] In this embodiment, by comparing the alternative frames with the information quantity evaluation threshold, the alternative stagnant periods are determined, and further, the stagnant periods are screened out according to the stagnant duration threshold and the alternative stagnant periods. By screening out the stagnant periods, the workload of extracting key frames can be reduced, the extraction of non-key frames can be avoided, and the efficiency of extracting key frames is improved.
[0102] In one embodiment, the obtaining the stagnant period of the target video from the alternative stagnant periods according to a preset stagnant duration threshold includes:
[0103] Obtain the duration of each alternative stagnant period;
[0104] Judge whether the duration of each alternative stagnant period exceeds the preset stagnant duration threshold;
[0105] Use the alternative stagnant periods whose duration exceeds the preset stagnant duration threshold as the stagnant periods of the target video.
[0106] Specifically, the duration of the i-th alternative stagnant period when the drone appears is T end (i) - T start (i), the stagnant duration threshold is T. When T end (i) - T start (i) < T, eliminate this alternative stagnant period, and only T end(i)-T start The candidate stagnation period of (i) ≥ T is taken as the stagnation period of the target video.
[0107] In this embodiment, by setting a stagnation time threshold and eliminating the candidate stagnation time periods in the stagnation time threshold area from the candidate stagnation time periods, noise interference is eliminated from the candidate stagnation time periods, which can improve the accuracy of obtaining the stagnation time periods.
[0108] In one embodiment, acquiring key frames in the target video according to the stagnant period in the target video includes:
[0109] According to a preset second time interval, the stagnation period is divided into no less than a group of key video segments;
[0110] The image frames with the smallest information evaluation value are extracted from each key video clip as the key frames of the target video.
[0111] Specifically, the stagnant period is divided into a plurality of groups of key video segments according to a preset second time interval; the specific grouping method is similar to dividing the target video into a plurality of video segments according to the first time interval. And the image frame with the smallest information evaluation value is selected from each key video segment as the key frame of the target video.
[0112] For example, for the five stagnant periods in Table 1, with 10 seconds as the second time interval, the corresponding moments of the image frames with the smallest information evaluation value in each group of key video segments are extracted as shown in Table 2:
[0113] Table 2 Key frame images corresponding to the time
[0114]
[0115] As shown in Table 2, a total of 12 key frames of the target video are extracted for the 5 stagnant periods in Table 1. The time points of the target video corresponding to the key frames are: 148 seconds, 165 seconds, 172 seconds, 179 seconds, 226 seconds, 229 seconds, 332 seconds, 333 seconds, 341 seconds, 354 seconds, 407 seconds and 412 seconds.
[0116] In summary, for a drone inspection video, after adopting the method of extracting key frames in this embodiment, there are only 12 key frame images. This means that only image target detection is required for these 12 key frame images to complete target detection for the entire video, which improves the efficiency of extracting key frames and greatly reduces the time required for target detection.
[0117] In this embodiment, by selecting the image frame with the smallest information evaluation value from each key video clip as the key frame of the target video, the key frames are further screened, which further improves the efficiency of extracting key frames and can screen out the best key frames from each key video clip.
[0118] It should be understood that although Figure 2-3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-3 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0119] In one embodiment, Figure 5 As shown, a video key frame extraction device is provided, comprising: a first acquisition module 501, a second acquisition module 502 and an extraction module 503, wherein:
[0120] The first acquisition module 501 is used to acquire the information amount evaluation value of each image frame according to the Laplacian operator of each pixel point in each image frame in the target video; the information amount evaluation value is a parameter used to characterize the richness of information in the image frame;
[0121] The second acquisition module 502 is used to acquire a stagnant period in the target video according to the information amount evaluation value of each image frame; the stagnant period is a video segment containing a key frame in the target video;
[0122] The extraction module 503 is used to obtain key frames in the target video according to the stagnant period in the target video.
[0123] In one embodiment, the first acquisition module 501 is also used to acquire each image frame in the target video; grayscale the image frames to acquire the grayscale value of each pixel in the image frames; and acquire the Laplacian operator of each pixel in the image frames according to the grayscale value of each pixel in the image frames.
[0124] In one of the embodiments, the first acquisition module 501 is further used to obtain the Laplacian operator of each image frame according to the Laplacian operator of each pixel point in each image frame in the target video; and calculate the variance of the Laplacian operator of each image frame as the information amount evaluation value of each image frame.
[0125] In one embodiment, the second acquisition module 502 is further used to divide each image frame in the target video into no less than one group of video segments according to a preset first time interval; calculate the information amount evaluation value of each image frame in each video segment respectively, and use the image frame with the largest information amount evaluation value in each video segment as an alternative frame; and obtain the stagnation period of the target video according to the alternative frame.
[0126] In one embodiment, the second acquisition module 502 is further used to compare the information volume evaluation value of the alternative frame with a preset information volume evaluation threshold. If the information volume evaluation value of the current alternative frame is less than the information volume evaluation threshold, and the information volume evaluation value of the previous alternative frame of the current alternative frame is greater than or equal to the information volume evaluation threshold, the moment corresponding to the current alternative frame is used as the start moment; wherein, if the current alternative frame has no previous alternative frame, it is determined that the information volume evaluation value of the previous alternative frame of the current alternative frame is greater than the information volume evaluation threshold; if the information volume evaluation value of the current alternative frame is greater than or equal to the information volume evaluation threshold, and the information volume evaluation value of the previous alternative frame of the current alternative frame is less than the information volume evaluation threshold, the moment corresponding to the current alternative frame is used as the end moment; image frames between each start moment and the corresponding end moment are obtained as alternative stagnation periods; and according to the preset stagnation duration threshold, the stagnation period of the target video is obtained from the alternative stagnation periods.
[0127] In one embodiment, the second acquisition module 502 is further used to obtain the duration of each candidate stagnation period; determine whether the duration of each candidate stagnation period exceeds a preset stagnation duration threshold; and use the candidate stagnation period whose duration exceeds the preset stagnation duration threshold as the stagnation period of the target video.
[0128] In one embodiment, the extraction module 503 is further used to divide the stagnant period into at least one group of key video segments according to a preset second time interval; and extract image frames with the smallest information evaluation value from each key video segment as key frames of the target video.
[0129] The specific definition of the video key frame extraction device can be found in the definition of the video key frame extraction method above, which will not be repeated here. Each module in the above-mentioned video key frame extraction device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0130] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a video key frame extraction method is implemented.
[0131] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0132] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0133] According to the Laplacian operator of each pixel point in each image frame in the target video, an information amount evaluation value of each image frame is obtained; the information amount evaluation value is a parameter used to characterize the richness of information in the image frame;
[0134] According to the information amount evaluation value of each image frame, a stagnant period in the target video is obtained; the stagnant period is a video segment containing a key frame in the target video;
[0135] According to the stagnant period in the target video, a key frame in the target video is obtained.
[0136] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining each image frame in the target video; gray-scaling each image frame to obtain the gray value of each pixel in each image frame; and obtaining the Laplacian operator of each pixel in each image frame based on the gray value of each pixel in each image frame.
[0137] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the Laplacian operator of each image frame according to the Laplacian operator of each pixel point in each image frame in the target video; and calculating the variance of the Laplacian operator of each image frame as the information amount evaluation value of each image frame.
[0138] In one embodiment, when the processor executes the computer program, the following steps are also implemented: according to a preset first time interval, each image frame in the target video is divided into no less than a group of video segments; the information amount evaluation value of each image frame in each video segment is calculated respectively, and the image frame with the largest information amount evaluation value in each video segment is used as an alternative frame; based on the alternative frame, the stagnation period of the target video is obtained.
[0139] In one embodiment, when the processor executes the computer program, the following steps are also implemented: comparing the information volume evaluation value of the candidate frame with a preset information volume evaluation threshold; if the information volume evaluation value of the current candidate frame is less than the information volume evaluation threshold, and the information volume evaluation value of the previous candidate frame of the current candidate frame is greater than or equal to the information volume evaluation threshold, taking the time corresponding to the current candidate frame as the start time; wherein, if the current candidate frame has no previous candidate frame, determining that the information volume evaluation value of the previous candidate frame of the current candidate frame is greater than the information volume evaluation threshold; if the information volume evaluation value of the current candidate frame is greater than or equal to the information volume evaluation threshold, and the information volume evaluation value of the previous candidate frame of the current candidate frame is less than the information volume evaluation threshold, taking the time corresponding to the current candidate frame as the end time; acquiring image frames between each start time and the corresponding end time as candidate stagnation periods; and acquiring the stagnation period of the target video from the candidate stagnation periods according to the preset stagnation duration threshold.
[0140] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the duration of each candidate stagnation period; determining whether the duration of each candidate stagnation period exceeds a preset stagnation duration threshold; and taking the candidate stagnation period whose duration exceeds the preset stagnation duration threshold as the stagnation period of the target video.
[0141] In one embodiment, when the processor executes the computer program, the following steps are also implemented: according to a preset second time interval, the stagnation period is divided into no less than a group of key video segments; and the image frame with the smallest information evaluation value is extracted from each key video segment as the key frame of the target video.
[0142] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0143] According to the Laplacian operator of each pixel point in each image frame in the target video, an information amount evaluation value of each image frame is obtained; the information amount evaluation value is a parameter used to characterize the richness of information in the image frame;
[0144] According to the information amount evaluation value of each image frame, a stagnant period in the target video is obtained; the stagnant period is a video segment containing a key frame in the target video;
[0145] According to the stagnant period in the target video, a key frame in the target video is obtained.
[0146] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining each image frame in the target video; gray-scaling each image frame to obtain the gray value of each pixel in each image frame; and obtaining the Laplacian operator of each pixel in each image frame based on the gray value of each pixel in each image frame.
[0147] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the Laplacian operator of each image frame based on the Laplacian operator of each pixel point in each image frame in the target video; calculating the variance of the Laplacian operator of each image frame as the information amount evaluation value of each image frame.
[0148] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: according to a preset first time interval, each image frame in the target video is divided into no less than a group of video segments; the information amount evaluation value of each image frame in each video segment is calculated respectively, and the image frame with the largest information amount evaluation value in each video segment is used as an alternative frame; based on the alternative frame, the stagnation period of the target video is obtained.
[0149] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: comparing the information volume evaluation value of the candidate frame with a preset information volume evaluation threshold; if the information volume evaluation value of the current candidate frame is less than the information volume evaluation threshold, and the information volume evaluation value of the previous candidate frame of the current candidate frame is greater than or equal to the information volume evaluation threshold, taking the time corresponding to the current candidate frame as the start time; wherein, if the current candidate frame has no previous candidate frame, determining that the information volume evaluation value of the previous candidate frame of the current candidate frame is greater than the information volume evaluation threshold; if the information volume evaluation value of the current candidate frame is greater than or equal to the information volume evaluation threshold, and the information volume evaluation value of the previous candidate frame of the current candidate frame is less than the information volume evaluation threshold, taking the time corresponding to the current candidate frame as the end time; acquiring image frames between each start time and the corresponding end time as candidate stagnation periods; and acquiring the stagnation period of the target video from the candidate stagnation periods according to the preset stagnation duration threshold.
[0150] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the duration of each candidate stagnation period; determining whether the duration of each candidate stagnation period exceeds a preset stagnation duration threshold; and taking the candidate stagnation period whose duration exceeds the preset stagnation duration threshold as the stagnation period of the target video.
[0151] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: according to a preset second time interval, the stagnant period is divided into no less than a group of key video segments; and the image frame with the smallest information evaluation value is extracted from each key video segment as the key frame of the target video.
[0152] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0153] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0154] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A video key frame extraction method, characterized in that: The method comprises: According to the Laplacian operator of each pixel point in each image frame in the target video, an information amount evaluation value of each image frame is obtained; the information amount evaluation value is a parameter used to characterize the richness of information in the image frame; According to a preset first time interval, each image frame in the target video is divided into at least one group of video segments; Calculate the information evaluation value of each image frame in each video segment respectively, and take the image frame with the largest information evaluation value in each video segment as the candidate frame; Compare the information volume evaluation value of the candidate frame with a preset information volume evaluation threshold; if the information volume evaluation value of the current candidate frame is less than the information volume evaluation threshold, and the information volume evaluation value of the previous candidate frame of the current candidate frame is greater than or equal to the information volume evaluation threshold, take the time corresponding to the current candidate frame as the starting time; wherein, if the current candidate frame has no previous candidate frame, determine that the information volume evaluation value of the previous candidate frame of the current candidate frame is greater than the information volume evaluation threshold; If the information volume evaluation value of the current candidate frame is greater than or equal to the information volume evaluation threshold, and the information volume evaluation value of the previous candidate frame of the current candidate frame is less than the information volume evaluation threshold, the time corresponding to the current candidate frame is used as the end time; Acquire the image frames between each start time and the corresponding end time as candidate stagnation periods; According to a preset stagnation time threshold, a stagnation period of the target video is obtained from the candidate stagnation periods; the stagnation period is a video segment containing a key frame in the target video; According to the stagnant period in the target video, a key frame in the target video is obtained.
2. The method according to claim 1, characterized in that The step of obtaining the information amount evaluation value of each image frame according to the Laplacian operator of each pixel point in each image frame in the target video further includes: Obtain each image frame in the target video; Performing grayscale processing on each image frame to obtain the grayscale value of each pixel in each image frame; According to the grayscale value of each pixel in each image frame, the Laplacian operator of each pixel in each image frame is obtained.
3. The method according to claim 2, characterized in that The obtaining, according to the Laplacian operator of each pixel point in each image frame in the target video, an information amount evaluation value of each image frame comprises: Obtaining the Laplacian operator of each image frame according to the Laplacian operator of each pixel point in each image frame in the target video; The variance of the Laplacian operator of each image frame is calculated as an information amount evaluation value of each image frame.
4. The method according to claim 1, characterized in that: The step of acquiring the stagnation period of the target video from the candidate stagnation periods according to the preset stagnation time threshold comprises: Obtain the duration of each candidate stagnation period; Determine whether the duration of each candidate stagnation period exceeds a preset stagnation duration threshold; The candidate stagnation period whose duration exceeds a preset stagnation duration threshold is used as the stagnation period of the target video.
5. The method according to claim 4, characterized in that The step of obtaining a key frame in the target video according to the stagnant period in the target video comprises: According to a preset second time interval, the stagnation period is divided into no less than a group of key video segments; The image frames with the smallest information evaluation value are extracted from each key video clip as the key frames of the target video.
6. A video key frame extraction device, characterized in that: The device comprises: A first acquisition module is used to acquire an information amount evaluation value of each image frame according to the Laplacian operator of each pixel point in each image frame in the target video; the information amount evaluation value is a parameter used to characterize the richness of information in the image frame; The second acquisition module is used to divide each image frame in the target video into at least one group of video segments according to a preset first time interval; calculate the information amount evaluation value of each image frame in each video segment respectively, and take the image frame with the largest information amount evaluation value in each video segment as the candidate frame; The second acquisition module is also used to compare the information volume evaluation value of the candidate frame with a preset information volume evaluation threshold. If the information volume evaluation value of the current candidate frame is less than the information volume evaluation threshold, and the information volume evaluation value of the previous candidate frame of the current candidate frame is greater than or equal to the information volume evaluation threshold, the time corresponding to the current candidate frame is used as the starting time; wherein, if the current candidate frame has no previous candidate frame, it is determined that the information volume evaluation value of the previous candidate frame of the current candidate frame is greater than the information volume evaluation threshold; if the information volume evaluation value of the current candidate frame is greater than or equal to the information volume evaluation threshold, and the information volume evaluation value of the previous candidate frame of the current candidate frame is less than the information volume evaluation threshold, the time corresponding to the current candidate frame is used as the ending time; image frames between each starting time and the corresponding ending time are obtained as candidate stagnation periods; according to the preset stagnation duration threshold, the stagnation period of the target video is obtained from the candidate stagnation period; the stagnation period is a video segment containing key frames in the target video; The extraction module is used to obtain key frames in the target video according to the stagnant period in the target video.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
