You are on page 1of 1

import cv2 as cv

img = cv.imread(r"C:\Users\Autumn\Pictures\vcl.jpg")
cv.imshow('Cat', img)
def rescaleFrame(frame, scale=0.2):
width = int(frame.shape[1] * scale)
height = int(frame.shape[0] * scale)
dimensions = (width, height)
return cv.resize(frame, dimensions, interpolation = cv.INTER_AREA)
resized_image = rescaleFrame(img)
cv.imshow('Image', resized_image)
capture = cv.VideoCapture(r"C:\Users\Autumn\Videos\Captures\HackChecked.mp4")
while True:
isTrue, frame = capture.read()
frame_resized = rescaleFrame(frame)
cv.imshow('Video', frame)
cv.imshow('Video Resized', frame_resized)
if cv.waitKey(20) & 0xFF==ord('d'):
break
capture.release()
cv.destroyAllWindows()
cv.waitKey()
------------------------------------
import cv2
import numpy as np

img = cv2.imread(r"C:\Users\Autumn\Pictures\cheese.png")

print(img.shape)

imgCropped = img[0:600, 200:500]

imgResize = cv2.resize(img, (600, 800))

cv2.imshow("Image", img)
cv2.imshow("Image2", imgResize)
cv2.imshow("Image3", imgCropped)
cv2.waitKey(0)

You might also like