OpenCV error on Training, please help. [closed]

asked 2019-06-13 12:42:33 -0600

updated 2019-06-14 03:07:57 -0600

LBerger gravatar image

Hello all;

I am trying to install Facial Recognition on my Magic Mirror. I am a total newbie so it is a challenge, however I am doing ok so far. However, I am at the point where Open CV is compiled and installed and I am trying to train it to recognize faces. When I run python tools.train.py I get the following error message. I have been stuck on this for a couple of days now and there is nothing helpful on the 'net. Please help!

    OpenCV Error: Assertion failed (ssize.width > 0 && ssize.height > 0) in resize, file /home/pi/opencv-3.3.0/modules/imgproc/src/imgwarp.cpp, line 3483
Traceback (most recent call last):
  File "tools.train.py", line 14, in <module>
    ToolsTrain().train()
  File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/tools/train.py", line 53, in train
    faces.append(self.prepareImage(filename))
  File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/tools/train.py", line 29, in prepareImage
    return self.face.resize(cv2.imread(filename, cv2.IMREAD_GRAYSCALE),ToolsConfig.FACE_WIDTH, ToolsConfig.FACE_HEIGHT)
  File "/home/pi/MagicMirror/modules/MMM-Facial-Recognition-OCV3/lib/common/face.py", line 113, in resize
    return cv2.resize(image, (face_width, face_height), interpolation=cv2.INTER_LANCZOS4)
cv2.error: /home/pi/opencv-3.3.0/modules/imgproc/src/imgwarp.cpp:3483: error: (-215) ssize.width > 0 && ssize.height > 0 in function resize
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-21 03:55:40.305326

Comments

unikely, that anyone will download and debug a 3rdparty repo for you here ;(

but the error is quite clear:

imread() may silently fail, and return an empty image, andyou fail to check that before processing further.

in other words -- an image was not loaded.

berak gravatar imageberak ( 2019-06-13 23:58:48 -0600 )edit