当前位置:网站首页>opencv创建窗口—cv.namedWindow()
opencv创建窗口—cv.namedWindow()
2022-08-01 09:14:00 【旅途中的宽~】
1、格式:
cv.namedWindow(winname[, flags])
2、功能:
创建一个窗口
3、输入:
winname:窗口名
flags:窗口创建模式,包括:
(1)WINDOW_NORMAL 或 WINDOW_AUTOSIZE
WINDOW_NORMAL:窗口尺寸可变
WINDOW_AUTOSIZE:窗口尺寸为图像尺寸,不可变
(2)WINDOW_KEEPRATIO 或 WINDOW_FREERATIO
WINDOW_KEEPRATIO:保持图像宽高比
WINDOW_FREERATIO:图像宽高比可变
(3)WINDOW_GUI_EXPANDED 或 WINDOW_GUI_NORMAL
WINDOW_GUI_EXPANDED:窗口带有工具栏和状态栏
WINDOW_GUI_NORMAL:窗口不带工具栏和状态栏
默认的 flags 为:
WINDOW_AUTOSIZE | WINDOW_KEEPRATIO | WINDOW_GUI_EXPANDED
3、输出:
None
4、示例:
# 导入 OpenCV
import cv2 as cv
# 读取图像
image = cv.imread(r'fire.jpeg')
# 创建窗口
cv.namedWindow('image', cv.WINDOW_NORMAL)
# 显示图像
cv.imshow('image', image)
cv.waitKey(0)
我们图片结果为:
边栏推荐
猜你喜欢
随机推荐
Redis learning
nodetype中值1、2、3分别代表什么意思
Intensive reading of ACmix papers, and analysis of its model structure
【杭电多校第四场 B题】最短路图+缩点dp
【数据集】各类绝缘子、鸟巢及防震锤数据集汇总
《时代》杂志:元宇宙时代将改变世界
How does UXDB return the number of records for all tables in the current database?
22牛客多校1 J.Serval and Essay (启发式合并)
Detailed explanation of JVM runtime data area and JMM memory model
力扣每日一题-第44天-290. 单词规律
优炫数据库支持Oracle哪几种时间及日期类型
如何保证数据库与缓存数据一致性?
leetcode 42. 接雨水
杰理AD14N/AD15N---串口中断问题
【STM32】入门(二):跑马灯-GPIO端口输出控制
HoloView--live data
leetcode-6133: maximum number of groupings
codeforces每日5题(均1600)-第二十七天
pytest interface automation testing framework | single/multiple parameters
How to ensure the consistency of database and cache data?