Video concentration method, device, terminal equipment and storage medium
By performing frame skipping extraction and scene recognition, segmentation and moving target extraction on video time-series images, the compression rate of video concentration is dynamically adjusted, which solves the problems of poor flexibility and poor scene information processing of video condensation methods in the existing technology, and achieves a better Efficient video filtering effect.
Patent Information
- Application Number
- CN202110038883.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-12
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-01-12
AI Technical Summary
Existing video condensation methods have poor flexibility and cannot effectively filter out problems such as shaking leaves in the video. As a result, the compression rate of video condensation is not flexible enough and it is difficult to adapt to changes in scene information in surveillance videos.
By acquiring time-series images of the video, perform frame skipping extraction and scene recognition, segment the image, perform motion detection and moving target extraction, perform image encoding based on the classification results, dynamically adjust the compression rate of video condensation, and effectively filter scene changes.
It achieves dynamic adjustment of the compression rate of video condensation and effective scene information filtering, improves the flexibility and filtering effect of video condensation, and can better handle problems such as shaking leaves in surveillance videos.
Smart Images

Figure CN112883783B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a video concentration method, device, terminal equipment and storage medium. Background Art
[0002] With the rapid development of the national economy and basic science, video surveillance plays an increasingly prominent role in promoting public security. In recent years, with the need for public security and the reduction of monitoring costs, more and more surveillance cameras have been placed in every corner of the city and even in the home to provide security. However, the popularity of a large number of surveillance cameras has also generated a massive amount of surveillance video data. The surveillance videos are often very lengthy, and most of the clips are just a static background, not containing the things people want to detect. This also causes security personnel to spend a lot of time filtering out effective information from the surveillance videos. The existing video concentration method usually buffers 4 seconds of video frames, uses the quick sort algorithm to extract the median value as the first background of the video, and then extracts 4 seconds of video frames from the buffer each time, and extracts and tracks the target based on the difference between the grayscale image and the background in turn, numbers the video clips, and updates the background area. The background image is numbered according to the number of updates, and then the clips are classified according to whether they are in the same background, and the classified video clips are arranged in chronological order to form a concentrated video.
[0003] However, this method has poor flexibility and can only extract 4 seconds of video for processing each time, resulting in an inflexible compression rate for video concentration. Secondly, since the background is updated at most every 4 seconds, it is unable to filter out problems such as shaking leaves in the video and fails to take into account the scene information in the surveillance video. Summary of the invention
[0004] The technical problem to be solved by the embodiments of the present invention is to provide a video concentration method, device, terminal device and storage medium, which can dynamically adjust the compression rate of video concentration, effectively filter out problems such as leaf shaking through scene recognition, and have a good filtering effect.
[0005] In order to achieve the above object, an embodiment of the present invention provides a video condensation method, comprising:
[0006] Acquire a time-series image of a video, and perform frame skipping extraction on the time-series image according to a preset compression rate to obtain a time-series image to be processed;
[0007] Taking an image that meets a predetermined scene reference condition from the time-series images to be processed as a scene reference image, and performing scene recognition on the scene reference image;
[0008] Performing image segmentation on the remaining images in the time-series images to be processed according to the scene recognition result of the scene reference image to obtain segmented images;
[0009] Performing motion detection on the segmented image to obtain a binary mask image;
[0010] Extracting moving targets from the mask image, and classifying the extracted regional images of the moving targets to obtain classification results of the moving targets;
[0011] If the classification result belongs to a predetermined moving target classification type, image encoding is performed on the corresponding time-series images to be processed to generate a video file.
[0012] Furthermore, the step of taking an image that meets a predetermined scene change detection condition from the time-series images to be processed as a scene reference image specifically includes:
[0013] Using the first frame of the time-series images to be processed as an initial scene reference image;
[0014] If it is detected that the image scene of the time-series image to be processed meets a predetermined scene change condition, the time-series image to be processed is used as the current scene reference image.
[0015] Furthermore, the performing motion detection on the segmented image to obtain a binary mask image specifically includes:
[0016] Performing similarity matching on all pixels of the segmented image and corresponding pixels of a preset image sample set to obtain a similarity matching result;
[0017] A binary mask image is obtained according to the similarity matching result; wherein, if the similarity matching result is less than a preset pixel similarity matching threshold, the pixel of the segmented image is used as a foreground point pixel; if the similarity matching result is greater than the preset pixel similarity matching threshold, the pixel of the segmented image is used as a background point pixel.
[0018] Furthermore, the pixel similarity matching thresholds corresponding to the segmented images of different image regions are different.
[0019] Furthermore, the sample set includes a long-term sample set, a mid-term sample set and a recent sample set established for each pixel; wherein the pixel samples of the long-term sample set, the mid-term sample set and the recent sample set are not completely the same.
[0020] Furthermore, the extracting of moving targets from the mask image and classifying the extracted regional images of the moving targets to obtain classification results of the moving targets specifically include:
[0021] Counting the ratio of foreground point pixels in the mask image to the pixels of the entire image to obtain a statistical result;
[0022] If the statistical result exceeds a preset first threshold, it is determined that the scene has changed, and morphological processing and connected domain extraction are performed on the foreground point pixels in the mask image;
[0023] Filtering the size of the extracted connected domain, if the area of the connected domain is greater than a preset second threshold, treating the connected domain as a moving target;
[0024] The regional image of the moving target is classified by a classifier.
[0025] Furthermore, the scene change condition specifically includes:
[0026] If the statistical result does not exceed a preset third threshold value, and the time from the last scene recognition exceeds a preset fourth threshold value, NCC calculation is performed on the time series image to be processed and the initial scene reference image to obtain an NCC value;
[0027] If the NCC value is less than a preset fifth threshold, it is determined that the scene has changed.
[0028] The embodiment of the present invention further provides a video condensing device, comprising:
[0029] An image acquisition module is used to acquire time-series images of a video and perform frame skipping extraction on the time-series images according to a preset compression rate to obtain time-series images to be processed;
[0030] A scene recognition module, used to take an image that meets a predetermined scene reference condition from the time-series images to be processed as a scene reference image, and perform scene recognition on the scene reference image;
[0031] An image segmentation module, used for performing image segmentation on the remaining images in the time-series images to be processed according to the scene recognition result of the scene reference image, to obtain segmented images;
[0032] A motion detection module, used for performing motion detection on the segmented image to obtain a binary mask image;
[0033] An image classification module is used to extract moving targets from the mask image and classify the extracted regional images of the moving targets to obtain classification results of the moving targets;
[0034] The image encoding module is used to perform image encoding on the corresponding time-series image to be processed to generate a video file if the classification result belongs to a predetermined motion target classification type.
[0035] An embodiment of the present invention further provides a terminal device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements any of the above-mentioned video condensation methods when executing the computer program.
[0036] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned video condensation methods.
[0037] Compared with the prior art, the video concentration method, device, terminal device and storage medium provided by the embodiment of the present invention have the following beneficial effects: by acquiring the time-series images of the video, and performing frame skipping extraction on the time-series images according to a preset compression rate, the time-series images to be processed are obtained; images that meet the predetermined scene reference conditions are taken from the time-series images to be processed as scene reference images, and scene recognition is performed on the scene reference images; image segmentation is performed on the remaining images in the time-series images to be processed according to the scene recognition results of the scene reference images to obtain segmented images; motion detection is performed on the segmented images to obtain a binary mask image; moving target extraction is performed on the mask image, and the regional images of the extracted moving targets are classified to obtain the classification results of the moving targets; if the classification result belongs to the predetermined moving target classification type, the corresponding time-series images to be processed are image encoded to generate a video file. The embodiment of the present invention can dynamically adjust the compression rate of video concentration, effectively filter problems such as leaf shaking through scene recognition, and has a good filtering effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a flow chart of a preferred embodiment of a video condensation method provided by the present invention;
[0039] Figure 2 It is a structural schematic diagram of a preferred embodiment of a video concentration device provided by the present invention;
[0040] Figure 3 It is a structural schematic diagram of a preferred embodiment of a terminal device provided by the present invention. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0042] See also Figure 1 , Figure 1 1 is a flow chart of a preferred embodiment of a video condensation method provided by the present invention. The video condensation method comprises:
[0043] S1, acquiring a time-series image of a video, and performing frame skipping extraction on the time-series image according to a preset compression rate to obtain a time-series image to be processed;
[0044] S2, taking an image that meets a predetermined scene reference condition from the time-series images to be processed as a scene reference image, and performing scene recognition on the scene reference image;
[0045] S3, performing image segmentation on the remaining images in the time-series images to be processed according to the scene recognition result of the scene reference image to obtain segmented images;
[0046] S4, performing motion detection on the segmented image to obtain a binary mask image;
[0047] S5, extracting moving targets from the mask image, and classifying the extracted regional images of the moving targets to obtain classification results of the moving targets;
[0048] S6: If the classification result belongs to a predetermined moving target classification type, image encoding is performed on the corresponding time-series image to be processed to generate a video file.
[0049] Specifically, first, the time-series images of the video are acquired, and frame skipping extraction is performed on the time-series images according to a preset compression rate to obtain the time-series images to be processed; then, images that meet the predetermined scene reference conditions are taken from the time-series images to be processed as scene reference images, and scene recognition is performed on the scene reference images; secondly, image segmentation is performed on the remaining images in the time-series images to be processed according to the scene recognition results of the scene reference images to obtain segmented images; motion detection is then performed on the segmented images to obtain a binary mask image; motion target extraction is performed on the mask image, and the extracted regional images of the motion target are classified to obtain a classification result of the motion target; if the classification result belongs to a predetermined motion target classification type, image encoding is performed on the corresponding time-series images to be processed to generate a video file.
[0050] This embodiment can dynamically adjust the compression rate of video concentration, effectively filter out problems such as shaking leaves through scene recognition, and has a good filtering effect.
[0051] In another preferred embodiment, taking an image that meets a predetermined scene change detection condition from the time-series images to be processed as a scene reference image specifically includes:
[0052] Using the first frame of the time-series images to be processed as an initial scene reference image;
[0053] If it is detected that the image scene of the time-series image to be processed meets a predetermined scene change condition, the time-series image to be processed is used as the current scene reference image.
[0054] In another preferred embodiment, the performing motion detection on the segmented image to obtain a binary mask image specifically includes:
[0055] Performing similarity matching on all pixels of the segmented image and corresponding pixels of a preset image sample set to obtain a similarity matching result;
[0056] A binary mask image is obtained according to the similarity matching result; wherein, if the similarity matching result is less than a preset pixel similarity matching threshold, the pixel of the segmented image is used as a foreground point pixel; if the similarity matching result is greater than the preset pixel similarity matching threshold, the pixel of the segmented image is used as a background point pixel.
[0057] As a preferred solution, the pixel similarity matching thresholds corresponding to the segmented images of different image regions are different.
[0058] It should be noted that the different pixel similarity matching thresholds corresponding to the segmented images of different image regions refer to the different pixel similarity matching thresholds of the image sample sets corresponding to the segmented images of different image regions.
[0059] As a preferred solution, the sample set includes a long-term sample set, a mid-term sample set and a recent sample set established for each pixel; wherein the pixel samples of the long-term sample set, the mid-term sample set and the recent sample set are not completely the same.
[0060] In another preferred embodiment, the step of extracting a moving target from the mask image and classifying the extracted regional image of the moving target to obtain a classification result of the moving target specifically includes:
[0061] Counting the ratio of foreground point pixels in the mask image to the pixels of the entire image to obtain a statistical result;
[0062] If the statistical result exceeds a preset first threshold, it is determined that the scene has changed, and morphological processing and connected domain extraction are performed on the foreground point pixels in the mask image;
[0063] Filtering the size of the extracted connected domain, if the area of the connected domain is greater than a preset second threshold, treating the connected domain as a moving target;
[0064] The regional image of the moving target is classified by a classifier.
[0065] In another preferred embodiment, the scene change condition specifically includes:
[0066] If the statistical result does not exceed a preset third threshold value, and the time from the last scene recognition exceeds a preset fourth threshold value, NCC calculation is performed on the time series image to be processed and the initial scene reference image to obtain an NCC value;
[0067] If the NCC value is less than a preset fifth threshold, it is determined that the scene has changed.
[0068] Accordingly, the present invention also provides a video condensation device, which can implement all the processes of the video condensation method in the above embodiment.
[0069] See also Figure 2 , Figure 2 1 is a schematic diagram of a preferred embodiment of a video condensation device provided by the present invention. The video condensation device comprises:
[0070] The image acquisition module 201 is used to acquire time-series images of a video and perform frame skipping extraction on the time-series images according to a preset compression rate to obtain time-series images to be processed;
[0071] A scene recognition module 202 is used to take an image that meets a predetermined scene reference condition from the time-series images to be processed as a scene reference image, and perform scene recognition on the scene reference image;
[0072] An image segmentation module 203 is used to perform image segmentation on the remaining images in the time-series images to be processed according to the scene recognition result of the scene reference image to obtain segmented images;
[0073] A motion detection module 204 is used to perform motion detection on the segmented image to obtain a binary mask image;
[0074] The image classification module 205 is used to extract the moving target from the mask image and classify the extracted regional image of the moving target to obtain the classification result of the moving target;
[0075] The image encoding module 206 is configured to perform image encoding on the corresponding time-series images to be processed to generate a video file if the classification result belongs to a predetermined moving target classification type.
[0076] Preferably, the scene recognition module 202 takes an image that meets a predetermined scene reference condition from the time-series images to be processed as a scene reference image, specifically including:
[0077] Using the first frame of the time-series images to be processed as an initial scene reference image;
[0078] If it is detected that the image scene of the time-series image to be processed meets a predetermined scene change condition, the time-series image to be processed is used as the current scene reference image.
[0079] Preferably, the image segmentation module 203 is specifically used for:
[0080] Performing similarity matching on all pixels of the segmented image and corresponding pixels of a preset image sample set to obtain a similarity matching result;
[0081] A binary mask image is obtained according to the similarity matching result; wherein, if the similarity matching result is less than a preset pixel similarity matching threshold, the pixel of the segmented image is used as a foreground point pixel; if the similarity matching result is greater than the preset pixel similarity matching threshold, the pixel of the segmented image is used as a background point pixel.
[0082] Preferably, the pixel similarity matching thresholds corresponding to the segmented images of different image regions are different.
[0083] Preferably, the sample set includes a long-term sample set, a mid-term sample set and a recent sample set established for each pixel; wherein the pixel samples of the long-term sample set, the mid-term sample set and the recent sample set are not completely the same.
[0084] Preferably, the image classification module 205 is specifically used for:
[0085] Counting the ratio of foreground point pixels in the mask image to the pixels of the entire image to obtain a statistical result;
[0086] If the statistical result exceeds a preset first threshold, it is determined that the scene has changed, and morphological processing and connected domain extraction are performed on the foreground point pixels in the mask image;
[0087] Filtering the size of the extracted connected domain, if the area of the connected domain is greater than a preset second threshold, treating the connected domain as a moving target;
[0088] The regional image of the moving target is classified by a classifier.
[0089] Preferably, the scene change condition specifically includes:
[0090] If the statistical result does not exceed a preset third threshold value, and the time from the last scene recognition exceeds a preset fourth threshold value, NCC calculation is performed on the time series image to be processed and the initial scene reference image to obtain an NCC value;
[0091] If the NCC value is less than a preset fifth threshold, it is determined that the scene has changed.
[0092] In specific implementation, the working principle, control process and technical effect achieved by the video concentration device provided in the embodiment of the present invention are the same as those of the video concentration method in the above embodiment, and will not be described in detail here.
[0093] See also Figure 3 , Figure 3 3 is a schematic diagram of a preferred embodiment of a terminal device provided by the present invention. The terminal device includes a processor 301, a memory 302, and a computer program stored in the memory 302 and configured to be executed by the processor 301. When the processor 301 executes the computer program, the video condensation method described in any of the above embodiments is implemented.
[0094] Preferably, the computer program can be divided into one or more modules / units (such as computer program 1, computer program 2, ...), and the one or more modules / units are stored in the memory 302 and executed by the processor 301 to complete the present invention. The one or more modules / units can be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program in the terminal device.
[0095] The processor 301 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor, or the processor 301 can be any conventional processor. The processor 301 is the control center of the terminal device, and various parts of the terminal device are connected using various interfaces and lines.
[0096] The memory 302 mainly includes a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, etc., and the data storage area can store related data, etc. In addition, the memory 302 can be a high-speed random access memory, or a non-volatile memory, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, and a flash card (Flash Card), etc., or the memory 302 can also be other volatile solid-state storage devices.
[0097] It should be noted that the above terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will understand that Figure 3 The structural diagram is only an example of the above-mentioned terminal device and does not constitute a limitation of the above-mentioned terminal device. It may include more or less components than shown in the figure, or combine certain components, or different components.
[0098] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the video condensation method described in any of the above embodiments.
[0099] The embodiment of the present invention provides a video concentration method, apparatus, terminal device and storage medium, which obtains the time-series images of the video and performs frame skipping extraction on the time-series images according to a preset compression rate to obtain the time-series images to be processed; takes the images that meet the predetermined scene reference conditions from the time-series images to be processed as scene reference images, and performs scene recognition on the scene reference images; performs image segmentation on the remaining images in the time-series images to be processed according to the scene recognition results of the scene reference images to obtain segmented images; performs motion detection on the segmented images to obtain a binary mask image; extracts moving targets from the mask image, and classifies the regional images of the extracted moving targets to obtain the classification results of the moving targets; if the classification results belong to the predetermined moving target classification type, the corresponding time-series images to be processed are image encoded to generate a video file. The embodiment of the present invention can dynamically adjust the compression rate of video concentration, effectively filter problems such as leaf shaking through scene recognition, and has a good filtering effect.
[0100] It should be noted that the system embodiment described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the system embodiment provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0101] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A video condensation method, characterized in that: include: Acquire a time-series image of a video, and perform frame skipping extraction on the time-series image according to a preset compression rate to obtain a time-series image to be processed; Taking an image that meets a predetermined scene reference condition from the time-series images to be processed as a scene reference image, and performing scene recognition on the scene reference image; Performing image segmentation on the remaining images in the time-series images to be processed according to the scene recognition result of the scene reference image to obtain segmented images; Performing motion detection on the segmented image to obtain a binary mask image; Extracting moving targets from the mask image, and classifying the extracted regional images of the moving targets to obtain classification results of the moving targets; If the classification result belongs to a predetermined moving target classification type, image encoding is performed on the corresponding time-series images to be processed to generate a video file.
2. The video condensation method according to claim 1, characterized in that: The step of taking an image that meets a predetermined scene change detection condition from the time-series images to be processed as a scene reference image specifically includes: Using the first frame of the time-series images to be processed as an initial scene reference image; If it is detected that the image scene of the time-series image to be processed meets a predetermined scene change condition, the time-series image to be processed is used as the current scene reference image.
3. A video condensation method as claimed in claim 2, characterized in that: The performing motion detection on the segmented image to obtain a binary mask image specifically includes: Performing similarity matching on all pixels of the segmented image and corresponding pixels of a preset image sample set to obtain a similarity matching result; A binary mask image is obtained according to the similarity matching result; wherein, if the similarity matching result is less than a preset pixel similarity matching threshold, the pixel of the segmented image is used as a foreground point pixel; if the similarity matching result is greater than the preset pixel similarity matching threshold, the pixel of the segmented image is used as a background point pixel.
4. A video condensation method as claimed in claim 3, characterized in that: The pixel similarity matching thresholds corresponding to the segmented images of different image regions are different.
5. A video condensation method as claimed in claim 3, characterized in that: The sample set includes a long-term sample set, a mid-term sample set and a recent sample set established for each pixel; wherein the pixel samples of the long-term sample set, the mid-term sample set and the recent sample set are not completely the same.
6. A video condensation method as claimed in claim 3, characterized in that: The extracting of moving targets from the mask image and classifying the extracted regional images of the moving targets to obtain the classification results of the moving targets specifically include: Counting the ratio of foreground point pixels in the mask image to the pixels of the entire image to obtain a statistical result; If the statistical result exceeds a preset first threshold, it is determined that the scene has changed, and morphological processing and connected domain extraction are performed on the foreground point pixels in the mask image; Filtering the size of the extracted connected domain, if the area of the connected domain is greater than a preset second threshold, treating the connected domain as a moving target; The regional image of the moving target is classified by a classifier.
7. The video condensation method according to claim 6, characterized in that: The scene change conditions specifically include: If the statistical result does not exceed a preset third threshold value, and the time from the last scene recognition exceeds a preset fourth threshold value, NCC calculation is performed on the time series image to be processed and the initial scene reference image to obtain an NCC value; If the NCC value is less than a preset fifth threshold, it is determined that the scene has changed.
8. A video concentration device, characterized in that: include: An image acquisition module is used to acquire time-series images of a video and perform frame skipping extraction on the time-series images according to a preset compression rate to obtain time-series images to be processed; A scene recognition module, used to take an image that meets a predetermined scene reference condition from the time-series images to be processed as a scene reference image, and perform scene recognition on the scene reference image; An image segmentation module, used for performing image segmentation on the remaining images in the time-series images to be processed according to the scene recognition result of the scene reference image, to obtain segmented images; A motion detection module, used for performing motion detection on the segmented image to obtain a binary mask image; An image classification module is used to extract moving targets from the mask image and classify the extracted regional images of the moving targets to obtain classification results of the moving targets; The image encoding module is used to perform image encoding on the corresponding time-series image to be processed to generate a video file if the classification result belongs to a predetermined motion target classification type.
9. A terminal device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the video condensation method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the video condensation method according to any one of claims 1 to 7.
