当前位置:网站首页>cv2.resize()
cv2.resize()
2022-07-26 19:12:00 【Wanderer001】
1、简介
cv2.resize(src,dsize,dst=None,fx=None,fy=None,interpolation=None)
- scr:原图
- dsize:输出图像尺寸
- fx:沿水平轴的比例因子
- fy:沿垂直轴的比例因子
- interpolation:插值方法
2、代码实现
import cv2
import numpy as np
img = cv2.imread('McGrady.jpg')
#方法一:
# res = cv2.resize(img,None,fx=2,fy=2,interpolation=cv2.INTER_CUBIC) #比例因子:fx=2,fy=2
# 方法二:
##print(img.shape) #输出为(450,600,3)
##print(img.shape[:2]) #输出为(450,600)
height,width = img.shape[:2] #获取原图像的水平方向尺寸和垂直方向尺寸。
res = cv2.resize(img,(2*width,2*height),interpolation=cv2.INTER_CUBIC) #dsize=(2*width,2*height)
while(1):
cv2.imshow('res',res)
cv2.imshow('img',img)
if cv2.waitKey(1) & 0XFF ==27:
break
cv2.destroyWindow()边栏推荐
猜你喜欢

Win11 U盘驱动异常怎么调整为正常?

Overview of canvas

十大排序详解

2022/07/26 learning notes (day16) abstraction and interface

Intensive reading of the paper: yolov2 - yolo9000: better, faster, stronger
![[internship experience] exception handling and URL result response data processing](/img/ed/05622fad0d3d8dcf17ce7069340669.jpg)
[internship experience] exception handling and URL result response data processing

负载均衡的使用

Training embedded representation of large categories using triple loss and twin neural networks

LeetCode每日一练 —— 27. 移除元素

Ten sorting details
随机推荐
数据库笔记(来自老社)
浅析接口测试
【机器学习】变量间的相关性分析
ShardingSphere-JDBC 关键字问题
金仓数据库 KingbaseES SQL 语言参考手册 (21. KES正则表达式支持)
Live video source code to achieve the advertising effect of scrolling up and down
Detailed explanation of Yolo v1
【PHP】MySQL原生PHP操作-天龙八步
直播预约有奖| 高级咨询顾问徐雁斐:效能度量如何助力高效精细的外包管理
[shell] Reprint: batch replacement find awk sed xargs
Digital transformation of enterprises has become a general trend, and it is important to choose the right online collaboration tools
答应我,看完别再写狗屎代码了。。
2022 极术通讯-安谋科技开启商业化新篇章
【shell】转载:批量替换 find awk sed xargs
C# .net 时间戳和时间转换 支持时区
Bug feedback: synchronization failed
【PHP】常用的header头部定义
Deeply analyze the execution process of worker threads in the thread pool through the source code
以 NFT 为抵押品的借贷协议模式探讨
Codeforces Round #810 (Div. 2)(A~C)