Camera imaging blur processing method, device, equipment and medium

By obtaining the gradient value and frequency domain conversion of the camera video frame, combined with Fourier transform and Canny edge detection algorithm, the blurred area is processed, which solves the blurring problem under the influence of illumination and color changes in the existing technology, and improves the monitoring picture. clarity and recognition accuracy.

CN118351024BActive Publication Date: 2024-09-24HAINA CLOUD IOT TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410748976.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-09-24
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

Existing camera blur processing methods are greatly affected by lighting conditions and color changes, resulting in blurred image edges, affecting target detection and recognition effects, and unable to effectively improve the clarity of surveillance images.

Method used

By obtaining the gradient value of the camera video frame, the candidate blur area is determined, and frequency domain conversion is performed. Combined with Fourier transform and Canny edge detection algorithm, the target blur area is smoothed and the blur area is diluted.

Benefits of technology

It improves the clarity of surveillance images, enables accurate identification and judgment of target objects, events and behaviors, and enhances the accuracy of camera surveillance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118351024B
    Figure CN118351024B
Patent Text Reader

Abstract

The present application belongs to the field of image detection technology, and specifically relates to a camera imaging blur processing method, device, equipment and medium, including: obtaining a video frame shot by a camera at the current moment, and obtaining the gradient value of each pixel in the video frame; obtaining a candidate blur region according to the gradient value of each pixel; performing frequency domain conversion on the candidate blur region, obtaining the converted spectrum image information, and obtaining the target blur region according to the spectrum image information; smoothing the target video frame marked with the target blur region to reduce the blur of the target video frame. This method effectively improves the clarity of the monitoring screen, realizes accurate recognition and judgment of the target object, time and behavior, and improves the accuracy of camera monitoring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of image detection technology, and specifically relates to a camera imaging blur processing method, device, equipment and medium. Background Art

[0002] In some scenarios where cameras are required for monitoring, the cameras are often placed in glass covers to protect them from the external environment. However, over time, these glass covers often have various problems, including white spots caused by dust, water vapor or other dirt. These spots not only affect the clarity of the images taken by the camera, but also cause the risk of misjudgment and missed detection during monitoring.

[0003] In the prior art, some simple processing algorithms are usually used to identify and process blurred images. However, these processing methods are greatly affected by lighting conditions and color changes, and are sensitive to the specific distribution and changes of color information. They may cause the edges of the image to become blurred, thus affecting subsequent target detection and recognition tasks. Therefore, the clarity of the monitoring image cannot be effectively improved, but it will affect the accurate recognition and judgment of the target object, event and behavior. Summary of the invention

[0004] The present application provides a camera imaging blur processing method, device, equipment and medium to solve the problem that the clarity of the monitoring image cannot be effectively improved.

[0005] In a first aspect, the present application provides a camera imaging blur processing method, the method comprising:

[0006] Obtain a video frame captured by the camera at the current moment, and obtain a gradient value of each pixel in the video frame;

[0007] Obtaining a candidate fuzzy area according to the gradient value of each pixel;

[0008] Performing frequency domain conversion on the candidate blurred area to obtain the converted spectrum image information, and obtaining the target blurred area according to the spectrum image information;

[0009] The target video frame with the target blurred area marked thereon is smoothed to reduce the blur of the target video frame.

[0010] In a possible implementation, obtaining a candidate blur area according to the gradient value of each pixel point includes:

[0011] Compare the gradient value of each pixel with a first preset threshold to determine whether there is a pixel whose gradient value is less than the first preset threshold;

[0012] If yes, then mark the pixel points whose gradient value is less than the first preset threshold;

[0013] The marked pixels are connected to generate the candidate fuzzy region, and the candidate fuzzy region includes at least one sub-fuzzy region.

[0014] In a possible implementation, performing frequency domain conversion on the candidate blurred region to obtain converted spectrum image information includes:

[0015] Based on Fourier transform, converting the candidate blur region in the video frame into an initial amplitude spectrum image;

[0016] The amplitude of each frequency point of the initial amplitude spectrum image is converted so that the amplitude of each frequency point is converted into a real number, and the converted spectrum image information is obtained.

[0017] In a possible implementation manner, acquiring the target blurred area according to the spectrum image information includes:

[0018] Traversing the spectrum image information, comparing the amplitude of each frequency point in the spectrum image information with a second preset threshold, and marking the frequency points whose amplitude is lower than the second preset threshold;

[0019] Performing binary mask processing on the spectrum image information to obtain a frequency domain binary mask to distinguish the marked frequency points;

[0020] Performing inverse Fourier transform on the frequency domain binary mask to obtain a corresponding spatial domain binary image;

[0021] The spatial domain binary image and the video frame are weighted mixed to obtain a target blurred area marked in a target video frame.

[0022] In a possible implementation manner, the smoothing of the target video frame marking the target blurred area includes:

[0023] Based on the Canny edge detection algorithm, the contour of the target video frame is detected to obtain contour information, where the contour information is used to indicate the contour of the target blurred area;

[0024] According to the contour information, obtaining a smoothing value corresponding to the target blurred area;

[0025] The pixel values ​​of the target blurred area are replaced with the smoothed values ​​to obtain a processed target video frame.

[0026] In a possible implementation manner, acquiring a smoothing value corresponding to the target blurred area according to the contour information includes:

[0027] Select a preset number of target pixels on both sides of the contour in the contour information, and obtain the pixel value variance of the neighborhood corresponding to each target pixel, where each target pixel corresponds to a different area;

[0028] According to the pixel value variance of the neighborhood corresponding to each target pixel point, obtaining the average variance corresponding to the preset number of target pixel points;

[0029] Comparing the average variance with a third preset threshold, if the average variance is greater than the third preset threshold, the third preset threshold is the smoothing value;

[0030] If the average variance is less than or equal to a third preset threshold, the average variance is the smoothed value.

[0031] In a possible implementation manner, obtaining the gradient value of each pixel in the video frame includes:

[0032] Performing a convolution operation on the video frame through a gradient operator to obtain gradient images in the horizontal and vertical directions;

[0033] According to the gradient image, a gradient value corresponding to each pixel is calculated.

[0034] In a second aspect, the present application provides a camera imaging blur processing device, the device comprising:

[0035] An acquisition module is used to acquire a video frame captured by the camera at the current moment, and to acquire a gradient value of each pixel in the video frame;

[0036] The acquisition module is also used to acquire a candidate fuzzy area according to the gradient value of each pixel point;

[0037] A processing module, used for performing frequency domain conversion on the candidate blurred area, obtaining spectrum image information after conversion, and obtaining a target blurred area according to the spectrum image information;

[0038] The processing module is further configured to perform smoothing processing on the target video frame marking the target blurred area, so as to reduce the blur of the target video frame.

[0039] In a third aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method as described in any one of the first aspects.

[0040] In a fourth aspect, the present application provides an electronic device, comprising: at least one processor and a memory; wherein:

[0041] The memory stores computer-executable instructions;

[0042] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method as described in any one of the first aspects.

[0043] In a fifth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, can implement the method described in any one of the first aspects.

[0044] The camera imaging blur processing method, device, equipment and medium provided in the present application obtain the gradient value of each pixel in the video frame by obtaining the video frame taken by the camera at the current moment. According to the gradient value of each pixel, the candidate blur area is determined, and the candidate blur area is converted into the frequency domain to obtain the converted spectrum image information, and the target blur area is determined according to the spectrum image information. The target video frame with the target blur area marked is smoothed to reduce the blur of the target video frame. This method effectively improves the clarity of the monitoring screen, realizes the accurate recognition and judgment of the target object, time and behavior, and improves the accuracy of camera monitoring. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0046] Figure 1 The process of the camera imaging blur processing method provided in the embodiment of the present application Figure 1 ;

[0047] Figure 2 The process of the camera imaging blur processing method provided in the embodiment of the present application Figure 2 ;

[0048] Figure 3 The process of the camera imaging blur processing method provided in the embodiment of the present application Figure 3 ;

[0049] Figure 4 A diagram of a camera imaging blur processing device provided by an embodiment of the present invention;

[0050] Figure 5 A hardware schematic diagram of an electronic device provided by an embodiment of the present invention.

[0051] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0053] The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of the present invention and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in sequences other than those illustrated or described herein, for example.

[0054] In the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0055] Over the years, with the popularization of high-definition video technology and the in-depth development of computer vision technology, cameras have been increasingly widely used in various fields. However, in actual applications, the images captured by cameras often become blurred for various reasons, which may be due to improper focus, lens contamination, insufficient light, motion blur and other factors. Blurred images not only reduce the clarity of the monitoring images, but are also likely to affect the computer vision algorithm's accurate recognition and judgment of target objects, events and behaviors. For example, in elevator scenarios, in order to improve the safety and management efficiency of elevators, cameras are often installed inside elevators for monitoring. However, these cameras are often placed in glass covers to protect them from the external environment. But over time, these glass covers often have various problems, including white spots caused by dust, water vapor or other dirt. These spots not only affect the clarity of the images captured by the camera, but may also bring the risk of misjudgment and missed detection of battery vehicles to the monitoring system, adding potential threats to the safety of residential buildings.

