Telraam / Telraam-RPi

The scripts that run on the Telraam Raspberry Pi computers, responsible for connecting to the local wifi, traffic monitoring and communicating with the central Telraam servers.
128 stars 19 forks source link

Bug in background_calculation? #13

Closed dvanderfaeillie closed 3 years ago

dvanderfaeillie commented 4 years ago

The service telraam_monitoring crashed and the following was logged:

Jan  3 10:53:00 telraam python3[5253]: Traceback (most recent call last):
Jan  3 10:53:00 telraam python3[5253]:   File "/home/pi/Telraam/Scripts/telraam_monitoring.py", line 654, in <module>
Jan  3 10:53:00 telraam python3[5253]:     background = background_calculation()
Jan  3 10:53:00 telraam python3[5253]:   File "/home/pi/Telraam/Scripts/telraam_monitoring.py", line 217, in background_calculation
Jan  3 10:53:00 telraam python3[5253]:     frame_small = cv2.resize(frame, (X_RESIZED, Y_RESIZED), interpolation=cv2.INTER_LINEAR)
Jan  3 10:53:00 telraam python3[5253]: cv2.error: OpenCV(3.4.3) /home/pi/opencv-3.4.3/modules/imgproc/src/resize.cpp:4044: error: (-215:Assertion failed) !ssize.empty() in function 'resize'
Telraam commented 4 years ago

Thank you for the report. Indeed we have encountered this once or twice while testing, the error simply means that while the camera did not actually manage to capture an image (for an unknown reason -> making the debugging difficult), the script still tries to process the (non-existent) image. We will look into this and either try to find out what circumstances can result in a failed image capture, or wrap this command in a try/except check, and loop back to a new capture in case the resizing fails.

dvanderfaeillie commented 4 years ago

Agreed, failure to capture an image (even for unknown reasons) shouldn't result in a crash of the service. Catching it would be an improvement.