简体   繁体   English

使用 cv2.imread() 在 Jupyter 笔记本上上传图像时出错 function

[英]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.

相关问题 使用 cv2.imread() 时出现 Python openCV 错误 - Python openCV error while using cv2.imread() 在 Django views.py 中使用 cv2.imread() 读取图像时出错 - Error while reading image using cv2.imread() in Django views.py 无法使用cv2.imread()读取图像 - Cannot read image using cv2.imread() 本地计算机上的图像可以在图像查看器上正确显示,但是在使用cv2.imread()时无法正确读取? - An image on local machine is displayed properly on image viewer but is not read properly while using cv2.imread()? cv2.imread 错误:img = cv2.imread(0) 系统错误:<built-in function imread> 返回 NULL 没有设置错误</built-in> - cv2.imread error:img = cv2.imread(0) SystemError: <built-in function imread> returned NULL without setting an error 使用cv2.imread加载图像时发生意外的图像修改 - Unexpected image modification when using cv2.imread for image loading CV2.imread() Python 图像未加载且未显示错误 - CV2.imread() Python image not loading and no error displayed 使用 cv2.imread:“<built-in function imread> 没有设置错误就返回NULL”,好像无法打开图片或获取数据</built-in> - Using cv2.imread: “<built-in function imread> returned NULL without setting an error”, as if it can't open the picture or get the data 使用cv2.imread的屏幕截图和语法错误 - screen capture and syntax error using cv2.imread 无法使用 cv2.imread 加载图像 - unable to load image with cv2.imread
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM