Wednesday, 24 February 2021

python opencv 1



grey scale

resize

half size

rotate
//cmd
pip install opencv-python

//main.py
import cv2

img = cv2.imread('assets/beach.jpg', 1)
#img = cv2.resize(img, (384, 216))
img = cv2.resize(img, (0, 0), fx=0.5, fy=0.5)
img = cv2.rotate(img, cv2.ROTATE_90_COUNTERCLOCKWISE)

cv2.imwrite('new_img.jpg', img)

cv2.imshow('beach image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()

reference:

No comments:

Post a Comment