Image Transformations Using OpenCV

Machine Learning courses with 100+ Real-time projects Start Now!!

Program 1

import cv2
import numpy as np
img=cv2.imread("D://opencvapp//wildlifeImages//walking-dog.jpg")
print(type(img))
cv2.imshow('Orginal Image Window',img)
x=-100
y=100
trans=np.float32([[1,0,x],[0,1,y]])
dim=((img.shape[1],img.shape[0]))
img1=cv2.warpAffine(img,trans,dim)
cv2.imshow('Transformation Image Window',img1)
cv2.waitKey(0)
cv2.destroyAllWindows()

 

If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google

courses

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *