import cv2 as cv
import numpy as np
dog = cv.imread('imgs/dog.jpeg')
# 缩小指定大小
new = cv.resize(dog,(600,400))
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-6n5sNNoo-1645946826367)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220227151026275.png)]](https://img-blog.csdnimg.cn/b9e9114247444333962e175e4e7a6cfe.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAamlhbGFuNzU=,size_20,color_FFFFFF,t_70,g_se,x_16)
# 缩小一半
new = cv.resize(dog,None,fx=0.5,fy=0.5,interpolation=cv.INTER_AREA)
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-5YzxYpwm-1645946826368)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220227151143523.png)]](https://img-blog.csdnimg.cn/b188f2134c5648d38da883d9e6cd88ea.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAamlhbGFuNzU=,size_20,color_FFFFFF,t_70,g_se,x_16)
# 上下翻转
new2 = cv.flip(new,0)
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-jzI829v7-1645946826368)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220227152405169.png)]](https://img-blog.csdnimg.cn/6b8ed96c641f4755af1b4059d85372b9.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAamlhbGFuNzU=,size_20,color_FFFFFF,t_70,g_se,x_16)
# 水平翻转
new2 = cv.flip(new,1)
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-aD8ZQqxs-1645946826368)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220227152422615.png)]](https://img-blog.csdnimg.cn/8e23a45823fc44a192bac87e3e1128b6.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAamlhbGFuNzU=,size_20,color_FFFFFF,t_70,g_se,x_16)
# 上下翻转 水平翻转
new2 = cv.flip(new,-1)
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-0qJxgYFy-1645946826369)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220227152540473.png)]](https://img-blog.csdnimg.cn/f2d544c550934394aff9503465d4af5d.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAamlhbGFuNzU=,size_20,color_FFFFFF,t_70,g_se,x_16)
new180 = cv.rotate(new,cv.ROTATE_180)
new90 = cv.rotate(new,cv.ROTATE_90_CLOCKWISE)
new270 = cv.rotate(new,cv.ROTATE_90_COUNTERCLOCKWISE)

版权声明:本文为jialan75原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。