Challenge

Project 1

!pip install opencv-python

import cv2 as computervision
import numpy as numericalpython

image=computervision.imread(r"image11.png")
assert not isinstance(image,type(None)), 'image not found'

height,width=image.shape[:2]
center=(width/2,height/2)
rotated_matrix=computervision.getRotationMatrix2D(center=center,angle=140,scale=1)
rotated_image=computervision.warpAffine(src=image,M=rotated_matrix,dsize=(width,height))
computervision.imwrite(r"rotated_image11.jpg",rotated_image)

scale_percent = 50
resized_width = int(rotated_image.shape[1] * scale_percent / 100)
resized_height = int(rotated_image.shape[0] * scale_percent / 100)
dim = (resized_width, resized_height)
resized_image = computervision.resize(rotated_image, dim, interpolation = computervision.INTER_AREA)
computervision.imwrite(r"resized_image11.jpg",resized_image)

image.shape
rowstart=104
rowend=537
colstart=178
colend=854
if(rowstart<0 or rowstart>rowend or rowend>image.shape[0] or colstart<0 or colstart>colend or colend>image.shape[1]):
print("invalid cropping dimension")
cropped_image = image[rowstart:rowend, colstart:colend]
computervision.imwrite(r"cropped_image11.jpg",cropped_image)

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.