0% found this document useful (0 votes)
24 views3 pages

Friday Lab 2

This lab assignment asks students to study various image contrast stretching techniques using OpenCV. Students are provided with several image transformations to implement, including single leg and two-leg contrast stretching with different parameter values. For each transformation, students must plot the stretch line, display the original and transformed images side by side, and explain how the transformation affects image contrast, brightness, etc. The goal is to practice different methods for improving contrast in images with poor contrast.
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)
24 views3 pages

Friday Lab 2

This lab assignment asks students to study various image contrast stretching techniques using OpenCV. Students are provided with several image transformations to implement, including single leg and two-leg contrast stretching with different parameter values. For each transformation, students must plot the stretch line, display the original and transformed images side by side, and explain how the transformation affects image contrast, brightness, etc. The goal is to practice different methods for improving contrast in images with poor contrast.
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/ 3

School of Computer Science Engineering and Technology

CSET344 Image and Video Processing

Lab Assignment 2

Continue your Image processing lab work in google colab using OpenCV computer vision
library. In this lab you will study various issues related to contrast stretching of gray values in
an image.
A number of image transformations have been suggested in the assignment. You are required
to plot each transformation, show the original and transformed images side by side, and
provide explanation for the change in image, or justify it.
Submit a PDF file for this assignment.

1. Download the following images or borrow similar images with poor contrast from the net

i) Pick up one of the above images and carry out single leg contrast stretching with
following parameters: R1 =0, S1 = 30, R2 = 225, S2 = 255

Plot the contrast stretch line, taking hint from following code
import matplotlib.pyplot as plt
import numpy as np
# define data values
x = np.array([0, 30, 180, 255]) # X-axis points
y = np.array([0, 0, 255, 255]) # Y-axis points
School of Computer Science Engineering and Technology
plt.plot(x, y) # Plot the chart
plt.show() # display

Show the original image and the transformed image. Discuss whether this transformation brightens
the picture, darkens the picture, improves contrast, converts into binary or whatever the output.
Justify the output in relation to your plot.
Repeat the above steps with other sets of parameters given below:
Plot the line, carry out transformation, show the output, and provide explanation for it.
ii) R1 = 30, S1 = 0, R2 = 255, S2 = 225

iii) R1 = 30, S1 = 0, R2 = 180, S2 = 255

iv) R1 = 80, S1 = 0, R2 = 80, S2 = 255

v) R1 = 0, S1 = 255, R2 = 255, S2 = 0

vi) R1 = 10, S1 = 80, R2 = 255, S2 =80

2. This part deals with transforming very dark pictures. Carry out two-leg contrast stretching
on the following images with following parameters, plot the curves, and justify the nature
of the output in each case
a. R1 = 0, S1 = 0, R2 = 125, S2 =200, R3 = 255, S3 =255
b. R1 = 0, S1 = 0, R2 = 80, S2 =200, R3 = 255, S3 =255

3. This part is also for very dark images. Carry out Log transformation on images used in the
last problem. Repeat the same steps as before.
School of Computer Science Engineering and Technology
s = c * log (1 + r)

c = 255 / (log (1 + max_input_pixel_value))

4. This part relates to handling very bright images. Carry out two-leg contrast stretching on
following images with following parameters, justify the nature of the output in each
case. Plot the curves, and provide explanation for the outputs as before. Try with other
bright image from the net.

a. R1 = 0, S1 = 0, R2 = 180, S2 =80, R3 = 255, S3 =255


b. R1 = 0, S1 = 0, R2 = 100, S2 =50, R3 = 255, S3 =255

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy