OpenCV Error: Assertion failed (size.width>0 && size.height>0)

0 votes

I make one python program that stream my video using cv2 module. But sometimes it gives me the below error.

OpenCV Error: Assertion failed (size.width>0 && size.height>0)

How can I solve this error?

Apr 20 in Machine Learning by akhtar
• 11,270 points
173 views

1 answer to this question.

0 votes

Hi@akhtar,

You are getting this error, because your camera is not able to detect any face. It means when your program unable to find any face it throws an error because of null value.

To avoid this error, you can use if else condition in your python code. If it is not able to detect any face it will pass otherwise it will run your code.

Hope this will give you some idea how to avoid this error.

answered Apr 20 by MD
• 24,500 points

Related Questions In Machine Learning

+1 vote
1 answer
0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 963 views
0 votes
0 answers