Image deblurring method and device, computer equipment and readable storage medium
Through Fourier transform and autocorrelation processing technology, the blur angle and length are estimated, the blur kernel is determined, and the blurred image is restored, which solves the problem of low efficiency of traditional methods and achieves efficient processing of image deblurring in the field of autonomous driving.
Patent Information
- Application Number
- CN202410732411.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-10-08
AI Technical Summary
Traditional image deblurring methods are inefficient and difficult to effectively process motion blurred images. Especially in the field of autonomous driving, the common blurring phenomenon during image acquisition is difficult to restore.
Obtain the spectrogram through Fourier transform, estimate the blur angle and length, determine the blur kernel, restore the blurred image, and obtain the deblurred image. Specific steps include performing differential processing and autocorrelation processing on the blurred image, analyzing the two-dimensional gradient image and autocorrelation curve, determining the blur length, and constructing a blur kernel based on the blur length and angle for image restoration.
It improves the efficiency and accuracy of image deblurring, reduces implementation costs, makes images easier to identify, and is suitable for deblurring motion blurred images in the field of autonomous driving.
Smart Images

Figure CN118747728A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of autonomous driving technology, and in particular to an image deblurring method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] At present, image recognition in the field of autonomous driving is mainly divided into the following core scenarios, namely, radar cloud map recognition, obstacle recognition on the way, driving area recognition, traffic sign recognition and optical flow recognition. In the process of image acquisition, because the shooting scene and the photographed object are in a constantly changing state, and precisely because image acquisition can only record object information at a moment in time, the obtained image content is often more prone to blurring, and it is usually difficult to restore it after motion blur occurs.
[0003] Traditional image deblurring methods use regularization terms to establish constraint models, such as regularization models based on non-local averages, which use local image similarities to smooth images in a relatively gentle manner. In addition, there are some regularization models based on convex relaxation techniques that can transform image restoration problems into convex optimization problems and achieve image deblurring by solving convex problems. However, traditional methods are relatively difficult to implement and have the problem of low image deblurring efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide an image deblurring method, apparatus, computer device, computer-readable storage medium and computer program product that can improve the image deblurring efficiency in response to the above technical problems.
[0005] In a first aspect, the present application provides an image deblurring method, comprising:
[0006] Acquire a blurred image, and perform Fourier transform on the blurred image to obtain a spectrum diagram;
[0007] Estimate the blur angle according to the projection values of the spectrum at different tilt angles;
[0008] Perform differentiation and autocorrelation processing on the blurred image to determine the blur length;
[0009] The blur kernel is determined according to the blur length and blur angle, and the blurred image is restored according to the blur kernel to obtain a deblurred image.
[0010] In one embodiment, performing differentiation processing and autocorrelation processing on the blurred image to determine the blur length includes:
[0011] Perform differentiation processing on the blurred image to obtain a two-dimensional gradient image;
[0012] Perform autocorrelation processing on the two-dimensional gradient image to obtain an autocorrelation curve;
[0013] The blur length is determined based on the correlation peak in the autocorrelation curve.
[0014] In one embodiment, determining the blur length according to the correlation peak in the autocorrelation curve includes:
[0015] If there are multiple correlation peaks, the distance between each adjacent correlation peak is obtained;
[0016] If the difference between the distance of any adjacent correlation peak and the mean distance of other adjacent correlation peaks is within the difference range, and the discrete degree of the distance of each adjacent correlation peak is within the preset degree range, the distance of the adjacent correlation peaks is used as the fuzzy length.
[0017] In one embodiment, restoring the blurred image according to the blur kernel to obtain the deblurred image includes:
[0018] The blur kernel is normalized to obtain a normalized blur kernel;
[0019] The blurred image is restored according to the normalized blur kernel to obtain the deblurred image.
[0020] In one embodiment, restoring the blurred image according to the blur kernel to obtain the deblurred image includes:
[0021] Obtain the minimum criterion function and construct the Lagrangian function corresponding to the minimum criterion function;
[0022] Based on the derivative of the Lagrangian function, the frequency domain expression of the deblurred image is obtained;
[0023] The deblurred image is obtained based on the frequency domain expression.
[0024] In one embodiment, estimating the blur angle according to the projection values of the spectrum at different tilt angles includes:
[0025] Find the maximum value among the projection values of the spectrum graph at different tilt angles;
[0026] The tilt angle corresponding to the maximum value is used as the blur angle.
[0027] In a second aspect, the present application also provides an image deblurring device, comprising:
[0028] An acquisition module is used to acquire a blurred image and perform Fourier transform on the blurred image to obtain a spectrum diagram;
[0029] An estimation module, used for estimating blur angles according to projection values of the spectrum graph at different tilt angles;
[0030] A determination module, used for performing differentiation and autocorrelation processing on the blurred image to determine the blur length;
[0031] The restoration module is used to determine the blur kernel according to the blur length and the blur angle, and restore the blurred image according to the blur kernel to obtain a deblurred image.
[0032] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0033] Acquire a blurred image, and perform Fourier transform on the blurred image to obtain a spectrum diagram;
[0034] Estimate the blur angle according to the projection values of the spectrum at different tilt angles;
[0035] Perform differentiation and autocorrelation processing on the blurred image to determine the blur length;
[0036] The blur kernel is determined according to the blur length and blur angle, and the blurred image is restored according to the blur kernel to obtain a deblurred image.
[0037] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0038] Acquire a blurred image, and perform Fourier transform on the blurred image to obtain a spectrum diagram;
[0039] Estimate the blur angle according to the projection values of the spectrum at different tilt angles;
[0040] Perform differentiation and autocorrelation processing on the blurred image to determine the blur length;
[0041] The blur kernel is determined according to the blur length and blur angle, and the blurred image is restored according to the blur kernel to obtain a deblurred image.
[0042] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0043] Acquire a blurred image, and perform Fourier transform on the blurred image to obtain a spectrum diagram;
[0044] Estimate the blur angle according to the projection values of the spectrum at different tilt angles;
[0045] Perform differentiation and autocorrelation processing on the blurred image to determine the blur length;
[0046] The blur kernel is determined according to the blur length and blur angle, and the blurred image is restored according to the blur kernel to obtain a deblurred image.
[0047] The above-mentioned image deblurring method, device, computer equipment, computer-readable storage medium and computer program product estimate the blur angle by the projection value of the spectrum diagram corresponding to the blurred image at different tilt angles, which is conducive to obtaining an accurate blur angle; differential processing of the blurred image is conducive to highlighting the changing part in the image, and autocorrelation processing of the blurred image is conducive to analyzing the periodicity and trend of the time series in the image. For motion blurred images, it is conducive to obtaining the blur length; based on the blur length and blur angle, the blur kernel can be determined, and the blurred image is restored by the blur kernel to obtain a deblurred image. With this image deblurring method, the image is easier to be recognized, the implementation cost of image deblurring is relatively low, and it is conducive to improving the efficiency of image deblurring. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0049] Figure 1 A diagram showing an application environment of an image deblurring method in one embodiment;
[0050] Figure 2 is a schematic diagram of a flow chart of an image deblurring method in one embodiment;
[0051] Figure 3 is a schematic diagram of a sub-flow chart of step 206 in one embodiment;
[0052] Figure 4 is a flow chart of an image deblurring method according to another embodiment;
[0053] Figure 5 is a structural block diagram of an image deblurring device in one embodiment;
[0054] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0056] The image deblurring method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers. It can be understood that the method can be applied to the terminal 102, can also be applied to the server 104, can also be applied to the system including the terminal 102 and the server 104, and is implemented through the interaction between the terminal 102 and the server 104. Taking the application to the terminal 102 as an example, the terminal 102 obtains a blurred image, and performs Fourier transform on the blurred image to obtain a spectrum diagram; estimates the blur angle according to the projection value of the spectrum diagram at different tilt angles; performs differential processing and autocorrelation processing on the blurred image to determine the blur length; determines the blur kernel according to the blur length and blur angle, and restores the blurred image according to the blur kernel to obtain a deblurred image. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices, and the Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. The portable wearable device may be a smart watch, a smart bracelet, a head-mounted device, etc. The head-mounted device may be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 104 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0057] In an exemplary embodiment, Figure 2 As shown, an image deblurring method is provided, which is applied to Figure 1 The terminal 102 in the example is used as an example to illustrate, including the following steps 202 to 208. Among them:
[0058] Step 202: Obtain a blurred image and perform Fourier transform on the blurred image to obtain a spectrum diagram.
[0059] Among them, a blurred image refers to an image blurred by motion, for example, it can be an image taken during the driving of a vehicle. The blurred image can be an image blurred by uniform motion, that is, a linear blurred image, or an image blurred by non-uniform motion, that is, a non-linear blurred image.
[0060] The terminal grayscales the blurred image to obtain a grayscale image. For example, the grayscale image may be grayscaled using the rgb2gray function. The grayscale image is then Fourier transformed to obtain a spectrum diagram.
[0061] Step 204 , estimating the blur angle according to the projection values of the spectrum at different tilt angles.
[0062] The projection value refers to the projection value of the spectrum at different tilt angles, for example, the projection value can be obtained by Radon transform. The blur angle refers to the angle between the motion direction and the horizontal direction.
[0063] The terminal can estimate the blur angle according to the projection value corresponding to the spectrum diagram. The implementation method is simple and is conducive to improving the image deblurring efficiency.
[0064] Step 206, performing differentiation processing and autocorrelation processing on the blurred image to determine the blur length.
[0065] The differential processing refers to using a differential operator to perform differential processing on the blurred image. For example, it can be a first-order differential operator, a second-order differential operator, etc. Exemplarily, a first-order differential operator Sobel can be used to perform first-order differential processing along the motion direction.
[0066] Autocorrelation processing refers to a method for calculating the similarity of each pixel in a blurred image in two different directions of row or column. The autocorrelation result can be obtained by autocorrelation processing to reflect the grayscale correlation within the local area of the blurred image.
[0067] Blur length refers to the distance that the blur effect extends in an image. It is a quantitative indicator that describes the degree of image distortion or blur caused by motion or other factors during the blurring process.
[0068] The terminal performs differentiation processing on the blurred image, performs autocorrelation processing on the result of the differentiation processing, and determines the blur length based on the result of the autocorrelation processing.
[0069] Step 208, determining a blur kernel according to the blur length and the blur angle, and restoring the blurred image according to the blur kernel to obtain a deblurred image.
[0070] The blur kernel refers to the convolution kernel that converts the image from a clear state to a blurred state. The clear image is convolved with the blur kernel and some additional noise is added to obtain a blurred image. Similarly, the terminal determines the blur kernel based on the blur length and blur angle, and the blur kernel can restore the blurred image to obtain a deblurred image. The deblurred image is the clear image before motion blur.
[0071] In some embodiments, the blur kernel representation in the spatial domain may be calculated by the following formula:
[0072]
[0073] Among them, a represents the amplitude value of the blur kernel, rect() represents the rectangle function, the return value of the rectangle function is in matrix form, L represents the blur length, 𝛽 represents the blur angle, and x and y represent the coordinate values of the pixels in the image.
[0074] In the above-mentioned image deblurring method, the blur angle is estimated by the projection value of the spectrum diagram corresponding to the blurred image at different tilt angles, which is conducive to obtaining an accurate blur angle; differential processing of the blurred image is conducive to highlighting the changing part of the image, and autocorrelation processing of the blurred image is conducive to analyzing the periodicity and trend of the time series in the image. For motion blurred images, it is conducive to obtaining the blur length; based on the blur length and blur angle, the blur kernel can be determined, and the blurred image is restored by the blur kernel to obtain a deblurred image. With this image deblurring method, the image is easier to be recognized, the implementation cost of image deblurring is relatively low, and it is conducive to improving the efficiency of image deblurring.
[0075] In an exemplary embodiment, Figure 3 As shown, the blurred image is subjected to differentiation and autocorrelation processing to determine the blur length, including:
[0076] Step 302: Perform differentiation processing on the blurred image to obtain a two-dimensional gradient image.
[0077] Step 304: perform autocorrelation processing on the two-dimensional gradient image to obtain an autocorrelation curve; determine the blur length according to the correlation peak in the autocorrelation curve.
[0078] Among them, the use of the Soble operator to perform differential processing on a blurred image is taken as an example for explanation. The parameters required by the Soble operator include gradients in two directions. The terminal performs a convolution operation on the Soble operator and each pixel in the blurred image to obtain a convolution result, that is, a two-dimensional gradient image.
[0079] The terminal performs autocorrelation processing on the two-dimensional gradient image to obtain an autocorrelation curve for analyzing the correlation in the image sequence. The autocorrelation curve can be obtained by calling a preset function. When calculating the autocorrelation, the image is moved to the left or right by a certain distance, and then the correlation between the moved image and the original image is calculated. The moving distance is the value of the horizontal axis, that is, the distance or offset between the two pixels in the direction of movement. The vertical axis is the correlation between the two pixels. For example, the correlation can be expressed by similarity or matching degree.
[0080] Ideally, if the image is not blurred, the autocorrelation curve will be symmetrical around the zero point, and the correlation will drop rapidly to zero as the distance increases. However, when there is motion blur along the direction of motion, the autocorrelation curve will show a series of symmetrical correlation peaks, which may have negative peaks, indicating that at certain positions, motion blur causes the image's features in that direction to match its own features at a certain time or spatial distance. The position and number of these negative peaks are directly related to the degree of blur in the direction of motion of the image. The distance between two adjacent correlation peaks can be regarded as the distance that the image's features extend in the direction of motion, that is, the distance that the blur effect in the image extends, that is, the blur length.
[0081] In this embodiment, the blurred image is differentiated and then autocorrelated to obtain an autocorrelation curve. The blur length is determined based on the correlation peak in the autocorrelation curve, which is beneficial for obtaining an accurate blur length. The calculation method is simple and the implementation cost is low, which is beneficial for improving the image deblurring efficiency.
[0082] In an exemplary embodiment, the fuzzy length is determined based on the correlation peaks in the autocorrelation curve, including: if there are multiple correlation peaks, obtaining the distance between each adjacent correlation peak; if the difference between the distance of any adjacent correlation peak and the mean value of the distance of other adjacent correlation peaks is within a difference range, and the discrete degree of the distance of each adjacent correlation peak is within a preset degree range, then the distance between the adjacent correlation peaks is used as the fuzzy length.
[0083] If there are multiple correlation peaks, it is necessary to determine which correlation peak corresponds to the fuzzy length. The following methods can be combined for judgment: First, calculate the distances between adjacent correlation peaks and compare the size relationship between them. If the difference between the distance of any adjacent correlation peak and the mean distance of other adjacent correlation peaks is within the difference range, and the discrete degree of the distances of each adjacent correlation peak is within the preset degree range, the distance of the adjacent correlation peaks is used as the fuzzy length.
[0084] Among them, the degree of discreteness of the distance between each adjacent correlation peak is within the preset range, indicating that the distance between the correlation peaks corresponding to the blur length is relatively stable, and the distance between the correlation peaks shows consistency and repeatability at different positions. If the image experiences uniform blur in the direction of motion, the correlation peaks on the autocorrelation curve should show a relatively uniform distribution in distance, that is, the distance between adjacent peaks is roughly equal. This consistency indicates that the blur effect is uniform across the entire image, without local changes or anomalies.
[0085] In this embodiment, when there are multiple correlation peaks, it is possible to determine which correlation peak's corresponding distance is the fuzzy length based on the difference between the distances between adjacent correlation peaks and the mean values of the distances of other adjacent correlation peaks, as well as the degree of discreteness of the distances of each adjacent correlation peak, thereby facilitating determination of an accurate fuzzy length.
[0086] In an exemplary embodiment, restoring a blurred image according to a blur kernel to obtain a deblurred image includes: normalizing the blur kernel to obtain a normalized blur kernel; and restoring the blurred image according to the normalized blur kernel to obtain a deblurred image.
[0087] The normalization process may be to divide each element in the blur kernel by the sum of all elements to obtain a normalized blur kernel, and the sum of all elements in the normalized blur kernel is equal to 1.
[0088] The terminal uses a normalized blur kernel to restore the blurred image to obtain a deblurred image.
[0089] In this embodiment, the blur kernel is normalized so that the sum of all elements in the normalized blur kernel is equal to 1, and the blurred image is restored using the normalized blur kernel, which helps to maintain the characteristics of the blur kernel and does not introduce any additional noise or distortion.
[0090] In an exemplary embodiment, a blurred image is restored according to a blur kernel to obtain a deblurred image, including: obtaining a minimum criterion function and constructing a Lagrangian function corresponding to the minimum criterion function; obtaining a frequency domain expression of the deblurred image based on a derivative of the Lagrangian function; and obtaining the deblurred image based on the frequency domain expression.
[0091] Among them, since the blurring process of the image refers to convolving the clear image with a blur kernel and then adding noise to obtain a blurred image, the blurring process of the image can be expressed by the following formula:
[0092] g(x,y)=h(x,y)×f(x,y)+n(x,y)
[0093] Among them, g(x,y) represents the blurred image, h(x,y) represents the blur kernel, f(x,y) represents the clear image, and n(x,y) represents the noise.
[0094] In order to solve the problem of the sensitivity of the blur function to noise, the image needs to be smoothed. The smoothing method can be to calculate the second-order derivative of the image, which is equivalent to performing a Laplace transform on the blurred image. In the image deblurring problem, the criterion function is usually used to measure the difference between the deblurred image and the observed blurred image. The smaller the criterion function value, the smaller the difference and the better the restoration effect. Based on the above, a minimum criterion function C with constraints can be obtained:
[0095]
[0096] in, represents the Laplace operator, represents the estimated value of the deblurred image, M and N represent the number of pixels in the blurred image in the horizontal and vertical directions, respectively, and x and y represent the pixel positions in the blurred image in the horizontal and vertical directions, respectively. The Euclidean vector norm form constraint of this formula is:
[0097]
[0098] The frequency domain expression of the minimum criterion function C is as follows:
[0099]
[0100] Wherein, P represents the Fourier transform of the Laplace operator.
[0101] Introducing Lagrange multipliers , construct the Lagrangian function corresponding to the minimum criterion function (frequency domain):
[0102]
[0103] By taking the derivative of the Lagrangian function and setting the derivative equal to 0, the optimal solution for the constrained optimization problem can be obtained. Frequency domain expression:
[0104]
[0105] in, represents the Fourier transform of the blur kernel, , represents the Laplace Fourier transform, represents the Fourier transform of the blurred image, represents the estimated Fourier transform of the deblurred image.
[0106] The deblurred image is obtained according to the Fourier transform of the deblurred image. The uniform motion blurred image can be deblurred through the above steps.
[0107] In this embodiment, by obtaining the minimum criterion function and constructing the Lagrangian function corresponding to the minimum criterion function; based on the derivative of the Lagrangian function, the frequency domain expression of the deblurred image is obtained; the deblurred image is obtained based on the frequency domain expression, which is conducive to solving the problem of the sensitivity of the blur function to noise and is conducive to obtaining an accurate deblurred image.
[0108] In an exemplary embodiment, estimating the blur angle according to the projection values of the spectrum at different tilt angles includes: finding the maximum value among the projection values of the spectrum at different tilt angles; and taking the tilt angle corresponding to the maximum value as the blur angle.
[0109] Among them, the terminal searches for the maximum value in the projection values at different tilt angles. In some embodiments, a Radon transform is used to obtain a projection value matrix R, and each element in the matrix R is the projection value of the spectrum at different tilt angles. For example, the element R (i, j) represents the projection value from the frequency domain to the time domain at the i-th tilt angle. Each column in the matrix R corresponds to a tilt angle, and each row represents the projection value, that is, the distance of the projection.
[0110] The maximum value can be found by nesting the max function twice to find the maximum value of all elements in the matrix R, and the maximum value max among all the projection values can be determined.
[0111] Furthermore, the terminal searches for the tilt angle corresponding to the maximum value. The find function can be used to find the elements with values equal to max in the matrix R, and return the subscripts of the rows and columns where they are located. The angle corresponding to the column is the tilt angle corresponding to the maximum value. The terminal uses the tilt angle corresponding to the maximum value as the blur angle.
[0112] Among them, when performing the Radon transform of the spectrum graph, the tilt angle corresponding to each column is usually determined according to the selected projection angle range and the number of projections. For example, if a set of projection angles, such as {0°, 45°, 90°, 135°}, is selected, and it is desired to project at each projection angle, each column of the projection value matrix will correspond to one of these projection angles. In this case, the first column corresponds to an angle of 0 degrees, the second column corresponds to an angle of 45 degrees, and so on. If more detailed angle sampling is required, the number of selected angles can be increased. Then, each column still corresponds to a specific angle within the selected angle range. In short, the tilt angle corresponding to each column is determined according to the selected projection angle range and number, and can be obtained by uniformly selecting angles within the projection angle range.
[0113] In this embodiment, the blur angle is estimated by finding the maximum value of the projection values of the spectrum graph at different tilt angles. The tilt angle corresponding to the maximum value is closest to the blur angle. This blur angle estimation method is less difficult to obtain and is closer to the accurate value. Image deblurring based on the blur angle is beneficial to improving image deblurring efficiency.
[0114] To explain the image deblurring method and effect in this solution in detail, a most detailed embodiment is described below:
[0115] This article takes the motion blurred image scene captured in the autonomous driving scenario as an example. Figure 4 The figure is a flow chart of an image deblurring method in one embodiment. The terminal obtains a blurred image, estimates blur parameters such as blur length and blur angle based on the blurred image, then estimates a blur kernel based on the blur parameters, deblurs the blurred image based on the blur angle to obtain a deblurred image, and finally, performs image restoration quality evaluation.
[0116] Among them, the process of estimating blur parameters such as blur length and blur angle based on the blurred image, specifically, the terminal performs Fourier transform on the blurred image to obtain a spectrum diagram, finds the maximum value in the projection values of the spectrum diagram at different tilt angles; takes the tilt angle corresponding to the maximum value as the blur angle; performs differentiation and autocorrelation processing on the blurred image to determine the blur length.
[0117] The method of performing differential processing and autocorrelation processing on the blurred image to determine the blur length includes: performing differential processing on the blurred image to obtain a two-dimensional gradient image; performing autocorrelation processing on the two-dimensional gradient image to obtain an autocorrelation curve; and determining the blur length according to a correlation peak in the autocorrelation curve.
[0118] Wherein, determining the fuzzy length according to the correlation peak in the autocorrelation curve includes: if there are multiple correlation peaks, obtaining the distance between each adjacent correlation peak; if the difference between the distance of any adjacent correlation peak and the mean value of the distance of other adjacent correlation peaks is within a difference range, and the discrete degree of the distance of each adjacent correlation peak is within a preset degree range, then taking the distance between adjacent correlation peaks as the fuzzy length.
[0119] The method of restoring the blurred image according to the blur kernel to obtain the deblurred image includes: normalizing the blur kernel to obtain a normalized blur kernel; and restoring the blurred image according to the normalized blur kernel to obtain the deblurred image.
[0120] Among them, restoring the blurred image according to the blur kernel to obtain the deblurred image also includes: obtaining the minimum criterion function and constructing the Lagrangian function corresponding to the minimum criterion function; obtaining the frequency domain expression of the deblurred image based on the derivative of the Lagrangian function; and obtaining the deblurred image based on the frequency domain expression.
[0121] In some embodiments, the terminal can evaluate the restoration effect of the deblurred image. For example, the peak signal-to-noise ratio (PSNR) can be used as a restoration effect evaluation indicator. The specific value of PSNR is calculated using the psnr function. In addition, although the PSNR value can quantitatively evaluate the image quality, it can still be considered in combination with other indicators to fully reflect the effectiveness and advantages and disadvantages of the algorithm.
[0122] The above-mentioned image deblurring method estimates the blur angle through the projection values of the spectrum graph corresponding to the blurred image at different tilt angles, which is conducive to obtaining an accurate blur angle; differential processing of the blurred image is conducive to highlighting the changing parts in the image, and autocorrelation processing of the blurred image is conducive to analyzing the periodicity and trend of the time series in the image. For motion blurred images, it is conducive to obtaining the blur length; based on the blur length and blur angle, the blur kernel can be determined, and the blurred image is restored by the blur kernel to obtain a deblurred image. With this image deblurring method, the image is easier to be recognized, the implementation cost of image deblurring is relatively low, and it is conducive to improving the efficiency of image deblurring.
[0123] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0124] Based on the same inventive concept, the embodiment of the present application also provides an image deblurring device for implementing the above-mentioned image deblurring method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more image deblurring device embodiments provided below can refer to the limitations of the image deblurring method above, and will not be repeated here.
[0125] In an exemplary embodiment, Figure 5 As shown, an image deblurring device 500 is provided, comprising: an acquisition module 520, an estimation module 540, a determination module 560 and a restoration module 580, wherein:
[0126] An acquisition module 520 is used to acquire a blurred image and perform Fourier transform on the blurred image to obtain a spectrum diagram;
[0127] An estimation module 540, configured to estimate a blur angle according to projection values of the spectrum at different tilt angles;
[0128] A determination module 560, for performing differentiation processing and autocorrelation processing on the blurred image to determine the blur length;
[0129] The restoration module 580 is used to determine a blur kernel according to the blur length and the blur angle, and restore the blurred image according to the blur kernel to obtain a deblurred image.
[0130] The above-mentioned image deblurring device estimates the blur angle through the projection values of the spectrum diagram corresponding to the blurred image at different tilt angles, which is conducive to obtaining an accurate blur angle; differential processing of the blurred image is conducive to highlighting the changing parts in the image, and autocorrelation processing of the blurred image is conducive to analyzing the periodicity and trend of the time series in the image. For motion blurred images, it is conducive to obtaining the blur length; based on the blur length and blur angle, the blur kernel can be determined, and the blurred image is restored by the blur kernel to obtain a deblurred image. With this image deblurring method, the image is easier to be recognized, the implementation cost of image deblurring is relatively low, and it is conducive to improving the efficiency of image deblurring.
[0131] In one embodiment, the blurred image is subjected to differentiation processing and autocorrelation processing to determine the blur length, and the determination module 560 is further used to: perform differentiation processing on the blurred image to obtain a two-dimensional gradient image; perform autocorrelation processing on the two-dimensional gradient image to obtain an autocorrelation curve; and determine the blur length according to a correlation peak in the autocorrelation curve.
[0132] In one embodiment, the fuzzy length is determined according to the correlation peaks in the autocorrelation curve, and the determination module 560 is further used to: if there are multiple correlation peaks, obtain the distance between each adjacent correlation peak; if the difference between the distance of any adjacent correlation peak and the mean value of the distance of other adjacent correlation peaks is within a difference range, and the discrete degree of the distance of each adjacent correlation peak is within a preset degree range, then the distance between the adjacent correlation peaks is used as the fuzzy length.
[0133] In one embodiment, the blurred image is restored according to the blur kernel to obtain a deblurred image, and the restoration module 580 is further used to: normalize the blur kernel to obtain a normalized blur kernel; and restore the blurred image according to the normalized blur kernel to obtain a deblurred image.
[0134] In one embodiment, the blurred image is restored according to the blur kernel to obtain a deblurred image, and the restoration module 580 is also used to: obtain the minimum criterion function and construct a Lagrangian function corresponding to the minimum criterion function; obtain the frequency domain expression of the deblurred image based on the derivative of the Lagrangian function; and obtain the deblurred image based on the frequency domain expression.
[0135] In one embodiment, the blur angle is estimated according to the projection values of the spectrum at different tilt angles. The estimation module 540 is further used to: find the maximum value among the projection values of the spectrum at different tilt angles; and use the tilt angle corresponding to the maximum value as the blur angle.
[0136] Each module in the above-mentioned image deblurring device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0137] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, an image deblurring method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0138] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0139] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0140] A blurred image is acquired and Fourier transformed to obtain a spectrum diagram; the blur angle is estimated according to the projection values of the spectrum diagram at different tilt angles; the blurred image is differentiated and autocorrelated to determine the blur length; a blur kernel is determined according to the blur length and the blur angle, and the blurred image is restored according to the blur kernel to obtain a deblurred image.
[0141] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0142] The blurred image is differentiated to obtain a two-dimensional gradient image; the two-dimensional gradient image is autocorrelated to obtain an autocorrelation curve; and the blur length is determined according to a correlation peak in the autocorrelation curve.
[0143] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0144] If there are multiple correlation peaks, the distance between each adjacent correlation peak is obtained; if the difference between the distance of any adjacent correlation peak and the mean distance of other adjacent correlation peaks is within a difference range, and the discrete degree of the distance of each adjacent correlation peak is within a preset degree range, the distance between the adjacent correlation peaks is used as the fuzzy length.
[0145] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0146] The blur kernel is normalized to obtain a normalized blur kernel; the blurred image is restored according to the normalized blur kernel to obtain a deblurred image.
[0147] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0148] A minimum criterion function is obtained, and a Lagrangian function corresponding to the minimum criterion function is constructed; a frequency domain expression of a deblurred image is obtained based on a derivative of the Lagrangian function; and a deblurred image is obtained based on the frequency domain expression.
[0149] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0150] Find the maximum value among the projection values of the spectrum graph at different tilt angles; and use the tilt angle corresponding to the maximum value as the blur angle.
[0151] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0152] A blurred image is acquired and Fourier transformed to obtain a spectrum diagram; the blur angle is estimated according to the projection values of the spectrum diagram at different tilt angles; the blurred image is differentiated and autocorrelated to determine the blur length; a blur kernel is determined according to the blur length and the blur angle, and the blurred image is restored according to the blur kernel to obtain a deblurred image.
[0153] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0154] The blurred image is differentiated to obtain a two-dimensional gradient image; the two-dimensional gradient image is autocorrelated to obtain an autocorrelation curve; and the blur length is determined according to a correlation peak in the autocorrelation curve.
[0155] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0156] If there are multiple correlation peaks, the distance between each adjacent correlation peak is obtained; if the difference between the distance of any adjacent correlation peak and the mean distance of other adjacent correlation peaks is within a difference range, and the discrete degree of the distance of each adjacent correlation peak is within a preset degree range, the distance between the adjacent correlation peaks is used as the fuzzy length.
[0157] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0158] The blur kernel is normalized to obtain a normalized blur kernel; the blurred image is restored according to the normalized blur kernel to obtain a deblurred image.
[0159] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0160] A minimum criterion function is obtained, and a Lagrangian function corresponding to the minimum criterion function is constructed; a frequency domain expression of a deblurred image is obtained based on a derivative of the Lagrangian function; and a deblurred image is obtained based on the frequency domain expression.
[0161] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0162] Find the maximum value among the projection values of the spectrum graph at different tilt angles; and use the tilt angle corresponding to the maximum value as the blur angle.
[0163] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0164] A blurred image is acquired and Fourier transformed to obtain a spectrum diagram; the blur angle is estimated according to the projection values of the spectrum diagram at different tilt angles; the blurred image is differentiated and autocorrelated to determine the blur length; a blur kernel is determined according to the blur length and the blur angle, and the blurred image is restored according to the blur kernel to obtain a deblurred image.
[0165] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0166] The blurred image is differentiated to obtain a two-dimensional gradient image; the two-dimensional gradient image is autocorrelated to obtain an autocorrelation curve; and the blur length is determined according to a correlation peak in the autocorrelation curve.
[0167] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0168] If there are multiple correlation peaks, the distance between each adjacent correlation peak is obtained; if the difference between the distance of any adjacent correlation peak and the mean distance of other adjacent correlation peaks is within a difference range, and the discrete degree of the distance of each adjacent correlation peak is within a preset degree range, the distance between the adjacent correlation peaks is used as the fuzzy length.
[0169] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0170] The blur kernel is normalized to obtain a normalized blur kernel; the blurred image is restored according to the normalized blur kernel to obtain a deblurred image.
[0171] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining a minimum criterion function and constructing a Lagrangian function corresponding to the minimum criterion function; obtaining a frequency domain expression of a deblurred image based on a derivative of the Lagrangian function; and obtaining a deblurred image based on the frequency domain expression.
[0172] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0173] Find the maximum value among the projection values of the spectrum graph at different tilt angles; and use the tilt angle corresponding to the maximum value as the blur angle.
[0174] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0175] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0176] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0177] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An image deblurring method, characterized in that: The method comprises: Acquire a blurred image, and perform Fourier transform on the blurred image to obtain a spectrum diagram; estimating a blur angle according to projection values of the spectrum at different tilt angles; Performing differentiation processing and autocorrelation processing on the blurred image to determine the blur length; A blur kernel is determined according to the blur length and the blur angle, and the blurred image is restored according to the blur kernel to obtain a deblurred image.
2. The method according to claim 1, characterized in that The step of performing differentiation processing and autocorrelation processing on the blurred image to determine the blur length includes: Performing differentiation processing on the blurred image to obtain a two-dimensional gradient image; Performing autocorrelation processing on the two-dimensional gradient image to obtain an autocorrelation curve; The blur length is determined according to a correlation peak in the autocorrelation curve.
3. The method according to claim 2, characterized in that The determining of the fuzzy length according to the correlation peak in the autocorrelation curve comprises: If there are multiple correlation peaks, the distance between each adjacent correlation peak is obtained; If the difference between the distance of any adjacent correlation peak and the mean value of the distances of other adjacent correlation peaks is within a difference range, and the discrete degree of the distances of each adjacent correlation peak is within a preset degree range, the distance of the adjacent correlation peaks is used as the fuzzy length.
4. The method according to claim 1, characterized in that: The restoring the blurred image according to the blur kernel to obtain a deblurred image includes: Normalizing the blur kernel to obtain a normalized blur kernel; The blurred image is restored according to the normalized blur kernel to obtain a deblurred image.
5. The method according to claim 1, characterized in that The restoring the blurred image according to the blur kernel to obtain a deblurred image includes: Obtaining a minimum criterion function, and constructing a Lagrangian function corresponding to the minimum criterion function; Based on the derivative of the Lagrangian function, a frequency domain expression of the deblurred image is obtained; A deblurred image is obtained based on the frequency domain expression.
6. The method according to claim 1, characterized in that The estimating the blur angle according to the projection values of the spectrum at different tilt angles includes: Find the maximum value among the projection values of the spectrum graph at different tilt angles; The tilt angle corresponding to the maximum value is used as the blur angle.
7. An image deblurring device, characterized in that: The device comprises: An acquisition module, used for acquiring a blurred image and performing Fourier transform on the blurred image to obtain a spectrum diagram; An estimation module, used for estimating a blur angle according to projection values of the spectrum at different tilt angles; A determination module, used for performing differentiation processing and autocorrelation processing on the blurred image to determine the blur length; The restoration module is used to determine a blur kernel according to the blur length and the blur angle, and restore the blurred image according to the blur kernel to obtain a deblurred image.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Noise-possessing movement fuzzy image restoration method based on radial basis nerve network
CN101079149A
Fuzzy image integrated processing method and system
CN108305230A
Fuzzy image blind restoration method for a high speed linear motion object
CN108376393A
Cited By
Method and system for measuring motion blurring kernel of material visual inspection system
CN119180842A
Measurement method suitable for rotor model surface pressure
CN122042190A
