BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates to an image processing method, especially to an image processing method based on sensor characteristics.
2. Description of Related Art
A general alpha blending technique uses a noise level to determine the degree of a texture/smooth characteristic of each pixel in a picture, and assigns a blending ratio to each pixel according to the degree of the texture/smooth characteristic of this pixel for the execution of subsequent processes. In regard to a conventional image processing device, many modules thereof have demands for noise reduction and texture retention; however, one or more back-end modules among these modules usually lack the information of an unspoiled noise level for determining the degree of a texture/smooth characteristic of each pixel due to one or more front-end processes (e.g., auto white balance, auto exposure gain, lens shading correction (LSC), and black level correction (BLC)), and thus the back-end modules are often incapable of distinguishing a texture region of a picture from a smooth region of the picture.
Several conventional techniques are listed below for reference:
- (1) Weisheng Dong, Ming Yuan, Xin Li, and Guangming Shi, “Joint Demosaicing and Denoising with Perceptual Optimization on a Generative Adversarial Network”.
- (2) Micha{umlaut over ( )}el Gharbi, Gaurav Chaurasia, Sylvain Paris, and Fr′edo Durand “Deep Joint Demosaicking and Denoising”.
- (3) Keigo Hirakawa and Thomas W. Parks, “JOINT DEMOSAICING AND DENOISING”.
- (4) Marc Levoy, “Image formation”, page 60˜62, Computer Science Department, Stanford University, CS 178, Spring 2014.
- (5) Wojciech Jarosz, “Computational Aspects of Digital Photography—Noise & Denoising”, Dartmouth College, CS 89.15/189.5, Fall 2015.
- (6) Marc Levoy, “Noise and ISO”, page 7-11, Computer Science Department, Stanford University, CS 178, Spring 2014.
SUMMARY OF THE INVENTION
An object of the present disclosure is to provide an image processing method based on sensor characteristics without the problem of the prior art.
An embodiment of the image processing method of the present disclosure includes the following steps: obtaining a constant “c≈σ(x)/√{square root over (x)}” of a relation between output signals and a noise standard deviation “σ(x)” of these output signals, in which the output signals are outputted by a sensor based on at least one sensor gain (e.g., photosensitivity such as an ISO value of a camera); calculating a gradient value according to values of pixels within a sampling range, in which the values of pixels include an input value of a target pixel; calculating a smooth value and a texture value according to the values of pixels; obtaining a weighting value based on a weighting calculation according to a weighting variation rate, the gradient value, a front-end gain (e.g., an auto exposure gain), and the constant; and obtaining an output value of the target pixel based on a blending calculation based on at least the smooth value, the texture value, and the weighting value.
Another embodiment of the image processing method of the present disclosure includes the following steps: obtaining a constant of a relation between output signals and a noise standard deviation of these output signals, in which the output signals are outputted by a sensor based on at least one sensor gain; calculating an output value of a target pixel according to values of pixels within a sampling range, the constant, and a front-end gain, wherein an input value of the target pixel is one of the values of pixels.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiments that are illustrated in the various figures and drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 shows a sensor's output image.
FIG. 2 shows the texture of FIG. 1 obtained according to a low texture-recognition threshold.
FIG. 3 shows the texture of FIG. 1 obtained according to a high texture-recognition threshold.
FIG. 4 shows the texture of FIG. 1 obtained according to an embodiment of the present disclosure.
FIG. 5 shows the image processing method based on sensor characteristics according to an embodiment of the present disclosure.
FIG. 6 shows the relation between the grayscale values of output signals of a sensor and noise standard deviations of these output signals.
FIG. 7 shows the relation between a gradient value and a weighting value.
FIG. 8 shows the image processing method based on sensor characteristics according to another embodiment of the present disclosure.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
A feature of the present invention is capable of accurately determining the degree of a texture/smooth characteristic of each pixel in a picture according to the characteristics of a sensor (e.g., an optical sensor). A general prior art (e.g., a prior art functioning based on gradient value calculation) is hard to distinguish the texture region in a picture from the smooth region in the picture because the noise strength of a dark part of the picture may be different from the noise strength of a bright part of the picture. Take a sensor's output image 100 of FIG. 1 for example; if a fixed threshold is used for distinguishing the texture region in the image 100 from the smooth region in the image 100 regardless of the noise difference between the dart part and bright part of the image 100, some of the smooth region in the image 100 will be mistaken for a texture region as shown in the image 200 of FIG. 2 on condition that the fixed threshold is relatively low, or some of the texture region in the image 100 will be mistaken for a smooth region as shown in the image 300 of FIG. 3 on condition that the fixed threshold is relatively high. Compared with the above-mentioned prior art, the present invention can accurately distinguish the texture region in the image 100 from the smooth region in the image 100 as shown in the image 400 of FIG. 4. It should be noted that the black part in the images of FIGS. 2-4 is indicative of a texture region while the white part in these images is indicative of a smooth region.
FIG. 5 shows the image processing method based on sensor characteristics according to an embodiment of the present disclosure. This image processing method can be performed by a known or self-developed image processing device, and includes the following steps:
- step S510: obtaining a constant “c≈σ(x)/√{square root over (x)}” of a relation between output signals “x” and a noise standard deviation “σ(x)” of these output signals, in which the output signals are outputted by a sensor based on at least one sensor gain (e.g., photosensitivity such as an ISO value of a camera).
- In an exemplary implementation, the sensor gain is 16, each of the pixel values of the output signals is a 12-bit value (i.e., a value between 0 and 4095), the main noise of the sensor is shot noise, and the sensor captures K images (e.g., 100 images) of the same object according to each of Q kinds of exposure time (e.g., 1/30 second, 1 second, and 10 seconds) so that the total captured images amount to Q×K images and they basically cover all kinds of pixel values (i.e., every value between 0 and 4095), wherein each of the Q and the K is an integer greater than one. On the basis of the above, one average pixel value can be obtained according to the average of the pixel values of the K images related to the same pixel position, and thereby Q average pixel values related to the same pixel position can be obtained according to the Q×K images and the total average pixel values related to all/selected pixel positions of all the captured images can cover all kinds of pixel values (i.e., every value between 0 and 4095), wherein each set of K images among the Q×K images relates to the same exposure time and the Q×K images relates to the Q kinds of exposure time. Afterwards, a standard deviation can be obtained according to K pixel values of a set of K images related to one pixel position and the average pixel value related to this pixel position of the same set of K images, more standard deviations can be obtained in the same way, and then a regression line can be obtained according to the distribution of all the standard deviations “σ(x)” in relation to all the average pixel values “x” as shown in FIG. 6. In light of the above, the relation between the square root √{square root over (x)} of each average pixel value (a.k.a. each grayscale value) and the standard deviation σ(x) corresponding to this average pixel value can be expressed with the equation σ(x)≈c×√{square root over (x)}, in which “c” is a constant that can be derived from the regression line of FIG. 6. As a result, the relation between the square root √{square root over (x)} (i.e., √{square root over (0)}, √{square root over (1)}, . . . , and √{square root over (n)}, in which “n” is the maximum grayscale value) and its corresponding standard deviation σ(x) (i.e., σ0, σ1, . . . , and σn) can be expressed with the following equation:
- step S520: calculating a gradient value according to values of pixels within a sampling range, in which the values of pixels include an input value of a target pixel.
- In an exemplary implementation, the pixels within the sampling range forms a 3×3 pixel matrix
the central pixel in this pixel matrix is the target pixel; a square root matrix
can be obtained by calculating a square root of each pixel value of the pixel matrix; a horizontal gradient value “GH=2” and a vertical gradient value “GV=0” can be obtained by multiplying the square root matrix by a predetermined horizontal gradient mask
and a predetermined vertical gradient mask
respectively; and then the gradient value “GToTAL=GH+GV=2” can be obtained according to the horizontal and vertical gradient values.
- step S530: calculating a smooth value and a texture value according to the values of pixels. In an exemplary implementation, the pixels within the sampling range forms a 3×3 pixel matrix
the smooth value
is equal to the sum (i.e., 24) of all the pixel values divided by the total number of pixels (i.e., 9); the texture value
is equal to the sum (i.e., 4+4+4=12) of those pixels including the target pixel along the texture direction (i.e., the vertical direction because GH>HV in this exemplary implementation) divided by the total number of those pixels (i.e., 3).
- step S540: performing a weighting calculation according to a weighting variation rate (e.g., the slope determined by the thresholds thd0 and thd1 mentioned below), the gradient value, a front-end gain (e.g., an auto exposure gain), and the constant and thereby obtaining a weighting value (a.k.a. a blending ratio) “W”.
- In an exemplary implementation, the front-end gain “DG” is 4, the constant “c” is 0.75, the smooth region threshold setting value “thd0_manual” and the texture region threshold setting value “thd1_manual”, that are set by a user or predetermined, are 0.4 and 4 respectively; therefore the smooth region threshold
can be obtained according to the smooth region threshold setting value, the front-end gain, and the constant, and the texture region threshold
can be obtained according to the texture region threshold setting value, the front-end gain, and the constant. In addition, the smooth region threshold and the texture region threshold jointly determine the weighting variation rate “WSLOPE” as shown in FIG. 7 (i.e., the slope of a straight line between the minimum weighting value WMIN assigned to thd0 and the maximum weighting value WMAX assigned to thd1, that is to say
Accordingly, the weighting value “W” being equal to “the difference between the gradient value and the smooth region threshold” multiplied by “the weighting variation rate” is obtained (i.e., W=(GTOTAL−thd0)×WSLOPE+WMIN=(2−0.3)×3034+0≈5158). It should be noted that any gradient value less than the smooth region threshold is assigned the minimum weighting value (e.g., the minimum weighting value “0” as shown in FIG. 7), and any gradient value greater than the texture region threshold is assigned the maximum weighting value (e.g., the maximum weighting value “8192” as shown in FIG. 7) in this exemplary implementation.
- step S550: performing a blending calculation on the smooth value and the texture value according to the weighting value and thereby obtaining an output value of the target pixel.
- In an exemplary implementation, step S550 includes the following steps: multiplying the texture value “ITexture” by the weighting value “W” to obtain a weighting texture value; multiplying the smooth value “ISmooth” by a difference between a maximum weighting value and the weighting value “W” to obtain a weighting smooth value; summing the weighting texture value and the weighting smooth value up to obtain a sum value; and dividing the sum value by the maximum weighting value to obtain the output value “IOUTPUT”. This exemplary implementation can be expressed with the following equation:
- If the values obtained in the exemplary implementations of the previous steps substitute for the variables of the above equation, the output value “IOUTPUT” of the target pixel is shown below:
It should be noted that in the exemplary implementation of step S540, the way to calculate the smooth region threshold and the texture region threshold is based on the following conditions. The front-end gain “DG” and the noise standard deviation “σ(x)≈c×√{square root over (x)}” of the output signals of the sensor have been obtained already; T(⋅) denotes a conversion equation for performing conversion on the output signals of the sensor; therefore, a gradient value for determining a texture/smooth characteristic can be calculated with the following gradient equation: T(DG×x+DG×σ(x))−T(DG×x)≈T′(DG×x)·DG×σ(x). Furthermore, given
can be derived, and thus the gradient equation can be rewritten as shown below:
In brief, both the gradient value and the front-end gain “DG” are related to the constant “c”.
In an exemplary implementation, the sensor is an optical sensor. In an exemplary implementation, the front-end gain is or relates to one of the following: a lens shading correction (LSC) gain; a gain for pixel values of a specific color; an auto exposure (AE) gain; a black level correction (BLC) gain; and a color correction matrix (CCM). In an exemplary implementation, the main noise of the output signals is shot noise. In an exemplary implementation, the output signals include all signals between a signal having a minimum grayscale value and a signal having a maximum grayscale value.
FIG. 8 shows an image processing method based on sensor characteristics according to another embodiment of the present disclosure. This image processing method includes the following steps:
- step S810: obtaining a constant of a relation between output signals and a noise standard deviation of these output signals, in which the output signals are outputted by a sensor based on at least one sensor gain.
- step S820: calculating an output value of a target pixel according to values of pixels within a sampling range, the constant, and a front-end gain, wherein an input value of the target pixel is one of the values of pixels.
Since those of ordinary skill in the art can refer to the disclosure of FIGS. 1-7 to appreciate the detail and modification of the embodiment of FIG. 8, which implies that some or all of the features of the disclosure of FIGS. 1-7 can be applied to the embodiment of FIG. 8 in a logical way, repeated and redundant description is omitted here.
It should be noted that people of ordinary skill in the art can selectively use some or all of the features of any embodiment in this specification or selectively use some or all of the features of multiple embodiments in this specification to implement the present invention as long as such implementation is practicable; in other words, one can implement the present invention flexibly in accordance with the present disclosure.
To sum up, the image processing method of the present disclosure can accurately determine the degree of a texture/smooth characteristic of each pixel in an image based on sensor characteristics.
The aforementioned descriptions represent merely the preferred embodiments of the present invention, without any intention to limit the scope of the present invention thereto. Various equivalent changes, alterations, or modifications based on the claims of the present invention are all consequently viewed as being embraced by the scope of the present invention.