Error in [Optical-Flow+openCV+python]

asked 2016-10-06 09:49:48 -0500

I just working on the task above as the URL below shows.

http://opencv-python-tutroals.readthe...

But everytime I try, the error massage below emerges.

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /tmp/opencv-20160915-26910-go28a5/opencv-2.4.13/modules/highgui/src/window.cpp, line 261 Traceback (most recent call last): File "lucaskanade.py", line 47, in <module> cv2.imshow('frame',img) cv2.error: /tmp/opencv-20160915-26910-go28a5/opencv-2.4.13/modules/highgui/src/window.cpp:261: error: (-215) size.width>0 && size.height>0 in function imshow

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー Could somebody tell me how to solve this problem?

edit retag flag offensive close merge delete

Comments

(unrelated, but please bear with us - due to a lot of spam, this site had to go moderated, - be patient [removed your duplicate post])

berak gravatar imageberak ( 2016-10-06 09:59:40 -0500 )edit
  • be careful with the tutrorials, they're meant to be used with opencv3
  • can it be, your img is simply empty / not loaded ? please check immediately after imread()
berak gravatar imageberak ( 2016-10-06 10:13:16 -0500 )edit

Hi berak.

Thank you for replying to me. I do have both opencv and opencv3 which have been installed via homebrew.

But currently, only the former is invalid according to doing brew search.

So how can I alter it to opencv3? I'm totally a beginner...

kazuaki gravatar imagekazuaki ( 2016-10-06 11:19:36 -0500 )edit

can it be, your img is simply empty / not loaded ? please check immediately after imread()

I did it not by my img but by my web camera. In another session, it was successful to load web camera with python+opencv.

kazuaki gravatar imagekazuaki ( 2016-10-06 11:22:47 -0500 )edit