0% found this document useful (0 votes)
7 views

2 - UNIT DIP

Uploaded by

mohanmysore6742
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

2 - UNIT DIP

Uploaded by

mohanmysore6742
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 95

UNIT- 2

Image Enhancement using Spatial Domain


Unit – 2 Syllabus
What is Image Enhancement?
• Image enhancement is the process of adjusting digital
images so that the results are more suitable for
display or further image analysis.
• For example, you can remove noise, sharpen, or
brighten an image, making it easier to identify key
features.
Image Enhancement
• The main objective of image enhancement is to process the given
image into a more suitable form for a specific application

• It makes an image more noticeable by enhancing the features such as


edge, boundaries or contrast.

• There are two types of image enhancement methods


• Special domain enhancement
• Frequency domain enhancement
Techniques of Image Enhancement
• Spatial Domain : Manipulating pixel values
• Frequency Domain : Modifying the Fourier transformation of Image
• Combination : Combination of first two methods
Spatial Domain
• Direct manipulation of the pixel
• Intensity transformation – modification of the intensity will takes place
• Spatial filtering – direct manipulation of pixel using mask

• General manipulation of pixel can be shown as:


Intensity transformation function
Low and High Contrast – Colour image
Low and High Contrast – Gray scale image
Some Basic Gray Level
Transformations
Some Gray level operations
It is called point processing because, the intensity
change is depends only on that pixel value
Spatial Filtering
• Apply filter along with neighbourhood of the pixel
• Neighbourhood – smallest will be 1x1. Then it will be Intensity
transformation.
Mask design
Basic Intensity Transformation Functions
• 3 popular Gray level transformation
• Linear (Negative and Identity)
• Logarithmic (Log and Inverse log)
• Power Law (nth power and nth root)
Linear : Identity and Negative
• Identity:
• Identity is very less useful in DIP
• Input pixel value and output pixel value remains same and hence rarely
used

• Negative:
• In Image negative, intensity will be reversed to produce a photographic
negative. White pixels will become black and vice versa.
• So Each value of input image is subtracted from L-1 and mapped onto the
output image. Where L is the maximum value of intensity
• It is given by:

Graphical representation of Negative and
Identity, Example in next slide
Computing
Image Negative,
Considering 256
level Gray values
Example for Negative Image
Log Transformation
• Log transformation means replacing each pixel value with its logarithm (10)
value.
• The log transformation can be defined by the formula:
• Where s and r are the pixel values of the output and input image and c is
the constant.
• If there is a pixel intensity of 0, then log(0) will be infinity, so 1 is added to
make the minimum value at least 1.
• C is a constant.
• Properties of Log transformation is: For lower amplitudes of input image
the range of gray levels are expanded. For higher amplitudes of input
image the range of gray levels are compressed
• Summary is : dark pixels are expanded and brighter images are compressed
Log and Inverse Log
Log transformation : Example
Log Transformation : Example 2-Darker
regions are now bright.
Inverse Log
• Performs the inverse operation of the Log.
• Here dark pixels are compressed and brighter images are Expanded.
• This is usually applied on lighter image to make darker.
• Inverse Log is computed using the formula:
• Where s is the output, r is the input and c is constant.
Power Law (Gamma Correction)
• Given by the formula:

• It maps a narrow range of dark input values into a wider range of


output values or vice versa.
• Varying Y (Gamma) gives a whole family of curves. (Next slide)
Log curve for different values of Gamma.
Bit Plane Slicing
• Separating a digital image into its bit planes is useful for
analyzing the relative importance played by each bit of the
image, implying, it determines the adequacy of numbers of bits
used to quantize each pixel , useful for image compression.
Bit plane slicing
Grey Level Slicing : Highlight the specific
range of values
Histogram Processing
Histogram and Histogram Equalization
• Histogram shows the distribution of Gray values of the image.
• Example:
Histogram Equalization is used
Example of Histogram Equalization
Gray Level histogram representation
Histogram Equalized representation
Arithmetic and Logical
Operations
Arithmetic / Logic operations
• These are array operations which are carried out between
corresponding pixel pairs. The four arithmetic operations are denoted
as:
Few important points to note:
Example : Addition
Addition of images
Subtraction
Subtraction of the two images.
Division
Division of Images : shadow correction
Logical Operations on Image
AND Operations
OR Operations
OR operations
NOT Operation
Complement Operation
MATLAB Code to illustrate Complement
Complement Displayed
Other logical operations
Multiplication
Multiplication of Images
Basics of Spatial Filtering
Basics of Spatial Filtering
• The basics of spatial filtering is shown in next slide.
• The process is simple that move the filter mask from point to point of
an image.
• At each point of image, the response of filter is calculated using a
predefined relationship.

• Net effect of Spatial Filtering is Blurring.


• Spatial Filtering is also called as integration operations
Basics of Spatial Filtering
Illustration of Basics of Spatial Filtering
Movement of Spatial Filter
Basic Operation of Filtering
Smoothing Spatial Filters
Smoothing Spatial filter is classified as:
Smoothing using Linear filter
• They are also know as averaging filters or lowpass filters as they are
simply average of the pixels contained in the neighbourhood of the
filter mask.
• The process results in an image with reduced “Sharp” transitions n
intensities which ultimately leads to noise reduction
Box Filter – All co- efficient are equal : It is
also called Mean filter.
Weighted Average -
Example: Given image and the structing
element
Gaussian Filter – Weights are samples of 2D
Gaussian function
Example
Non-Linear Filters:
Median, Min and Max Filter
They are also called Order Statistical Filters of Non-
linear Filter
They are based on ordering of the pixels in the
neighbourhood
Median filter: Arrange the elements in ascending
order then pick the middle element
Min Filter and Max filter
• Min Filter : Minimum value out of 9 elements is selected
• Max Filter : Maximum value out of 9 elements is selected
Sharpening Spatial Filters
Why Sharpening?
• As sometime it is required to suppress some irrelevant information by
blurring, it is sometime essential for image enhancement to sharp
some small but relevant information. So the process opposite to
blurring (Smoothing) is sharpening.

• So Blurring = Average of neighbouring pixels = Integration of pixels


• And Sharpening = Derivative of pixel
What is derivative
• Derivative – First Order. The first order derivative of a
function represents the rate of change of one variable with respect to
another variable.
Consider the first and second order
derivatives as:
As the image is a two dimension with x and y:
Laplacian mask is used for image sharpening:
sum of the weights is always 0.
Enhanced Laplacian Filter
Question on enhanced Laplacian Filter
For the edges either you can pad with 0 or
replicate with the edge values
Gradient = difference between the pixel intensity
Combining Spatial Enhancement methods
Example
End of Unit - 2

You might also like