Image Enhancement in Spatial Domain By Dr. Rajeev Srivastava
CONTENTS Image Enhancement in Spatial Domain Spatial Domain Methods 1. Point Processing Functions A. Gray Level Transformation functions for i. Contrast Enhancement ii. Thresholding B. Some basic gray level transformations i. Negative transformation ii. Logarithmic transformation iii. Power Law Transformations
CONTENTS 2. Piecewise Linear Transformation Functions A. Contrast Stretching Special Cases: Clipping and Thresholding B. Intensity or gray level slicing C. Bit Extraction or Bit Plane Slicing 3. Histogram Processing A. Definition of histogram Example: Contrast Stretching B. Histogram Equalization C. Histogram Matching or Specification D. Histogram Modification
CONTENTS 4. Spatial operators for image enhancement A. Spatial Averaging (Spatial Low Pass Filtering) Methods Examples B. Directional Smoothing C. Median Filtering D. Unsharp Masking and Crispening 5. Spatial Low Pass, High Pass and Band Pass Filtering 6. Inverse Contrast Ratio Mapping and Statistical Scaling
Image Enhancement in Spatial Domain Objective: To Process an image so that the result is more suitable than the original image for a specific application. To bring out details which are obscured or to highlight certain features of an image. Example: Contrast Enhancement
Image Enhancement Methods SPATIAL DOMAIN -Spatial domain refers to image plane itself. -Methods in this group directly manipulates the pixels in an image. FREQUENCY DOMAIN -Frequency domain refers to image plane obtained after applying Fourier transformation or its variants such as Discrete Fourier Transform (DFT), Discrete Cosine Transform (DCT) etc. -Methods in this group relates to modify Fourier transform of an image.
Spatial Domain Methods Spatial domain methods Let us consider that a digital image is represented by a two dimensional random field f(x,y). An image processing operator in the spatial domain may be expressed as a mathematical function T[.] applied to the image f(x,y) to produce a new image g(x,y) as follows: g(x,y)=t[f(x,y)] The operator T[.] applied on f(x,y) may be defined over: i. A single pixel (x,y). In this case T [.] is a grey level transformation function or mapping function. ii. iii. Some neighbourhood of (x,y). T[.] may operate to a set of input images instead of a single image.
Example 1: Contrast Stretching One example of spatial domain image enhancement is contrast stretching. The transformation function for contrast stretching is shown in figure given below. The objective of this transformation is to produce an image of higher contrast than the original, by darkening the levels below and brightening the levels above in the original image.
Example 2: Thresholding The result of the transformation shown in the figure below is to produce a binary image.
Spatial Domain: Enhancement by Point Processing Here we deal with image processing methods that are based only on the intensity of single pixels. In this case, the new image g(x, y) in enhanced image depends only on the value of old unenhanced image f(x, y) and the image enhancement operator T[. ] becomes a grey level or intensity transformations of the form: s = T(r) Where r= grey level of f(x, y) at pixel location (x, y) s= grey level of g(x, y) at (x, y)
Point Processing Intensity or grey level transformations - Linear (Image Negatives) - Logarithmic (Log and Inverse Log Transformations) - Power Law or Gamma (n th power and n th root Transformations)
Negative Linear Transformation The negative of a digital image is obtained by the transformation function s = T r = L 1 r shown in the above figure, where L is the number of grey levels. The idea is that the intensity of the output image decreases as the intensity of the input increases. This is useful in numerous applications such as displaying medical images.
Example: Negative Transform (a) A panda Image (b) its photographic negative transformed image
Power Law or Gamma Transformations Power Law or Gamma Transform g x, y = c [f(x, y)] γ
Example: Gamma Transform a. (Upper Left ) MRI Image of an upper thoracic human spine with a fracture dislocation and spinal cord impingement. b. (Upper Right) Result after Gamma transformation with = 0.6, c=1 c. (Lower Left) Result with = 0.4, c=1 d. (Lower Right) Result with = 0.3, c=1
Logarithmic Transform Log transform is defined as: s = c log (1 + r) Value of c is constant and it is assumed that input value of pixel r is positive. Performs spreading or compression of grey levels. When the dynamic range of the image data is too large so that only the few pixels are visible, then the dynamic range can be compressed via log transformations. This transformation is used to expand the values of dark pixels in an image while compressing the higher level values. In Fourier spectrum, pixel values have a large dynamic range. Log transform can be used to scale it.
Piecewise Linear Transformation Functions Contrast Stretching αr ; 0 r < m s = β r m + Sm ; m r < n γ r n + Sn; n r < L s Sn β γ Sm α 0 m n L r
Contrast Stretching For dark region stretch: α > 1, m L 3 Mid region i.e. low contrast stretch: β > 1, n 2 3 L Bright region stretch: γ 1 As a rule, the slope of transformation is chosen greater than unity in the region of stretch.
Special Cases: Contrast Stretching CLIPPING THRESHOLDING CLIPPING: A special case of contrast stretching where α = γ = 0 is called clipping. Clipping is useful for noise reduction when the input signal is known to lie in the range [m,n].
CLIPPING s r Clipping Transformation