[0056] In the field of security monitoring, the detection of camera blur is extremely important. First, it can detect abnormalities in the working state of the camera in a timely manner, so as to carry out maintenance and adjustments in time to ensure that the camera can continue to provide high-quality monitoring images. Secondly, for blurry images caused by insufficient light or motion blur, blur detection algorithms can assist other computer vision algorithms, such as target detection and behavior recognition.

[0057] However, existing camera blur processing methods are greatly affected by lighting conditions and color changes, and are sensitive to the specific distribution and changes of color information. When processing blurred areas, the edges of the image may become blurred, thus affecting subsequent target detection and recognition tasks. The performance of some algorithms is greatly affected by parameter settings, and inappropriate parameter settings lead to poor detection results.

[0058] In view of the above problems, the present application provides a camera imaging blur processing method, by obtaining the video frame shot by the camera at the current moment, further obtaining the gradient value of each pixel in the video frame. According to the gradient value of each pixel, the candidate blur area is determined, and the candidate blur area is converted into the frequency domain, the converted spectrum image information is obtained, and the target blur area is determined according to the spectrum image information. The target video frame marking the target blur area is smoothed to make the blur of the target video frame fade. By combining the two methods of gradient analysis and frequency domain analysis, the technical advantages of the two methods are combined, and the blur area can be more accurately identified and processed. Gradient analysis can capture the edge and texture information of the image, while frequency domain analysis can provide the frequency characteristics of the blur area. The combination of the two makes blur detection more comprehensive and accurate. The analyzed blur area is blurred and faded to maintain the details and texture information of the image. This method effectively improves the clarity of the monitoring screen, realizes accurate identification and judgment of target objects, time and behavior, and improves the accuracy of camera monitoring.

[0059] In summary, the present invention overcomes the defects of the prior art and provides a more robust and efficient method for processing unclear images caused by camera stains and other reasons in various complex scenes, which has significant technical advantages.

[0060] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments may exist independently or in combination with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0061] Figure 1 The process of the camera imaging blur processing method provided in the embodiment of the present application Figure 1 .like Figure 1 As shown, the method includes:

[0062] S101, obtaining a video frame captured by a camera at a current moment, and obtaining a gradient value of each pixel in the video frame.

[0063] In this step, in general monitoring scenarios, the camera usually continuously monitors the scene of the shooting environment, and the captured video screen is actually composed of multiple continuous frames. By performing fuzzy analysis and processing on each video frame, the video stream shot by the camera can be made clear. The gradient value reflects the rate of change of the pixel value in the image and can reveal features such as edges and textures in the image. When calculating the gradient of the pixel points in the video frame, the gradient operator (such as Sobel, Roberts, Prewitt, etc.) can be used for calculation.

[0064] Exemplarily, obtaining the gradient value of each pixel in the video frame includes:

[0065] Performing a convolution operation on the video frame through a gradient operator to obtain gradient images in the horizontal and vertical directions;

[0066] According to the gradient image, a gradient value corresponding to each pixel is calculated.

[0067] It should be noted that the Sobel gradient operator can be used to perform convolution operations on the image to calculate the gradient value of each pixel. and Perform convolution operation to obtain gradient images in the horizontal and vertical directions and Then, the gradient magnitude G of each pixel can be calculated by the following formula: .

[0068] S102: Obtain a candidate blurred area according to the gradient value of each pixel.

[0069] In this step, the calculated gradient value can be analyzed to obtain the distribution of the gradient value, so that based on the statistical distribution of the gradient value, an adaptive threshold method is used to dynamically calculate the threshold according to the local characteristics of the image to distinguish between clear areas and blurred areas. The analysis of the gradient value means a quantitative analysis of the gradient value. By calculating the gradient value of each pixel in the image, a set of these gradient values ​​is obtained, and then these values ​​are sorted and described. The statistical analysis can include calculating the average value, median, standard deviation, minimum value, maximum value and other statistics of the gradient value, so as to have a comprehensive understanding of the distribution characteristics of the gradient value. These statistics can reflect the central tendency and dispersion degree of the image gradient change, and provide a basis for the subsequent adaptive threshold calculation. When the adaptive threshold algorithm is used, these statistics will be used to determine the appropriate threshold, which can be dynamically adjusted according to the different characteristics of the clear area and the blurred area in the image. Usually, the gradient value of the clear area will be larger than that of the blurred area, so these areas can be identified by setting a higher threshold. On the contrary, the gradient value of the blurred area is small, and a lower threshold can be used for detection. In addition, the gradient can also be judged by presetting a fixed threshold, and the setting of the threshold is not limited here.

[0070] By identifying the area formed by the pixels whose gradient values ​​are lower than the threshold, it is marked as a potential blurred area, i.e., a candidate blurred area. It should be understood that when there are stains or other conditions on the camera, the generated blurred areas may not be regularly distributed, and there may be multiple smaller blurred areas. Therefore, when the pixels filtered by the gradient value are obtained, the possible blurred areas can be obtained by connecting them using the corresponding algorithm. Exemplarily, a regional growing algorithm can be used, starting from a set of seed points, and similar pixels are gradually merged into the same area. In blurred area detection, pixels with gradient values ​​lower than a certain threshold can be used as seed points, and then adjacent pixels are gradually added to the area until no more pixels can be added. Alternatively, using the level set method, the blurred area can be separated from the background by evolving the level set. In addition, similar algorithms such as the graph cut algorithm can also be used to determine the blurred area, which is not limited here.

[0071] Exemplarily, obtaining a candidate blur area according to the gradient value of each pixel point includes:

[0072] Compare the gradient value of each pixel with a first preset threshold to determine whether there is a pixel whose gradient value is less than the first preset threshold;

[0073] If yes, then mark the pixel points whose gradient value is less than the first preset threshold;

[0074] The marked pixels are connected to generate the candidate fuzzy region, and the candidate fuzzy region includes at least one sub-fuzzy region.

[0075] It should be noted that the camera can first determine the existence of the blurred area before analyzing and processing the blurred area. Therefore, when comparing the gradient value of the pixel point with the first preset threshold, it is achieved by confirming whether there is a pixel point with a gradient value less than the first preset threshold. When there is a pixel point with a gradient value less than the first preset threshold, it means that there is a blurred area in the picture captured by the current camera, and further processing can be performed. Otherwise, it means that no subsequent processing is required.

[0076] S103 , performing frequency domain conversion on the candidate blurred area to obtain spectrum image information after the conversion, and obtaining a target blurred area according to the spectrum image information.

[0077] In this step, the candidate blurred area can be further converted to the frequency domain, and the image can be converted from the spatial domain to the frequency domain, which can be achieved by Fourier transform. In the frequency domain, the information of the image will be decomposed into components of different frequencies, and the high-frequency components usually correspond to the edge and detail information in the image. In order to analyze and process the image converted to the frequency domain, after further refining the blurred area, it is marked and enhanced so that the outline of the blurred area is clearer. Exemplarily, the image converted to the frequency domain can be further processed by binary masking to distinguish the blurred area from the clear area, so that the image converted back to the spatial domain presents the blurred area more clearly and accurately. The spectrum image information represents the spectrum image of the blurred area after the frequency domain conversion, or includes the spectrum image after further enhancement processing of the spectrum image. After the image is converted to the frequency domain and analyzed in the frequency domain, an inverse transformation can be performed on the frequency domain image to convert it back to the spatial domain image, so that the blurred area in the spatial domain image is subsequently deblurred. Therefore, the target blurred area represents the area where the frequency domain image has been inversely transformed back to the spatial domain image.

[0078] S104: Smoothing the target video frame with the target blurred area marked thereon to reduce blur of the target video frame.

[0079] In this step, after determining the target blurred area, the edge detection algorithm can be used to refine the outline of the target blurred area in the target video frame to ensure the accuracy and clarity of the outline. Further, based on the outline of the blurred area, a certain number of pixels can be taken around it, and the variance value of each pixel can be calculated to map it to a smoothing value, thereby determining the degree to which the blurred area needs to be smoothed. Finally, the blurred area is faded based on the obtained smoothing value, and the pixel value of the blurred area is smoothed to reduce the difference with the background and maintain the details and texture information of the image.

