Image enhancement method and device, electronic equipment, storage medium and program product

By adjusting the weights based on the degree of high-frequency texture similarity and local neighborhood similarity during image enhancement, a reasonable allocation between denoising and sharpening is achieved, improving the detail and edge clarity of the image while reducing the consumption of storage and hardware resources.

CN120997080APending Publication Date: 2025-11-21VERISILICON MICROELECTRONICS (SHANGHAI) CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511194227.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-25
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

Existing technologies have poor denoising and sharpening effects in image enhancement, and cannot effectively improve image quality.

Method used

By obtaining the initial denoising weights and initial sharpening weights of the neighboring pixel blocks of each pixel in the grayscale image, and adjusting the weights in combination with the high frequency texture similarity, image enhancement is performed using a weighted processing method. Taking into account local neighborhood similarity and directional filtering, a reasonable allocation of denoising and sharpening is achieved.

Benefits of technology

It improves image detail and edge sharpness, reduces storage space and hardware resource consumption, and achieves better image correction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120997080A_ABST
    Figure CN120997080A_ABST
Patent Text Reader

Abstract

The invention aims to provide an image enhancement method and device, electronic equipment, a storage medium and a program product, and relates to the technical field of image processing. The method comprises the following steps: acquiring a grayscale image, and determining a target denoising weight and a target sharpening weight of each neighborhood pixel block according to a high-frequency texture suspected degree of each first pixel point; for the first pixel point, weighting a pixel value of a preset position in each neighborhood pixel block corresponding to the pixel block where the first pixel point is located by using the target denoising weight of the neighborhood pixel block of the first pixel point to obtain a target denoising value of the first pixel point; weighting a non-directional texture value of a preset position in each neighborhood pixel block corresponding to the pixel block where the first pixel point is located by using the target sharpening weight of the neighborhood pixel block of the first pixel point to obtain a target sharpening value of the first pixel point; and correcting the first pixel point by using the target denoising value and the target sharpening value corresponding to the first pixel point to obtain a corrected image. In this way, the image correction effect is better.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and more specifically, to an image enhancement method and apparatus, electronic device, storage medium, and program product. Background Technology

[0002] Currently, images are typically acquired using imaging devices. However, due to the sometimes complex environment in which images are captured, noise is inevitably introduced into the raw images generated by these devices. Furthermore, factors such as lens diffraction and focusing errors during image acquisition can cause blurring of details in the raw images. Therefore, image enhancement processing is usually required for the raw images. Common techniques in image enhancement include noise reduction and sharpening.

[0003] In related technologies, images are usually denoised first, and then sharpened on the denoised image. However, the image quality is still poor when processed in this way. Summary of the Invention

[0004] In view of this, this application aims to provide an image enhancement method and apparatus, electronic device, storage medium, and program product to improve image quality.

[0005] In a first aspect, embodiments of this application provide an image enhancement method, comprising: acquiring a grayscale image, and acquiring initial denoising weights and initial sharpening weights of neighboring pixel blocks corresponding to each first pixel in the grayscale image; adjusting each of the initial denoising weights and initial sharpening weights according to the high-frequency texture likelihood of each first pixel to obtain each target denoising weight and each target sharpening weight; the high-frequency texture likelihood is used to describe the probability that the first pixel is a high-frequency texture; for each first pixel: using the target denoising weights of the neighboring pixel blocks of the first pixel to weight the pixel values ​​at preset positions in each of the neighboring pixel blocks corresponding to the pixel block where the first pixel is located, to obtain a target denoising value for the first pixel; using the target sharpening weights of the neighboring pixel blocks of the first pixel to weight the undirected texture values ​​at preset positions in each of the neighboring pixel blocks corresponding to the pixel block where the first pixel is located, to obtain a target sharpening value for the first pixel; and using the target denoising value and the target sharpening value corresponding to the first pixel to correct the first pixel to obtain a corrected image.

[0006] The high-frequency texture likelihood can reflect the probability that the first pixel is a high-frequency texture, thus distinguishing the first pixel in different regions. By determining the high-frequency texture likelihood of the first pixel, the target denoising value for image denoising and the target sharpening value for image sharpening can be determined. In the process of image denoising and sharpening, the first pixel in different regions of the image can be denoised and sharpened in a targeted manner, resulting in a smoother corrected image with thinner and longer edges, thus achieving a better image correction effect.

[0007] In one embodiment, the high-frequency texture likelihood of each first pixel is determined by the following method: for each first pixel: obtain the non-directional texture value and the directional edge value corresponding to the first pixel; determine the high-frequency texture likelihood of the first pixel based on the non-directional texture value and the directional edge value.

[0008] Considering that non-directional textures can reflect isotropic high-frequency details (such as noise and fine spots), but may misjudge directional high-frequency textures (such as dense lines), while directional edge values ​​can reflect low-frequency or mid-frequency structural directions (such as edges and stripes), combining non-directional texture values ​​and directional edge values ​​to determine the high-frequency texture likelihood of the first pixel can reduce misjudgments and improve the accuracy of the determined high-frequency texture likelihood.

[0009] In one embodiment, determining the high-frequency texture likelihood of the first pixel based on the non-directional texture value and the directional edge value includes: weighting the non-directional texture value and the directional edge value according to a first preset weight set to obtain the high-frequency texture likelihood; the first preset weight set stores a first weight corresponding to the non-directional texture value and a second weight corresponding to the directional edge value.

[0010] By weighting the undirected texture value and the directional edge value of the first pixel, the undirected texture information and the directional edge information of the first pixel can be combined, thereby more accurately determining the high-frequency texture suspicion of the first pixel.

[0011] In one embodiment, the initial denoising weights and initial sharpening weights of the neighboring pixel blocks corresponding to the first pixel are obtained in the following manner: For each first pixel: the initial denoising weights and initial sharpening weights of each neighboring pixel block corresponding to the first pixel are determined according to the local neighborhood similarity situation corresponding to the first pixel; the local neighborhood similarity situation is used to characterize the similarity between the pixel block where the first pixel is located and the neighboring pixel blocks of the first pixel.

[0012] Local neighborhood similarity reflects the similarity between neighboring pixel blocks and the pixel block containing the first pixel. High neighborhood similarity suggests the neighboring pixel block is likely a smooth region with less noise and requires less sharpening. Low neighborhood similarity suggests the neighboring pixel block is likely noisier and requires increased sharpening. Therefore, local neighborhood similarity allows for a more reasonable determination of the initial denoising and sharpening weights for different neighboring pixel blocks. Furthermore, if denoising is performed first, followed by sharpening, assuming a single pixel is processed using 5x5 windows for both denoising and sharpening, obtaining the initial denoising and sharpening weights requires two 5x5 windows sequentially. This necessitates storing 5 rows of image data for denoising and 5 rows for sharpening in the hardware. Considering potential overlap between the denoising and sharpening windows, this actually requires storing 9 rows of input image data. However, using the method described in this application, processing a single pixel with a 5x5 window only requires storing 4 rows of the original image in the hardware. Therefore, by determining the target denoising weights and target denoising weights of each neighboring pixel block corresponding to the first pixel using the method of this application, less data needs to be stored, thereby reducing the consumption of hardware resources such as storage space.

[0013] In one embodiment, the local neighborhood similarity includes: a first similarity value and a second similarity value; the first similarity value is the pixel difference between the pixel block where the first pixel is located and the neighboring pixel blocks; the second similarity value is the pixel mean of the difference between the pixel block where the first pixel is located and the neighboring pixel blocks; determining the initial denoising weight and initial sharpening weight of each neighboring pixel block corresponding to the first pixel based on the local neighborhood similarity of the first pixel includes: for each neighboring pixel block corresponding to the first pixel: determining the initial denoising weight corresponding to the neighboring pixel block based on preset constraint parameters, the first similarity value and the second similarity value corresponding to the neighboring pixel block; the constraint parameters reflect the distance between the neighboring pixel block and the pixel block where the first pixel is located; determining the initial sharpening weight corresponding to the neighboring pixel block based on the first similarity value and the second similarity value corresponding to the neighboring pixel block.

