Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Basics/Crop_Resize_Images.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import cv2

path = "Resources/road.jpg"
img = cv2.imread(path)
img = cv2.imread(path)
print(img.shape)

width ,height = 1000 , 1000
imgResize = cv2.resize(img,(width,height))
width, height = 1000, 1000
imgResize = cv2.resize(img, (width, height))
print(imgResize.shape)

imgCropped = img[300:540,430:480]
imCropResize = cv2.resize(imgCropped,(img.shape[1],img.shape[0]))
imgCropped = img[300:540, 430:480]
imCropResize = cv2.resize(imgCropped, (img.shape[1], img.shape[0]))

cv2.imshow("Road",img)
cv2.imshow("Road Resized",imgResize)
cv2.imshow("Road Cropped",imgCropped)
cv2.imshow("Road Cropped Resized",imCropResize)
cv2.imshow("Road", img)
cv2.imshow("Road Resized", imgResize)
cv2.imshow("Road Cropped", imgCropped)
cv2.imshow("Road Cropped Resized", imCropResize)
cv2.waitKey(0)