当前位置:网站首页>opencv显示图像
opencv显示图像
2022-06-23 03:58:00 【andrew P】
一。用opencv读取图片,用matplotlib.pyplot 显示
1.opencv读取的图像通道是,BGR,如果用matplotlib显示,就要转化成RGB
import matplotlib.pyplot as plt
import cv2
def CVshow_RGB(path):
img = cv2.imread(path)
img = img[:, :, [2, 1, 0]]#BGR to RGB
plt.title("RGB")
plt.imshow(img)
plt.show()2.如果有批量,需要压缩批量维度
def CVshow_pixes(title,img_pixes):
if len(img_pixes.shape)!=3 :
img_pixes=np.squeeze(img_pixes,axis=0)
cv2.imshow(title,img_pixes)
cv2.waitKey()
cv2.destroyAllWindows()二.用opencv读取图片,用opencv显示
边栏推荐
- 数学分析_笔记_第1章:集合与映射
- jvm: 方法重载时,具体调用哪个方法,是由传入参数的静态类型来决定的,而不是由参数的实际类型来决定
- 手机无线充电双线圈15W方案SOC英集芯IP6809
- What does it mean to open more accounts? Why open more accounts? How to implement it safely?
- Go grouping & sorting
- ES6的Array.from方法创建长度为N的undefined数组
- About information disclosure and defense
- 高等数学(第七版)同济大学 习题1-7 个人解答
- About dos/ddos attack and defense
- AI艺术的基因工程?使用 #Artbreeder 改变图像的任意形态
猜你喜欢

What do Niu B programmers pay attention to when "creating an index"?

今日睡眠质量记录80分

STC 32 Bit 8051 Single Chip Computer Development Example Tutorial one development environment

ES6的Array.from方法创建长度为N的undefined数组

STC 32位8051单片机开发实例教程 一 开发环境搭建

Go language -panic and recover

STM32 clock tree misconfiguration causes boot to enter hard interrupt

Heimdall Database Proxy横向扩展提高20倍

数据库连接异常:create connection error, url: jdbc:mysql://ip/数据库名, errorCode 0, state 08S01问题处理

visdom画多条动态损失曲线
随机推荐
Introduction to JDBC (I) DML operation
MCS: continuous random variable chi square distribution
Differences between fs4059a and fs5080e charging chips
JDBC入门学习(一)之DML操作
Composite API
After the idea code is developed, the code is submitted. If the branch is found to be incorrect after submission, how can I withdraw it
STM32cube 串口使用DMA+IDLE接收不定长数据
Chapter IX app project test (1)
JVM原理之内存模型
MySQL自定义序列数的实现
弱者易怒如虎,强者平静如水,真正厉害的人早已戒掉了情绪
Build a gocd environment
51万奖池邀你参战——第二届阿里云ECS CloudBuild开发者大赛来袭
1010 Radix
JVM原理之完整的一次GC流程
Mysql入门学习(一)之语法
visdom画多条动态损失曲线
Export PDF with watermark
Go grouping & sorting
H5 适配全面屏