[0014] The similarity between the pixel block containing the first pixel and its neighboring pixel blocks can be reflected by both the pixel difference and the average pixel value between them. Combining the first and second similarity values ​​provides a more accurate reflection of the similarity between the pixel block containing the first pixel and its neighboring pixel blocks. Furthermore, by adding constraint parameters during the denoising process, the influence of neighboring pixel blocks at different distances on the pixel block containing the first pixel can be adjusted, thus effectively denoising while preserving the image's edge regions.

[0015] In one embodiment, adjusting the initial denoising weights and initial sharpening weights based on the high-frequency texture resemblance of each first pixel to obtain target denoising weights and target sharpening weights includes: for each first pixel: determining a denoising correction value and a non-directional sharpening correction value for the first pixel based on the high-frequency texture resemblance; for the initial denoising weight of each neighboring pixel block of the first pixel: correcting the initial denoising weight using the denoising correction value of the first pixel to obtain a target denoising weight corresponding to the initial denoising weight; for the initial sharpening weight of each neighboring pixel block of the first pixel: correcting the initial sharpening weight using the denoising correction value and the non-directional sharpening correction value of the first pixel to obtain a target sharpening weight corresponding to the initial sharpening weight.

[0016] Since denoising is typically used to remove noise from an image, while sharpening usually enhances high-frequency components such as edges and textures to make blurred areas clearer, the denoising and sharpening values ​​needed for the same pixel are different. Determining the denoising correction value and the non-directional sharpening correction value based on the high-frequency texture resemblance allows for targeted adjustments to the initial denoising and sharpening weights, resulting in target denoising and sharpening weights that better reflect the actual image conditions.

[0017] In one embodiment, the initial denoising weight is corrected using the denoising correction value of the first pixel to obtain the target denoising weight corresponding to the initial denoising weight, including: calculating... Obtain the target denoising weights corresponding to the initial denoising weights; where, Diff nr (x,y,p,q) represents the initial denoising weights for the neighboring pixel block with x-coordinate p and y-coordinate, corresponding to the center coordinate of the first pixel with x-coordinate x and y-coordinate q; W nr (x,y,p,q) represents the target denoising weights for the neighborhood pixel block with x-coordinate p and y-coordinate corresponding to the center coordinate of the first pixel with x-coordinate x and y-coordinate q; NrGain(x,y) represents the denoising correction value corresponding to the first pixel with x-coordinate x and y-coordinate q; σ nr Adjust the parameters for the shape of the first noise reduction curve.

[0018] The initial denoising weights are adjusted by combining the denoising correction values ​​determined by the high frequency texture similarity, so that the obtained target denoising weights are more in line with the actual image situation.

[0019] In one embodiment, calculation Obtain alternative sharpening weights; calculate W ee2 (x,y,p,q)=W ee1(x,y,p,q)*TextureEnhanceGain(x,y) yields the target sharpening weights corresponding to the initial sharpening weights; where Diff ee (x,y,p,q) represents the initial sharpening weights for the neighboring pixel block with x-coordinate p and y-coordinate, corresponding to the center coordinate of the first pixel with x-coordinate x and y-coordinate ; NrGain(x,y) represents the denoising correction value corresponding to the first pixel with x-coordinate x and y-coordinate ; W ee1 (x,y,p,q) represents the candidate sharpening weights for the neighboring pixel block with x-coordinate p and y-coordinate, corresponding to the center coordinate of the first pixel point with x-coordinate x and y-coordinate q; W ee2 (x,y,p,q) represents the target sharpening weight for the neighborhood pixel block with x-coordinate p and y-coordinate corresponding to the center coordinate of the first pixel with x-coordinate x and y-coordinate q; TextureEnhanceGain(x,y) is the undirected sharpening correction value corresponding to the first pixel with x-coordinate x and y-coordinate y; σ ee Adjust the parameters for the shape of the second noise reduction curve.

[0020] The initial sharpening weights are adjusted by combining the denoising correction value determined by the high frequency texture similarity and the non-directional sharpening correction value, so that the obtained target sharpening weights are more in line with the actual image situation.

[0021] In one embodiment, the image enhancement method further includes: obtaining target direction edge values ​​corresponding to each first pixel; for each first pixel: correcting the target sharpening value using the target direction edge values ​​corresponding to the first pixel to obtain an updated target sharpening value; correspondingly, correcting the first pixel using the target denoising value and the target sharpening value corresponding to the first pixel to obtain a corrected image, including: correcting the first pixel using the target denoising value and the updated target sharpening value corresponding to the first pixel to obtain a corrected image.

[0022] Considering that a high target direction edge value for the first pixel indicates that it is located in an edge region, sharpening is needed to highlight the edge. Correcting the target sharpening value by adjusting the target direction edge value, and then using the updated target sharpening value for image correction, results in better detail representation of the image.

[0023] In one embodiment, the target direction edge value corresponding to the first pixel is obtained by: filtering the grayscale image using a first filtering kernel in a preset first direction to obtain a first candidate edge image; the first filtering kernel is used for directional filtering; filtering the grayscale image using a first filtering kernel in a preset second direction to obtain a second candidate edge image; the first direction and the second direction are different; fusing the first candidate edge image and the second candidate edge image to obtain a third candidate edge image; the value of the second pixel in the third candidate edge image that is at the same position as the first pixel is the target direction edge value corresponding to the first pixel.

[0024] By combining candidate edge images that have undergone directional filtering in both directions, more image information can be retained in the target direction edge value corresponding to the first pixel.

[0025] In one embodiment, the image enhancement method further includes: determining a directional sharpening correction value based on the high-frequency texture similarity; correcting the target directional edge value using the directional sharpening correction value to obtain an updated target directional edge value; correspondingly, correcting the target sharpening value using the target directional edge value corresponding to the first pixel to obtain an updated target sharpening value, including: correcting the target sharpening value using the updated target directional edge value corresponding to the first pixel.

[0026] By correcting the target direction edge value with the directional sharpening correction value, the edge region reflected by the target direction edge value is made more accurate. The target sharpening value is then corrected by the corrected target direction edge value, and the image is then corrected using the updated target sharpening value, which can improve the detail representation of the image.

[0027] In one embodiment, the first pixel is corrected using the target denoising value and the target sharpening value corresponding to the first pixel to obtain a corrected image, including: for each first pixel: superimposing the pixel value of the first pixel, the target denoising value and the target sharpening value to obtain the target corrected pixel value corresponding to the first pixel; the target corrected pixel values ​​corresponding to each first pixel respectively constitute the corrected image.

[0028] By simultaneously overlaying the target denoising value and the target sharpening value on the first pixel, image denoising and sharpening can be achieved in one step. There is no need to store the denoised image separately and then perform sharpening processing based on the denoised image, which can reduce the consumption of hardware resources such as storage space.

[0029] Secondly, embodiments of this application provide an image enhancement apparatus, comprising: an acquisition module, configured to acquire a grayscale image, and acquire initial denoising weights and initial sharpening weights of neighboring pixel blocks corresponding to each first pixel in the grayscale image; a weight adjustment module, configured to adjust each of the initial denoising weights and initial sharpening weights according to the high-frequency texture likelihood of each first pixel, to obtain each target denoising weight and each target sharpening weight; the high-frequency texture likelihood is used to describe the probability that the first pixel is a high-frequency texture; and a correction value determination module, configured to determine the correction value for each first pixel. The first pixel is denoised using the target denoising weights of its neighboring pixel blocks. The pixel values ​​at preset positions in each neighboring pixel block corresponding to the first pixel are weighted to obtain the target denoising value of the first pixel. The undirected texture values ​​at preset positions in each neighboring pixel block corresponding to the first pixel are weighted using the target sharpening weights of its neighboring pixel blocks to obtain the target sharpening value of the first pixel. The image enhancement module is used to correct the first pixel using the target denoising value and the target sharpening value to obtain a corrected image.

