-
Notifications
You must be signed in to change notification settings - Fork 0
/
chapter-3
31 lines (22 loc) · 824 Bytes
/
chapter-3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
----------------------------------------------------------------size and shape --------------------------------------------------------
import cv2
import numpy as np
img = cv2.imread(".venv/image.jpg")
print(img.shape)
imgResize=cv2.resize(img,(1000,500))#width first and height second
print(imgResize.shape)
cv2.imshow("Image",img)
cv2.imshow("Image",imgResize)
cv2.waitKey(0)
-------------------------------------------------------------cropped image----------------------------------------------------------------------------
import cv2
import numpy as np
img = cv2.imread(".venv/image.jpg")
print(img.shape)
imgResize=cv2.resize(img,(1000,500))
print(imgResize.shape)
imgcropped=img[0:450,200:500]
cv2.imshow("Image",img)
cv2.imshow("ImageResize",imgResize)
cv2.imshow("Imagecropped",imgcropped)
cv2.waitKey(0)