图像缩放变换

图像缩放

  • 两种方式

  1. 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()
  1. 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 左右反转

最后更新于

这有帮助吗?