100% found this document useful (1 vote)
125 views16 pages

Digital Image Processing: Lab 2: Image Enhancement in The Spatial Domain

This document discusses image enhancement techniques in the spatial domain. It covers image negative, contrast scaling and stretching, and log and power law transformations. For image negative, it reverses the intensity levels of an image. For log and power law transformations, it maps a narrow range of low intensity values to a wider range of high intensity values. This expands dark pixels while compressing brighter values. For tasks, it asks the reader to apply these techniques to images and explain the steps taken.

Uploaded by

Waqar Tanveer
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
100% found this document useful (1 vote)
125 views16 pages

Digital Image Processing: Lab 2: Image Enhancement in The Spatial Domain

This document discusses image enhancement techniques in the spatial domain. It covers image negative, contrast scaling and stretching, and log and power law transformations. For image negative, it reverses the intensity levels of an image. For log and power law transformations, it maps a narrow range of low intensity values to a wider range of high intensity values. This expands dark pixels while compressing brighter values. For tasks, it asks the reader to apply these techniques to images and explain the steps taken.

Uploaded by

Waqar Tanveer
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/ 16

Digital Image Processing

Lab 2: Image Enhancement in the Spatial Domain

Waqar Tanveer
Department of Computer Engineering
Bahria University, Islamabad

September 28, 2020

Digital Image Processing 1 / 16


Objective

For image enhancement, we will cover the following topics:

Image Negative

Contrast scaling and stretching

Log and Power law transformations

Digital Image Processing 2 / 16


Image Negative
Reversing the intensity levels of an image is called as the
negative of that image.

It is performed by using negative transformation as given in


following formula:
s = T (r ) = L − 1 − r
where,
r : Pixels of Input Image
s : Pixels of Output Image
T : Transformation
L : Intensity Levels of Image

It is suitable for a better visualization of hidden information in


dark images.

Most specifically it is used to enhance white or gray details


embedded in a dark image.
Digital Image Processing 3 / 16
Image Negative (Continue)

Figure: Image with its Negative

Digital Image Processing 4 / 16


Log Transformation

Mapping of narrow range of low intensity values from input


image to wider range of high intensity values of output image
or vice versa is called as log transformation.

Log transformation is represented by following formula:


s = c log (1 + r )
where,
r : Pixels of Input Image
s : Pixels of Output Image
c : Constant

It is used to expand the values of dark pixels in an image


while compressing the higher level values or vice versa.

Digital Image Processing 5 / 16


Log Tansformation (Continue)

Figure: Log Transformation

Digital Image Processing 6 / 16


Power-Law Transformation

Similar to log transformation but it is more precise.

It is represented by following formula:


s = cr γ
where,
r : Pixels of Input Image
s : Pixels of Output Image
c : Positive Constant
γ: Positive Constant

Digital Image Processing 7 / 16


Power-Law Transformation (Continue)

Figure: Original Image Figure: c = 1, γ = 3

Figure: c = 1, γ = 4 Figure: c = 1, γ = 5
Digital Image Processing 8 / 16
Plot of Power-Law Tranformation

Figure: Plot of equation s = cr γ for various values of γ and c = 1

Digital Image Processing 9 / 16


Plot of Basic Intensity Transformations

Figure: Plot of Basic Intensity Transformations

Digital Image Processing 10 / 16


Contrast Stretching
Contrast Stretching is a process that expands the range of
intensity levels in an image so that is spans the full intensity
range of the recording medium or display device.

Figure: contrast stretching


Digital Image Processing 11 / 16
Tasks

Task 1

Consider any gray scale image, find its negative and display
both original and output images.

Consider any rgb image, find its negative and display both
original and output images.

Explain each step of task in 2,3 lines along with figures. Also
include the code.

Digital Image Processing 12 / 16


Tasks (Continued)
Task 2
Apply the log transformation on following images and display
the results.

Take any rgb underexposed(dark) image and apply the same


procedure on it.
Explain each step of task in 2,3 lines along with figures. Also
include the code.
Digital Image Processing 13 / 16
Tasks (Continued)
Task 3
Apply the power-law transformation on following images and
display the results.

Take any overexposed and underexposed rgb images and


apply the same procedure on it.
Explain each step of task in 2,3 lines along with figures. Also
include the code.
Digital Image Processing 14 / 16
Tasks (Continued)

Task 4

Take any grayscale image and apply contrast stretching on it.

Take any rgb image and apply contrast stretching on it.

Hint: Take a look on ”imadjust” and ”stretchlim” commands


in MATLAB.

Explain each step of task in 2,3 lines along with figures. Also
include the code.

Digital Image Processing 15 / 16


Instructions

Digital Image Processing 16 / 16

You might also like