This Application claims priority of Taiwan Patent Application No. 104115842, filed on May 19, 2015, the entirety of which is incorporated by reference herein.
Field of the Invention
The disclosure generally relates to an image-correction system and an image correction method, and in particular, to an image-correction system and an image correction method which are used for correcting an image according to the ratio value of a mean value and a variance value of the image.
Description of the Related Art
With developments constantly being made in the imaging industry, image sensors have come to be used widely in digital cameras. In the pursuit of better image quality, the requirements for image processing by the image sensor are also increasing. Image sensors in cameras must be able to remove noise, removing cross-talk, and correct defect in the sensor. With conventional technology, retaining detail and removing noise cannot be taken into account when removing cross-talk. This means that when an image has more detail, it might also have more noise. Otherwise, the lower the noise level, the lower the detail. Moreover, the gain of an image and its exposure time might affect the detection of defective pixels. Thus, how to improve the efficiency of image processing while maintaining the cost-effectiveness of a device is a current problem that needs to be solved.
In order to solve the aforementioned problem, an embodiment of the invention provides an image-correction system, including an image-capture module, a first calculation module, a second calculation module and an output module. The image-capture module obtains an input image and a guide image. The first calculation module obtains a first correction image according to a first parameter and a second parameter. The first calculation module also obtains a smooth function according to a ratio value and a mean value of the guide image, obtains the first parameter according to the mean value of the guide image, a variance value of the guide image, a mean value of the input image and the smooth function, and obtains the second parameter according to the first parameter, the mean value of the guide image and the mean value of the input image. The second calculation module obtains the ratio value of the mean value and the variance value according to the mean value of the guide image and the variance value of the guide image. The output module outputs the first correction image.
Another embodiment of the invention provides an image correction method, including: obtaining an input image and a guide image; obtaining a ratio value of a mean value of the guide image and a variance value of the guide image according to the mean value of the guide image and the variance value of the guide image; obtaining a smooth function according to the ratio value and the mean value of the guide image; obtaining a first parameter according to the mean value of the guide image, the variance value of the guide image, a mean value of the input image and the smooth function; obtaining a second parameter according to the first parameter, the mean value of the guide image and the mean value of the input image; obtaining a guide filter function according to the first parameter and the second parameter; and obtaining a first correction image according to the guide filter function
The invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:
Further areas in which the present devices and methods can be applied will become apparent from the following detailed description. It should be understood that the detailed description and specific examples, while indicating exemplary embodiments of the image-correction systems and the image correction devices, are intended for the purposes of illustration only and are not intended to limit the scope of the invention.
The distribution of the pixel value can be obtained according to the mean value and the variance value of the image, and thus the details of the image can be obtained by calculating the ratio value of the mean value and the variance value. For example.
The first calculation module 120 calculates the smooth function ƒ(k) according to the ratio value and the mean value Ī of the guide image I. The formula for obtaining the smooth function ƒ(k) is shown as follows:
wherein,
is a variance factor,
is a mean factor, c1 and c2 are constants, and k refers to the kth filtering window.
After the first calculation module 120 obtains the smooth function ƒ(k), the first calculation module 120 also obtains the first parameter ak according to the mean value Ī of the guide image I, a variance value σ2 of the guide image I, a mean value
wherein, wk is the kth filtering window, |w| is number of pixels of the kth filtering window, Ii is the ith pixel of the guide image I, pi is the ith pixel of the input image p, Īk is the mean value of the kth filtering window of the guide image I,
After the first calculation module 120 obtains the first parameter ak and the second parameter bk, the first calculation module 120 further obtains a first correction image qi according to the first parameter ak and the second parameter bk. The formula for obtaining the first correction image qi is shown as follows:
qi=akIi+bk
wherein, qi is the first correction image.
Due to the details of the image being related to the variance factor calculated according to the mean value Ī and the variance value σ2 of the image, the smooth function ƒ(k) determines the blurriness of the flattest area, i.e.,
by adjusting the value of c1. When the image becomes more blurred, the area becomes flatter, and the difference between pixels is also smaller. Moreover, the user determines the amount of detail by adjusting the value of c1, such as when
is greater than c1, the smooth function ƒ(k) is 0, and the first calculation module 120 keeps the details of the image entirely.
Due to the brightness of the image being related to the mean value Ī of the mean factor, the smooth function f(k) determines the blurriness of all of the image blocks by adjusting the value of c2, which means that when the value of c2 is greater, all of the image blocks become more blurred. However, when the brightness of the blocks are the same, the greater the value of c2, the smaller the first parameter ak, and the larger the second parameter bk. When the first correction image qi is close to the mean value of the input image p, which means that the first correction image qi has more details of the input image qi. Otherwise, the smaller the value of c2, the larger the first parameter ak, and the smaller the second parameter bk. The first correction image qi has more details of the guide image I. Moreover, when q(Īk) is a maximal value, i.e. the brightest area of the image, the first parameter ak is close to 0, and the second parameter bk is equal to the mean value
As described above, the user determines the amount of the details he/she wants to keep by adjusting the value of c1, and determines the blurriness of the areas with different brightness by adjusting the value of c2.
According to another embodiment of the invention, the image-correction system 100 also includes a third calculation module 150, configured to determine whether the image has a defective pixel according to the ratio values of the mean value Ī and the variance value σ2 of a plurality of pixels within the predetermined area. The defective pixel means the pixel value of the center pixel has an obvious difference with the pixel values of adjacent pixels. First, the user defines a first predetermined value as a standard of the defective pixel, and second, identifies whether the number of pixels within the predetermined area with a pixel value that is greater than the first predetermined value is greater than a second predetermined value. When the first predetermined value and the second predetermined value are larger, this means that the condition for identifying the center pixel as the defective pixel is higher. Otherwise, when the first predetermined value and second predetermined value are smaller, that means it is easier to establish the defective pixel. For example,
Please refer to
According to another embodiment of the invention, after obtaining the ratio value of the mean value of the guide image and the variance value of the guide image, the third calculation module 150 further calculates the number of pixels within the predetermined area with a pixel value that is greater than a first predetermined value, and determines whether the number of pixels within the predetermined area is greater than the second predetermined value. When the number of pixels within the predetermined area is greater than the second predetermined value, the third calculation module 150 identifies the center pixel of the predetermined area as the defective pixel, corrects the input image, and obtains the second correction image. The output module 140 outputs the third correction image according to the first correction image and the second correction image.
As described above, the invention provides an image-correction system and an image correction method. The user only needs a simple calculation module for calculating the ratio value of the mean value and the variance value to adjust the blurriness of the smooth area and the dark area, remove the cross-talk of the bright area and further keep the details of the dark area. Moreover, due to the ratio value of the mean value and the variance value being difficult to affect by the gain of the pixels and the exposure, it can be used to determine whether the center pixel of the predetermined area is the defective pixel, and improve the accuracy of the determination.
It will be apparent to those skilled in the art that various modifications and variations can be made to the structure disclosed without departing from the scope or spirit of the invention. In view of the foregoing, it is intended that the present invention covers modifications and variations of this invention, provided they fall within the scope of the following claims and their equivalents.
Number | Date | Country | Kind |
---|---|---|---|
104115842 A | May 2015 | TW | national |
Number | Name | Date | Kind |
---|---|---|---|
20140193093 | Rao | Jul 2014 | A1 |
20150016720 | Vermeir | Jan 2015 | A1 |
Number | Date | Country |
---|---|---|
EP 2851867 | Mar 2015 | FR |
EP 2887309 | Jun 2015 | FR |
WO 2014168587 | Oct 2014 | SG |
200828984 | Jul 2008 | TW |
Entry |
---|
He, K. et al.: 'Guided Image Filtering' Proceedings, Part I, Lecture Notes in Computer Science Nov. 5, 2010, Computer Vision—ECCV 2010, 11th European Conference on Computer Vision, Heraklion, Crete, Greece. |