python 图像旋转

import cv2
import imutils
image = cv2.imread(r"C:\Users\HP\OneDrive\Desktop\Penskull Education.png")
 
rot = imutils.rotate(image, angle=45)
cv2.imshow("Rotated", rot)
cv2.waitKey(0)
from PIL import Image 
 
  
img = Image.open(r"C:\Users\HP\OneDrive\Desktop\Penskull Education -- 01.png") 
 
rotate_img= img.rotate(45)
 
rotate_img.show() 
import cv2
import numpy as np
 
 
img1 = cv2.imread('./Image/reba_color.jpg',cv2.IMREAD_COLOR)
 
 
tx = 20  # x
ty = 20  # y
 
affine_arr = np.float32([[1,0,tx],[0,1,ty]])
 
res = cv2.warpAffine(img1,affine_arr,(img1.shape[0],img1.shape[1]))
 
cv2.imshow('img',img1)
cv2.imshow('res',res)
 
cv2.waitkey(0)
import cv2

pre_img = cv2.imread('image.jpg', cv2.IMREAD_GRAYSCALE)
h, w = pre_img.shape

kernel = cv2.getStructuringElement(cv2.MORPH_RECT, ksize=(1, 2 * h))

dilated = cv2.dilate(pre_img, kernel)

cv2.imshow('input', pre_img)
cv2.imshow('output', dilated)
cv2.waitKey(0)
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值