Image adjustment method and associated image processing circuit
20200394760 ยท 2020-12-17
Inventors
Cpc classification
International classification
Abstract
An image adjustment method includes: sequentially processing a plurality of pixels in at least one frame, wherein a pixel under processing is a current pixel, the current pixel and multiple adjacent pixels form a current block, and each current block is performed with following operations: reading a grayscale value of each pixel in the current block; determining a region grayscale value and a region variance of the current block according to the grayscale values of the pixels; generating a variance adjustment parameter via a variance adjustment function, wherein the region grayscale value is a variable of the variance adjustment function; generating an adjusted region variance according to the variance adjustment parameter and the region variance; and comparing the adjusted region variance with a variance threshold to determine whether to perform a noise suppression operation on the current pixel.
Claims
1. An image adjustment method for adjusting an image, the image comprising at least one frame that comprises a plurality of pixels, the image adjustment method comprising: sequentially processing the pixels in the at least one frame, wherein a pixel under processing is a current pixel, the current pixel and a plurality of adjacent pixels form a current block, and each current block is processed with following operations: reading a grayscale value of each pixel in the current block; determining a region grayscale value and a region variance of the current block according to the grayscale values of the pixels; generating a variance adjustment parameter via a variance adjustment function, wherein the region grayscale value is a variable of the variance adjustment function; generating an adjusted region variance according to the variance adjustment parameter and the region variance; and comparing the adjusted region variance with a variance threshold to determine whether to perform a noise suppression operation on the current pixel.
2. The image adjustment method of claim 1, wherein the region grayscale value of the current block is an average of the grayscale values of all pixels in the current block.
3. The image adjustment method of claim 1, wherein the variance adjustment function is a gradient adjustment function, the variance adjustment parameter is a gradient adjustment parameter and the region variance is a region gradient.
4. The image adjustment method of claim 3, wherein the region gradient comprises a vertical gradient and a horizontal gradient, and the region gradient is expressed as:
G=|Gx|+|Gy| where Gx is the horizontal gradient and Gy is the vertical gradient.
5. The image adjustment method of claim 4, wherein the step of generating the adjusted region variance according to the variance adjustment parameter and the region variance is expressed as a following function:
G.sub.final=f1(Brightness.sub.local)G where G.sub.final is the adjusted region variance, f1 is the gradient adjustment function, Brightness.sub.local is the region grayscale value and G is the region gradient.
6. The image adjustment method of claim 5, wherein the gradient adjustment function is a linear transfer function and is expressed as:
7. The image adjustment method of claim 1, wherein the step of comparing the adjusted region variance with the variance threshold to determine whether to perform the noise suppression operation on the current pixel further comprises: when the adjusted region variance of the current block is smaller than the variance threshold, not performing the noise suppression operation on the current pixel.
8. The image adjustment method of claim 1, further comprising: using a filter to adjust the region grayscale value and generate an adjusted grayscale value, wherein the adjusted grayscale value is expressed as:
P.sub.out=P.sub.lpf+(1)P.sub.in where P.sub.in is original grayscale value, P.sub.lpf is the grayscale value after being filtered, P.sub.out is the adjusted grayscale value and is a noise suppression strength.
9. The image adjustment method of claim 8, wherein the noise suppression strength is expressed as:
10. The image adjustment method of claim 9, further comprising: dynamically adjusting the first edge feature threshold and the second edge feature threshold according to the region grayscale value to generate an adjusted first edge feature threshold and an adjusted second edge feature threshold, wherein the adjusted first edge feature threshold and the adjusted second edge feature threshold are expressed as:
edge_thd1_final=edge_thd1+brightness_offset
edge_thd2_final=edge_thd2+brightness_offset where edge_thd1_final and edge_thd2_final are respectively the adjusted first edge feature threshold and the adjusted second edge feature threshold, and brightness_offset is an grayscale offset .
11. An image processing circuit, comprising: a processor, configured to sequentially process a plurality of pixels in at least one frame of an image, wherein a pixel under processing is a current pixel, the current pixel and a plurality of adjacent pixels form a current block, and the processor is configured to process each current block with following operations: reading a grayscale value of each pixel in the current block; determining a region grayscale value and a region variance of the current block according to the grayscale values of the pixels; generating a variance adjustment parameter via a variance adjustment function, wherein the region grayscale value is a variable of the variance adjustment function; generating an adjusted region variance according to the variance adjustment parameter and the region variance; and comparing the adjusted region variance with a variance threshold to determine whether to perform a noise suppression operation on the current pixel.
12. The image processing circuit of claim 11, wherein the region grayscale value of the current block is an average of the grayscale values of all pixels in the current block.
13. The image processing circuit of claim 11, wherein the variance adjustment function is a gradient adjustment function, the variance adjustment parameter is a gradient adjustment parameter and the region variance is a region gradient.
14. The image processing circuit of claim 13, wherein the region gradient comprises a vertical gradient and a horizontal gradient, and the region gradient is expressed as:
G=|Gx|+|Gy| where Gx is the horizontal gradient and Gy is the vertical gradient.
15. The image processing circuit of claim 14, wherein the operation of generating the adjusted region variance according to the variance adjustment parameter and the region variance is expressed as a following function:
G.sub.final=f1(Brightness.sub.local)G where G.sub.final is the adjusted region variance, f1 is the gradient adjustment function, Brightness.sub.local is the region grayscale value and G is the region gradient.
16. The image processing circuit of claim 15, wherein the gradient adjustment function is a linear transfer function and is expressed as:
17. The image processing circuit of claim 11, wherein the operation of comparing the adjusted region variance with the variance threshold to determine whether to perform the noise suppression operation on the current pixel further comprises: when the adjusted region variance of the current block is smaller than the variance threshold, not performing the noise suppression operation on the current pixel.
18. The image processing circuit of claim 11, wherein the processor is further configured to process each current block with following operation: using a filter to adjust the region grayscale value and generate an adjusted grayscale value, wherein the adjusted grayscale value is expressed as:
P.sub.out=P.sub.lpf+(1)P.sub.in where P.sub.in is original grayscale value, P.sub.lpf is the grayscale value after being filtered, P.sub.out is the adjusted grayscale value and is a noise suppression strength.
19. The image processing of claim 18, wherein the noise suppression strength is expressed as:
20. The image processing of claim 19, wherein the processor is further configured to process each current block with following operation: dynamically adjusting the first edge feature threshold and the second edge feature threshold according to the region grayscale value to generate an adjusted first edge feature threshold and an adjusted second edge feature threshold, wherein the adjusted first edge feature threshold and the adjusted second edge feature threshold are expressed as:
edge_thd1_final=edge_thd1+brightness_offset
edge_thd2_final=edge_thd2+brightness_offset where edge_thd1_final and edge_thd2_final are respectively the adjusted first edge feature threshold and the adjusted second edge feature threshold, and brightness_offset is an grayscale offset.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
DETAILED DESCRIPTION
[0023] Certain terms are used throughout the description and following claims to refer to particular components. As one skilled in the art will appreciate, manufacturers may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not function. In the following description and in the claims, the terms include and comprise are used in an open-ended fashion and should be interpreted as include/comprise but not limited to, and thus should not be interpreted as a close-ended term such as consist of. Also, the term couple is intended to mean either an indirect or direct electrical connection. Accordingly, if one device is coupled to another device, that connection may be through a direct electrical connection, or through an indirect electrical connection via other devices and connections.
[0024] In the embodiments of the invention, at the beginning of image optimization, it is first determined whether the current image block has an edge feature, so as to determine whether the current image block belongs to noise or details of a scene. The afore-mentioned determination may be achieved by calculating the gradient or variance of the image blocks. The pixel under processing is a current pixel and the current pixel and a plurality of adjacent pixels form a current block. Next, the invention focuses on correcting gradient and variance according to brightness, so as to improve the shortcomings of conventional techniques. As can be seen from the example shown in
[0025] In normal image processing technology, gradient or variance of a region is calculated, so as to determine whether the region is an edge or determine the amount of noise. The determination is usually made by partitioning the region by using one or more threshold values. However, the experiments show that the image brightness actually has a certain influence on the gradients or variances. That is, the calculated gradients or variances are relative high in the region with high brightness. In the following paragraphs, how to process at least one (for example, one or more) frame of an image will be described. Each frame may comprise a plurality of pixels, and the frames may be processed at the same time or individually processed.
[0026] Calculation of Region Gradient I
[0027] First of all, the region gradient is calculated so as to determine whether the region (for example, the 33 image block as shown in
[0028] When a vertical edge is detected, an average of the grayscale values of the pixels a1, a4 and a7 is subtracted from an average of the grayscale values of all the pixels a0-a8, and then the absolute value is taken therefrom to obtain a determination value (the calculation is shown below) . The determination value is compared with a threshold value to obtain a high frequency response (|(603)/3(2256+603)/9|=110), thereby determining whether the pixels a1, a4 and a7 collectively form the vertical edge.
[0029] Further referring to
[0030] First of all, the image blocks in
[0031] Considering the problem as discussed above, a dynamic correction method is proposed. The proposed dynamic correction method is capable of setting a specific curve under different scenes (that is, different grayscale values) of the image, such that the aforementioned threshold value, the variance between pixels (for example, the gradient between pixels) can vary as the image brightness changes. In this manner, edge detection or noise suppression for the regions with different brightness can be effectively performed.
[0032] Taking the edge detections in
[0033] In addition, in the embodiments of the invention, different curves can be adopted to perform different segmental adjustments under different scenes, environments, user modes or sensor types, so as to optimize the noise suppression performance.
[0034] The invention focuses on adjusting the edge feature threshold value and the variance for the regions in an image with different brightness values, and it can be combined with various noise suppression technologies to improve the image quality. Details of the proposed method will be introduced in the following paragraphs.
[0035] Calculation of Region Gradient II
[0036] As mentioned above, the variance can be represented by gradient (but it is not limited thereto) . For example, in the embodiments of the invention, the region gradient can be calculated by Sobel operator. The Sobel operator can be divided into gradient calculation filters in the horizontal and vertical directions, as shown on the left side and the right side in
G=|Gx|+|Gy|
[0037] Next, accompanying the grayscale values of the pixels as shown in
Gx=(1)120+(2)100+(1)120 +160+240+190=210
Gy=(1)120+(2)30+(1)90+120+280+60=70
[0038] Finally, the gradient G=|Gx|+|Gy|=210+70=280.
[0039] Calculation of Region Brightness
[0040] The calculation of region brightness (region grayscale value) Brightness.sub.local can be achieved by using an nn mean filter (But the invention is not limited thereto. For example, the Gaussian filter can also be used when calculating the region brightness) . Taking the 33 matrix shown in
[0041] Adjusting the Final Region Gradient According to the Region Brightness
[0042] The final region gradient G.sub.final may be adjusted according to the region brightness as the following function:
G.sub.final=f1(Brightness.sub.local)G
[0043] Where f1is the gradient adjustment function, which is a linear transfer function or a linear segmental adjustment function.
[0044] The linear segmental adjustment function may be divided into m segments, where b1bm correspond to different brightness segments and v1vm are generated according to f1(b1)f1(bm). The gradient adjustment function is expressed as the following equation and shown in
[0045]
G.sub.final=f1(Brightness.sub.local)G=<f1(76)280=0.475280=133
[0046] Adjusting the Noise Suppression Strength According to the Final Region Gradient
[0047] The noise suppression can be performed with any conventional noise suppression filter. For example, in the embodiments of the invention, the mean filter can be adopted, and the final grayscale value can be obtained via the following equation as:
P.sub.out=P.sub.lpf+(1)P.sub.in
where P.sub.in is original grayscale value, P.sub.lpf is the grayscale value after being filtered, P.sub.out is the final (adjusted) grayscale value and is a noise suppression strength (the noise suppression strength increases as increases) . The noise suppression strength may be adjusted according to the final (adjusted) region gradient. The adjustment may be expressed as the following equation and shown in
[0048]
where edge_thd1 and edge_thd2 are respectively the edge feature upper threshold and the edge feature lower threshold, coef1 and coef2 are respectively user defined noise suppression strength upper and lower thresholds. Since the possibility of being an edge texture is higher when the gradient is higher, the value of noise suppression strength should be selected as a small one (that is, using a weaker noise suppression) , to avoid damaging the edge texture. For example, the value of decreases when the final region gradient G.sub.final increases (note that it can be designed that is not less than coef2, so as to prevent from losing the noise suppression effect) . On the contrary, when the final region gradient G.sub.final is small, the value of is large, but it can be designed that is not greater than 1, where =1 means that no noise suppression is performed. In the embodiments of the invention, the degree of noise suppression is dynamically adjusted by controlling the value of .
[0049] Referring to
[0050] Step 902: calculating region gradient;
[0051] Step 904: calculating region brightness;
[0052] Step 906: generating the final region gradient (the adjusted region gradient) according to the region brightness and the region gradient; and
[0053] Step 908: adjusting the noise suppression strength according to the final region gradient.
[0054] Adjusting the Threshold Values According to the Region Brightness
[0055] In the aforementioned approach, the degree of noise suppression is dynamically adjusted by controlling the value of . In the following paragraphs, an alternative approach is described, in which the threshold value increases as the region brightness increases.
edge_thd1_final=edge_thd1+brightness_offset
edge_thd2_final=edge_thd2+brightness_offset
wherein edge_thd1_final and edge_thd2_final are respectively the adjusted edge feature upper threshold and the adjusted edge feature lower threshold, and the brightness_offset is a corresponding brightness offset (grayscale offset). Similar to the previous embodiment, it can also be a linear segmental adjustment function which varies with the region brightness. The trend of edge_thd1_final and edge_thd2_final varies with the brightness is shown in
[0056] The alternative approach is shown in
[0057] Step 1102: calculating region gradient;
[0058] Step 1104: calculating region brightness;
[0059] Step 1106: adjusting the threshold value according to the region brightness; and
[0060] Step 1108: adjusting the noise suppression strength according to the region gradient.
[0061]
[0062] Actual Effect
[0063] For example, please refer to
[0064] In summary, the proposed image adjustment method and the associated image processing circuit provided by the invention can effectively suppress noise in the image without introducing side effects (for example, without losing picture's details) . In addition, the technology of the invention can also be applied in different color spaces, such as Gray, Raw, RGB, YUV, etc.
[0065] Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.