1. Field of the Invention
The present invention relates generally to the field of image processing, and more particularly to systems and methods for performing contrast adjustment of an image.
2. Background of the Invention
In its simplest form, the contrast of an image is a measure of the difference in brightness between light and dark portions of an image. The contrast of an image can affect its appearance. Accordingly, at times, it is beneficial to adjust the contrast of an image in order to improve the appearance of the image.
Various methods have been developed to adjust the contrast of images. For example, contrast stretching is an image enhancement technique that attempts to improve the contrast of an image by adjusting the range of intensity values the image contains. Typically, a histogram representing the distribution of pixel intensities of an image is generated and that distribution is adjusted to span a desired range of values—generally the full range of pixel values that the display device allows. Other contrast adjustment techniques are histogram modeling techniques or histogram equalization. These techniques provide means for modifying the range and contrast of an image by altering the image histogram into a desired shape. Histogram modeling techniques may employ non-linear and non-monotonic transfer functions, which map the intensity values of pixels in the input image to an output image such that the output image possesses a certain distribution of intensities. Traditional pyramidal decomposition schemes, such as wavelets, Laplacian pyramid, and the like, are also used in contrast adjustment methods.
These methods and other traditional methods have difficulty preserving edge information at different lightness levels. For example, contrast stretching may wash out or remove certain image details. Traditional pyramidal decomposition schemes suffer from the problem of edge information propagating across multiple levels of resolution. When the processed levels are recombined into the contrast-adjusted image, edge artifacts result.
Accordingly, systems and methods are needed that can provide contrast adjustment while preserving edge detail information in the image.
According to an aspect of the present invention, systems and methods are disclosed that seek to preserve edge detail in an image while performing contrast adjustment.
Embodiments of the present invention obtain detail information by employing multiple edge-preserving adaptive filters that present multi-resolution views of the image data without employing traditional multi-resolution pyramidal decomposition schemes, which cause edge artifacts in the output image due to the problem of edge information propagating across multiple levels of resolution.
In an embodiment, a system for performing contrast adjustment comprises a plurality of edge-preserving adaptive filters (EPAF), which generate images at multiple levels of resolution. An edge-preserving adaptive filter comprises a set of filters. The set of filters comprises a set of spatial filters with the same kernel size but with differing spatial orientations. For an input pixel value that is filtered, each of the plurality of edge-preserving adaptive filters outputs the filtered pixel value obtained from its set of filters that has the smallest numerical difference from the input pixel value.
In an embodiment, each of the set of filters of the edge-preserving adaptive filters may also have at least one color filter. In an embodiment, a filtered pixel value is related to the product of a spatial filter and a color filter.
In an embodiment, the outputs of adjacent edge-preserving adaptive filters are provided to an adder that receives the outputted filtered pixel values and that outputs a difference pixel value by subtracting the filtered pixel values outputted from edge-preserving adaptive filters with adjacent kernel sizes. A clipper receives the difference pixel value and applies a clipping function to the difference pixel value to obtain a clipped pixel value. In an embodiment, the clipping function may be a soft clipping function. An adjustor coupled to receive the clipped pixel value adjusts the clipped pixel value by a gain factor to obtain an adjusted pixel value. A contrast stretcher receives the filtered image from the edge-preserving adaptive filter with the largest kernel size and applies a stretching function to the filtered image to obtain stretched pixel values. An adder receives the stretched pixel values, and for a pixel, adds the stretched pixel value to the corresponding the adjusted pixel values.
In an embodiment, the input to the system represents the logarithm of an image. In such embodiments, an exponentiator may be coupled to receive the sum of the adjusted pixel values and the stretched pixel value and exponentiates the sum to obtain an exponentiated pixel value. In an embodiment, a normalizer may be coupled to receive the exponentiated pixel value and applies a normalizing function to the exponentiated pixel value, thereby normalizing it to the output range of the display device. In an embodiment, the system may include a quantizer for quantizing the image to the required number of bits prior to output.
In an embodiment, a method for performing contrast adjustment of an input image, comprising a plurality of input pixels each having a value, involves applying multi-resolution edge-preserving adaptive filters. The edge-preserving adaptive filters each comprise a set of filters. In an embodiment, a set of filters comprises a set of spatial filters with the same kernel size but with differing spatial orientations. The differing spatially-oriented filters help preserves the edge features in the input image. To achieve multi-resolution, the kernel size, which has an associated region of support, of the set of spatial filters of an edge-preserving adaptive filter differs from the other edge-preserving adaptive filters' sets of spatial filters. For an input pixel that is filtered, each of the edge-preserving adaptive filters outputs the filtered pixel value obtained from its set of filters that is closest to, or has the smallest numerical difference from, the input pixel value. In an embodiment, for an input pixel value that is filtered, each edge-preserving adaptive filter applies the filter from its set of filters that yields the filtered pixel value closest to the input pixel value.
In an embodiment, each of the set of filters may also comprise at least one color filter, such as a color distance function, wherein a filtered pixel value is related to the product of a spatial filter and a color filter.
In an embodiment, the contrast adjustment method also comprises obtaining a difference pixel value by subtracting the filtered pixel values outputted from edge-preserving adaptive filters with adjacent kernel sizes; applying a clipping function to the difference pixel value to obtain a clipped pixel value; and adjusting the clipped pixel value by a gain factor to obtain an adjusted pixel value. In an embodiment, the clipping function may be a soft clipping function.
In an embodiment, the filtered image obtained from the edge-preserving adaptive filter with the largest region of support is stretched to obtain a stretched pixel value of the input pixel value. The stretched pixel value is added to all of the adjusted pixel values for that input pixel to obtain an output pixel value.
In an embodiment, the input image may represent the logarithm of an image. In such embodiments, the contrast adjustment method may also comprise exponentiating the sum of the adjusted pixel value and the stretched input pixel values to obtain an exponentiated pixel value; and applying a normalizing function to the exponentiated pixel value. In an embodiment, the normalized value may be quantized to the required number of bits for a specific display device.
An embodiment of the present invention may comprise a computer-readable medium carrying one or more sequences of instructions which, when executed by one or more processors, cause the one or more processors to perform a portion or all of the steps of discussed above.
Although the features and advantages of the invention are generally described in this summary section and the following detailed description section in the context of embodiments, it shall be understood that the scope of the invention should not be limited to these particular embodiments. Many additional features and advantages will be apparent to one of ordinary skill in the art in view of the drawings, specification, and claims hereof.
Reference will be made to embodiments of the invention, examples of which may be illustrated in the accompanying figures. These figures are intended to be illustrative, not limiting. Although the invention is generally described in the context of these embodiments, it should be understood that it is not intended to limit the scope of the invention to these particular embodiments.
FIG. (“FIG.”) 1 is a functional block diagram illustrating an exemplary system in which exemplary embodiments of the present invention may operate.
In the following description, for purposes of explanation, specific details are set forth in order to provide an understanding of the invention. It will be apparent, however, to one skilled in the art that the invention can be practiced without these details. One skilled in the art will recognize that embodiments of the present invention, described below, may be performed in a variety of ways and using a variety of means and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will convey the scope of the invention to those skilled in the art. Those skilled in the art will also recognize additional modifications, applications, and embodiments are within the scope thereof, as are additional fields in which the invention may provide utility. Accordingly, the embodiments described below are illustrative of specific embodiments of the invention and are meant to avoid obscuring the invention.
Reference in the specification to “one embodiment” or “an embodiment” means that a particular feature, structure, characteristic, or function described in connection with the embodiment is included in at least one embodiment of the invention. Furthermore, the appearance of the phrase “in one embodiment,” “in an embodiment,” or the like in various places in the specification are not necessarily all referring to the same embodiment.
Various systems in accordance with the present invention may be constructed.
Depicted in
It shall be noted that the terms “coupled” or “communicatively coupled,” whether used in connection with modules, devices, system components, or functional blocks, shall be understood to include direct connections, indirect connections through one or more intermediary devices, and wireless connections. It shall also be understood that throughout this discussion that the system components may be described as separate components, but those skilled in the art will recognize that the various components, or portions thereof, may be subdivided into separate units or may be integrated together. It shall be noted that one or more portions of system 100 may be implemented in software, hardware, firmware, or a combination thereof.
It shall be noted that the present invention may be incorporated into or used with a display devices, including but not limited to, computers, personal data assistants (PDAs), mobile devices, cellular telephones, digital cameras, CRT displays, LCD displays, printers, and the like. In addition, embodiments of the present invention may relate to computer products with a computer-readable medium or media that have computer code thereon for performing various computer-implemented operations. The media and computer code may be those specially designed and constructed for the purposes of the present invention, or they may be of the kind well known and available to those having skill in the relevant arts. Examples of computer-readable media include, but are not limited to: magnetic media such as hard disks, floppy disks, and magnetic tape; optical media such as CD-ROMs and holographic devices; magneto-optical media; and hardware devices that are specially configured to store or to store and execute program code, such as application-specific integrated circuits (ASICs), programmable logic devices (PLDs) and ROM and RAM devices. Examples of computer code include machine code, such as produced by a compiler, and files containing higher level code that are executed by a computer using an interpreter.
Turning to
The edge-preserving adaptive filtering may be applied to generate images at multiple levels of resolution. In an embodiment, an edge-preserving adaptive filter, EPAF k 110, denotes filtering with a set of filters with support over a square of pixels with an edge size of 2k+1 pixels. One skilled in the art will recognize that the present methods may be adapted for use with filtering kernels with different edge size configurations, including without limitation even-numbered edge sizes.
In an embodiment, the filtering for the edge-preserving adaptive filters, EPAF k, proceeds with a set of 2k+3 filter kernels. According to an embodiment, the largest filter kernel in the set of filter kernels may be a symmetric two-dimensional (2-D) Gaussian kernel. The remaining 2k+2 kernels may be oriented Gaussian kernels with the principal axis aligned along the 2k+2 directions defined by the center and the pixels along the edge of the region of support.
Consider, for example, edge-preserving adaptive filter 1, EPAF 1110-1, as depicted in
2k+1=2·1+1=3.
The number of filters in the set of kernel filters is:
2k+3=2·1+3=5.
In an embodiment, the edge-preserving adaptive filtering 110 may also include filtering based not only on the spatial orientation but also on color distance. For example, filtering may be performed in a manner analogous to using sigma filters, where the weight of a given pixel within the region of support is determined by both its spatial distance and its color distance to the pixel at the location to be filtered. In an embodiment, the weight of the pixel within the filter kernel's region of support may be related to the product of the weight obtained from the spatial filter and the weight obtained from the color-distance filter. It should be noted that a spatial filter combined with one or more color filters may be construed as a single filter within a set of filters.
In an embodiment, instead of using a sharp color-distance cutoff as in a traditional sigma filter, a smoothly decaying function of color distance may be used.
An embodiment of the edge-preserving adaptive filtering with spatial and color distance filtering may be represented according to the following mathematical equations. An embodiment of the present invention may comprise a number, k, of edge-preserving adaptive filters, and each edge-preserving adaptive filter comprises a set of filters. Accordingly, let km denote filter, m, of edge-preserving adaptive filter EPAF k. Given an edge-preserving adaptive filter, EPAF k, the weighted factors for a filter, m, from the set of spatial filters in EPAF k, may be denoted as wijk
Alternatively, the filtered color value may be obtained according to the following formula:
A filtered pixel value is obtained for each of the filters in EPAF k's set of filters to obtain a set of filtered pixel values (e.g., ccenterk
ccenter4=ccenter4
Returning to
An embodiment of a soft clipping function 605 is illustrated in
In an embodiment, the value of T may be selected. In one embodiment, T may be selected experimentally. In an alternative embodiment, T may be selected using one or more calibration techniques. For example, a known input, such as a flat color image, may be applied to an edge-preserving adaptive filter. Given the output, the noise for the edge-preserving adaptive filter may be determined or approximated, and T may be selected to account for noise at each edge-preserving adaptive filter output. Given a noise level, T may be set varying levels, including, without limitation, minimum noise level, maximum noise level, average noise level, or statistical noise level. It shall be noted that the value of T may vary among the soft-clipping functions 120.
Returning to
0≦gk. (4)
In an embodiment, the output of the edge-preserving adaptive filter with the largest support is stretched (225). Contrast stretching may be performed using any of a number of methods known to those of skill in the art. In one embodiment, a histogram of the EPAF-filtered image may be used to determine the levels at the 10th and 90th percentiles. These levels may then be rescaled uniformly to a predefined range to perform the stretch operation. One skilled in the art will recognize that other histogram equalization methods may also be used for performing the stretch operation (225).
The scaled, clipped differences of the edge-preserving adaptive filter outputs may be added to the stretched result to form the final output. In an embodiment, the output image may be exponentiated and normalized (230) to the output range of the display device. In an embodiment, the image may be quantized (235) to the required number of bits prior to outputting the output image 145.
One skilled in the art shall recognize that the system and methods may be reordered or reconfigured from the exemplary embodiments provided herein to obtain the same or similar results, and such reordering are within the scope of the present invention.
While the invention is susceptible to various modifications and alternative forms, specific examples thereof have been shown presented herein. It should be understood, however, that the invention is not to be limited to the particular forms disclosed, but to the contrary, the invention is to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the appended claims.