[0030] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the above-described image enhancement method.

[0031] Fourthly, embodiments of this application provide a storage medium storing computer-executable instructions. When these computer-executable instructions are invoked and executed by a processor, they cause the processor to implement the aforementioned image enhancement method.

[0032] Fifthly, embodiments of this application provide a computer program product, the computer program product including a computer program, which, when executed by a processor, implements the above-described image enhancement method. Attached Figure Description

[0033] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0034] Figure 1 A flowchart illustrating an image enhancement method provided in an embodiment of this application;

[0035] Figure 2 A schematic diagram of the pixel block where the first pixel is located and the neighboring pixel blocks of the first pixel, provided in an embodiment of this application;

[0036] Figure 3 This is a schematic diagram showing the effect comparison before and after processing the first image provided in the embodiments of this application;

[0037] Figure 4 This is a schematic diagram showing the effect comparison before and after the second processed image provided in the embodiments of this application;

[0038] Figure 5 This is a schematic diagram showing the effect comparison before and after processing the third image provided in the embodiments of this application;

[0039] Figure 6 This is a schematic diagram showing the effect comparison before and after processing the fourth image, provided in an embodiment of this application.

[0040] Figure 7 This is a schematic diagram showing the effect comparison before and after processing the fifth image provided in the embodiments of this application;

[0041] Figure 8 This is a schematic diagram of the structure of an image enhancement device provided in an embodiment of this application;

[0042] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0043] Icons: 1: Acquisition module; 2: Weight adjustment module; 3: Correction value determination module; 4: Image enhancement module; 5: Memory; 6: Communication interface; 7: Bus; 8: Processor. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.

[0045] Example 1

[0046] Please see Figure 1 , Figure 1 A flowchart of an image enhancement method provided in this application embodiment includes:

[0047] S101, acquire a grayscale image, and acquire the initial denoising weights and initial sharpening weights of the neighboring pixel blocks corresponding to each first pixel in the grayscale image.

[0048] In some embodiments, an imaging device can be used to capture an image to be processed. Alternatively, an image uploaded by a user that is desired to be denoised and / or sharpened can be received as the image to be processed. The image to be processed is the image that requires denoising and / or sharpening. If the image to be processed is not in YUV (a color model used for video encoding) format, it can be converted to YUV format first, and then the Y component of the image to be processed can be extracted to form a grayscale image.

[0049] In other embodiments, grayscale images uploaded by users can also be received directly.

[0050] In some embodiments, the initial denoising weights and initial sharpening weights of the neighboring pixel blocks corresponding to the first pixel can be obtained in the following manner: For each first pixel: the initial denoising weights and initial sharpening weights of each neighboring pixel block corresponding to the first pixel are determined according to the local neighborhood similarity situation corresponding to the first pixel.

[0051] Among them, the local neighborhood similarity case is used to characterize the similarity between the pixel block where the first pixel is located and the neighboring pixel blocks of the first pixel.

[0052] For example, in combination Figure 2 As shown, Figure 2 This is a schematic diagram of the pixel block where the first pixel is located and the neighboring pixel blocks of the first pixel. Figure 2 In the diagram, the box at coordinates (x, y) represents the pixel block containing the first pixel, and the box at coordinates (p, q) represents one of its neighboring pixel blocks.

[0053] For example, local neighborhood similarity may include: a first similarity value and / or a second similarity value.

[0054] The first similarity value is the pixel difference between the pixel block containing the first pixel and its neighboring pixel blocks. For example, the first similarity value can be obtained in the following way:

[0055] calculate Obtain the first similarity value. Where p∈[x-wsize,x+wsize], q∈[y-wsize,y+wsize]. `share_diff(x,y,p,q)` is the pixel difference between the pixel block containing the first pixel with x-coordinate x and y-coordinate and the neighboring pixel block with center coordinate p and q. `wsize` represents the search window radius for block matching. `ksize` represents the block radius for block matching. `inputY(x+r1,y+r2)` represents the pixel value of the pixel with x-coordinate x+r1 and y-coordinate y+r2 in the grayscale image. `inputY(p+r1,q+r2)` represents the pixel value of the pixel with x-coordinate p+r1 and q+r2 in the grayscale image. `r1∈[-ksize,ksize]`, `r2∈[-ksize,ksize]`.

[0056] The second similarity value is the average pixel value of the difference between the pixel block containing the first pixel and its neighboring pixel blocks. For example, the second similarity value can be obtained in the following way:

[0057] calculate Here, share_mean_diff(x, y, p, q) is the pixel mean difference between the pixel block containing the first pixel with x-coordinate x and y-coordinate and the neighboring pixel block with x-coordinate p and y-coordinate q at the center.

[0058] In one optional embodiment of the above, the local neighborhood similarity may include: a first similarity value and a second similarity value. Determining the initial denoising weight and initial sharpening weight of each neighboring pixel block corresponding to the first pixel point based on the local neighborhood similarity of the first pixel point may include: for each neighboring pixel block corresponding to the first pixel point: determining the initial denoising weight corresponding to the neighboring pixel block based on preset constraint parameters, the first similarity value and the second similarity value corresponding to the neighboring pixel block; determining the initial sharpening weight corresponding to the neighboring pixel block based on the first similarity value and the second similarity value corresponding to the neighboring pixel block.

[0059] The constraint parameter reflects the distance between the neighboring pixel block and the pixel block containing the first pixel. For example, the closer the neighboring pixel block is to the pixel block containing the first pixel, the larger the constraint parameter.

[0060] In the above optional method, determining the initial denoising weight corresponding to the neighboring pixel block according to the preset constraint parameters, the first similarity value and the second similarity value corresponding to the neighboring pixel block may include: weighting the first similarity value and the second similarity value corresponding to the neighboring pixel block according to the second preset weight set to obtain the candidate denoising weight corresponding to the neighboring pixel block; calculating the sum of the candidate denoising weight and the preset constraint parameters to obtain the initial denoising weight.

[0061] The second preset weight set stores the third weight corresponding to the first similarity value and the fourth weight corresponding to the second similarity value. For example, the third and fourth weights can be preset based on engineering experience.

[0062] For example, calculating Diff nr (x,y,p,q)=τ*share_diff(x,y,p,q)+ε*share_mean_diff(x,y,p,q)+spatial_diff(x,y,p,q) to obtain the initial denoising weights. Where, Diff... nr (x, y, p, q) represents the initial denoising weights for the neighboring pixel block with x-coordinate p and y-coordinate, corresponding to the center coordinate of the first pixel with x-coordinate x and y-coordinate q. τ is the third weight, ε is the fourth weight, and spatial_diff(x, y, p, q) are constraint parameters. For example, τ is 1 and ε is 0.05.

[0063] In the above optional method, determining the initial sharpening weight corresponding to the neighboring pixel block based on the first similarity value and the second similarity value corresponding to the neighboring pixel block may include: weighting the first similarity value and the second similarity value corresponding to the neighboring pixel block according to a third preset weight set to obtain the initial sharpening weight corresponding to the neighboring pixel block.

[0064] The third preset weight set stores the fifth weight corresponding to the first similarity value and the sixth weight corresponding to the second similarity value. For example, the fifth and sixth weights can be preset based on engineering experience.

[0065] For example, calculating Diff ee (x,y,p,q) = θ*share_diff(x,y,p,q) + δ*share_mean_diff(x,y,p,q), obtaining the initial sharpening weights. Where, Diff... ee (x, y, p, q) represents the initial sharpening weights for the neighboring pixel block with x-coordinate p and y-coordinate, corresponding to the center coordinate of the first pixel point with x-coordinate x and y-coordinate q. θ is the fifth weight, and δ is the sixth weight. Optionally, θ is 1 and δ is 0.05.

[0066] In another optional embodiment described above, the local neighborhood similarity may include: a first similarity value and a second similarity value. Determining the initial denoising weight and initial sharpening weight for each neighboring pixel block corresponding to the first pixel point based on the local neighborhood similarity can be achieved by: for each neighboring pixel block corresponding to the first pixel point, searching in a preset first weight database for the initial denoising weight and initial sharpening weight corresponding to the first similarity value and the second similarity value of the neighboring pixel block.

[0067] The first weight database stores the correspondence between the first similarity value, the second similarity value, the initial denoising weight, and the initial sharpening weight.

[0068] In another optional embodiment described above, the local neighborhood similarity may include a first similarity value. Determining the initial denoising weights and initial sharpening weights for each neighboring pixel block corresponding to the first pixel point based on the local neighborhood similarity can be achieved by: for each neighboring pixel block corresponding to the first pixel point, searching in a preset second weight database for the initial denoising weights and initial sharpening weights corresponding to the first similarity value of the neighboring pixel block.

[0069] The second weight database stores the correspondence between the first similarity value, the initial denoising weight, and the initial sharpening weight.

[0070] In another optional embodiment described above, the local neighborhood similarity condition may include a second similarity value. Determining the initial denoising weights and initial sharpening weights for each neighboring pixel block corresponding to the first pixel point based on the local neighborhood similarity condition can be achieved by: for each neighboring pixel block corresponding to the first pixel point, searching in a preset third weight database for the initial denoising weights and initial sharpening weights corresponding to the second similarity value of that neighboring pixel block.

[0071] The third weight database stores the correspondence between the second similarity value, the initial denoising weight, and the initial sharpening weight.

[0072] S102, adjust each initial denoising weight and each initial sharpening weight according to the high frequency texture similarity of each first pixel, and obtain each target denoising weight and each target sharpening weight.

[0073] Optionally, the high-frequency texture likelihood is used to describe the probability that the first pixel is a high-frequency texture. High-frequency textures correspond to areas in the image where details change drastically, manifested as significant differences in pixel values ​​within a very small spatial range (e.g., within a few pixels). That is, if the difference in pixel values ​​between pixels within a preset number of pixels exceeds a certain threshold, it can be considered a high-frequency texture. The preset number and threshold can be set based on the experience of the developers.

[0074] In some embodiments, the high-frequency texture likelihood of each first pixel can be determined by the following method: for each first pixel: obtain the non-directional texture value and the directional edge value corresponding to the first pixel; determine the high-frequency texture likelihood of the first pixel based on the non-directional texture value and the directional edge value.

[0075] In the above embodiments, the non-directional texture value corresponding to the first pixel can be obtained by: filtering the grayscale image using a preset second filter kernel to obtain a smooth image; subtracting the smooth image from the grayscale image to obtain a residual image; the non-directional texture value corresponding to the first pixel is equal to the pixel value of the third pixel in the residual image that is at the same position as the first pixel.

[0076] The second filter kernel is a Gaussian filter kernel.

[0077] For example, it can be calculated using a formula. Obtain the undirected texture value corresponding to the first pixel. Here, `textureY(x, y)` is the pixel value of the third pixel with x-coordinate and y-coordinate, which is also the undirected texture value corresponding to the first pixel with x-coordinate and y-coordinate. `inputY(x, y)` is the pixel value of the first pixel in the grayscale image with x-coordinate and y-coordinate. `inputY[i, j]` is the pixel value of the first pixel in the grayscale image with x-coordinate i and y-coordinate j. `Kernel[i, j]` is the value in the second filter kernel with x-coordinate i and y-coordinate j. "*" indicates multiplication.

[0078] In the above embodiments, the directional edge value corresponding to the first pixel can be obtained by filtering the grayscale image using a preset k-direction first filter kernel to obtain a fourth candidate edge image; superimposing each fourth candidate edge image to obtain a directional edge image; the directional edge value corresponding to the first pixel is equal to the pixel value of the fourth pixel at the same position in the directional edge image.

[0079] The first filter kernel is used for directional filtering.

[0080] For example, calculation Obtain the directional edge image; the pixel value of the fourth pixel in the directional edge image that is at the same position as the first pixel is the directional edge value corresponding to the first pixel. Where edgeScore is the directional edge image, edge_detect_kernel[k] is the first filtering kernel in the k-th direction, and inputY is the grayscale image. This represents convolution. There are k directions, for example: horizontal 0°, horizontal 180°, vertical 90°, vertical 270°, diagonal 45°, diagonal 225°, diagonal 135°, and diagonal 315°.

[0081] In one optional embodiment of the above, determining the high-frequency texture likelihood of the first pixel based on the undirected texture value and the directed edge value can be achieved by weighting the undirected texture value and the directed edge value according to a first preset weight set to obtain the high-frequency texture likelihood.

[0082] The first preset weight set stores the first weight corresponding to the undirected texture value and the second weight corresponding to the directed edge value.

[0083] For example, we calculate Score(x,y) = α*edgeScore(x,y) + β*textureY(x,y) to obtain the high-frequency texture likelihood. Here, Score(x,y) is the high-frequency texture likelihood of the first pixel with x-coordinate and y-coordinate. edgeScore(x,y) is the oriented edge value corresponding to the first pixel with x-coordinate and y-coordinate. textureY(x,y) is the unoriented texture value corresponding to the first pixel with x-coordinate and y-coordinate.

[0084] In the example above, α is the second weight corresponding to the directional edge value, and β is the first weight corresponding to the undirectional texture value. α and β follow the constraint α + β = 1. The specific values ​​of α and β can be adjusted based on the engineer's experience; for example, α = 0.4 and β = 0.6. Another example is α = 0.3 and β = 0.7.

[0085] In another optional embodiment described above, determining the high-frequency texture likelihood of the first pixel based on the non-directional texture value and the directional edge value can be achieved by searching a preset likelihood database for the high-frequency texture likelihood corresponding to both the non-directional texture value and the directional edge value.

[0086] The suspicion level database stores the correspondence between non-directional texture values, directional edge values, and the suspicion level of high-frequency textures.

[0087] In one optional embodiment of the above, adjusting the initial denoising weights and initial sharpening weights according to the high-frequency texture resemblance of each first pixel to obtain the target denoising weights and target sharpening weights can be as follows: For each first pixel: determining the denoising correction value and the non-directional sharpening correction value of the first pixel based on the high-frequency texture resemblance of the first pixel; For the initial denoising weight of each neighboring pixel block of the first pixel: correcting the initial denoising weight using the denoising correction value of the first pixel to obtain the target denoising weight corresponding to the initial denoising weight; For the initial sharpening weight of each neighboring pixel block of the first pixel: correcting the initial sharpening weight using the denoising correction value and the non-directional sharpening correction value of the first pixel to obtain the target sharpening weight corresponding to the initial sharpening weight.

[0088] In the above optional method, determining the denoising correction value and non-directional sharpening correction value of the first pixel based on the high-frequency texture similarity of the first pixel can be done by: searching for the denoising correction value and non-directional sharpening correction value corresponding to the high-frequency texture similarity of the first pixel in a preset first correction value database.

[0089] The first correction value database stores the correspondence between the high-frequency texture suspicion level, the noise reduction correction value, and the non-directional sharpening correction value.

[0090] In the above optional methods, the initial denoising weight is corrected using the denoising correction value of the first pixel to obtain the target denoising weight corresponding to the initial denoising weight, which can be achieved by: calculating... Obtain the target denoising weights corresponding to the initial denoising weights. Where W... nr (x,y,p,q) represents the target denoising weights for the neighborhood pixel block with x-coordinate p and y-coordinate, corresponding to the center coordinate of the first pixel with x-coordinate x and y-coordinate . NrGain(x,y) is the denoising correction value corresponding to the first pixel with x-coordinate x and y-coordinate . σ nr The parameter for adjusting the shape of the first noise reduction curve is used to control the rate at which the weights decrease, σ. nr The larger W nr The slower (x,y,p,q) decreases, the greater σ becomes. nr The smaller W nr (x,y,p,q) varies with Diff nr As (x,y,p,q) increases, it decreases rapidly, and exp() is the natural exponential function.

[0091] In the above optional methods, the initial sharpening weight is corrected using the denoising correction value and the non-directional sharpening correction value of the first pixel to obtain the target sharpening weight corresponding to the initial sharpening weight. This can be achieved by: calculating... Obtain alternative sharpening weights; calculate W ee2 (x,y,p,q)=W ee1 (x,y,p,q)*TextureEnhanceGain(x,y) obtains the target sharpening weights corresponding to the initial sharpening weights. Where W... ee1 (x,y,p,q) represents the candidate sharpening weights for the neighboring pixel block with x-coordinate p and y-coordinate, corresponding to the center coordinate of the first pixel point with x-coordinate x and y-coordinate y. ee2 (x,y,p,q) represents the target sharpening weight for the neighborhood pixel block with x-coordinate p and y-coordinate corresponding to the center coordinate of the first pixel with x-coordinate x and y-coordinate . TextureEnhanceGain(x,y) is the undirected sharpening correction value corresponding to the first pixel with x-coordinate x and y-coordinate . σ ee The parameter for adjusting the shape of the second noise reduction curve is used to control the rate at which the weights decrease, σ. ee The larger W ee1 The slower (x,y,p,q) decreases, the greater σ becomes. ee The smaller W ee1 (x,y,p,q) varies with Diff ee It decreases rapidly as (x,y,p,q) increases.

[0092] In another optional embodiment described above, adjusting each initial denoising weight according to the high-frequency texture likelihood of the first pixel to obtain each target denoising weight can be achieved by: for each neighboring pixel block corresponding to the first pixel, searching in a preset fourth weight database for the target denoising weight that corresponds to both the high-frequency texture likelihood of the first pixel and the initial denoising weight of the neighboring pixel block.

[0093] The fourth weight database stores the correspondence between the high-frequency texture suspicion level, the initial denoising weight, and the target denoising weight.

[0094] In another optional embodiment described above, adjusting each initial sharpening weight based on the high-frequency texture likelihood of the first pixel to obtain each target sharpening weight can be achieved by: for each neighboring pixel block corresponding to the first pixel, searching in a preset fifth weight database for the target sharpening weight that corresponds to both the high-frequency texture likelihood of the first pixel and the initial sharpening weight of the neighboring pixel block.

[0095] The fifth weight database stores the correspondence between the high-frequency texture suspicion level, the initial sharpening weight, and the target sharpening weight.

[0096] S103, for each first pixel: using the target denoising weight of the neighboring pixel blocks of the first pixel, the pixel values ​​at preset positions in each neighboring pixel block corresponding to the pixel block where the first pixel is located are weighted to obtain the target denoising value of the first pixel; using the target sharpening weight of the neighboring pixel blocks of the first pixel, the undirected texture values ​​at preset positions in each neighboring pixel block corresponding to the pixel block where the first pixel is located are weighted to obtain the target sharpening value of the first pixel.

[0097] The preset position can be set based on the engineer's experience. For example, the preset position is the center of a neighboring pixel block. Another example is the preset position being the second pixel to the right of the center of the neighboring pixel block.

[0098] In the above embodiments, the preset position is the center of the neighboring pixel block, and the pixel value at the preset position in the neighboring pixel block is the pixel value of the center coordinate of the neighboring pixel block. The target denoising value of the first pixel is obtained by weighting the pixel values ​​of the center coordinates of each neighboring pixel block corresponding to the first pixel using the target denoising weights of the neighboring pixel blocks. This may include: calculating... Obtain the denoised value of the first pixel. Here, NR_Y(x,y) is the denoised value corresponding to the first pixel with x-coordinate and y-coordinate.

[0099] In an optional embodiment of the above, the target sharpening value may be equal to the first candidate sharpening value; the first candidate sharpening value of the first pixel is obtained by weighting the undirected texture values ​​of the center coordinates of each neighboring pixel block corresponding to the first pixel using the target sharpening weights of the neighboring pixel blocks of the first pixel, including: calculating Obtain the first candidate sharpening value for the first pixel. Here, NR_Texture(x,y) is the first candidate sharpening value corresponding to the first pixel with x-coordinate and y-coordinate.

[0100] In another optional embodiment described above, the target sharpening value can be equal to the second alternative sharpening value. This can be achieved by obtaining the target direction edge value corresponding to each first pixel. For each first pixel: the first alternative sharpening value corresponding to the first pixel is corrected using the target direction edge value corresponding to that first pixel to obtain the second alternative sharpening value for the first pixel.

[0101] In the above optional methods, the target direction edge value corresponding to the first pixel can be obtained by: filtering the grayscale image using a preset first filter kernel in a first direction to obtain a first candidate edge image; the first filter kernel is used for directional filtering; filtering the grayscale image using a preset second filter kernel in a second direction to obtain a second candidate edge image; fusing the first candidate edge image and the second candidate edge image to obtain a third candidate edge image; the value of the second pixel in the third candidate edge image that is at the same position as the first pixel is the target direction edge value corresponding to the first pixel.

[0102] The first direction and the second direction are different.

[0103] In one implementation, the two directions can be determined as the first and second directions in the following way: the grayscale image is filtered using a preset first filter kernel with k directions to obtain a fourth candidate edge image; the absolute value of the pixel value matrix corresponding to the fourth candidate edge image is taken to obtain k first direction edge values; the direction corresponding to the first first direction edge value in descending order is selected as the first direction, and the direction corresponding to the second first direction edge value in descending order is selected as the second direction.

[0104] In another implementation, the two directions can be determined as follows: the grayscale image is filtered using a preset first filter kernel with k directions to obtain a fourth candidate edge image; the absolute value of the pixel value matrix corresponding to the fourth candidate edge image is taken to obtain k first direction edge values; the first direction edge values ​​of two directions with the same slope are added together to obtain the second direction edge value corresponding to the direction with the smaller degree involved in the calculation; the direction corresponding to the first second direction edge value is selected as the first direction in descending order, and the direction corresponding to the second second direction edge value is selected as the second direction in descending order.

[0105] For example, calculation Obtain the second direction edge value. The value of k ranges from 0 to 3. When k is 0, it represents the horizontal 0° direction, and k+4 represents the horizontal 180° direction. When k is 1, it represents the horizontal 45° direction, and k+4 represents the horizontal 225° direction. When k is 2, it represents the horizontal 90° direction, and k+4 represents the horizontal 270° direction. When k is 3, it represents the horizontal 135° direction, and k+4 represents the horizontal 315° direction. The second direction edge value with the largest value is determined by dir = max(max(Edge_score[0], Edge_score[1]), max(Edge_score[2], Edge_score[3])), and the second largest value is determined by dir_auxi = min(max(Edge_score[0], Edge_score[1]), max(Edge_score[2], Edge_score[3])).

[0106] In one implementation, fusing the first candidate edge image and the second candidate edge image to obtain the third candidate edge image can be achieved by weighting the first candidate edge image and the second candidate edge image according to a fourth preset weight set to obtain the third candidate edge image.

[0107] The fourth preset weight set stores the seventh weight corresponding to the first candidate edge image and the eighth weight corresponding to the second candidate edge image. For example, the seventh weight and the eighth weight follow the constraint that the sum of the seventh weight and the eighth weight equals 1. The specific values ​​of the seventh weight and the eighth weight can be adjusted according to the engineer's experience, for example, the seventh weight is 0.3 and the eighth weight is 0.7.

[0108] For example, calculation Obtain the third candidate edge image. Where edgeY is the third candidate edge image, edge_extract_kernel[dir] is the first candidate edge image, edge_extract_kernel[dir_auxi] is the second candidate edge image, dir_weight is the seventh weight, and dir_weight_auxi is the eighth weight.

[0109] In another alternative embodiment described above, the target sharpening value can be equal to the third alternative sharpening value. A directional sharpening correction value can be determined based on the degree of high-frequency texture similarity; the target directional edge value is corrected using the directional sharpening correction value; the first alternative sharpening value is then corrected using the corrected target directional edge value to obtain the third alternative sharpening value.

