图像缩放
- 两种方式
dsize: 元组,传入要缩放图像的宽高
import cv2
img = cv2.imread('img_path')
img1 = cv2.resize(av,dsize=(100,100))
cv2.imshow('img',img)
cv2.imshow('img1',img1)
cv2.waitKey()
cv2.destroyAllWindows()
fx fy参数,分别 修改横列 缩放系数
import cv2
img = cv2.imread('img_path')
img1 = cv2.resize(img,None,fx=2,fy=2)
cv2.imshow('img',img)
cv2.imshow('img1',img1)
cv2.waitKey()
cv2.destroyAllWindows()
翻转变换
flipCode:
>1沿着y axis左右变换=0沿着x axis上下变换<0沿着x axis上下 翻转,再沿着y axis左右反转
import cv2
img = cv2.imread('img_path')
img1 = cv2.flip(img,flipCode=1)
cv2.imshow('img',img)
cv2.imshow('img1',img1)
cv2.waitKey()
cv2.destroyAllWindows()