[0080] The camera imaging blur processing method provided in this embodiment obtains the gradient value of each pixel in the video frame by obtaining the video frame taken by the camera at the current moment. According to the gradient value of each pixel, the candidate blur region is determined, and the candidate blur region is converted into the frequency domain to obtain the converted spectrum image information, and the target blur region is determined according to the spectrum image information. The target video frame with the target blur region marked is smoothed to reduce the blur of the target video frame. This method effectively improves the clarity of the monitoring screen, realizes the accurate recognition and judgment of the target object, time and behavior, and improves the accuracy of camera monitoring.

[0081] Figure 2 The process of the camera imaging blur processing method provided in the embodiment of the present application Figure 2 .like Figure 2 As shown, in this embodiment Figure 1 Based on the embodiment, the process of obtaining the target fuzzy area is described in detail. The method includes:

[0082] S201. Obtain a candidate blurred area according to the gradient value of each pixel.

[0083] This step is the same as S102 and will not be described again here.

[0084] S202: Based on Fourier transform, convert the candidate blurred area in the video frame into an initial amplitude spectrum image.

[0085] In this step, the image is converted from the spatial domain to the frequency domain through Fourier transform. The Fourier transform formula is as follows:

[0086]

[0087] in, Represents the pixel value in the original image (i.e., video frame), and x and y represent the horizontal and vertical positions of the pixel, respectively. represents the initial amplitude spectrum image after Fourier transformation, where u and v are variables in the frequency domain. M and N refer to the height and width of the image respectively.

[0088] S203 , converting the amplitude of each frequency point of the initial amplitude spectrum image so that the amplitude of each frequency point is converted into a real number, and obtaining converted spectrum image information.

[0089] In this step, when it comes to Fourier transform and spectrum analysis, the results of the two-dimensional discrete Fourier transform (DFT) of an image are usually traversed. The result of DFT is a complex matrix in which each element corresponds to a specific frequency point The modulus (or magnitude) of this complex matrix is ​​often used to represent spectral images because it provides information about the intensity of different frequency components in the image.

[0090] Traversing the amplitude spectrum image means for each frequency point However, directly iterating over the modulus (i.e., magnitude) of a complex matrix does not involve computation of the complex numbers themselves, since the modulus is a real number. For example, if we use To represent the DFT at the frequency point , then the amplitude of the point It can be calculated by the following formula:

[0091] ,

[0092] in, and Respectively The real and imaginary parts of .

[0093] S204 , traverse the spectrum image information, compare the amplitude of each frequency point in the spectrum image information with a second preset threshold, and mark the frequency points whose amplitude is lower than the second preset threshold.

[0094] In this step, due to the loss of high-frequency information in the blurred area, its high-frequency components in the frequency domain representation are reduced. In the blurred area, there are fewer high-frequency components in the amplitude spectrum. In the clear area, there are more high-frequency components in the amplitude spectrum. According to the amplitude spectrum of the image, a threshold of the high-frequency component is set to distinguish between the clear area and the blurred area. Traverse the amplitude spectrum image, for each frequency point, if the high-frequency component is lower than the set threshold, it is considered that the spatial domain area corresponding to the frequency point is blurred. On the contrary, it is considered that the spatial domain area corresponding to the frequency point is clear. The second preset threshold is used to compare the amplitude of the high-frequency component of each frequency point with the size of the threshold. This threshold can be fixed or dynamically adjusted according to the image characteristics. The setting of the second preset threshold can be based on the empirical method, that is, the previous experience and the professional knowledge of image processing, to pre-set the corresponding appropriate threshold; or the characteristics of the image, such as noise level, edge strength and texture details, can be analyzed to determine a suitable threshold. For example, if the image noise is low, a higher threshold may be required to distinguish between clear and blurred areas. In addition, automatic threshold determination algorithms such as Otsu method, Wavelet threshold, etc. can also be used. These algorithms can automatically select thresholds based on the statistical characteristics of the image to maximize the distinction between clear and blurred areas in the image. The specific method of setting the threshold is not limited here.

[0095] When marking the frequency points whose amplitude is lower than the second preset threshold, illustratively, a data structure method can be used, that is, a list, a set or other data structure can be used to record the coordinates or indexes of all frequency points lower than the threshold; or different colors or patterns can be used to visually mark the frequency points lower than the threshold on the image. Optionally, the identified frequency points can also be directly marked and distinguished through the following binary mask step.

[0096] S205 , performing binary mask processing on the spectrum image information to obtain a frequency domain binary mask to distinguish the marked frequency points.

[0097] S206: Perform inverse Fourier transform on the frequency domain binary mask to obtain a corresponding space domain binary image.

