Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views8 pages

Exp 02

The lab manual outlines Experiment No. 02, focusing on image enhancement techniques using MATLAB, including power law transformation, thresholding, and contrast stretching. Students are expected to implement various point processing operations and understand their effects on images. The manual also includes procedures for completing each task and sections for students to document their code, inputs, outputs, observations, and conclusions.

Uploaded by

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

Exp 02

The lab manual outlines Experiment No. 02, focusing on image enhancement techniques using MATLAB, including power law transformation, thresholding, and contrast stretching. Students are expected to implement various point processing operations and understand their effects on images. The manual also includes procedures for completing each task and sections for students to document their code, inputs, outputs, observations, and conclusions.

Uploaded by

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

LAB Manual

PART A
(PART A : TO BE REFFERED BY STUDENTS)

Experiment No. 02
A.1 Aim:
1. For the given test image, apply power law transformation with gamma

2. For the given low contrast image, apply thresholding and contrast stretching point
processing techniques to enhance the image.

A.2 Prerequisite:
1 MATLAB programming syntax (Refer the MATLAB manual).
2.Knowledge of point processing operations.
3. Availability of Soft copy of your Photograph for experiment.

A.3 Outcome:
After successful completion of this experiment students will be able to
1. Implement following point processing image enhancement
operations.

a. Negation of an image
b. Thresholding of an image
c. Contrast Stretching of an image
d. Gray level Slicing
e. Power law transform
2. Understand the effect of point processing operations on an
Image.
3. Identify the real-life application of point processing techniques
implemented.

A.4 Theory:
a. Negation of an image
The negative of an image with gray levels in the range [ 0, L-1] is obtained by using
the negative transformation given by the expression
S= L – 1 – r …… Equation (1)

This is according to the transformation S = T ( r ). In the above transformation (1),


the intensity of the output image decreases as the intensity of the input image
increases. The type of processing is particularly suited for enhancing white or gray
detail embedded in dark regions of an image, especially when black areas are
dominant in the scene.
Figure 1: The concept of image negation

b. Thresholding of an Image
Theory:
Thresholding is a simple process to separate the object from the background. It
gives the binary image. The formula for achieving thresholding is as follows

s = 0; if r <= t ……Equation (2)


s = L-1; if r > t

Figure 2: The concept of image thresholding

c. Contrast Stretching of an Image


Theory:
Low contrast images can result from poor illumination, lack of dynamic range in the
imaging sensor etc. The idea behind contrast stretching is to increase the dynamic
range of the gray levels in the image being processed. The transformation function
for contrast stretching is given by

