[英]Error while uploading an image on Jupyter notebook using cv2.imread() function
I am totally new to programming and just started learning Python 15 days back.我对编程完全陌生,15 天前才开始学习 Python。 I am trying to upload an image on Jupyter notebook using the imread()
function but am not able to upload an image.我正在尝试使用imread()
function 在 Jupyter Notebook 上上传图像,但无法上传图像。 Any file path I specify, whether from my computer or online link, I am not able to upload an image.我指定的任何文件路径,无论是从我的计算机还是在线链接,我都无法上传图像。 It does not throw any error, but in next step when I enquire the datatype of image - it shows N.netype
ie no image uploaded.它不会抛出任何错误,但在下一步中当我查询图像的数据类型时 - 它显示N.netype
即没有上传图像。
Note:- I am using the Jupyter cloud - which means I directly logon to Jupyter website and am using it through a web browser.注意:- 我正在使用 Jupyter 云 - 这意味着我直接登录到 Jupyter 网站并通过 web 浏览器使用它。
I have uploaded a screenshot of my Jupyter notebook program.我已经上传了我的 Jupyter notebook 程序的截图。 enter image description here在此处输入图像描述
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import cv2
img=cv2.imread('https://notebooks.gesis.org/binder/jupyter/user/ipython-ipython-in-depth-3oioonok/view/binder/python--study.jpg')
type(img)
The path you specify should be a file system path instead of a URL. Since your notebook is in the cloud, using paths to your computer wouldn't work either.您指定的路径应该是文件系统路径而不是 URL。由于您的笔记本在云端,因此使用您计算机的路径也不起作用。 If python--study.jpg
is in the same directory as your notebook on this cloud server, you could do:如果python--study.jpg
与此云服务器上的笔记本位于同一目录中,您可以执行以下操作:
img=cv2.imread('python--study.jpg')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.