[0098] In the binary mask processing, a frequency domain binary mask of the same size as the spectrum image can be created. For frequency points in the spectrum image that are higher than the threshold, the corresponding positions in the mask are set to 1 (or white), indicating that these frequency points correspond to clear areas; for frequency points in the spectrum image that are lower than the threshold, the corresponding positions in the mask are set to 0 (or black), indicating that these frequency points correspond to blurred areas.

[0099] In the inverse Fourier transform, the frequency domain binary mask is inversely Fourier transformed to obtain a spatial domain binary image. The inverse Fourier transform formula is as follows:

[0100] ,

[0101] in, represents the frequency domain binary mask, u and v are frequency variables in the frequency domain, Represents a binary image in the spatial domain after inverse Fourier transform. x and y refer to the coordinates in the spatial domain, and M and N refer to the height and width of the image, respectively.

[0102] S207 , performing weighted mixing processing on the spatial domain binary image and the video frame to obtain a target blurred area marked in a target video frame.

[0103] In this step, the binary image in the spatial domain is weighted mixed with the original image to achieve superposition or fusion of the binary image and the original image (i.e., video frame) to mark the clear and blurred areas on the original image, and the target video frame represents the image containing the marked blurred area. This step is to correspond the analysis results in the frequency domain with the original image for the convenience of subsequent processing.

[0104] Weighted blending processing represents the process of fusing binary images in the spatial domain in a video frame to achieve the purpose of highlighting the target blurred area marked in the spatial domain. Exemplarily, weighted blending can be implemented by a variety of algorithms, such as simple superposition, linear weighting, nonlinear weighting, etc. Simple superposition is to add the binary image directly to the video frame. Linear or nonlinear weighting involves more complex operations, and each pixel of the video frame is adjusted according to a predetermined weight. The predetermined weight function needs to be able to assign weights according to the importance of the frequency point in the spectrum image information. The weight assignment may be based on the amplitude size or other characteristics of the frequency point. Optionally, since the binary image is usually black and white, it may not match the brightness of the video frame, so it is necessary to adjust the brightness of the video frame to ensure that the fused image is both in line with the visual effect and not overly distorted. In addition, some optimization algorithms can be used to ensure the smoothness of the fusion process to avoid over-sharp edges or other visually unnatural phenomena. Optionally, when implementing weighted blending, numerical methods need to be used to ensure the accuracy and efficiency of the operation. For example, the Fast Fourier Transform (FFT) can be used to speed up the inverse Fourier transform and image blending process.

[0105] The camera imaging blur processing method provided in this embodiment converts the video frame into the frequency domain based on Fourier transform, so as to perform frequency domain analysis. The pixel points of the blurred area identified by analysis are subjected to binary mask processing, and the inverse Fourier transform is performed on them to make the outline of the blurred area clearer. The video frame and the inverse transformed spatial domain binary image are fused to mark the blurred area on the original image. The method further accurately analyzes and determines the blurred area extracted by gradient analysis, so as to make the blur detection more comprehensive and accurate.

[0106] Figure 3 The process of the camera imaging blur processing method provided in the embodiment of the present application Figure 3 .like Figure 3 As shown, in this embodiment Figure 2 Based on the embodiment, the process of smoothing the target video frame marked with the target blurred area is described in detail. The method includes:

[0107] S301. Detect the contour of the target video frame based on the Canny edge detection algorithm to obtain contour information, where the contour information is used to indicate the contour of the target blurred area.

[0108] S302: Obtain a smoothing value corresponding to the target blurred area according to the contour information.

[0109] The Canny edge detection algorithm is used to detect the edges of the target video frame and further refine the contour. The Canny edge detection algorithm can extract strong edge information in the image, which helps to locate the blurred area more accurately. The contour information represents the position, shape, and size of the contour of the blurred area, that is, the contour of the blurred area is located.

[0110] Exemplarily, obtaining a smoothing value corresponding to the target blurred area according to the contour information includes:

[0111] Select a preset number of target pixels on both sides of the contour in the contour information, and obtain the pixel value variance of the neighborhood corresponding to each target pixel, where each target pixel corresponds to a different area;

[0112] According to the pixel value variance of the neighborhood corresponding to each target pixel point, obtaining the average variance corresponding to the preset number of target pixel points;

[0113] Comparing the average variance with a third preset threshold, if the average variance is greater than the third preset threshold, the third preset threshold is the smoothing value;