{
l∗r 0 ≤ r ≤ a
s= m ( r −a ) + v a<r ≤b
n ( r −b ) + w b<r ≤ L−1
Where: f(x, y) is the Piecewise Linear Contrast Stretch in the image, a, b, and c are
appropriate constants, which are the slopes in the respective regions, and B is the
maximum intensity value.

Figure 3: The concept of Contrast stretching

The location of the points (r1, s1) & (r2, s2) controls the shape of the transformation
function.

d. Gray Level Slicing (Intensity Level Slicing) :


Theory:
Highlighting a specific range of gray levels in an image is often desired. Applications
include enhancing features such as masses of water, crop regions, or certain
elevation areas in satellite imagery. Another application is enhancing flaws in X-
rays. There are two main approaches:

 highlight a range of intensities while diminishing all others to a constant low


level.

 highlight a range of intensities but preserve all others.

The fig. illustrates the intensity level slicing process. The left figures show a
transformation function that highlights a range [A, B] while diminishing all the
others. The right figures highlight a range [A, B] but preserve all the others.
Figure 4: The concept of Gray level slicing with and without background
The formulation for grey level slicing without background is

S = L-1 ; if A ≤ r ≤ B … Equation (4)

S = 0; Otherwise

The formulation for grey level slicing with background is


S = L-1 ; if A ≤ r ≤ B ….Equation (5)

S = r; Otherwise

e. Power – Law transformations

There are two further transformations are power law transformations, that include
nth power and nth root transformation. These transformations can be given by the
expression:
s=cr^γ
This symbol γ is called gamma, due to which this transformation is also known as
gamma transformation.
Variation in the value of γ varies the enhancement of the images. Different display
devices / monitors have their own gamma correction, that’s why they display their
image at different intensity.
This type of transformation is used for enhancing images for different type of
display devices. The gamma of different display devices is different. For example,
Gamma of CRT lies in between of 1.8 to 2.5, that means the image displayed on
CRT is dark.

A.5 Procedure/Algorithm:
A.5.1 TASK 1:

Negation of an image

1. Read i/p image


2. Read the maximum gray level pixel of i/p image
3. Replace input image by (maximum – i/p ) = o/p
4. Display o/p image
5. Observe the output and complete PART B of the lab manual.
6. Save and close the file and name it as EXP2_Task1_your Roll
no.m
A.5.2 TASK 2:

Thresholding of an Image

1. Read the input image


2. Enter thresholding value t
3. If the image pixel is less than t replace it by zero.
4. If the image pixel is > t replace it by 255
5. Display input image
6. Display threshold image
7. Display input image
8. Display threshold image
9. Observe the output and complete PART B of the lab manual.
10. Save and close the file and name it as EXP2_Task2_your Roll
no.m

A.5.3 TASK 3:

Contrast Stretching of an Image

1. Read the input image


2. Enter values r1,r2,s1,s2
3. Calculate alpha, beta, and gamma slopes.
4. if input pixel value is <= r1 then o/p = alpha x input
5. If input pixel is > r1and <=r2 then o/p = beta x (r-r1)+s1
6. otherwise o/p = gamma x (r-r2)+s2
7. Display i/p image
8. Display o/p image.
9. Observe the output and complete PART B of lab manual.
10. Save and close the file and name it as EXP2_Task3_your Roll
no.m

A.5.4 TASK 4:

Gray Level Slicing (Intensity Level Slicing)


1. Read input image
2. Enter values A, B.
3. Use the appropriate formula for without background and with background.
4. Find the output image for without background and with background.
5. Display i/p image
6. Display o/p images.
7. Observe the output and complete PART B of lab manual.
8. Save and close the file and name it as EXP2_Task4_your Roll
no.m

A.5.5 TASK 5:

Power law transformation


1. Read input image.
2. Give the different values of gamma
3. Apply gamma correction formula
4. Display all output images.
5. Observe the output and complete PART B of lab manual.
6. Save and close the file and name it as EXP2_Task5_your Roll
no.m

**********************
PART B
(PART B: TO BE COMPLETED BY STUDENTS)
(Students must submit the soft copy as per the following segments
within two hours of the practical. The soft copy must be uploaded
on the Blackboard or emailed to the concerned lab in charge faculty
at the end of the practical, in case there is no Blackboard access
available.
Roll No. Name:
Class : Batch :
Date of Experiment: Date of Submission
Grade :

B.1 Software Code written by student:


(Paste your Matlab code completed during the 2 hours of practical in the lab
here)

B.2 Input and Output:


(Paste your program input and output in the following format. If there is
error, then paste the specific error in the output part. In case of error with
due permission of the faculty extension can be given to submit the error free
code with output in due course of time. Students will be graded accordingly.)
Input Images: Your photographs
Output:
1. Output Image for each point processing operation
performed on input image.
2. Comments based on matrix content of output image (for
each operation) as seen in Workspace.
B.3 Observations and learning:
(Students are expected to comment on the output obtained with clear
observations and learning for each task/subpart assigned)

B.4 Conclusion:
(Students must write the conclusion as per the attainment of the individual
outcome listed above and learning/observation noted in section B.3)

B.5 Question of Curiosity


(To be answered by student based on the practical performed and
learning/observations)
Application of image enhancement in real life.
************************

You might also like