[0110] In the above optional methods, determining the directional sharpening correction value based on the degree of high-frequency texture suspicion can be achieved by searching for the directional sharpening correction value corresponding to the degree of high-frequency texture suspicion in a preset second correction value database.

[0111] The second correction value database stores the correspondence between the high-frequency texture likelihood level and the directional sharpening correction value. For example, the second correction value database can be a look-out table (LUT) obtained based on engineer experience, which records the correspondence between the high-frequency texture likelihood level and the directional sharpening correction value.

[0112] In the above optional methods, correcting the target direction edge value using the direction sharpening correction value can be done by calculating the product of the direction sharpening correction value and the target direction edge value to obtain the corrected target direction edge value.

[0113] In the above optional method, the first candidate sharpening value is corrected by using the corrected target direction edge value to obtain the third candidate sharpening value. This can be done by weighting the first candidate sharpening value and the corrected target direction edge value according to the fifth preset weight set to obtain the third candidate sharpening value.

[0114] The fifth preset weight set stores the ninth weight corresponding to the first candidate sharpening value and the tenth weight corresponding to the corrected target direction edge value. For example, the ninth weight and the tenth weight follow the constraint that the sum of the ninth weight and the tenth weight is equal to 1. The specific values ​​of the ninth weight and the tenth weight can be adjusted according to the engineer's experience, for example: the ninth weight is 0.8 and the tenth weight is 0.2.

[0115] S104, use the target denoising value and target sharpening value corresponding to the first pixel to correct the first pixel and obtain the corrected image.

[0116] In some embodiments, S104 may include: for each first pixel: superimposing the pixel value, target denoising value and target sharpening value of the first pixel to obtain the target correction pixel value corresponding to the first pixel; the target correction pixel values ​​corresponding to each first pixel form a correction image.

[0117] In the above embodiments, the pixel value, target denoising value and target sharpening value of the first pixel are superimposed to obtain the target corrected pixel value corresponding to the first pixel. This can be done by: for each first pixel, superimposing the pixel value, target denoising value and target sharpening value of the first pixel according to the sixth preset weight set to obtain the target corrected pixel value corresponding to the first pixel.

[0118] The sixth preset weight set stores the eleventh weight corresponding to the target denoising value, the twelfth weight corresponding to the target sharpening value, and the thirteenth weight corresponding to the pixel value of the first pixel. For example, the eleventh and thirteenth weights follow the constraint that the sum of the eleventh and thirteenth weights equals 1. The specific values ​​of the eleventh and thirteenth weights can be adjusted based on the engineer's experience; for example, the eleventh weight could be 0.5, and the thirteenth weight could be 0.5. The twelfth weight can take the value of 0 or 1.

[0119] In the above embodiments, the grayscale image, the first candidate image, and the second candidate image can also be weighted and superimposed according to the sixth preset weight set to obtain the corrected image. The weight of the first candidate image is the eleventh weight, the weight of the second candidate image is the twelfth weight, and the weight of the grayscale image is the thirteenth weight.

[0120] The first candidate image is an image composed of the denoised values ​​of the target corresponding to each first pixel. The second candidate image is an image composed of the sharpened values ​​of the target corresponding to each first pixel.

[0121] For example, the corrected image is obtained by calculating outputY = γ*inputY + κ*NR_Y + φ*(μ*NR_Texture + ω*EdgeEnhanceGain*edgeY). Here, outputY is the corrected image, γ is the thirteenth weight, κ is the eleventh weight, φ is the twelfth weight, μ is the ninth weight, ω is the tenth weight, EdgeEnhanceGain is the directional sharpening correction value, NR_Y is the first candidate image, and NR_Texture is the second candidate image.

[0122] For example, this application first obtains a grayscale image, and then sequentially calculates it using the formula... Obtain the undirected texture value corresponding to the first pixel. Calculate. Obtain the directional edge value corresponding to the first pixel. Calculate Score(x,y) = α*edgeScore(x,y) + β*textureY(x,y) to obtain the high-frequency texture likelihood. Use the high-frequency texture likelihood to query the denoising correction value, non-directional sharpening correction value, and directional sharpening correction value corresponding to each first pixel. Then calculate... Obtain the first similarity value of the neighboring pixel block corresponding to the first pixel. Calculate Obtain the second similarity value of the neighboring pixel block corresponding to the first pixel. Calculate the Diff. nr(x,y,p,q)=τ*share_diff(x,y,p,q)+ε*share_mean_diff(x,y,p,q)+spatial_diff(x,y,p,q), obtains the initial denoising weights for the neighboring pixel block corresponding to the first pixel. Calculate Diff. ee (x,y,p,q)=θ*share_diff(x,y,p,q)+δ*share_mean_diff(x,y,p,q), obtains the initial sharpening weights for the neighboring pixel blocks corresponding to the first pixel. Calculation Obtain the target denoising weights corresponding to the initial denoising weights. Calculate. Obtain the candidate sharpening weights corresponding to the initial sharpening weights. Calculate. Obtain the target denoising value of the first pixel. Calculate. Obtain the first candidate sharpening value for the first pixel. Then calculate... Obtain the edge value in the second direction to determine the first and second directions used to calculate the third candidate edge image. Then calculate... The third candidate edge image is obtained. Finally, the corrected image is obtained by calculating outputY = γ*inputY + τ*NR_Y + φ*(μ*NR_Texture + ω*EdgeEnhanceGain*edgeY).

[0123] Thus, combined Figures 3 to 6 As shown, Figures 3 to 6 These are all comparison images showing the effects before and after image processing. Figures 3 to 6 The images are divided into three partitions: the leftmost partition contains the input image, the middle partition contains the output image, and the rightmost partition contains images generated based on the high-frequency texture similarity. If φ equals 1 and τ equals 0, it's equivalent to only sharpening the image; the image processing effect is as follows. Figure 3 and Figure 4 As shown. If φ equals 1, the sum of τ and γ equals 1, which is equivalent to performing denoising and sharpening corrections on the image. The image processing effect at this time is as follows. Figure 5 and Figure 6 As shown. If φ equals 0, the sum of τ and γ equals 1, which is equivalent to only performing noise reduction on the image. The image processing effect at this time is as follows. Figure 7 As shown.

[0124] Example 2

[0125] Please see Figure 8 , Figure 8An image enhancement apparatus provided in this application includes: an acquisition module 1, a weight adjustment module 2, a correction value determination module 3, and an image enhancement module 4. The system comprises the following modules: Acquisition module 1, which acquires a grayscale image and obtains the initial denoising weights and initial sharpening weights of the neighboring pixel blocks corresponding to each first pixel in the grayscale image; Weight adjustment module 2, which adjusts the initial denoising weights and initial sharpening weights according to the high-frequency texture similarity of each first pixel to obtain target denoising weights and target sharpening weights; Correction value determination module 3, which, for each first pixel, uses the target denoising weights of the neighboring pixel blocks to weight the pixel values ​​at preset positions in the neighboring pixel blocks corresponding to the first pixel to obtain the target denoising value of the first pixel; and uses the target sharpening weights of the neighboring pixel blocks to weight the undirected texture values ​​at preset positions in the neighboring pixel blocks corresponding to the first pixel to obtain the target sharpening value of the first pixel; and Image enhancement module 4, which uses the target denoising value and target sharpening value corresponding to the first pixel to correct the first pixel and obtain a corrected image.

[0126] In some embodiments, the weight adjustment module 2 is used to determine the high-frequency texture likelihood of each first pixel in the following manner: for each first pixel: obtain the non-directional texture value and the directional edge value corresponding to the first pixel; determine the high-frequency texture likelihood of the first pixel based on the non-directional texture value and the directional edge value.

[0127] In some embodiments, the weight adjustment module 2 is used to determine the high-frequency texture likelihood of the first pixel based on the undirected texture value and the directed edge value in the following manner: weighting the undirected texture value and the directed edge value according to a first preset weight set to obtain the high-frequency texture likelihood; the first preset weight set stores the first weight corresponding to the undirected texture value and the second weight corresponding to the directed edge value.

