Python 10.OpenCV 放大图片旋转图片等

import cv2
import numpy as np

img = cv2.imread('pic1.png')

res = cv2.resize(img, None, fx=2, fy=2, interpolation=cv2.INTER_CUBIC)

# OR
# 直接设置输出图像的尺寸
height, width = img.shape[:2]
res = cv2.resize(img, (2*width, 2*height), interpolation=cv2.INTER_CUBIC)

mhh = cv2.getRotationMatrix2D((height/2, width/2), 45, 0.6)
dst = cv2.warpAffine(img, mhh, (2*width, 2*height))

cv2.imshow('img1', dst)
cv2.imshow('res', res)
cv2.imshow('img', img)

cv2.waitKey(0)
cv2.destroyAllWindows()

发布了54 篇原创文章 · 获赞 41 · 访问量 7902

猜你喜欢

转载自blog.csdn.net/qq_36071362/article/details/104110375