1. Technical Field
The present invention relates to image enhancement, and in particular to a method for enhancing the facial regions of images and apparatuses using the same.
2. Description of the Related Art
When viewing images, users often pay less attention to small objects. However, the small objects may reveal beauty, and should be emphasized. It is required that camera users emphasize small objects so that they “pop” out of the scene. For example, eyes although occupy a small area of the face, it often captures viewer's attention when looking at a portrait photo. Eyes with clear contrast would make a person look more attractive. Also, it is desirable to remove defects of face area for making skin smooth, such as pore, black dots created by noise, etc. As a result it is desirable to process an image for enhancing visual satisfaction of certain areas.
In order to emphasize small objects, the embodiments disclose image enhancing methods and apparatuses for increasing the contrast of an image object.
An embodiment of an image enhancement method is introduced. An object is detected from a received image according to an object feature. The intensity distribution of the object is computed. A plurality of color values of pixels of the object is mapped to a plurality of new color values of the pixels according to the intensity distribution. Finally, a new image comprising the new color values of the pixels is provided to the user.
An embodiment of an image enhancement apparatus is introduced. The image enhancement apparatus comprises a detection unit, an analysis unit and a composition unit. The detection unit is configured to receive the image and detect the object according to an object feature. The analysis unit, coupled to the detection unit, is configured to compute the intensity distribution of the object and map a plurality of color values of pixels of the object to a plurality of new color values of the pixels according to the intensity distribution. The composition unit, coupled to the analysis unit, is configured to provide a new image comprising the new color values of the pixels to the user.
A detailed description is given in the following embodiments with reference to the accompanying drawings.
The present invention can be fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:
The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims.
It will be further understood that the terms “comprises,” “comprising,” “includes” and/or “including,” when used herein, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The segmented object 111 is then processed to determine its intensity distribution by the analysis unit 140. The analysis unit 140 may, for example, calculate a brightness histogram of the segmented object 111, which provides general appearance description of the segmented object 111, and apply an algorithm to the brightness histogram to find a threshold value 143 that can roughly divide the distribution into two parts 141 and 142. For example, the Otsu's thresholding may be used to find a threshold value that divides the brightness histogram into a brighter part and a darker part. The Otsu's thresholding involves exhaustively searching for the threshold that minimizes the intra-part variance, defined as a weighted sum of variances of the two parts:
σω2(t)=ω1(t)σ12(t)+ω2(t)σ22(t) (1)
where, weights ωi are the probabilities of the two parts separated by a threshold t and σi2 are variances of these parts. Otsu shows that minimizing the intra-class variance is the same as maximizing inter-class variance:
σb2(t)=σ2−σω2(t)=ω1(t)ω2(t)[μ1(t)−μ2(t)]2 (2)
which is expressed in terms of part probabilities ωi and part means μi. Since many different thresholding algorithms can be implemented for the segmented object 111, the analysis unit 140 does not mandate a particular thresholding algorithm. After finding the threshold, the analysis unit 140 may apply a histogram equalization algorithm to the brighter part and the darker part of the brightness histogram, respectively, to enhance the contrast by redistributing the two parts in wider ranges 144 and 145. Exemplary histogram equalization algorithms are simply described. For the darker part, a given object {X} is described by L discrete intensity levels {X0, X1, . . . , XL−2}, where, X0 and XL−2 denote a black level and one level prior to the thresholding level XL−1, respectively. A PDF (probability density function) is defined as:
p(Xk)=nk/n, for k=0, 1, . . . L−2 (3)
where, nk denotes the number of times of a intensity level Xk appears in the object {X} and n denotes the total number of samples in the object {X}. And, the CDF (cumulative distribution function) is defined as follows.
An output Y of the equalization algorithm with respect to the input sample Xk of the given object based on the CDF value is expressed as follows:
Y=c(Xk)XL−2 (5)
For the brighter part, a given object {X} is described by (256-L) discrete intensity levels {XL, XL+1, . . . , X255}, where, X255 denotes a white level, and equations (3) to (5) can be modified for k=L, L+1, . . . 255 without excessive effort. The resulting object 112 is therefore obtained. Therefore, by mapping the levels of the input object 111 to new intensity levels based on the CDF, image quality is improved by enhancing the contrast of the object 111. As can be observed in
After the brightness histogram is redistributed, the new pixel values are then applied to corresponding pixels of the segmented object to produce an enhanced object 112. The composition unit 150 is used to provide a new image having new color values of the pixels to a user. The composition unit 150 may combine the enhanced object 112 back to the source image to generate an enhanced image 110′. In some embodiments, the composition unit 150 may replace pixel values of the segmented object with the newly mapped values so as to enhance the contrast within the segmented object. The enhanced image 110′ may be displayed on a display unit or stored in a memory or a storage device for a user.
Also, the software instructions of the algorithms illustrated in
To make the computations less demanding, an eye model may be applied to the segmented eye region 320 so as to locate the position of the pupil. For example, the eye radius may be determined or predefined to define the actual region that will undergo the enhancement processing. The eye radius may be set according to the proportion of the face region to a reference, such as a background object or image size, etc.
Moreover, when the detected object is a face region of a person. The segmentation unit 130 may apply a low pass filter on the pixels of the object. The analysis unit 140 may compute intensity distributions by forming a face map comprising the color values of the face region, and a filtered map comprising filtered color values. The composition unit 150 may map the color values by mapping the color values of the face map to the new color values according to the difference of the face map and the filtered map.
S=T+αD (6)
where α is a predetermined scaling factor. Each of the maps may comprise information regarding the pixel coordinates and the pixel values. The smooth map S is then applied to the original image 400 to produce the skin-smoothed image 400′. An image fusion method may be employed to combine the original image 400 and the smooth map S. The image composition may be implemented by replacing the color values of the pixels in the face map O with the color values of the corresponding pixels in the smooth map S. Although the skin tone smoothing in the embodiment shown, it is understood that alternative embodiments are contemplated, such as applying the face enhancement to a lip, eyebrows, and/or other facial features of the face region. In some embodiments, the low-pass filter and the scaling factor α may be configured by the user. In an example, when a user might wish to filter out visible defects on a face in an image, such as a scar, a scratch mark, etc., the low-pass filter may be configured to filter out such defects. In another example, the low-pass filter may be configured to filter out wrinkles on a face in an image. In addition, the scaling factor α may be set to a different value to provide a different smoothing effect.
After the color conversion, each source image is sent to the face pre-processing module 530 of the GPU. Two main processes are performed in the module 530: the face map construction and the face color processing. Due to the GPU being designed with parallel pixel manipulation, it gains better performance to perform the two processes by the GPU than by the CPU. The face pre-processing module 530 renders the results into the GPU/CPU communication buffer 540. The face pre-processing module 530 renders the results into the GPU/CPU communication buffer 540. Since the GPU/CPU communication buffer 540 is preserved in a RAM (random access memory) for streaming textures, data stored in the GPU/CPU communication buffer 540 can be accessed by both the GPU and CPU. The GPU/CPU communication buffer 540 may store four channel images, in which each pixel is represented by 32 bits. The first three channels are used to store HSI data and the fourth channel is used to store the aforementioned facial mask information, wherein the facial mask is defined by algorithms performed by the CPU or GPU. The face mask can been seen in 310 of
The data of the GPU/CPU communication buffer 540 is sent to the CPU, and is rendered by the face pre-processing module 530 of the GPU. Since the CPU has a higher memory I/O access rate on RAM and faster computation capability than that of the GPU, the CPU may perform certain pixel computation tasks, such as anti-shining, or others, more efficiently. Finally, after the CPU completes the tasks, the data of the GPU/CPU communication buffer 540 will be sent back to the face post-processing module 550 of the GPU for post-processing, such as contrast enhancement, face smoothing, or others, and the color conversion module 560 of the GPU converts the color format, such as the HSI color format, into the original color format that the source images use, and then renders the adjusted images to the frame buffer 510. The described CPU/GPU hybrid architecture provides better performance and less CPU usage. It is measured that the overall computation performances for reducing or eliminating perspective distortion can be enhanced by at least 4 times over the sole use of the CPU.
In some embodiments, a step for applying a filter, may be a low pass filter, on the pixels of the object between steps S610 and S620. Detailed references of the added steps may be made to the aforementioned description of the segmentation unit 130. Step S630 may be practiced by forming a face map comprising the color values of the detected object, and a filtered map comprising filtered color values. Step S640 may be practiced by mapping the color values of the face map to the new color values according to the difference of the face map and the filtered map. Examples may further refer to the related description of
Detailed references of steps S610 and S620 may be made to the aforementioned description of the detection unit 120 and the segmentation unit 130. Detailed references of steps S630 and S640 may be made to the aforementioned analysis unit 140. Detailed references of step S650 may be made to the aforementioned composition unit. 150.
While the invention has been described by way of example and in terms of the preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments. On the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements.
This application claims the benefit of U.S. Provisional Application No. 61/703,620 filed on Sep. 20, 2012, the entirety of which is incorporated by reference herein.
Number | Date | Country | |
---|---|---|---|
61703620 | Sep 2012 | US |