[0128] In some embodiments, the weight adjustment module 2 is used to obtain the initial denoising weight and initial sharpening weight of the neighboring pixel blocks corresponding to the first pixel point in the following manner: For each first pixel point: the initial denoising weight and initial sharpening weight of each neighboring pixel block corresponding to the first pixel point are determined according to the local neighborhood similarity situation corresponding to the first pixel point; the local neighborhood similarity situation is used to characterize the similarity between the pixel block where the first pixel point is located and the neighboring pixel blocks of the first pixel point.

[0129] In some embodiments, the local neighborhood similarity includes: a first similarity value and a second similarity value; the first similarity value is the pixel difference between the pixel block where the first pixel is located and the neighboring pixel blocks; the second similarity value is the pixel mean of the difference between the pixel block where the first pixel is located and the neighboring pixel blocks; the weight adjustment module 2 is used to determine the initial denoising weight and initial sharpening weight of each neighboring pixel block corresponding to the first pixel point according to the local neighborhood similarity of the first pixel point in the following manner: for each neighboring pixel block corresponding to the first pixel point: the initial denoising weight corresponding to the neighboring pixel block is determined according to the preset constraint parameters, the first similarity value and the second similarity value corresponding to the neighboring pixel block; the constraint parameters reflect the distance between the neighboring pixel block and the pixel block where the first pixel is located; the initial sharpening weight corresponding to the neighboring pixel block is determined according to the first similarity value and the second similarity value corresponding to the neighboring pixel block.

[0130] In some embodiments, the weight adjustment module 2 is used to adjust each initial denoising weight and each initial sharpening weight according to the high-frequency texture resemblance of each first pixel in the following manner to obtain each target denoising weight and each target sharpening weight: For each first pixel: determine the denoising correction value and the non-directional sharpening correction value of the first pixel according to the high-frequency texture resemblance of the first pixel; For the initial denoising weight of each neighboring pixel block of the first pixel: correct the initial denoising weight using the denoising correction value of the first pixel to obtain the target denoising weight corresponding to the initial denoising weight; For the initial sharpening weight of each neighboring pixel block of the first pixel: correct the initial sharpening weight using the denoising correction value and the non-directional sharpening correction value of the first pixel to obtain the target sharpening weight corresponding to the initial sharpening weight.

[0131] In some embodiments, the weight adjustment module 2 is configured to adjust the initial denoising weight using the denoising correction value of the first pixel in the following manner, to obtain the target denoising weight corresponding to the initial denoising weight: Calculate Obtain the target denoising weight corresponding to the initial denoising weight.

[0132] In some embodiments, the weight adjustment module 2 is used to adjust the initial sharpening weight using the denoising correction value and the non-directional sharpening correction value of the first pixel in the following manner, to obtain the target sharpening weight corresponding to the initial sharpening weight: Calculate Obtain alternative sharpening weights; calculate W ee2 (x,y,p,q)=W ee1 (x,y,p,q)*TextureEnhanceGain(x,y) obtains the target sharpening weights corresponding to the initial sharpening weights.

[0133] In some embodiments, the correction value determination module 3 is further configured to obtain the target direction edge value corresponding to each first pixel; for each first pixel: the target sharpening value is corrected using the target direction edge value corresponding to the first pixel to obtain an updated target sharpening value. Correspondingly, the first pixel is corrected using the target denoising value and the target sharpening value corresponding to the first pixel to obtain a corrected image, including: correcting the first pixel using the target denoising value and the updated target sharpening value corresponding to the first pixel to obtain a corrected image.

[0134] In some embodiments, the correction value determination module 3 is used to determine the target direction edge value corresponding to the first pixel point by: filtering the grayscale image using a first filter kernel in a preset first direction to obtain a first candidate edge image; the first filter kernel is used to perform directional filtering; filtering the grayscale image using a first filter kernel in a preset second direction to obtain a second candidate edge image; fusing the first candidate edge image and the second candidate edge image to obtain a third candidate edge image; the value of the second pixel point in the third candidate edge image that is at the same position as the first pixel point is the target direction edge value corresponding to the first pixel point.

[0135] In some embodiments, the correction value determination module 3 is further configured to: determine a directional sharpening correction value based on the degree of high-frequency texture similarity; and correct the target directional edge value using the directional sharpening correction value to obtain an updated target directional edge value. Correspondingly, correcting the target sharpening value using the target directional edge value corresponding to the first pixel to obtain an updated target sharpening value includes: correcting the target sharpening value using the updated target directional edge value corresponding to the first pixel.

[0136] In some embodiments, the image enhancement module 4 is used to correct the first pixel using the target denoising value and target sharpening value corresponding to the first pixel in the following manner to obtain a corrected image: for each first pixel: the pixel value, target denoising value and target sharpening value of the first pixel are superimposed to obtain the target corrected pixel value corresponding to the first pixel; the target corrected pixel values ​​corresponding to each first pixel form the corrected image.

[0137] It is understood that the embodiments described in Embodiment 1 are also applicable in Embodiment 2 without conflict. For the sake of brevity, they will not be repeated here.

[0138] Example 3

[0139] Combination Figure 9As shown, this application embodiment provides an electronic device including a processor 8 and a memory 5. Optionally, the device may further include a communication interface 6 and a bus 7. The processor 8, communication interface 6, and memory 5 can communicate with each other via the bus 7. The communication interface 6 can be used for information transmission. The processor 8 can call logical instructions in the memory 5 to execute the image enhancement method of the above embodiment.

[0140] Furthermore, the logical instructions in the aforementioned memory 5 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.

[0141] The memory 5, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this application. The processor 8 executes the program instructions / modules stored in the memory 5 to perform functional applications and data processing, that is, to implement the image enhancement method in the above embodiments.

[0142] The memory 5 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 5 may include high-speed random access memory and may also include non-volatile memory.

[0143] Among them, electronic devices can be computers or servers, or they can be display devices with screens.

[0144] This application provides a storage medium storing computer-executable instructions configured to perform the above-described image enhancement method.

[0145] This application provides a computer program product, which includes a computer program stored on a storage medium. The computer program includes program instructions, which, when executed by a computer, cause the computer to perform the above-described image enhancement method.

[0146] The aforementioned computer-readable storage medium may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.

[0147] The technical solutions of this application embodiment can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes one or more instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in this application embodiment. The aforementioned storage medium can be a non-transitory storage medium, including various media capable of storing program code such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks, or it can be a transient storage medium.

[0148] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0149] The above descriptions are merely embodiments of this application and are not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. Furthermore, the above embodiments can be combined with each other to form new embodiments without conflict.

Claims

1. A method for image enhancement, characterized in that, include: Acquire a grayscale image, and acquire the initial denoising weight and initial sharpening weight of the neighboring pixel block corresponding to each first pixel in the grayscale image; The initial denoising weights and initial sharpening weights are adjusted according to the high-frequency texture likelihood of each first pixel to obtain the target denoising weights and target sharpening weights; the high-frequency texture likelihood is used to describe the probability that the first pixel is a high-frequency texture; For each first pixel: the target denoising value of the first pixel is obtained by weighting the pixel values ​​at preset positions in each neighboring pixel block corresponding to the pixel block where the first pixel is located using the target denoising weight of the neighboring pixel block; the target sharpening value of the first pixel is obtained by weighting the undirected texture values ​​at preset positions in each neighboring pixel block corresponding to the pixel block where the first pixel is located using the target sharpening weight of the neighboring pixel block. The first pixel is corrected using the target denoising value and the target sharpening value corresponding to the first pixel to obtain a corrected image.

2. The method according to claim 1, characterized in that, The high-frequency texture resemblance of each first pixel is determined by the following method: For each of the first pixels: Obtain the undirected texture value and the directed edge value corresponding to the first pixel; The high-frequency texture likelihood of the first pixel is determined based on the non-directional texture value and the directional edge value.

