LoginSignup
15
6

More than 3 years have passed since last update.

Python OpenCV (-215:Assertion failed) !_src.empty() エラーについて

Last updated at Posted at 2020-01-07

解決方法

ファイルの指定先を絶対パスにする。

readcv.ipynb
'img = cv2.imread(r'C:\Users\ユーザー名\Anaconda3\envs\pytorch04gpu\Lib\site-packages\cv2\data\画像ファイル名.jpg')'

概要

pythonにて画像認識のプログラムを読み込んだ際に
(-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'というエラーが出た。

「Color」と書かれているので色が関係しているのかと思いきや違った

原因

img = cv2.imread('画像ファイル名.jpg')

ファイルのパス指定が出来ておらずファイルを認識していないという意味のエラー

15
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
6