opencv-dnn-demo icon indicating copy to clipboard operation
opencv-dnn-demo copied to clipboard

(-215:Assertion failed) !ssize.empty() in function 'resize'

Open cognitiveRobot opened this issue 6 years ago • 13 comments

Hi Fabito, Thank you for your code. I am trying to run webcam.py file. But, I get the following error

**Traceback (most recent call last): File "/usr/local/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/local/lib/python3.6/multiprocessing/process.py", line 93, in run self._target(*self._args, *self._kwargs) File "/usr/local/lib/python3.6/multiprocessing/pool.py", line 103, in worker initializer(initargs) File "mainWebCam.py", line 70, in worker frm = detect_objects(frm, net, min_confidence) File "mainWebCam.py", line 36, in detect_objects blob = cv.dnn.blobFromImage(frame, inScaleFactor, (inWidth, inHeight), (0, 0, 0), True, False) cv2.error: OpenCV(3.4.2) /io/opencv/modules/imgproc/src/resize.cpp:4044: error: (-215:Assertion failed) !ssize.empty() in function 'resize'

output of pip list $ pip list Package Version


imutils 0.4.6
mtcnn 0.0.7
numpy 1.14.5
opencv-contrib-python 3.4.2.16 pip 18.0
setuptools 28.8.0
utils 0.9.0

Can you please help?

Regards Hossain

cognitiveRobot avatar Jul 23 '18 10:07 cognitiveRobot

Thanks. It's been fix. it was not getting the frame from the camera.

cognitiveRobot avatar Jul 24 '18 05:07 cognitiveRobot

@cognitiveRobot how did you fix it?

dscha09 avatar Oct 11 '18 07:10 dscha09

@chaine09 sorry I forgot. I will check and let you know asap.

cognitiveRobot avatar Oct 12 '18 00:10 cognitiveRobot

@chaine09, Sorry again. I lost the old project and couldn't reproduce the error from the new code.

cognitiveRobot avatar Oct 13 '18 03:10 cognitiveRobot

Hello @cognitiveRobot, can you remember if you fixed any line of code or downloaded any package?

dscha09 avatar Oct 22 '18 01:10 dscha09

Hey try to check if the file is not 0 bytes... A 0 bytes image caused that error for me.

mmargegaj avatar Nov 20 '18 09:11 mmargegaj

i had the same problem, it cause by some coordinate value is less than zero

daxingshen avatar Dec 10 '18 10:12 daxingshen

i had the same problem, it caused by no frame or image ,try printing the length

TheMrCoder avatar Dec 26 '18 11:12 TheMrCoder

@TheMrCoder I agree, I encountered the same issue with invalid image file.

GayatriPurandharT avatar Apr 11 '19 09:04 GayatriPurandharT

I guess the error is due to invalid image file or file not found. Make sure you are referencing the file correctly and image is not broken.

annu205v avatar Apr 22 '19 17:04 annu205v

The real error is due to the camera connecting, you just need to connect your camera then the error will disappear.

GhassanAlSumaidaee avatar Jul 22 '19 23:07 GhassanAlSumaidaee

It's strange.. its no problem runing in vscode but terminal,i dont know how to fix it :(

LordonCN avatar Aug 22 '19 02:08 LordonCN

I try to uninstall torch1.2.0 and found that another torch1.1 still existed.

LordonCN avatar Aug 28 '19 00:08 LordonCN