当前位置:网站首页>Opencv learning notes 1 -- several methods of reading images
Opencv learning notes 1 -- several methods of reading images
2022-07-07 08:23:00 【I am a little rice】
cv2.IMREAD_COLOR
Color imagescv2.IMREAD_GRAYSCALE
Grayscale imagecv2.COLOR_BGR2RGB
BGR turn RGB
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
from PIL import Image
1. cv
Display the image in
image = cv2.imread('image.png')
def cv_show(name, image):
cv2.imshow(name, image)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv_show("cat", image)
2. cv2+plt
Display the image in
image = cv2.imread('image.png')
plt.imshow(image)
because opencv
The data read in is not RGB
, It is BGR
, So pass cv2
Try not to use other tools to display the read image , It can be done by cv2.COLOR_BGR2RGB
To transform
image = cv2.imread('image.png')
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
plt.imshow(image)
3.plt
Display the image in
image = mpimg.imread('image.png')
plt.imshow(image)
4. Image
Display the image in
image = Image.open('image.png')
image.show()
边栏推荐
- [quick start of Digital IC Verification] 14. Basic syntax of SystemVerilog learning 1 (array, queue, structure, enumeration, string... Including practical exercises)
- Uniapp mobile terminal forced update function
- 数据中台落地实施之法
- Rainbow 5.7.1 supports docking with multiple public clouds and clusters for abnormal alarms
- 在Rainbond中实现数据库结构自动化升级
- IP-guard助力能源企业完善终端防泄密措施,保护机密资料安全
- [quick start of Digital IC Verification] 13. SystemVerilog interface and program learning
- CCTV is so warm-hearted that it teaches you to write HR's favorite resume hand in hand
- Obsidan之数学公式的输入
- Understanding of out covariance, in inversion and invariance in kotlin
猜你喜欢
Myabtis_ Plus
在Rainbond中实现数据库结构自动化升级
Open3d ISS key points
Practice of combining rook CEPH and rainbow, a cloud native storage solution
One click installation of highly available Nacos clusters in rainbow
XCiT学习笔记
Unityhub cracking & unity cracking
云原生存储解决方案Rook-Ceph与Rainbond结合的实践
GFS distributed file system
Game attack and defense world reverse
随机推荐
Explore creativity in steam art design
opencv学习笔记二——图像基本操作
Bisenet features
MES system is a necessary choice for enterprise production
Detailed explanation of apply, also, let, run functions and principle analysis of internal source code in kotlin
Interface as a parameter (interface callback)
Myabtis_ Plus
buureservewp(2)
CDC (change data capture technology), a powerful tool for real-time database synchronization
Offer harvester: add and sum two long string numbers (classic interview algorithm question)
Famine cloud service management script
IELTS review progress and method use [daily revision]
使用BiSeNet实现自己的数据集
Function extension, attribute extension and non empty type extension in kotlin
Use of any superclass and generic extension function in kotlin
Game attack and defense world reverse
opencv学习笔记四——膨胀/腐蚀/开运算/闭运算
Uniapp mobile terminal forced update function
The reified keyword in kotlin is used for generics
MES系统,是企业生产的必要选择