当前位置:网站首页>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()
边栏推荐
- Offer harvester: add and sum two long string numbers (classic interview algorithm question)
- Full text query classification
- Rainbow version 5.6 was released, adding a variety of installation methods and optimizing the topology operation experience
- Improve the delivery efficiency of enterprise products (1) -- one click installation and upgrade of enterprise applications
- IELTS review progress and method use [daily revision]
- Openjudge noi 2.1 1752: chicken and rabbit in the same cage
- Ebpf cilium practice (2) - underlying network observability
- Rainbow 5.7.1 supports docking with multiple public clouds and clusters for abnormal alarms
- Explore creativity in steam art design
- 通俗易懂单点登录SSO
猜你喜欢
随机推荐
Analysis of maker education in innovative education system
opencv学习笔记一——读取图像的几种方法
Transformation function map and flatmap in kotlin
Unityhub cracking & unity cracking
Complex network modeling (I)
Battery and motor technology have received great attention, but electric control technology is rarely mentioned?
Interview questions (CAS)
[IELTS speaking] Anna's oral learning records Part3
Explore creativity in steam art design
拓维信息使用 Rainbond 的云原生落地实践
Understanding of out covariance, in inversion and invariance in kotlin
Game attack and defense world reverse
Practice of implementing cloud native Devops based on rainbow library app
发挥创客教育空间的广泛实用性
Rainbow combines neuvector to practice container safety management
Fluentd is easy to use. Combined with the rainbow plug-in market, log collection is faster
Domain specific language / DSL in kotlin
积分商城管理系统中应包含的四大项
Rainbow 5.7.1 supports docking with multiple public clouds and clusters for abnormal alarms
Qinglong panel -- Huahua reading