0% found this document useful (0 votes)
6 views2 pages

Lab No. 5 Ippr

This document outlines Lab No. 5 focused on image transformation techniques using OpenCV, including translation, rotation, flipping, and resizing. It explains the theory behind these transformations and provides source code for implementing translation. The conclusion emphasizes the importance of these techniques in image processing and their applications in computer vision.

Uploaded by

Lok Regmi
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)
6 views2 pages

Lab No. 5 Ippr

This document outlines Lab No. 5 focused on image transformation techniques using OpenCV, including translation, rotation, flipping, and resizing. It explains the theory behind these transformations and provides source code for implementing translation. The conclusion emphasizes the importance of these techniques in image processing and their applications in computer vision.

Uploaded by

Lok Regmi
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/ 2

LAB NO.

5
TITLE:- IMAGE TRANSFORMATION USING OPENCV.

OBJECTIVE:-
➢ To understand and implement about image transformations techniques
such as translation, rotation, flipping, and resizing.

THEORY:-
Image transformation is a key concept in image processing that modifies the spatial
relationship of pixels in an image. It includes several basic operations:

• Translation moves the image from one position to another along the x and
y axes, useful for shifting objects within a frame.

• Rotation turns the image around a fixed point, typically the center, and is
used for orientation adjustments.

• Flipping mirrors the image either horizontally or vertically, often used in


data augmentation to increase diversity.

• Resizing changes the width and height of the image, which is important for
standardizing input sizes in machine learning or display purposes.
These transformations help in preparing images for analysis, improving model
performance, and enhancing visual interpretation.

SOURCE CODE:-
import cv2 as cv
import numpy as np

img=cv.imread('Photos/Flower.jpg')

cv.imshow('Flower',img)

#Translation
def translate(img,x,y):
transMat=np.float32([[1,0,x],[0,1,y]])
dimensions=(img.shape[1], img.shape[0])
return cv.warpAffine(img,transMat,dimensions)

# -x --> Left
# -y --> Up
# x --> Right
# y --> Down

translated = translate (img,100,100)


cv.imshow('Translated',translated)
cv.waitKey(0)
OUTPUT:-

CONCLUSION:-
In this lab, we learned how to apply basic image transformation techniques such as
translation, rotation, flipping, and resizing. These operations are fundamental in
image processing and are useful for preparing and augmenting images in various
real-world applications, especially in computer vision tasks.

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