A method and apparatus for detecting a blurred image in a video
By using motion compensation methods to calculate the motion-compensated image of the previous frame in the video and comparing the difference with the image to be detected, and combining reference and no-reference detection, the problem of insufficient accuracy in blurry frame detection in video is solved, and more efficient blurry image detection is achieved.
Patent Information
- Application Number
- CN202210794558.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-05
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2042-07-05
AI Technical Summary
Existing technologies struggle to effectively utilize the continuity between video frames in blurred frame detection, resulting in insufficient detection accuracy, especially with poor performance of no-reference detection methods.
The motion-compensated image of the previous frame is calculated using a motion compensation method and compared with the image to be detected. By combining reference and no-reference detection, the blurred image is determined by utilizing the continuity between video frames.
It improves the accuracy and effectiveness of blurry image detection in videos, enabling more detailed filtering of blurry images and enhancing the detection results.
Smart Images

Figure CN115375620B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for detecting blurred images in videos. Background Technology
[0002] Currently, the detection of blurred frames in videos mainly utilizes various algorithms to perform blur detection on individual video frames. Methods for detecting image blur can be broadly categorized into two types: 1. Reference-based detection, which is less common in practical applications because it's difficult to determine a fixed reference image in reality; 2. Referenceless detection, including methods using the Laplacian operator, the Brenner operator, the Tenengrad gradient function, and methods based on image gradients or wavelet transforms. These methods all involve calculating and detecting blur at the pixel level, focusing on a single image. Summary of the Invention
[0003] This invention provides a method and apparatus for detecting blurred images in videos.
[0004] In a first aspect, the present invention provides a method for detecting blurred images in a video, comprising: determining an image to be detected in the video and a blur value associated with the image to be detected; acquiring a previous frame image of the image to be detected and determining a blur value associated with the previous frame image, wherein both the blur value associated with the image to be detected and the blur value associated with the previous frame image are less than a preset blur threshold, and the previous frame image is the image closest to the image to be detected that has a blur value less than the preset blur threshold; calculating a motion-compensated image of the previous frame based on the image to be detected using a motion compensation method and determining a blur value of the motion-compensated image of the previous frame; if the difference between the blur value associated with the previous frame image and the blur value of the motion-compensated image of the previous frame is not within a preset range, comparing the blur value associated with the image to be detected and the blur value associated with the previous frame image, and determining the image with the larger blur value as a blurred image.
[0005] Furthermore, before determining the image to be detected in the video and the blur value associated with the image to be detected, the method further includes: determining the blur value of each frame in the video, judging whether the blur value of each frame is greater than or equal to a preset blur threshold, determining the image that is greater than or equal to the preset blur threshold as a blur image, and determining the image that is less than the preset blur threshold as the image to be detected.
[0006] Further, determining the image to be detected in the video and the blur value associated with the image to be detected, obtaining the previous frame image of the image to be detected and determining the blur value associated with the previous frame image includes: determining the image to be detected in the video and the blur value associated with the image to be detected, determining whether the image to be detected is the first frame image, and if the image to be detected is not the first frame image, then obtaining the previous frame image of the image to be detected and determining the blur value associated with the previous frame image.
[0007] Further, determining the image to be detected in the video and the blur value associated with the image to be detected, and obtaining the previous frame image of the image to be detected and determining the blur value associated with the previous frame image, includes: determining the image to be detected in the video, dividing the image to be detected into at least one region, and determining the blur value of each region of the image to be detected; obtaining the previous frame image of the image to be detected, dividing the previous frame image into at least one region, and determining the blur value of each region of the previous frame image; wherein each region of the image to be detected corresponds one-to-one with each region of the previous frame image.
[0008] Further, the step of calculating the motion-compensated image of the previous frame using a motion compensation method based on the image to be detected, and determining the blur value of the motion-compensated image of the previous frame, includes: for each region of the image to be detected, calculating the region of the motion-compensated image of the previous frame based on the region of the image to be detected using a motion compensation method, and determining the blur value of the region of the motion-compensated image of the previous frame, wherein each region of the motion-compensated image of the previous frame corresponds one-to-one with each region of the previous frame image.
[0009] Further, the step of calculating each region of the previous frame motion-compensated image for each region of the image to be detected using a motion compensation method, and determining the blur value of each region of the previous frame motion-compensated image, includes: for each region of the image to be detected, moving the pixels in the region according to a preset movement rule; calculating the candidate region of the previous frame motion-compensated image using a motion compensation method for each movement; determining the similarity between the candidate region of the previous frame motion-compensated image and the corresponding region of the previous frame image; selecting the candidate region with the highest similarity as the region of the previous frame motion-compensated image; and determining the blur value of the region of the previous frame motion-compensated image.
[0010] Further, if the difference between the blur value associated with the previous frame image and the blur value of the previous frame motion-compensated image is not within a preset range, then comparing the blur value associated with the image to be detected and the blur value associated with the previous frame image, and determining the image with the larger blur value as a blurred image, includes: subtracting the blur value of a region of the previous frame image from the blur value of the corresponding region of the previous frame motion-compensated image; if the difference is not within a preset range, then comparing the blur value of a region of the image to be detected and the blur value of the corresponding region of the previous frame image, and determining the region with the larger blur value as a blurred region.
[0011] Furthermore, the method also includes marking the blurred region.
[0012] Secondly, the present invention also provides a device for detecting blurred images in a video, comprising: a first processing module, configured to determine a target image in the video and a blur value associated with the target image, acquire a previous frame image of the target image and determine a blur value associated with the previous frame image, wherein both the blur value associated with the target image and the blur value associated with the previous frame image are less than a preset blur threshold, and the previous frame image is the frame closest to the target image that has a blur value less than the preset blur threshold; a second processing module, configured to calculate a motion-compensated image of the previous frame based on the target image using a motion compensation method, and determine the blur value of the motion-compensated image of the previous frame; and a third processing module, configured to compare the blur value associated with the target image and the blur value associated with the previous frame image if the difference between the blur value associated with the previous frame image and the blur value of the motion-compensated image of the previous frame is not within a preset range, and determine the image with the larger blur value as a blurred image.
[0013] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method for detecting blurred images in a video as described above.
[0014] Fourthly, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for detecting blurred images in a video as described above.
[0015] This invention provides a method and apparatus for detecting blurred images in video. Before determining the blur value associated with the image to be detected and the blur value of the previous frame image, it is necessary to ensure that both the blur value associated with the image to be detected and the blur value associated with the previous frame image are less than a preset blur threshold. Furthermore, the previous frame image is the closest frame to the image to be detected that has a blur value less than the preset blur threshold. By utilizing the continuity between each frame of the video, a combination of reference-based and referenceless detection methods is used to enhance the detection effect of blurred images. The motion-compensated image of the previous frame is calculated using a motion compensation method, and the blur value of the motion-compensated image is determined. Then, the difference between the blur value of the detected image and the blur value of the motion-compensated image of the previous frame is compared to determine the blurred image. Because the motion-compensated image of the previous frame references the image to be detected, comparing the two frames can more accurately identify the differences between them. Using this difference as a factor in image blur detection can enhance the detection effect. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0017] Figure 1 This is a schematic flowchart of some embodiments of the method for detecting blurred images in video provided by the present invention;
[0018] Figure 2 This is a schematic diagram of the structure of some embodiments of the device for detecting blurred images in video provided by the present invention;
[0019] Figure 3 This is a schematic diagram of the structure of an electronic device provided according to the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0021] It should also be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0022] It should be noted that the concepts of "first" and "second" mentioned in this invention are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0023] It should be noted that the terms "a" and "a plurality of" used in this invention are illustrative rather than restrictive. Those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0024] The names of the messages or information exchanged between the multiple devices in the embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of these messages or information.
[0025] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0026] Please see Figure 1 , Figure 1 This is a flowchart illustrating some embodiments of the method for detecting blurred images in videos provided by the present invention. For example... Figure 1 As shown, the method includes the following steps:
[0027] Step 101: Determine the image to be detected in the video and the blur value associated with the image to be detected. Obtain the previous frame image of the image to be detected and determine the blur value of the previous frame image. Both the blur value associated with the image to be detected and the blur value of the previous frame image are less than a preset blur threshold. The previous frame image is the image that is closest to the image to be detected and has a blur value less than the preset blur threshold.
[0028] In blurred image detection, a blur threshold is typically set. If the blur value of an image is greater than or equal to this threshold, the image is considered blurred; if the blur value is less than this threshold, the image is considered sharp. However, simply determining whether an image is blurred using a blur threshold only considers the blur of a single image. Video differs from a single image because each frame in a video is continuous. Therefore, by utilizing the continuity between frames in a video, the blur value of the preceding frame corresponding to the image to be detected is used as a reference.
[0029] Step 102: Based on the image to be detected, calculate the motion-compensated image of the previous frame using a motion compensation method, and determine the blur value of the motion-compensated image of the previous frame.
[0030] Since the images in the video are continuous, the image to be detected can be obtained by moving some pixels to get the part that overlaps with the previous frame image. The image to be detected after the movement is the motion-compensated image of the previous frame using the motion compensation method.
[0031] Motion compensation is a method for describing the differences between adjacent frames (adjacent here means adjacent in terms of encoding relationship, but not necessarily adjacent in terms of playback order). Specifically, it describes how each block in the previous frame moves to a certain position in the current frame. As an example, the motion compensation method used can be global motion compensation or block motion compensation.
[0032] Step 103: If the difference between the blur value of the previous frame image and the blur value of the previous frame motion-compensated image is not within a preset range, then compare the blur value associated with the image to be detected with the blur value of the previous frame image, and determine the image with the larger blur value as the blur image.
[0033] If the difference between the blur value of the previous frame image and the blur value of the previous frame motion-compensated image is not within the preset range, it indicates that the blur degree of the previous frame image or the image to be detected is significantly different. Therefore, one of them is a blurry image. The blur value associated with the previous frame image or the blur value associated with the image to be detected is determined. The image with the larger blur value is the blurry image. By utilizing the continuity between images, a more detailed screening of blurry images is achieved.
[0034] In some embodiments, the two closest frames to the image to be detected can be selected as references. The blur values of the two closest frames are calculated based on the image to be detected. If the difference between the calculated blur value of the two closest frames and the blur value of the two closest frames in the original video is outside a preset range, the blur value associated with the image to be detected is compared with the blur value of the two closest frames in the original video, and the image with the larger blur value is considered the blurred image. If the difference between the calculated blur value of the two closest frames and the blur value of the two closest frames in the original video is within the preset range, then there is no blurred image. The preset range for the difference can be set according to the positional relationship between the image to be detected and the preceding frames. For example, a reference table for the preset range of the difference can be set. If the image to be detected and the preceding frames are adjacent, the reference table is consulted to determine the preset range; if the image to be detected is the third frame from the preceding frame, the reference table is consulted to determine the preset range. This avoids the problem of inaccurate judgment caused by using a single preset range for images with large distance differences in consecutive images.
[0035] This invention discloses a method for detecting blurred images in videos. Before determining the blur value associated with the image to be detected and the blur value of the previous frame image, it is necessary to determine that both the blur value associated with the image to be detected and the blur value of the previous frame image are less than a preset blur threshold, and the previous frame image is the closest frame to the image to be detected whose blur value is less than the preset blur threshold. This method utilizes the continuity between each frame of the video to enhance the detection effect of blurred images by combining reference-based and referenceless detection methods. The previous frame motion-compensated image is calculated using a motion compensation method, and its blur value is determined. Then, the difference between the blur value of the detected image and the blur value of the previous frame motion-compensated image is compared to determine the blurred image. Because the previous frame motion-compensated image references the image to be detected, comparing the two frames can more accurately identify the differences between them. Using this difference as a factor in image blur detection can enhance the image blur detection effect.
[0036] In some optional implementations, before determining the image to be detected in the video and the blur value associated with the image to be detected, the method further includes: determining the blur value of each frame of the video, determining whether the blur value of each frame is greater than or equal to a preset blur threshold, determining images that are greater than or equal to the preset blur threshold as blur images, and determining images that are less than the preset blur threshold as images to be detected.
[0037] All images in the video are converted to grayscale before the blur value of the images is determined.
[0038] Since the video contains at least one frame, the blur value of each frame can be determined first. Images with a blur value less than a preset blur threshold are filtered out. From these filtered images, the image to be detected and the previous frame image are identified. The previous frame image can be the frame preceding the image to be detected, or it can be one of the previous three frames. Images with a blur value less than the blur threshold may also be blurry; therefore, based on the continuity of images in the video, the previous frame image is used as a reference to further detect whether images with a blur value less than the blur threshold are blurry.
[0039] In some optional implementations, determining the image to be detected in the video and the blur value associated with the image to be detected, obtaining the previous frame image of the image to be detected and determining the blur value of the previous frame image includes: determining the image to be detected in the video and the blur value associated with the image to be detected, determining whether the image to be detected is the first frame image, and if the image to be detected is not the first frame image, obtaining the previous frame image of the image to be detected and determining the blur value of the previous frame image.
[0040] Since the first frame of a video has no previous frame, it can be directly detected as a blurred image based on a preset blur threshold.
[0041] Since the image to be detected needs to use the previous frame image as a reference to detect blurred images, it is necessary to first determine whether the image to be detected is the first frame image.
[0042] In some optional implementations, determining the image to be detected in the video and the blur value associated with the image to be detected, and obtaining the previous frame image of the image to be detected and determining the blur value of the previous frame image, includes: determining the image to be detected in the video, dividing the image to be detected into at least one region, and determining the blur value of each region of the image to be detected; obtaining the previous frame image of the image to be detected, dividing the previous frame image into at least one region, and determining the blur value of each region of the previous frame image; wherein each region of the image to be detected corresponds one-to-one with each region of the previous frame image.
[0043] As an example, the image to be detected and the previous frame image can be cut into small blocks (regions) respectively. The cutting method is as follows: cut m blocks along the x-axis and n blocks along the y-axis, so that the entire image is cut into m*n blocks (regions).
[0044] As an example, for each of the above m*n regions, the Laplace operator is used to calculate the fuzzy value of each region. The calculation steps are as follows:
[0045] 1) Perform a convolution operation between the region and the Laplacian operator. The Laplacian operator is:
[0046]
[0047] 2) Calculate the variance of the convolved region; this variance is the fuzzy value.
[0048] In some optional implementations, based on the image to be detected, a motion-compensated image of the previous frame is calculated using a motion compensation method, and the blur value of the motion-compensated image of the previous frame is determined. This includes: for each region of the image to be detected, calculating the corresponding region of the motion-compensated image of the previous frame using a motion compensation method based on the region of the image to be detected, and determining the blur value of the region of the motion-compensated image of the previous frame. Each region of the motion-compensated image of the previous frame corresponds one-to-one with each region of the previous frame image.
[0049] By moving pixels within a region of the image to be detected, the blurring status of each region can be determined, thus more accurately locating blurred areas of the image. During the pixel movement within the region of the image to be detected, some pixels will be moved out. When the image to be detected is used as the previous frame, these moved-out pixels can also serve as a reference for blur detection in the next frame of the image to be detected.
[0050] In some optional implementations, for each region of the image to be detected, the motion compensation method is used to calculate each region of the previous frame motion-compensated image, and the blur value of each region of the previous frame motion-compensated image is determined. This includes: for each region of the image to be detected, moving the pixels in the region according to a preset movement rule, calculating the candidate region of the previous frame motion-compensated image according to the motion compensation method for each movement, determining the similarity between the candidate region of the previous frame motion-compensated image and the corresponding region of the previous frame image, selecting the candidate region with the highest similarity as the region of the previous frame motion-compensated image, and determining the blur value of the region of the previous frame motion-compensated image.
[0051] As an example, if the image to be detected is not the first frame, each region is moved as follows: from -x to +x, -y to +y, and for each pixel moved, the similarity between that region and the corresponding region in the previous frame is calculated (i.e., candidate regions are obtained). The region with the highest similarity after movement is determined. A total of m*n local regions with the highest similarity (i.e., regions in the previous frame's motion-compensated image) are retained. These regions are combined into one image to calculate the previous frame's motion-compensated image, where:
[0052] 1) The values of x and y are adjusted according to the situation. For example, x: 10 pixels, y: 10 pixels;
[0053] 2) Corresponding regions: Each movement generates a new image (each region moves synchronously). The image is divided into m*n regions. For example, the regions with the same top-left corner coordinates of two images are corresponding regions.
[0054] 3) Similarity can be calculated using the SSIM index.
[0055] In some optional implementations, if the difference between the blur value of the previous frame image and the blur value of the previous frame motion-compensated image is not within a preset range, then the blur value associated with the image to be detected is compared with the blur value of the previous frame image, and the image with the larger blur value is determined as the blur image. This includes: subtracting the blur value of a region of the previous frame image from the blur value of the corresponding region of the previous frame motion-compensated image; if the difference is not within a preset range, then comparing the blur value of a region of the image to be detected with the blur value of the corresponding region of the previous frame image, and determining the region with the larger blur value as the blur region.
[0056] If the blur value of a region in the previous frame image or the region in the image to be detected exceeds the blur threshold, it is judged as a blurred region. If it does not exceed the blur threshold, further judgment is made based on the continuity of the video. That is, the blur value of a region in the previous frame image is subtracted from the blur value of the corresponding region in the previous frame motion-compensated image. If the difference is not within a preset range, the blur value of the region in the image to be detected is compared with the blur value of the corresponding region in the previous frame image, and the region with the larger blur value is determined as the blurred region. The preset range and blur threshold can be adjusted according to specific circumstances.
[0057] In some alternative implementations, the method also includes marking out the blurred areas.
[0058] After the blurred area is detected, it can be outlined according to specific needs, or the video frames containing the blurred area can be discarded and the frames without the blurred area can be combined into a video for other uses.
[0059] In summary, this invention, in addition to detecting general blurred areas (such as blurred frames in recorded videos caused by camera chip quality), can also detect images or regions with blurred areas below a blur threshold. Furthermore, this invention can be extended to detect image quality issues such as deformation, stretching, and distortion.
[0060] Please see Figure 2 , Figure 2 These are schematic diagrams illustrating the structure of some embodiments of a device for detecting blurred images in video according to the present invention. As an implementation of the methods shown in the above figures, the present invention also provides some embodiments of a device for detecting blurred images in video, which are similar to... Figure 1 The embodiments of some of the methods shown correspond to this, and the device can be applied to a variety of electronic devices.
[0061] like Figure 2As shown, some embodiments of a device for detecting blurred images in a video include a first processing module 201, a second processing module 202, and a third processing module 203: The first processing module 201 is used to determine the image to be detected in the video and the blur value associated with the image to be detected, acquire the previous frame image of the image to be detected and determine the blur value of the previous frame image, wherein both the blur value associated with the image to be detected and the blur value of the previous frame image are less than a preset blur threshold, and the previous frame image is the image closest to the image to be detected whose blur value is less than the preset blur threshold; the second processing module 202 is used to calculate the motion-compensated image of the previous frame based on the image to be detected using a motion compensation method and determine the blur value of the motion-compensated image of the previous frame; the third processing module 203 is used to compare the blur value associated with the image to be detected and the blur value of the previous frame image if the difference between the blur value of the previous frame image and the blur value of the motion-compensated image of the previous frame is not within a preset range, and determine the image with the larger blur value as the blurred image.
[0062] In some optional implementations of the embodiments, the apparatus further includes: a fourth processing module, configured to determine the blur value of each frame of the video, determine whether the blur value of each frame is greater than or equal to a preset blur threshold, determine the image that is greater than or equal to the preset blur threshold as a blurred image, and determine the image that is less than the preset blur threshold as an image to be detected.
[0063] In some optional implementations of embodiments, the first processing module 201 is further configured to: determine the image to be detected in the video and the blur value associated with the image to be detected; determine whether the image to be detected is the first frame image; if the image to be detected is not the first frame image, obtain the previous frame image of the image to be detected and determine the blur value of the previous frame image.
[0064] In some optional implementations of the embodiments, the first processing module 201 is further configured to: determine the image to be detected in the video, divide the image to be detected into at least one region, and determine the blur value of each region of the image to be detected; acquire the previous frame image of the image to be detected, divide the previous frame image into at least one region, and determine the blur value of each region of the previous frame image; wherein each region of the image to be detected corresponds one-to-one with each region of the previous frame image.
[0065] In some optional implementations of the embodiments, the second processing module 202 is further configured to: for each region of the image to be detected, calculate the region of the previous frame motion-compensated image according to the region of the image to be detected by the motion compensation method, and determine the blur value of the region of the previous frame motion-compensated image, wherein each region of the previous frame motion-compensated image corresponds one-to-one with each region of the previous frame image.
[0066] In some optional implementations of the embodiments, the second processing module 202 is further configured to: for each region of the image to be detected, move the pixels in the region according to a preset movement rule, calculate the candidate region of the previous frame motion compensation image through the motion compensation method for each movement, determine the similarity between the candidate region of the previous frame motion compensation image and the region of the corresponding previous frame image, select the candidate region with the highest similarity as the region of the previous frame motion compensation image, and determine the blur value of the region of the previous frame motion compensation image.
[0067] In some optional implementations of the embodiments, the third processing module 203 is further configured to: subtract the blur value of the region of the previous frame image from the blur value of the corresponding region of the previous frame motion-compensated image; if the difference is not within a preset range, compare the blur value of the region of the image to be detected with the blur value of the corresponding region of the previous frame image, and determine the region with the larger blur value as the blur region.
[0068] In some alternative implementations of the embodiments, the apparatus further includes a fifth processing module for: marking the blurred region.
[0069] It is understandable that the modules described in this device are consistent with the reference. Figure 1 The steps in the described method correspond to each other. Therefore, the operations, features, and beneficial effects described above for the method also apply to the device and the modules and units contained therein, and will not be repeated here.
[0070] Figure 3 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 3As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330, and a communication bus 340, wherein the processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 can call logic instructions in the memory 330 to execute a method for detecting blurred images in a video. The method includes: determining a target image in the video and a blur value associated with the target image; acquiring the previous frame image of the target image and determining the blur value of the previous frame image, wherein both the blur value associated with the target image and the blur value of the previous frame image are less than a preset blur threshold; the previous frame image is the frame closest to the target image that has a blur value less than the preset blur threshold; calculating the motion-compensated image of the previous frame based on the target image using a motion compensation method and determining the blur value of the motion-compensated image of the previous frame; if the difference between the blur value of the previous frame image and the blur value of the motion-compensated image of the previous frame is not within a preset range, comparing the blur value associated with the target image and the blur value of the previous frame image, and determining the image with the larger blur value as the blurred image.
[0071] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0072] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer is able to execute the detection method for blurred images in video provided by the above methods, the method including: determining an image to be detected in a video and a blur value associated with the image to be detected; acquiring a previous frame image of the image to be detected and determining the blur value of the previous frame image, wherein both the blur value associated with the image to be detected and the blur value of the previous frame image are less than a preset blur threshold, the previous frame image is the frame closest to the image to be detected that has a blur value less than the preset blur threshold; calculating a motion-compensated image of the previous frame based on the image to be detected using a motion compensation method, and determining the blur value of the motion-compensated image of the previous frame; if the difference between the blur value of the previous frame image and the blur value of the motion-compensated image of the previous frame is not within a preset range, comparing the blur value associated with the image to be detected and the blur value of the previous frame image, and determining the image with the larger blur value as the blurred image.
[0073] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the aforementioned methods for detecting blurred images in a video. The method includes: determining a target image in the video and a blur value associated with the target image; acquiring a previous frame image of the target image and determining the blur value of the previous frame image, wherein both the blur value associated with the target image and the blur value of the previous frame image are less than a preset blur threshold; the previous frame image is the closest frame to the target image that has a blur value less than the preset blur threshold; calculating a motion-compensated image of the previous frame based on the target image using a motion compensation method, and determining the blur value of the motion-compensated image of the previous frame; if the difference between the blur value of the previous frame image and the blur value of the motion-compensated image of the previous frame is not within a preset range, comparing the blur value associated with the target image and the blur value of the previous frame image, and determining the image with the larger blur value as the blurred image.
[0074] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0075] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0076] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting a blurred image in a video, characterized in that, The method comprises the following steps: determining a to-be-detected image in a video and a blur value associated with the to-be-detected image, obtaining a previous frame image of the to-be-detected image and determining a blur value associated with the previous frame image, the blur value associated with the to-be-detected image and the blur value associated with the previous frame image are both less than a preset blur threshold, the previous frame image is an image in front of the to-be-detected image, and the blur value of the image is less than the preset blur threshold; the determination of the to-be-detected image in the video and the blur value associated with the to-be-detected image, the obtaining of the previous frame image of the to-be-detected image and the determination of the blur value associated with the previous frame image, comprises: determining a to-be-detected image in a video, dividing the to-be-detected image into at least one region, and determining a blur value of each region of the to-be-detected image; obtaining a previous frame image of the to-be-detected image, dividing the previous frame image into at least one region, and determining a blur value of each region of the previous frame image; wherein each region of the to-be-detected image corresponds to each region of the previous frame image one by one; calculating a previous frame motion compensation image from the to-be-detected image by a motion compensation method and determining a blur value of the previous frame motion compensation image; the calculation of the previous frame motion compensation image from the to-be-detected image by the motion compensation method and the determination of the blur value of the previous frame motion compensation image, comprises: for each region of the to-be-detected image, calculating a region of the previous frame motion compensation image from the region of the to-be-detected image by the motion compensation method, and determining a blur value of the region of the previous frame motion compensation image, each region of the previous frame motion compensation image corresponds to each region of the previous frame image one by one; the calculation of each region of the previous frame motion compensation image from each region of the to-be-detected image by the motion compensation method and the determination of the blur value of each region of the previous frame motion compensation image, comprises: for each region of the to-be-detected image, moving the pixels in the region according to a preset movement rule, calculating a candidate region of the previous frame motion compensation image by the motion compensation method after each movement, determining the similarity between the candidate region of the previous frame motion compensation image and the corresponding region of the previous frame image, selecting the candidate region with the largest similarity as the region of the previous frame motion compensation image, and determining the blur value of the region of the previous frame motion compensation image; if the difference between the blur value associated with the previous frame image and the blur value of the previous frame motion compensation image is not within a preset range, then comparing the blur value associated with the to-be-detected image and the blur value associated with the previous frame image, and determining the image with the larger blur value as the blurred image.
2. The method for detection of blurred images in video according to claim 1, characterized in that, Before the determination of the to-be-detected image in the video and the blur value associated with the to-be-detected image, the method further comprises: determining a blur value of each frame image in the video, judging whether the blur value of each frame image is greater than or equal to a preset blur threshold, determining an image with a blur value greater than or equal to the preset blur threshold as a blurred image, and determining an image with a blur value less than the preset blur threshold as a to-be-detected image.
3. The method for detection of blurred images in video according to claim 1, characterized in that, The determining of the image to be detected in the video and the blur value associated with the image to be detected comprises: The determining of the image to be detected in the video and the blur value associated with the image to be detected comprises judging whether the image to be detected is a first frame image, and if the image to be detected is not a first frame image, obtaining a previous frame image of the image to be detected and determining a blur value associated with the previous frame image.
4. The method for detecting blurred images in a video according to any one of claims 1 to 3, characterized in that, The comparing of the blur value associated with the image to be detected and the blur value associated with the previous frame image, and the determining of the image with the larger blur value as a blurred image, comprises: The comparing of the blur value of the region of the previous frame image and the blur value of the corresponding region of the previous frame motion compensation image, and the determining of the region with the larger blur value as a blurred region, comprises:
5. The method for detection of blurred images in video according to claim 4, characterized in that, The method further comprises: The method further comprises marking the blurred region.
6. An apparatus for detecting a blurred image in a video, characterized by, The device is applied to the method for detecting a blurred image in a video according to any one of claims 1 to 5, and the device comprises: A first processing module is configured to determine an image to be detected in a video and a blur value associated with the image to be detected, obtain a previous frame image of the image to be detected and determine a blur value associated with the previous frame image, and the blur value associated with the image to be detected and the blur value associated with the previous frame image are both less than a preset blur threshold, wherein the previous frame image is a frame image closest to the image to be detected and having a blur value less than the preset blur threshold; A second processing module is configured to calculate a previous frame motion compensation image by a motion compensation method according to the image to be detected, and determine a blur value of the previous frame motion compensation image; A third processing module is configured to compare the blur value associated with the image to be detected and the blur value associated with the previous frame image if a difference between the blur value associated with the previous frame image and the blur value of the previous frame motion compensation image is not within a preset range, and determine the image with the larger blur value as a blurred image.
7. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the steps of the method for detecting a blurred image in a video according to any one of claims 1 to 5 when executing the program.
8. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program implements the steps of the method for detecting a blurred image in a video according to any one of claims 1 to 5 when executed by the processor.
Citation Information
Patent Citations
Video stabilisation with deblurring
CN104380708A
Video deblurring method and device, equipment and storage medium
CN114359079A