3. The method according to claim 2, characterized in that, Determining the high-frequency texture likelihood of the first pixel based on the non-directional texture value and the directional edge value includes: The non-directional texture value and the directional edge value are weighted according to the first preset weight set to obtain the high-frequency texture suspicion degree; the first preset weight set stores the first weight corresponding to the non-directional texture value and the second weight corresponding to the directional edge value.

4. The method according to claim 1, characterized in that, The initial denoising weights and initial sharpening weights of the neighboring pixel block corresponding to the first pixel are obtained in the following way: For each of the first pixels: The initial denoising weights and initial sharpening weights of each neighboring pixel block corresponding to the first pixel point are determined based on the local neighborhood similarity of the first pixel point; the local neighborhood similarity is used to characterize the similarity between the pixel block where the first pixel point is located and the neighboring pixel blocks of the first pixel point.

5. The method according to claim 4, characterized in that, The local neighborhood similarity includes: a first similarity value and a second similarity value; the first similarity value is the pixel difference between the pixel block where the first pixel is located and its neighboring pixel blocks; the second similarity value is the pixel mean of the difference between the pixel block where the first pixel is located and its neighboring pixel blocks; the initial denoising weights and initial sharpening weights of each neighboring pixel block corresponding to the first pixel are determined based on the local neighborhood similarity of the first pixel, including: For each neighboring pixel block corresponding to the first pixel: The initial denoising weight corresponding to the neighboring pixel block is determined based on preset constraint parameters, the first similarity value and the second similarity value corresponding to the neighboring pixel block; the constraint parameters reflect the distance between the neighboring pixel block and the pixel block where the first pixel point is located; The initial sharpening weight corresponding to the neighboring pixel block is determined based on the first similarity value and the second similarity value corresponding to the neighboring pixel block.

6. The method according to claim 1, characterized in that, Adjusting the initial denoising weights and initial sharpening weights based on the high-frequency texture similarity of each first pixel to obtain the target denoising weights and target sharpening weights, including: For each of the first pixels: The noise reduction correction value and the non-directional sharpening correction value of the first pixel are determined based on the high frequency texture similarity of the first pixel. For each neighboring pixel block of the first pixel: the initial denoising weight is corrected using the denoising correction value of the first pixel to obtain the target denoising weight corresponding to the initial denoising weight; For each neighboring pixel block of the first pixel, the initial sharpening weight is modified using the denoising correction value and the non-directional sharpening correction value of the first pixel to obtain the target sharpening weight corresponding to the initial sharpening weight.

7. The method according to claim 6, characterized in that, The initial denoising weight is corrected using the denoising correction value of the first pixel to obtain the target denoising weight corresponding to the initial denoising weight, including: calculate Obtain the target denoising weights corresponding to the initial denoising weights; Among them, Diff nr (x,y,p,q) represents the initial denoising weights for the neighboring pixel block with x-coordinate p and y-coordinate, corresponding to the center coordinate of the first pixel with x-coordinate x and y-coordinate q; W nr (x,y,p,q) represents the target denoising weights for the neighborhood pixel block with x-coordinate p and y-coordinate corresponding to the center coordinate of the first pixel with x-coordinate x and y-coordinate q; NrGain(x,y) represents the denoising correction value corresponding to the first pixel with x-coordinate x and y-coordinate q; σ nr Adjust the parameters for the shape of the first noise reduction curve.

8. The method according to claim 6, characterized in that, The initial sharpening weight is corrected using the denoising correction value and the non-directional sharpening correction value of the first pixel to obtain the target sharpening weight corresponding to the initial sharpening weight, including: calculate Obtain alternative sharpening weights; Calculate W ee2 (x,y,p,q)=W ee1 (x,y,p,q)*TextureEnhanceGain(x,y) obtains the target sharpening weight corresponding to the initial sharpening weight; Among them, Diff ee (x,y,p,q) represents the initial sharpening weights for the neighboring pixel block with x-coordinate p and y-coordinate, corresponding to the center coordinate of the first pixel with x-coordinate x and y-coordinate ; NrGain(x,y) represents the denoising correction value corresponding to the first pixel with x-coordinate x and y-coordinate ; W ee1 (x,y,p,q) represents the candidate sharpening weights for the neighboring pixel block with x-coordinate p and y-coordinate, corresponding to the center coordinate of the first pixel point with x-coordinate x and y-coordinate q; W ee2 (x,y,p,q) represents the target sharpening weight for the neighborhood pixel block with x-coordinate p and y-coordinate corresponding to the center coordinate of the first pixel with x-coordinate x and y-coordinate q; TextureEnhanceGain(x,y) is the undirected sharpening correction value corresponding to the first pixel with x-coordinate x and y-coordinate y; σ ee Adjust the parameters for the shape of the second noise reduction curve.

9. The method according to claim 1, characterized in that, The method further includes: Obtain the target direction edge value corresponding to each of the first pixels; For each of the first pixels: the target sharpening value is corrected using the target direction edge value corresponding to the first pixel to obtain the updated target sharpening value; Correspondingly, the first pixel is corrected using the target denoising value and the target sharpening value corresponding to the first pixel to obtain a corrected image, including: correcting the first pixel using the target denoising value and the updated target sharpening value corresponding to the first pixel to obtain a corrected image.

10. The method according to claim 9, characterized in that, The target direction edge value corresponding to the first pixel is obtained in the following way: The grayscale image is filtered using a first filter kernel in a preset first direction to obtain a first candidate edge image; the first filter kernel is used for directional filtering. The grayscale image is filtered using a first filter kernel in a preset second direction to obtain a second candidate edge image; the first direction and the second direction are different. The first candidate edge image and the second candidate edge image are fused to obtain a third candidate edge image; the value of the second pixel in the third candidate edge image that is at the same position as the first pixel is the target direction edge value corresponding to the first pixel.

11. The method according to claim 9, characterized in that, The method further includes: The directional sharpening correction value is determined based on the degree of high-frequency texture similarity. The target direction edge value is corrected using the direction sharpening correction value to obtain the updated target direction edge value; Correspondingly, the target sharpening value is corrected using the target direction edge value corresponding to the first pixel to obtain an updated target sharpening value, including: correcting the target sharpening value using the updated target direction edge value corresponding to the first pixel.

12. The method according to any one of claims 1 to 11, characterized in that, The first pixel is corrected using the target denoising value and the target sharpening value corresponding to the first pixel to obtain a corrected image, including: For each first pixel: the pixel value of the first pixel, the target denoising value and the target sharpening value are superimposed to obtain the target corrected pixel value corresponding to the first pixel; The corrected image is composed of the target correction pixel values ​​corresponding to each of the first pixels.

13. An image enhancement apparatus, characterized in that, include: The acquisition module is used to acquire a grayscale image, and to acquire the initial denoising weight and initial sharpening weight of the neighboring pixel block corresponding to each first pixel in the grayscale image. The weight adjustment module is used to adjust the initial denoising weights and the initial sharpening weights according to the high-frequency texture similarity of each first pixel, so as to obtain the target denoising weights and the target sharpening weights; the high-frequency texture similarity is used to describe the probability that the first pixel is a high-frequency texture; The correction value determination module is used to, for each first pixel, weight the pixel values ​​at preset positions in each neighboring pixel block corresponding to the pixel block where the first pixel is located using the target denoising weight of the neighboring pixel block of the first pixel to obtain the target denoising value of the first pixel; and weight the undirected texture values ​​at preset positions in each neighboring pixel block corresponding to the pixel block where the first pixel is located using the target sharpening weight of the neighboring pixel block of the first pixel to obtain the target sharpening value of the first pixel. An image enhancement module is used to correct the first pixel using the target denoising value and the target sharpening value corresponding to the first pixel, thereby obtaining a corrected image.

14. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the image enhancement method according to any one of claims 1 to 12.

15. A storage medium, characterized in that, The storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the image enhancement method according to any one of claims 1 to 12.

16. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the image enhancement method according to any one of claims 1 to 12.

Citation Information

Cited By

  • Image sharpening method, electronic equipment and computer readable storage medium

    CN121685324A