Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

IMAGE TRANSFORM AND IMAGE

ENHANCEMENT
Unit II:

1
Fourier Transform

▪ Revision of Fourier Transform

2
Discrete Cosine Transform

▪ It represents an image as a sum of sinusoids of varying


magnitudes and frequencies.
▪ A function (dct2) computes the two-dimensional discrete
cosine transform (DCT) of an image.
▪ most of the visually significant information about the
image is concentrated in just a few coefficients of the DCT.
▪ DCT is often used in image compression applications.

3
Source: Matlab

4
DCT
▪ Syntax of DCT
▪ B = dct2(A)
Where dct2(A) returns the two-dimensional discrete cosine transform of A. The matrix B contains
the discrete cosine transform coefficients B(k ,k ).
1 2

▪ B = dct2(A,m,n) ........(1)
Here,
A - Input matrix, specified as a 2-D numeric matrix.
m- Number of image rows, specified as a positive integer. dct2 pads image A with 0s or truncates
image A so that it has m rows. By default, m is equal to size(A,1).
n- Number of image columns, specified as a positive integer. dct2 pads image A with 0s or
truncates image A so that it has n columns. By default, n is equal to size(A,2)
▪ B = dct2(A,[m n]) .......(2)
Where (1) and (2) pad the matrix A with 0s to size m-by-n before applying the transformation.
If m or n is smaller than the corresponding dimension of A, then dct2 crops A before the
transformation.
▪ Example: https://www.mathworks.com/help/images/ref/dct2.html

5
Properties of DCT

▪ The cosine transform is real and orthogonal.


▪ The cosine transform is not a real part of the unitary Discrete
Fourier Transform DFT.
▪ The cosine transform of a sequence is related to the DFT of its
antisymmetric extension.
▪ The cosine transform is a fast transform.
▪ The basis vectors of the cosine transform are the eigen vectors
of the symmetric tridiagonal of Toeplitz matrix

6
Properties of DCT

▪ The cosine transform is close to the KL transform of first order


Markov sequences. The cosine transform has very good to excellent
energy compaction property of images,
▪ The DCT is a real transform. This property makes it attractive in
comparison to the Fourier transform.
▪ The DCT has excellent energy compaction properties. For that reason
it is widely used in image compression standards (as for example
JPEG standards).
▪ There are fast algorithms to compute the DCT, similar to the FFT for
computing the DFT.
7
Haar Transforms
▪ An efficient way to perform both lossless and lossy image
compression.
▪ Relies on averaging and differencing values in an image
matrix to produce a matrix which is sparse or nearly sparse.

▪ Example:
https://www.mathworks.com/help/wavelet/ug/haar-
transforms-for-time-series-data-and-images.html

8
Properties of Harr transform

▪ The Harr transform is real and orthogonal.


▪ The Harr transform is a fast transform
▪ The basis vectors of the Harr transform are sequency
ordered
▪ The Harr transform is close to the KL transform of first
order Markov sequences.
▪ The Harr transform has poor energy compaction
property for images
9
Images of Haar Transform

Source: haar transform matlab images


10
Image enhancement

▪ Refers to the process of highlighting certain information of


an image, as well as weakening or removing any
unnecessary information according to specific needs.
▪ Example
▪ eliminating noise,
▪ revealing blurred details,
▪ adjusting levels to highlight features of an image.

11
Image enhancement

▪ Image enhancement techniques can be divided into two


broad categories:
▪ Spatial domain — enhancement of the image space that
divides an image into uniform pixels according to the
spatial coordinates with a particular resolution. The spatial
domain methods perform operations on pixels directly.
▪ Frequency domain — enhancement obtained by applying
the Fourier Transform to the spatial domain. In the
frequency domain, pixels are operated in groups as well as
indirectly.
12
▪ Types of spatial domain operator:
▪ Point operation (intensity transformation) - refer to
running the same conversion operation for each pixel in a
grayscale image. The transformation is based on the
original pixel and is independent of its location or
neighboring pixels.
▪ Spatial filter (or mask, kernel) - The output value
depends on the values of f(x,y) and its neighborhood.

13
Application of Image enhancement

▪ Deblur images
▪ Contrast adjustment
▪ Brighten an image
▪ Smooth and sharpen

14
Histogram processing

▪ Digital images are a two-dimensional matrix of intensity


levels ranging from 0 to L-1 with L representing the
number of intensity levels.
▪ The intensity levels of a pixel can range from 0 to L-1,
with zero level intensity denoting complete black or
dark, and L-1 level indicating white or grayscale.

15
Histogram processing

▪ Intensity transformation is a digital image processing


technique where the pixel intensity levels of an image are
transformed to new values using a mathematical
transformation function, s = T(r).
where s is the new pixel intensity level and r is the original pixel
intensity value of the given image and r≥0.

16
Histogram processing

▪ Common Intensity Transformation Functions include


▪ Image negation
▪ Image negation reverses the grayscales of an image.
▪ Log Transform
▪ Log Transform expands the dark pixel values.
▪ Power-law Transform.
▪ Power-law Transform can be used for a variety of purposes by
varying the value of arbitrary constants.

17
▪ The histogram of a digital image with intensity levels
between 0 and (L-1) is a function h(rk) = nk,
▪ where rk is the k-th intensity level and nk is the number of
pixels in the image having that intensity level.
▪ For an N x N image, a normalized histogram function is
p(rk) = nk/N2 which is the probability of the occurrence of
a pixel with the intensity level rk.

18
▪ The histogram of an image consists of the x-axis
representing the intensity levels rk and the y-axis denoting
the h(rk) or the p(rk) functions.
▪ Histogram equalization is the process of uniformly
distributing the image histogram over the entire
intensity axis by choosing a proper intensity
transformation function.

19
MATLAB code

▪ % Histogram Equalization in MATLAB ▪ % Histogram Equalization in MATLAB using


function
▪ % reading image
▪ % histogram equalization
▪ I = imread("GFG.jfif");
▪ J = histeq(I);
▪ figure
▪ figure
▪ subplot(1,3,1)
▪ subplot(1,3,1)
▪ imshow(I)
▪ imshow(J)
▪ subplot(1,3,2:3)
▪ subplot(1,3,2:3)
▪ imhist(I)
▪ imhist(J)

20
21
Frequency domain

▪ Image enhancement in the frequency domain is


straightforward:
▪ compute the Fourier transform of the image to be enhanced,
▪ multiply the result by a filter, and
▪ take the inverse transform to produce the enhanced image.
▪ leads to enhancement techniques that might not have been
thought of by restricting attention to the spatial domain.

22
Frequency domain

▪ Low pass filtering involves eliminating high frequency


components in an image, resulting in blurring
▪ Smoother transitions in the frequency domain filter, such as
the Butterworth filter, achieve better results.

23
Frequency domain

▪ Images normally consist of light reflected from objects.


▪ The basic nature of the image F(x,y) is characterized by
two components:
▪ the amount of source light incident on the scene being viewed,
and
▪ the amount of light reflected by the objects in the scene.
▪ These portions of light are called the illumination and
reflectance components, and are denoted i(x,y) and r(x,y)
respectively.
24
Frequency domain
▪ Fourier transform of the product of two functions is not
separable
▪ Fourier transform of the sum of two images is not separable
▪ resulting illumination component and enhance the
reflectance component.
▪ the process of homomorphic filtering.

25
Thank You

26

You might also like