[英]I cant open images in OpenCV
I can not open my images on Jupyter suddenly anymore, do you know why?我突然无法在 Jupyter 上打开我的图像了,你知道为什么吗?
import cv2
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
img = cv2.imread('DATA/crossword.jpg')
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(img)
The error message that I get我得到的错误信息
--------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-7-21f16fc8e901> in <module>()
----> 1 img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
2 plt.imshow(img)
error: OpenCV(3.4.2) c:\miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\imgproc\src\color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'cv::CvtHelper<struct cv::Set<3,4,-1>,struct cv::Set<3,4,-1>,struct cv::Set<0,2,5>,2>::CvtHelper'
Error message:错误信息:
Can anyone help?任何人都可以帮忙吗?
check your imgread path.检查您的 imgread 路径。 for example: I copy file path from window.
例如:我从窗口复制文件路径。
D:\\Python tutorial\\pyc_opencv\\img\\2253.png
but got the error.但得到了错误。
D:/Python tutorial/pyc_opencv/img/2253.png
Success.成功。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.