Blurred image restoration method and system, terminal and storage medium
By identifying the blur type and applying a variety of processing solutions, including frequency domain analysis and deep learning technologies, the problem of poor image blur repair in the prior art is solved, and the quality of the image and user experience are significantly improved.
Patent Information
- Application Number
- CN202411199726.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-12-31
AI Technical Summary
The prior art cannot effectively repair blurred images, and the image quality after repair is low, which affects users' acquisition and utilization of image information.
By acquiring the to-process blur image for type recognition, the fuzzy kernel parameters are determined according to the recognized blur type, and defuzzing and refinement are performed, including frequency domain analysis, gradient priors, pixel statistics and iterative defuzzing schemes, combined with convolutional nerves Networks and generative adversarial networks, gradually optimizing images to improve clarity and visual quality.
Effectively repair image blur problem, improve image clarity, contrast and color reproduction, and ensure the quality of users obtaining and utilizing image information.
Smart Images

Figure CN119228688A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method, system, terminal and computer-readable storage medium for repairing blurred images. Background Art
[0002] A camera is a device that converts image signals into electrical signals. It is widely used in mobile phones, computers, surveillance, medical and other fields. The imaging quality of a camera depends not only on its internal sensors, circuits and algorithms, but also on external factors such as lenses and glass covers. Among them, the lens is one of the most important components of a camera. It determines the camera's viewing angle, aperture, focal length and other parameters. It is also easily affected by the external environment, which affects the camera's imaging effect. The main manifestations are overall or partial blur, darkening, distortion and other phenomena. These phenomena will reduce the image's clarity, contrast and color reproduction, thereby affecting the user's acquisition and use of image information. Therefore, how to effectively and efficiently repair the blur problem of an image is a difficult problem that needs to be solved in the field of image processing.
[0003] Therefore, the prior art still needs to be improved and developed. Summary of the invention
[0004] The main purpose of the present invention is to provide a blurred image repair method, system, terminal and storage medium, aiming to solve the problem that blurred images cannot be effectively repaired and the quality of the repaired images is low in the prior art.
[0005] To achieve the above object, the present invention provides a method for restoring a blurred image, the method comprising the following steps:
[0006] Acquire a blurred image to be processed, identify the type of the blurred image to be processed to obtain a target blurred type, and confirm parameters of the blurred image to be processed according to the target blurred type to obtain a blur kernel parameter;
[0007] The blurred image to be processed is deblurred according to the blur kernel parameters to obtain a deblurred image, and the deblurred image is refined to obtain a target deblurred image.
[0008] Optionally, the blurred image restoration method, wherein the step of obtaining the blurred image to be processed and identifying the type of the blurred image to be processed to obtain the target blur type, specifically includes:
[0009] Acquire a training image set, perform model training according to the training image set, and obtain a fuzzy image type recognition model, wherein the training image set includes multiple groups of training samples, and each group of training samples includes a fuzzy image of a fuzzy type and a corresponding type label;
[0010] Obtain a blurred image to be processed, perform normalization processing and data enhancement processing on the blurred image to be processed respectively to obtain a target blurred image to be processed, and input the target blurred image to be processed into the blurred image type recognition model to output a target blurred type.
[0011] Optionally, the blurred image restoration method, wherein the acquiring of a training image set and performing model training according to the training image set to obtain a blurred image type recognition model, specifically comprises:
[0012] Acquire a training image set, create a fuzzy type training network model, and input a group of training samples in the training image set into the fuzzy type training network model;
[0013] Performing feature extraction on the blurred image to obtain target local features, and performing feature mapping on the target local features to obtain a target vector;
[0014] Classifying the target vector according to the weight matrix to obtain a probability distribution of blur types, and predicting the type of the blurred image according to the probability distribution to obtain a predicted blur type;
[0015] Calculating a loss value between the predicted fuzzy type and the type label according to a cross entropy loss function, and adjusting parameters of the fuzzy type training network model according to the loss value;
[0016] The next set of training samples is input into the fuzzy type training network model until the training status of the fuzzy type training network model meets the preset conditions, thereby obtaining a trained fuzzy image type recognition model.
[0017] Optionally, the blurred image restoration method, wherein the step of confirming parameters of the blurred image to be processed according to the target blur type to obtain blur kernel parameters, specifically includes:
[0018] According to the target blur type, the parameter processing scheme of the blurred image to be processed is matched to obtain a target parameter processing scheme, wherein the parameter processing scheme includes a frequency domain analysis scheme, a gradient prior scheme, a pixel statistics scheme and an iterative deblurring scheme;
[0019] Parameters of the blurred image to be processed are extracted according to the target parameter processing scheme to obtain corresponding blur kernel parameters.
[0020] Optionally, the blurred image restoration method, wherein the deblurring process is performed on the blurred image to be processed according to the blur kernel parameter to obtain the deblurred image, specifically comprises:
[0021] Performing a clearing process on the blurred image to be processed according to the blur kernel parameters to obtain an initialized image, and performing a denoising process on the initialized image to obtain a denoised image;
[0022] The denoised image is subjected to image enhancement processing and error correction processing respectively to obtain a target denoised image, and the target denoised image is subjected to quantitative evaluation according to a quantitative index to obtain a deblurred image, wherein the quantitative index includes a peak signal-to-noise ratio and a structural similarity.
[0023] Optionally, the blurred image restoration method, wherein the denoising process is performed on the initialization image to obtain the denoised image, specifically comprises:
[0024] Calculating the residual of the initialization image according to the blur kernel parameter, and performing iterative optimization processing on the initialization image according to the residual to obtain a target initialization image;
[0025] Prior information of the blurred image to be processed is obtained, and gradient constraints are performed on the target initialization image according to the prior information to obtain a denoised image.
[0026] Optionally, the blurred image restoration method, wherein the thinning process is performed on the deblurred image to obtain a target deblurred image, specifically comprises:
[0027] Performing sharpening processing and color correction on the deblurred image respectively to obtain an optimized image, and performing quality evaluation on the optimized image to obtain an evaluation result;
[0028] If the evaluation result meets the standard, the optimized image is determined to be the target deblurred image.
[0029] Optionally, in the blurred image restoration method, the blurred image restoration system comprises:
[0030] An image processing module is used to obtain a fuzzy image to be processed, identify the type of the fuzzy image to be processed, obtain a target fuzzy type, and confirm parameters of the fuzzy image to be processed according to the target fuzzy type to obtain fuzzy kernel parameters;
[0031] The blur removal module is used to perform a deblurring process on the blurred image to be processed according to the blur kernel parameters to obtain a deblurred image, and to perform a refinement process on the deblurred image to obtain a target deblurred image.
[0032] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a blurred image repair program stored in the memory and runnable on the processor, and when the blurred image repair program is executed by the processor, the steps of the blurred image repair method as described above are implemented.
[0033] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a blurred image repair program, and when the blurred image repair program is executed by a processor, the steps of the blurred image repair method as described above are implemented.
[0034] In the present invention, a blurred image to be processed is obtained, the type of the blurred image to be processed is identified to obtain a target blurred type, and the parameters of the blurred image to be processed are confirmed according to the target blurred type to obtain a blur kernel parameter; the blurred image to be processed is deblurred according to the blur kernel parameter to obtain a deblurred image, and the deblurred image is refined to obtain a target deblurred image. The present invention can effectively repair the blur problem of an image and improve the quality of the image, thereby ensuring that users can obtain and use image information. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a flow chart of a preferred embodiment of the method for repairing blurred images in the present invention;
[0036] Figure 2 It is a schematic diagram of the principle of a preferred embodiment of the blurred image restoration system of the present invention;
[0037] Figure 3 It is a schematic diagram of the operating environment of a preferred embodiment of the terminal of the present invention. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0039] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0040] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0041] The method for repairing a blurred image according to a preferred embodiment of the present invention is as follows: Figure 1 As shown, the method for repairing a blurred image comprises the following steps:
[0042] Step S10, obtaining a blurred image to be processed, performing type identification on the blurred image to be processed to obtain a target blurred type, and performing parameter confirmation on the blurred image to be processed according to the target blurred type to obtain a blur kernel parameter.
[0043] Specifically, when a blurred image to be processed, i.e., a blurred image to be processed, is obtained, the type of the blurred image to be processed must be identified first. In an embodiment of the present invention, type identification is performed through a trained CNN (Convolutional Neural Networks) model, i.e., a blurred image type recognition model. The training process of the blurred image type recognition model is as follows: first, a data set for training and verification, i.e., a training image set, needs to be prepared, wherein the training image set includes multiple groups of training samples, each group of the training samples includes a blurred image of a blur type and a corresponding type label, such as a motion blur label, a defocus blur label, and an optical blur label, etc. At the same time, a group of clear images also needs to be prepared so that the corresponding network model can learn the characteristic changes of the image from blurry to clear.
[0044] Afterwards, a CNN model for training is created, namely, a fuzzy type training network model, wherein the fuzzy type training network model includes an input layer, a convolution layer, a pooling layer, a batch normalization layer, a fully connected layer and an output layer; then a group of training samples in the training image set is input into the fuzzy type training network model, wherein the input layer in the fuzzy type training network model is used to receive the training samples, and usually the size of the blurred images in the training samples is a fixed size, in order to facilitate subsequent processing; the convolution layer is used to extract features from the blurred images to obtain target local features, specifically, the blurred images are convolved with a sliding window, and the convolution kernel extracts low-level features such as edges and textures in the image, wherein each convolution layer is usually followed by an activation function (e.g., a ReLU function), and the role of the activation function is to introduce nonlinearity so that the corresponding network model can learn more complex features. The layers are deepened layer by layer to gradually extract more advanced abstract features; the pooling layer is used to reduce the dimension of the output of the convolution layer and retain important features at the same time. Commonly used pooling operations include maximum pooling and average pooling. The purpose of the pooling operation is to effectively reduce the calculation amount of the fuzzy type training network model and prevent overfitting; the batch normalization layer is used to normalize the activation values of each convolution layer, so as to accelerate the training and stabilize the learning process of the model; the fully connected layer is used to map the target local features to the classification space after the feature extraction of the convolution and pooling layers is completed and the target local features are obtained, and flatten them into a one-dimensional vector, namely the target vector, and then classify the target vector through the weight matrix; the output layer converts the classified target vector into the probability distribution of each fuzzy type by using the Softmax activation function, and finally outputs the fuzzy type with the largest probability in the probability distribution, namely the predicted fuzzy type.
[0045] During the training process of the fuzzy type training network model, a cross entropy loss function is used to calculate the error between the predicted fuzzy type of the fuzzy type training network model and the actual type label, that is, the loss value. The purpose of using the cross entropy loss function is to effectively measure the difference between the predicted probability distribution and the actual distribution; then, according to the loss value, the corresponding optimization algorithm (for example, Adam optimizer or SGD) is used to adjust the parameters of the fuzzy type training network model. Specifically, the optimization algorithm calculates the gradient through the back propagation algorithm and updates the network weights so that the value of the loss function gradually decreases; then, the next set of training samples is input into the fuzzy type training network model, and the above process is repeated. To repeat, until the training situation of the fuzzy type training network model meets the preset conditions, the preset conditions include that the loss value meets the preset requirements or the number of training times reaches the preset number, wherein the preset requirements can be determined according to the accuracy of the fuzzy image type recognition model, which is not described in detail here, and the preset number of times can be the maximum number of training times of the fuzzy type training network model, for example, 2000 times, etc., to finally obtain a trained fuzzy image type recognition model; after obtaining the fuzzy image type recognition model, it is necessary to test the fuzzy image type recognition model to evaluate its performance on unseen data, and the test set usually contains fuzzy images different from the training set and the validation set, in order to evaluate the generalization ability of the model.
[0046] Before inputting the fuzzy image to be processed into the fuzzy image type recognition model, it is necessary to perform normalization processing and data enhancement processing on the fuzzy image to be processed respectively to obtain the target fuzzy image to be processed, wherein normalization processing refers to normalizing the pixel values of the fuzzy image to be processed to a fixed range (for example, between 0 and 1), which helps to accelerate the convergence speed of the fuzzy image type recognition model; data enhancement processing refers to performing data enhancement operations on the fuzzy image to be processed in order to improve the generalization ability of the fuzzy image type recognition model, such as rotation, scaling, cropping and flipping, etc., in order to effectively prevent the fuzzy image type recognition model from overfitting; after the processing of the fuzzy image to be processed is completed, the target fuzzy image to be processed is input into the fuzzy image type recognition model, and the target fuzzy type is output.
[0047] Subsequently, after obtaining the target blur type, it is necessary to obtain the corresponding blur kernel parameters of the blurred image to be processed, wherein the blur kernel in the blur kernel parameters is also called PSF (Point Spread Function), which describes the process of generating image blur. This blur kernel can be understood as a convolution kernel. When an image is convolved with this convolution kernel, a blurring effect will be produced. That is to say, the blur kernel determines how a point or a pixel in the image diffuses to its surrounding pixels, thereby causing blurring. For example, if there is a single bright point in the image, due to blurring, the point that should have been clear will diffuse into a larger area, and the manner and degree of this diffusion are determined by the blur kernel. The blur kernel parameters refer to the numerical values or parameter sets that describe the characteristics of the blur kernel, which specifically stipulate the shape and intensity of the blur. Different types of blur have different blur kernel parameters, for example, uniform blur (UniformBlur); usually represented by a simple square or rectangular blur kernel, the size of the kernel (such as 3x3, 5x5, etc.) is the blur kernel parameter; Gaussian Blur: This blur kernel is usually a Gaussian distribution, and the corresponding blur kernel parameter is the standard deviation. This standard deviation determines the degree of blur diffusion, that is, the larger the standard deviation, the stronger the blur; Motion Blur: refers to the blur caused by the movement of the camera during exposure. Its blur kernel is usually a linear kernel, and the corresponding blur kernel parameters include blur direction and blur length, which determine the degree of blur diffusion in a specific direction; Defocus Blur: refers to the blur caused by the focus not being on the photographed object. The blur kernel is usually circular, and the corresponding blur kernel parameter is the radius. This radius indicates the degree of blur.
[0048] In the process of deblurring the blurred image to be processed, the blur kernel parameters are the key to restoring the clear image, because the generation of blur can usually be regarded as the convolution of the clear image and the blur kernel, and the deblurring process is the inverse process of this convolution. Only when the blur kernel parameters are accurately understood can the original clear image be effectively restored. In an embodiment of the present invention, the parameter processing scheme of the blurred image to be processed is matched according to the target blur type to obtain a target parameter processing scheme, wherein the parameter processing scheme includes a frequency domain analysis scheme, a gradient prior scheme, a pixel statistics scheme and an iterative deblurring scheme.
[0049] Among them, the frequency domain analysis scheme is to obtain the blur kernel parameters by analyzing the frequency characteristics of the image. Because blur is usually manifested as the attenuation of high-frequency components in the frequency domain, the shape and parameters of the blur kernel can be inferred by analyzing the spectrum of the image. The frequency domain analysis scheme includes spectrum zero point detection and Wiener filtering. Spectrum zero point detection means that in the case of motion blur, the blur kernel will introduce periodic zero points in the frequency domain. By detecting the zero points in the image spectrum, the direction and length of the blur kernel can be obtained; Wiener filtering means that the blur kernel can be obtained by the inverse convolution method in the frequency domain, and Wiener filtering usually requires certain prior knowledge, such as noise level.
[0050] The gradient prior scheme refers to the use of the gradient distribution characteristics of natural images (for example, gradient sparsity) to constrain the estimation of the blur kernel in the deblurring problem. The gradient prior scheme includes L0 norm minimization and total variation regularization. L0 norm minimization means that the gradient of natural images is usually sparse, that is, the gradient is small in most areas, and only the gradient at the edge is large. By minimizing the L0 norm of the image gradient (that is, the number of non-zero gradient values), the blur kernel parameters can be effectively estimated; total variation regularization means that by performing total variation regularization on the image, the edge information of the image can be retained, and the blur kernel parameters can be obtained while deblurring.
[0051] The pixel statistics scheme is to analyze the statistical distribution of image blocks or image pixels to obtain the corresponding blur kernel; the pixel statistics scheme includes the maximum expectation algorithm and Bayesian inference. The maximum expectation algorithm is an iterative algorithm that gradually optimizes the blur kernel and the image in the iterative process to gradually approach the real blur kernel parameters; Bayesian inference is to use the Bayesian framework to treat the blur kernel parameters as random variables and use prior information and observed blurred images to estimate the blur kernel.
[0052] The iterative deblurring scheme usually estimates the blur kernel step by step during deblurring, and the two processes are performed alternately until convergence; the iterative deblurring scheme includes an alternating least squares method and a stepwise refinement method, wherein the alternating least squares method estimates the image by first fixing the blur kernel, and then estimates the blur kernel by fixing the image, and iterates to gradually obtain accurate blur kernel parameters; the stepwise refinement method starts with a rough estimate, gradually refines the blur kernel, and improves the accuracy of the blur kernel parameters through multiple iterations.
[0053] Furthermore, with the application of deep learning in blur kernel estimation, neural networks can also be used to effectively learn complex blur models and automatically estimate blur kernel parameters, such as convolutional neural networks and generative adversarial networks. Convolutional neural networks can directly extract blur kernel parameters from images through large-scale comparative learning of blurred images and clear images, and can adaptively estimate blur kernel parameters in different types of blur situations; generative adversarial networks can generate realistic blur kernels through adversarial learning, and in turn help restore clear images.
[0054] Afterwards, parameters of the blurred image to be processed are extracted according to the target parameter processing scheme to obtain corresponding blur kernel parameters.
[0055] Step S20: deblurring the blurred image to be processed according to the blur kernel parameters to obtain a deblurred image, and refining the deblurred image to obtain a target deblurred image.
[0056] The step S20 comprises:
[0057] Step S21, performing a clearing process on the blurred image to be processed according to the blur kernel parameters to obtain an initialized image, and performing a denoising process on the initialized image to obtain a denoised image;
[0058] Step S22, performing image enhancement processing and error correction processing on the denoised image respectively to obtain a target denoised image, and performing quantitative evaluation on the target denoised image according to a quantitative index to obtain a deblurred image, wherein the quantitative index includes a peak signal-to-noise ratio and a structural similarity;
[0059] Step S23, performing sharpening processing and color correction on the deblurred image to obtain an optimized image, and performing quality evaluation on the optimized image to obtain an evaluation result;
[0060] Step S24: If the evaluation result meets the standard, determine that the optimized image is the target deblurred image.
[0061] Specifically, in an embodiment of the present invention, after obtaining the blur kernel parameters, the blurred image to be processed is subjected to preliminary deblurring processing, that is, clarity processing, to obtain an initialized image, and the purpose of the preliminary deblurring processing is to perform preliminary clarity processing on the blurred image through known blur kernel parameters. Specifically, the method for performing preliminary deblurring processing includes a frequency domain-based method, a spatial domain-based method and a deep learning method, wherein the frequency domain-based method is to convert the blurred image to be processed and the corresponding blur kernel to the frequency domain, and remove the blur effect by performing an inverse convolution operation on the frequency domain; the spatial domain-based method refers to directly using convolution and deconvolution operations in the spatial domain to perform pixel-by-pixel processing on the blurred image to be processed; the deep learning method is to perform an inverse convolution operation through a convolutional neural network, that is, the mapping relationship from the blurred image to the clear image is pre-learned, and by inputting the blurred image to be processed and the blur kernel parameters, the image after preliminary deblurring, that is, the initialized image, is directly output.
[0062] The image after the preliminary deblurring process usually contains some residual blur effects or noise. In order to further refine the image quality, it is necessary to perform denoising on the initialization image. Specifically, on the basis of the preliminary deblurring process, an iterative optimization algorithm is used to further deblur the image. Each iteration calculates the residual based on the initialization image and the blur kernel parameter, and performs iterative optimization on the initialization image according to the residual. A clearer image, i.e., a target initialization image, can be obtained after a certain number of iterations. After that, the prior information of the blurred image to be processed is introduced, such as L1 regularization or L2 regularization. The gradient information of the image is constrained according to the prior information to obtain a denoised image, thereby reducing the noise or artifacts generated in the image deblurring process. In addition, assuming that the initialization image can be effectively represented under a certain sparse representation, sparse coding or dictionary learning and other methods can be used to denoise and refine the initialization image, so as to further reduce the blur effect, thereby improving the visual effect of the image.
[0063] After the refinement process is completed, there may still be a certain residual error. In this case, the denoised image can be subjected to image enhancement and error correction respectively to obtain the target denoised image. Specifically, the image enhancement process is to post-process the image using image enhancement techniques, such as contrast stretching and gamma correction, to improve the visual perception effect; the error correction process is to learn the residual and correct it by training the residual learning network, so as to effectively reduce the residual blur and artifacts. Afterwards, the target denoised image is quantitatively evaluated according to the quantitative index to obtain the deblurred image, wherein the quantitative index includes the peak signal-to-noise ratio and the structural similarity.
[0064] Subsequently, in order to further improve the quality of the image, especially in terms of detail recovery and visual perception, in an embodiment of the present invention, the deblurred image is processed by using a generative adversarial network to output a final high-quality image, which has higher clarity, details and visual quality; afterwards, the high-quality image can also be post-processed according to actual needs, such as sharpening, denoising or color correction, etc., to obtain an optimized image to further enhance the visual effect of the image. Afterwards, the optimized image needs to be quality evaluated to ensure that its clarity, contrast and detail performance meet the expected standards. Specifically, the optimized image is quality evaluated using a variety of objective indicators, such as peak signal-to-noise ratio, structural similarity index and mean square error, etc., and a subjective visual evaluation can also be performed to observe the visual realism and detail retention of the optimized image, and obtain the final evaluation result; if the evaluation result meets the standard, the optimized image is determined to be the target deblurred image. The present invention can not only effectively repair the blur problem of the image, but also improve the quality of the image, thereby ensuring the user's acquisition and use of image information.
[0065] Furthermore, if the evaluation result is that the image does not meet the standard, the optimized image needs to continue to be optimized until it meets the standard, thereby obtaining a final target deblurred image.
[0066] Furthermore, if Figure 2 As shown, based on the above-mentioned blurred image repair method, the present invention also provides a blurred image repair system accordingly, and the blurred image repair system includes:
[0067] The image processing module 51 is used to obtain a fuzzy image to be processed, identify the type of the fuzzy image to be processed, obtain a target fuzzy type, and confirm parameters of the fuzzy image to be processed according to the target fuzzy type to obtain fuzzy kernel parameters;
[0068] The blur removal module 52 is used to perform a deblurring process on the blurred image to be processed according to the blur kernel parameters to obtain a deblurred image, and perform a refinement process on the deblurred image to obtain a target deblurred image.
[0069] Furthermore, if Figure 3 As shown, based on the above-mentioned blurred image repair method, the present invention also provides a terminal accordingly, and the terminal includes a processor 10, a memory 20 and a display 30. Figure 3 Only some components of the terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0070] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the terminal. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed in the terminal, such as the program code of the installation terminal. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a blurred image repair program 40 is stored on the memory 20, and the blurred image repair program 40 can be executed by the processor 10, thereby realizing the blurred image repair method in the present application.
[0071] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run the program code or process data stored in the memory 20, such as executing the blurred image repair method.
[0072] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 30 is used to display information on the terminal and to display a visual user interface. The components 10-30 of the terminal communicate with each other via a system bus.
[0073] In one embodiment, when the processor 10 executes the blurred image repair program 40 in the memory 20, the following steps are implemented:
[0074] Acquire a blurred image to be processed, identify the type of the blurred image to be processed to obtain a target blurred type, and confirm parameters of the blurred image to be processed according to the target blurred type to obtain a blur kernel parameter;
[0075] The blurred image to be processed is deblurred according to the blur kernel parameters to obtain a deblurred image, and the deblurred image is refined to obtain a target deblurred image.
[0076] The step of obtaining a blurred image to be processed and identifying the type of the blurred image to be processed to obtain a target blurred type specifically includes:
[0077] Acquire a training image set, perform model training according to the training image set, and obtain a fuzzy image type recognition model, wherein the training image set includes multiple groups of training samples, and each group of training samples includes a fuzzy image of a fuzzy type and a corresponding type label;
[0078] Obtain a blurred image to be processed, perform normalization processing and data enhancement processing on the blurred image to be processed respectively to obtain a target blurred image to be processed, and input the target blurred image to be processed into the blurred image type recognition model to output a target blurred type.
[0079] The step of acquiring a training image set and performing model training according to the training image set to obtain a fuzzy image type recognition model specifically includes:
[0080] Acquire a training image set, create a fuzzy type training network model, and input a group of training samples in the training image set into the fuzzy type training network model;
[0081] Performing feature extraction on the blurred image to obtain target local features, and performing feature mapping on the target local features to obtain a target vector;
[0082] Classifying the target vector according to the weight matrix to obtain a probability distribution of blur types, and predicting the type of the blurred image according to the probability distribution to obtain a predicted blur type;
[0083] Calculating a loss value between the predicted fuzzy type and the type label according to a cross entropy loss function, and adjusting parameters of the fuzzy type training network model according to the loss value;
[0084] The next set of training samples is input into the fuzzy type training network model until the training status of the fuzzy type training network model meets the preset conditions, thereby obtaining a trained fuzzy image type recognition model.
[0085] The step of confirming the parameters of the blurred image to be processed according to the target blur type to obtain blur kernel parameters specifically includes:
[0086] According to the target blur type, the parameter processing scheme of the blurred image to be processed is matched to obtain a target parameter processing scheme, wherein the parameter processing scheme includes a frequency domain analysis scheme, a gradient prior scheme, a pixel statistics scheme and an iterative deblurring scheme;
[0087] Parameters of the blurred image to be processed are extracted according to the target parameter processing scheme to obtain corresponding blur kernel parameters.
[0088] The deblurring the blurred image to be processed according to the blur kernel parameters to obtain the deblurred image specifically includes:
[0089] Performing a clearing process on the blurred image to be processed according to the blur kernel parameters to obtain an initialized image, and performing a denoising process on the initialized image to obtain a denoised image;
[0090] The denoised image is subjected to image enhancement processing and error correction processing respectively to obtain a target denoised image, and the target denoised image is subjected to quantitative evaluation according to a quantitative index to obtain a deblurred image, wherein the quantitative index includes a peak signal-to-noise ratio and a structural similarity.
[0091] The denoising process is performed on the initialization image to obtain the denoised image, which specifically includes:
[0092] Calculating the residual of the initialization image according to the blur kernel parameter, and performing iterative optimization processing on the initialization image according to the residual to obtain a target initialization image;
[0093] Prior information of the blurred image to be processed is obtained, and gradient constraints are performed on the target initialization image according to the prior information to obtain a denoised image.
[0094] The step of performing thinning processing on the deblurred image to obtain a target deblurred image specifically includes:
[0095] Performing sharpening processing and color correction on the deblurred image respectively to obtain an optimized image, and performing quality evaluation on the optimized image to obtain an evaluation result;
[0096] If the evaluation result meets the standard, the optimized image is determined to be the target deblurred image.
[0097] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a blurred image repair program, and when the blurred image repair program is executed by a processor, the steps of the blurred image repair method described above are implemented.
[0098] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0099] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the program can be stored in a computer-readable storage medium that can be read by a computer, and the program can include the processes of the above-mentioned method embodiments when executed. The computer-readable storage medium can be a memory, a disk, an optical disk, etc.
[0100] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A method for repairing a blurred image, characterized in that: The method for repairing the blurred image comprises: Acquire a blurred image to be processed, identify the type of the blurred image to be processed to obtain a target blurred type, and confirm parameters of the blurred image to be processed according to the target blurred type to obtain a blur kernel parameter; The blurred image to be processed is deblurred according to the blur kernel parameters to obtain a deblurred image, and the deblurred image is refined to obtain a target deblurred image.
2. The method for repairing a blurred image according to claim 1, characterized in that: The acquiring of the blurred image to be processed and the identification of the type of the blurred image to be processed to obtain the target blur type specifically include: Acquire a training image set, perform model training according to the training image set, and obtain a fuzzy image type recognition model, wherein the training image set includes multiple groups of training samples, and each group of training samples includes a fuzzy image of a fuzzy type and a corresponding type label; Obtain a blurred image to be processed, perform normalization processing and data enhancement processing on the blurred image to be processed respectively to obtain a target blurred image to be processed, and input the target blurred image to be processed into the blurred image type recognition model to output a target blurred type.
3. The method for repairing a blurred image according to claim 2, characterized in that: The acquiring of a training image set and performing model training according to the training image set to obtain a fuzzy image type recognition model specifically includes: Acquire a training image set, create a fuzzy type training network model, and input a group of training samples in the training image set into the fuzzy type training network model; Performing feature extraction on the blurred image to obtain target local features, and performing feature mapping on the target local features to obtain a target vector; Classifying the target vector according to the weight matrix to obtain a probability distribution of blur types, and predicting the type of the blurred image according to the probability distribution to obtain a predicted blur type; Calculating a loss value between the predicted fuzzy type and the type label according to a cross entropy loss function, and adjusting parameters of the fuzzy type training network model according to the loss value; The next set of training samples is input into the fuzzy type training network model until the training status of the fuzzy type training network model meets the preset conditions, thereby obtaining a trained fuzzy image type recognition model.
4. The method for repairing a blurred image according to claim 1, characterized in that: The step of confirming the parameters of the blurred image to be processed according to the target blur type to obtain blur kernel parameters specifically includes: According to the target blur type, the parameter processing scheme of the blurred image to be processed is matched to obtain a target parameter processing scheme, wherein the parameter processing scheme includes a frequency domain analysis scheme, a gradient prior scheme, a pixel statistics scheme and an iterative deblurring scheme; Parameters of the blurred image to be processed are extracted according to the target parameter processing scheme to obtain corresponding blur kernel parameters.
5. The method for repairing a blurred image according to claim 1, characterized in that: The deblurring the blurred image to be processed according to the blur kernel parameter to obtain the deblurred image specifically includes: Performing a clearing process on the blurred image to be processed according to the blur kernel parameters to obtain an initialized image, and performing a denoising process on the initialized image to obtain a denoised image; The denoised image is subjected to image enhancement processing and error correction processing respectively to obtain a target denoised image, and the target denoised image is subjected to quantitative evaluation according to a quantitative index to obtain a deblurred image, wherein the quantitative index includes a peak signal-to-noise ratio and a structural similarity.
6. The method for repairing a blurred image according to claim 5, characterized in that: The denoising process is performed on the initialization image to obtain a denoised image, specifically comprising: Calculating the residual of the initialization image according to the blur kernel parameter, and performing iterative optimization processing on the initialization image according to the residual to obtain a target initialization image; Prior information of the blurred image to be processed is obtained, and gradient constraints are performed on the target initialization image according to the prior information to obtain a denoised image.
7. The method for restoring a blurred image according to claim 1, characterized in that: The thinning process of the deblurred image to obtain a target deblurred image specifically includes: Performing sharpening processing and color correction on the deblurred image respectively to obtain an optimized image, and performing quality evaluation on the optimized image to obtain an evaluation result; If the evaluation result meets the standard, the optimized image is determined to be the target deblurred image.
8. A blurred image restoration system, characterized in that: The blurred image restoration system comprises: An image processing module is used to obtain a fuzzy image to be processed, identify the type of the fuzzy image to be processed, obtain a target fuzzy type, and confirm parameters of the fuzzy image to be processed according to the target fuzzy type to obtain fuzzy kernel parameters; The blur removal module is used to perform a deblurring process on the blurred image to be processed according to the blur kernel parameters to obtain a deblurred image, and to perform a refinement process on the deblurred image to obtain a target deblurred image.
9. A terminal, characterized in that: The terminal includes a memory, a processor, and a program stored in the memory and executable on the processor. When the program is executed by the processor, the steps of the blurred image repair method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, wherein the computer-readable storage medium stores a blurred image repair program, and when the blurred image repair program is executed by a processor, the steps of the blurred image repair method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Video streaming fuzzy detection method based on frequency domain
CN104301722A
Fuzzy image restoration method for small unmanned aerial vehicle
CN108765325A
Image blurring degree processing method
CN113177893A
Auto-encoder deblurring method based on domain transformation
CN114066750A
Image processing method and device, electronic equipment and computer readable storage medium
CN114764868A
