Jupyer如何使用opencv-python显示图片
第一步先用pip安装opencv-python模块jovyan@re5ki1bmb1fc-job-q7hv8:~$ pip install opencv-pythonCollecting opencv-pythonDownloading opencv_python-4.4.0.42-cp38-cp38-manylinux2014_x86_64.whl (49.4 MB)|█████████████
第一步先用pip安装opencv-python模块
jovyan@re5ki1bmb1fc-job-q7hv8:~$ pip install opencv-python
Collecting opencv-pythonDownloading opencv_python-4.4.0.42-cp38-cp38-manylinux2014_x86_64.whl (49.4 MB)
|████████████████████████████████| 49.4 MB 25.3 MB/s
Requirement already satisfied: numpy>=1.17.3 in /opt/conda/lib/python3.8/site-packages (from opencv-python) (1.19.1)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.4.0.42
jovyan@re5ki1bmb1fc-job-q7hv8:~$
jovyan@re5ki1bmb1fc-job-q7hv8:~$
jovyan@re5ki1bmb1fc-job-q7hv8:~$
jovyan@re5ki1bmb1fc-job-q7hv8:~$ ls
Untitled.ipynb work
jovyan@re5ki1bmb1fc-job-q7hv8:~$ docker ps
bash: docker: command not found
jovyan@re5ki1bmb1fc-job-q7hv8:~$ docker info
bash: docker: command not found
jovyan@re5ki1bmb1fc-job-q7hv8:~$ ps
PID TTY TIME CMD
90 pts/1 00:00:00 bash
113 pts/1 00:00:00 ps
jovyan@re5ki1bmb1fc-job-q7hv8:~$ ps
PID TTY TIME CMD
90 pts/1 00:00:00 bash
114 pts/1 00:00:00 ps
jovyan@re5ki1bmb1fc-job-q7hv8:~$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
jovyan 1 0.0 0.0 2492 384 pts/0 Ss 05:13 0:00 tini -g -- start-notebook.sh
jovyan 6 1.6 0.0 220372 60204 pts/0 Sl+ 05:13 0:02 /opt/conda/bin/python /opt/conda/bin/jupyter-notebook
jovyan 28 0.9 0.1 2502508 132700 ? Ssl 05:13 0:01 /opt/conda/bin/python -m ipykernel_launcher -f /home/jovyan/.
jovyan 90 0.4 0.0 7232 2420 pts/1 Ss 05:13 0:00 /bin/bash
jovyan 115 0.0 0.0 8872 1556 pts/1 R+ 05:16 0:00 ps aux
jovyan@re5ki1bmb1fc-job-q7hv8:~$
其次传一张我们需要的图片到目录
然后写入代码
from matplotlib import pyplot as plt
import numpy as np
import cv2img = cv2.imread('1.png')
img2 = img[:,:,::-1]
plt.imshow(img)
然后运行结果如图
from matplotlib import pyplot as plt
import numpy as np
import cv2img = cv2.imread('1.png')
img2 = img[:,:,::-1]
plt.imshow(img2)
更多推荐
所有评论(0)