Digital Image Processing IMAGE ENHANCEMENT
Digital Image Processing IMAGE ENHANCEMENT
Processing IMAGE
ENHANCEMENT
Image Enhancement Definition
• Image Enhancement: is the process that improves the quality of the image for a specific application
Some Basic Intensity (Gray-level) Transformation Functions
• The value of pixels, before and after processing, will be denoted by r and s,
respectively.
s = T (r)
Consider the following figure, which shows three basic types of functions used frequently for image
enhancement:
Some Basic Intensity (Gray-level) Transformation Functions
• The three basic types of functions used frequently for image enhancement:
– Linear Functions:
• Negative Transformation
• Identity Transformation
– Logarithmic Functions:
• Log Transformation
• Inverse-log Transformation
– Power-Law Functions:
• nth power transformation
• nth root transformation
Linear Functions
• Identity Function
– This function doesn’t have an effect on an image, it was included in the graph only for
completeness
– Its expression:
s=r
Linear Functions
– The negative of an image with gray level in the range [0, L-1], where L = Largest value in an image, is
obtained by using the negative transformation’s expression:
s=L–1–r
Which reverses the intensity levels of an input image, in this manner produces the equivalent of a
photographic negative.
– The negative transformation is suitable for enhancing white or gray detail embedded in dark regions of
an image, especially when the black area are dominant in size
Logarithmic Transformations
• Log Transformation
The general form of the log transformation:
s = c log (1+r)
– Log curve maps a narrow range of low gray-level values in the input image into a wider range of the
output levels.
– Used to expand the values of dark pixels in an image while compressing the higher-level values.
– It compresses the dynamic range of images with large variations in pixel values.
Logarithmic Transformations
Logarithmic Transformations
– Used to expand the values of high pixels in an image while compressing the darker-level values
Power-Law Transformations
s = c.rᵞ
For example, Cathode Ray Tube (CRT) devices have an intensity-tovoltage response that is a power
function, with exponents varying from approximately 1.8 to 2.5.With reference to the curve for g=2.5 in
Fig. 3.6, we see that such display systems would tend to produce images that are darker than intended.
This effect is illustrated in Fig. 3.7. Figure 3.7(a) shows a simple gray-scale linear wedge input into a CRT
monitor. As expected, the output of the monitor appears darker than the input, as shown in Fig. 3.7(b).
Gamma correction. In this case is straightforward. All we need to do is preprocess the input image
before inputting it into the monitor by performing the transformation. The result is shown in Fig.
3.7(c).When input into the same monitor, this gamma-corrected input produces an output that is close
in appearance to the original image, as shown in Fig. 3.7(d).
Piecewise-Linear Transformation Functions
• Principle: Rather than using a well defined mathematical function we can use arbitrary user
defined transforms
• Disadvantage: Their specification requires more user input that previous transformations
– Contrast Stretching
– Gray-level Slicing
– Bit-plane slicing
Contrast Stretching
• One of the simplest piecewise linear functions is a contrast-stretching transformation, which is
used to enhance the low contrast images.
• The locations of points (r1, s1) and (r2, s2) control the shape of the transformation function.
• If r1 = s1 and r2 = s2, the transformation is a linear function that produces no changes in gray levels.
• If r1 = r2, s1 = 0 and s2 = L-1, the transformation becomes a Thresholding function that creates a binary
image.
• Intermediate values of (r1, s1) and (r2, s2) produce various degrees of spread in the gray levels of the
output image, thus affecting its contrast.
• For example, the intensity of each pixel in a 256 gray – scale image is composed of 8 bits (ie 1 byte)
• Instead of highlighting gray-level range, we could highlight the contribution made by each bit.
• Assuming that each pixel is represented by 8 bits, the image is composed of eight 1-bit planes
• Plane 0 containing the lowest order bit of all pixels in the image and plane 7 all the higher order
bits
• Only the most significant bits contain the majority of visually significant data. The other bit planes
constitute the most suitable details
• Separating a digital image into its bits planes is useful for analyzing the relative importance played
by each bit of the image
• It helps in determining the adequacy of the number of bits used to quantize each pixel
Image Enhancement Methods:
Spatial filtering term is the filtering operations that are performed directly on the pixels of
an image.
Mechanism of Spatial Filtering The process consists simply of moving the filter mask from
point to point in an image.
At each point (x,y) the response of the filter at that point is calculated using a predefined
relationship
Smoothing filters are used for
Blurring is used in preprocessing steps to removal of small details from an image prior to
object extraction and bridging of small gaps in lines or curves
How it works?
The value of every pixel is replaced by the average of the gray levels in the neighborhood.
Weighted averaging filter: (110 +2 x 120+90+2 x 91+4 x 94+2 x 98+90+2 x 91+99)/16 =97.81
Mask size determines the degree of smoothing and loss of detail.
Median filter(non linear)
Steps: 1.
Sort the pixels in ascending order: 90,90, 91, 94, 95, 98, 99, 110, 120
2. replace the original pixel value by the median : 95
Very effective for removing “salt and pepper” noise (i.e., random occurrences of black and
white pixels).
Spatial filters : Sharpening ( high pass)
Use: for highlighting fine detail or enhancing detail that
has been blurred.
SHARPENING – 1 ST DERIVATIVE
Apply the following laplace on the highlighted pixel
•154*4 – 158- 156-158-158 = -14
• The histogram of a digital image with gray levels in the range[0,L-1] is a discrete function,
where, rk is the kth gray level & nk is number of pixels in the image having gray level rk
• Histogram is normalized by dividing each of its values by the total no. of pixels in the
image denoted by ‘n’.
Thus normalized histogram is given by,
where, k = 0,1,2,….L-1
• Histograms are the basis for the numerous spatial domain processing techniques.
• Histogram manipulation is used effectively for image enhancement, also quite useful in
other image processing applications viz image compression & segmentation.
HISTOGRAM EQUALIZATION
Thus a processed (output) image is obtained by mapping each pixel with level rk in the input
image into a corresponding pixel with level Sk in the output image via the above equation.
• The method used to generate a processed image that has a specified histogram is called
histogram matching or histogram specification.