0% found this document useful (0 votes)
8 views5 pages

CV Lab 10 Manual

Uploaded by

Hashaam Zafar
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)
8 views5 pages

CV Lab 10 Manual

Uploaded by

Hashaam Zafar
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/ 5

Department of Electrical Engineering

Faculty Member: Date:


Semester:

CS477 Computer Vision


Lab 10: Geometric Transformations

PLO4 - CLO4 PLO5 - PLO8 - PLO9 -


CLO5 CLO6 CLO7
Name Reg. No Investigation Modern Ethics Individual
Tool and Team
Usage Work

5 Marks 5 Marks 5 Marks 5 Marks

Computer Vision
Introduction

This laboratory exercise will focus on applying various geometric


transformations such as scaling, rotation, reflection, stretching, shearing etc. Such
transformations are central to many applications such as in computer graphics,
video games, photo editing, application interfaces etc.

Objectives

• Implement scaling transformation


• Implement reflection transformation
• Implement rotation transformation
• Implement shearing transformation
 Use the tab key to provide the indentation in python.

Theory
This laboratory exercise will focus on applying various geometric
transformations such as scaling, rotation, reflection, stretching, shearing etc.
Geometric transformations can be accomplished by creating a transform matrix
that is multiplied with each pixel value to map a new output image which
contains the needed transformation. The transformations can also be
compounded together into a single transformation matrix.

A brief summary of the relevant keywords and functions in python is provided


below. (For more details, check the slides for this lab)

print() output text on console


input() get input from user on console
range() create a sequence of numbers
len() gives the number of characters in a string
if contains code that executes depending on a logical condition
else connects with if and elif, executes when conditions are not met
elif equivalent to else if

Computer Vision
while loops code as long as a condition is met
for loops code through a sequence of items in an iterable object
break exit loop immediately
continue jump to the next iteration of the loop
def used to define a function

In the lab, you must download some images to implement in the tasks

Lab Task 1 – Scaling __________________________________________________________


Load your image and create a function that takes three arguments: image, x factor, y
factor. Your function must create a new rescaled image using the x and y scaling
factors. Use any relevant inbuilt functions. For the screenshots, use different values
for x and y scaling factors. Provide the code and all relevant screenshots.

### TASK 1 CODE STARTS HERE ###

### TASK 1 CODE ENDS HERE ###

### TASK 1 SCREENSHOT STARTS HERE ###

### TASK 1 SCREENSHOT ENDS HERE ###

Lab Task 2 – Reflection ______________________________________________________


Load your image and create a program that implements reflection of the image
about the x and y axes. The dimensions of the output image must be the same as that
of the input image. You need to submit two screenshots (one reflection about the x-
axis and the other about the y-axis) for this task. Provide the code and all relevant
screenshots.

### TASK 2 CODE STARTS HERE ###

Computer Vision
### TASK 2 CODE ENDS HERE ###

### TASK 2 SCREENSHOT STARTS HERE ###

### TASK 2 SCREENSHOT ENDS HERE ###

Lab Task 3 – Rotation _______________________________________________________


Load your image and create a program that implements rotation of the image about
the center pixel at some given angle. The dimensions of the output image must be
the same as that of the input image. You need to submit three screenshots (three
different angles) for this task. Provide the code and all relevant screenshots.

### TASK 3 CODE STARTS HERE ###

### TASK 3 CODE ENDS HERE ###

### TASK 3 SCREENSHOT STARTS HERE ###

### TASK 3 SCREENSHOT ENDS HERE ###

Lab Task 4 – Rotation with rescaling _______________________________________


In this task, you will improve the rotation program so that it accounts for the size of
the image. Your program must rotate the image but the size of the output image
must be adjusted so that it contains the complete picture. You must write your code
from scratch.You need to submit three screenshots (three different angles) for this
task. Provide the code and all relevant screenshots.

### TASK 4 CODE STARTS HERE ###

### TASK 4 CODE ENDS HERE ###

### TASK 4 SCREENSHOT STARTS HERE ###

Computer Vision
### TASK 4 SCREENSHOT ENDS HERE ###

Lab Task 5 – Shearing ________________________________________________________


Load your image and create a program that implements shearing of the image. You
need to submit one screenshot for this task. Provide the code and the relevant
screenshot. Bonus marks will be given to those who will write code from scratch.

### TASK 5 CODE STARTS HERE ###

### TASK 5 CODE ENDS HERE ###

### TASK 5 SCREENSHOT STARTS HERE ###

### TASK 5 SCREENSHOT ENDS HERE ###

Computer Vision

You might also like