Ask Your Question
-2

anyone know how to solve this error??

asked 2018-08-30 00:34:05 -0500

hendra84 gravatar image

updated 2019-02-12 14:58:51 -0500

LBerger gravatar image

hsv = cv2.cvtColor(frame,cv2.COLOR_BGR2HSV)

cv2.error: OpenCV(4.0.0-pre) /home/pi/opencv-3/modules/imgproc/src/color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

edit retag flag offensive close merge delete

Comments

problem: like most python noobs, you don't understand murphy's law.

if you use cv2.imread() you MUST check, if the output is not None, same, if you read() from a VideoCapture.

failing to do so, will make it crash in the next operation (cvtColor in your case)

berak gravatar imageberak ( 2018-08-30 00:49:46 -0500 )edit

this must have been answered a 1000 times already.

downvote for lack of any own research !

berak gravatar imageberak ( 2018-08-30 00:54:55 -0500 )edit

I tried to run the same code on two different computers, in which exactly same python and opencv version and libraries are installed. However, only one computer would make it run. ( I was importing the exactly same .avi video) so there must not be a None output issue i think.

godgear gravatar imagegodgear ( 2018-10-31 04:33:52 -0500 )edit

@godgear, python users usually don't get what a "relative path" is, they NEVER check, if their VideoCapture opened, nor if it could read a frame from that. they also NEVER check, if imread() returned anything.

thus all those (not) funny errors.

berak gravatar imageberak ( 2018-10-31 04:39:38 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-08-30 01:41:00 -0500

andylanzhiyong gravatar image

updated 2018-09-01 04:04:45 -0500

berak gravatar image

frame is None (invalid)

edit flag offensive delete link more

Comments

Thanks for responses everyone. It very helpful. Thanks :)

hendra84 gravatar imagehendra84 ( 2018-09-04 00:37:06 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-08-30 00:34:05 -0500

Seen: 13,390 times

Last updated: Sep 04 '18