question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

See original GitHub issue
  • face_recognition version:4.1.0
  • Python version:3.7
  • Operating System:windows 10

Description

I’m having problem to run this program, the error under below Capture

gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY) cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function ‘cv::cvtColor’

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:31
  • Comments:101 (1 by maintainers)

github_iconTop GitHub Comments

76reactions
ageitgeycommented, Oct 24, 2019

This a secondary error that basically just means the image you are trying to process didn’t load and was empty.

If you grabbed the image dara from the camera, it means the camera connection failed or isn’t configured correctly. If you loaded an image file, it means the loading failed.

44reactions
ghostcommented, Dec 25, 2019

I have same problem. My old code is : cap = cv2.VideoCapture(1)

Then I change my code, and problem has solved. Probably, opencv accepts my finger print input as a camera. Thus, I change VideoCapture parameter as follows: cap = cv2.VideoCapture(0)

Read more comments on GitHub >

github_iconTop Results From Across the Web

imread returns None, violating assertion !_src.empty() in ...
COLOR_BGR2GRAY) cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) ...
Read more >
error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'
error : (-215:Assertion failed) !_src.empty() in function 'cvtColor' I don't have a user called Travis on my computer in case that is not ......
Read more >
error: (-215:Assertion failed) !_src.empty() in function 'cv
How to solve error : (- 215:Assertion failed ) !_src. empty () in function 'cv::cvtColor' in opencv is shown.
Read more >
215:Assertion failed) !_src.empty() in function 'cv ... - YouTube
opencverror # opencv #datascience #artificialintelligence #machinelearning #ml #ai #python # error #pythonerror #cvtcolor #cvtcolorerror ...
Read more >
error: opencv(4.6.0) /io/opencv/modules/imgproc/src/color.cpp ...
cpp:182 : error: (-215:assertion failed) !_src.empty() in function 'cv::cvtcolor'. Try Giving Full Path ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found