[0114] If the average variance is less than or equal to a third preset threshold, the average variance is the smoothed value.

[0115] For example, the variance of the inner pixel value of each pixel in the neighborhood N×N window can be calculated based on a preset number of target pixel points on both sides of the contour, for example, 20 pixel points. In the neighborhood of N×N, the variance of the inner pixel value of each pixel in the neighborhood of N×N window is included. pixels. The pixel value of each pixel in the neighborhood is expressed as , where i represents the row number, j represents the column number, i,j=1,2,...,N.

[0116] Furthermore, the mean of the pixel values ​​in the neighborhood is calculated : ;

[0117] Furthermore, the deviation of each pixel from the mean is calculated: ;

[0118] Furthermore, the square of the deviation is calculated The average value of: .

[0119] Through the above steps, the variance of the pixel values ​​in the neighborhood corresponding to the preset number of target pixels can be obtained. , according to the variance Calculate the average variance of a preset number of target pixels , the average variance The calculation formula is , where n represents the preset number of target pixels.

[0120] The mean variance Compared with the third preset threshold T, when the average variance When the average variance is greater than the threshold value T, the smoothing value takes a smaller value T; When it is less than or equal to the threshold T, the smoothing value takes the larger value This step is to determine the degree of smoothing to avoid loss of details due to over-smoothing.

[0121] The third preset threshold can be determined by analyzing a large amount of known image data in similar scenes, calculating the distribution of variance, and then selecting a threshold that can distinguish blurry areas from clear areas. Alternatively, a machine learning algorithm, such as a decision tree, support vector machine, etc., can be used to predict and determine the threshold based on the training data set.

[0122] S303: Replace the pixel value of the target blurred area with the smoothing value to obtain a processed target video frame.

[0123] In this step, the original value of each pixel in the target blurred area is replaced by the smoothing value. After the replacement is completed, a new video frame is obtained, and the blurred area in this frame is replaced by the smoothing value, thereby reducing the blur effect and achieving blur fading. In actual business scenarios, each frame of the image with a blurred area is processed to obtain a refined video stream to achieve the processing of camera imaging blur.

[0124] The camera imaging blur processing method provided in this embodiment detects the outline of the target video frame through an edge detection algorithm to accurately lock the outline of the target blur area. Further, the average variance of the pixel points around the outline is calculated, the smoothing value is determined, and smoothing processing is performed. The blur area in the video picture is effectively reduced, and the video quality is improved.

[0125] Figure 4 A camera imaging blur processing device diagram provided by an embodiment of the present invention, such as Figure 4 As shown, the device 40 includes: an acquisition module 401 and a processing module 402.

[0126] The acquisition module 401 is used to acquire the video frame captured by the camera at the current moment, and acquire the gradient value of each pixel in the video frame;

[0127] The acquisition module 401 is also used to acquire a candidate fuzzy area according to the gradient value of each pixel point;

[0128] The processing module 402 is used to perform frequency domain conversion on the candidate blurred area, obtain the converted spectrum image information, and obtain the target blurred area according to the spectrum image information;

[0129] The processing module 402 is further configured to perform smoothing processing on the target video frame with the target blurred area marked thereon, so as to reduce the blur of the target video frame.

[0130] Figure 5 Schematic diagram of the hardware of the electronic device provided by the embodiment of the present invention. Figure 5 As shown, the electronic device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. The device 50 also includes a communication component 503. The processor 501, the memory 502 and the communication component 503 are connected via a bus 504.

[0131] In a specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that at least one processor 501 executes the above method.

[0132] The specific implementation process of the processor 501 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0133] In the above Figure 5 In the illustrated embodiment, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0134] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.

[0135] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.

[0136] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method described above is implemented.

[0137] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0138] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0139] The division of the units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, which may be electrical, mechanical or other forms.

[0140] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0141] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0142] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0143] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0144] So far, the technical solution of the present application has been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific embodiments, and the above embodiments are only used to illustrate the technical solution of the present application rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A camera imaging fuzzy processing method, characterized in that: The method comprises: Obtain a video frame captured by the camera at the current moment, and obtain a gradient value of each pixel in the video frame; Obtaining a candidate fuzzy area according to the gradient value of each pixel; Performing frequency domain conversion on the candidate blurred area to obtain the converted spectrum image information, and obtaining the target blurred area according to the spectrum image information; Smoothing the target video frame marked with the target blur area to reduce the blur of the target video frame; The performing frequency domain conversion on the candidate fuzzy region to obtain converted spectrum image information includes: Based on Fourier transform, converting the candidate blur region in the video frame into an initial amplitude spectrum image; Converting the amplitude of each frequency point of the initial amplitude spectrum image so that the amplitude of each frequency point is converted into a real number, and obtaining converted spectrum image information; The step of obtaining the target blurred area according to the spectrum image information includes: Traversing the spectrum image information, comparing the amplitude of each frequency point in the spectrum image information with a second preset threshold, and marking the frequency points whose amplitude is lower than the second preset threshold; Performing binary mask processing on the spectrum image information to obtain a frequency domain binary mask to distinguish the marked frequency points; Performing inverse Fourier transform on the frequency domain binary mask to obtain a corresponding space domain binary image; Performing weighted mixing processing on the spatial domain binary image and the video frame to obtain a target blurred area marked in a target video frame; The step of smoothing the target video frame marked with the target blurred area comprises: Based on the Canny edge detection algorithm, the contour of the target video frame is detected to obtain contour information, where the contour information is used to indicate the contour of the target blurred area; According to the contour information, obtaining a smoothing value corresponding to the target blurred area; The pixel values ​​of the target blurred area are replaced with the smoothed values ​​to obtain a processed target video frame.

2. The method according to claim 1, characterized in that The step of obtaining a candidate fuzzy area according to the gradient value of each pixel point includes: Compare the gradient value of each pixel with a first preset threshold to determine whether there is a pixel whose gradient value is less than the first preset threshold; If yes, then mark the pixel points whose gradient value is less than the first preset threshold; The marked pixels are connected to generate the candidate fuzzy region, and the candidate fuzzy region includes at least one sub-fuzzy region.

3. The method according to claim 1, characterized in that The step of obtaining a smoothing value corresponding to the target blurred area according to the contour information includes: Select a preset number of target pixels on both sides of the contour in the contour information, and obtain the pixel value variance of the neighborhood corresponding to each target pixel, where each target pixel corresponds to a different area; According to the pixel value variance of the neighborhood corresponding to each target pixel point, obtaining the average variance corresponding to the preset number of target pixel points; Comparing the average variance with a third preset threshold, if the average variance is greater than the third preset threshold, the third preset threshold is the smoothing value; If the average variance is less than or equal to a third preset threshold, the average variance is the smoothed value.

4. The method according to claim 1, characterized in that: The obtaining of the gradient value of each pixel in the video frame includes: Performing a convolution operation on the video frame through a gradient operator to obtain gradient images in the horizontal and vertical directions; According to the gradient image, a gradient value corresponding to each pixel is calculated.

5. A camera imaging blur processing device, characterized in that: The device comprises: An acquisition module is used to acquire a video frame captured by the camera at the current moment, and to acquire a gradient value of each pixel in the video frame; The acquisition module is also used to acquire a candidate fuzzy area according to the gradient value of each pixel point; A processing module, used for performing frequency domain conversion on the candidate blurred area, obtaining spectrum image information after conversion, and obtaining a target blurred area according to the spectrum image information; The processing module is further used for performing smoothing processing on the target video frame marked with the target blurred area, so as to reduce the blur of the target video frame; The processing module is specifically used to: convert the candidate blur region in the video frame into an initial amplitude spectrum image based on Fourier transform; Converting the amplitude of each frequency point of the initial amplitude spectrum image so that the amplitude of each frequency point is converted into a real number, and obtaining converted spectrum image information; The processing module is further specifically used for: Traversing the spectrum image information, comparing the amplitude of each frequency point in the spectrum image information with a second preset threshold, and marking the frequency points whose amplitude is lower than the second preset threshold; Performing binary mask processing on the spectrum image information to obtain a frequency domain binary mask to distinguish the marked frequency points; Performing inverse Fourier transform on the frequency domain binary mask to obtain a corresponding space domain binary image; Performing weighted mixing processing on the spatial domain binary image and the video frame to obtain a target blurred area marked in a target video frame; The processing module is further specifically used for: Based on the Canny edge detection algorithm, the contour of the target video frame is detected to obtain contour information, where the contour information is used to indicate the contour of the target blurred area; According to the contour information, obtaining a smoothing value corresponding to the target blurred area; The pixel values ​​of the target blurred area are replaced with the smoothed values ​​to obtain a processed target video frame.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 4 when executed by a processor.

7. An electronic device, characterized in that: include: at least one processor and memory; wherein, The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 4.