Python Webcam Inference Examples not working

I am trying example and I am getting following error:

Traceback (most recent call last):
  File "C:\Users\timothym\mycode\", line 70, in <module>
    cv2.imshow('image', image)
cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:967: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'

what is the problem.

I just found the solution from this thread. I just specified model-name and model-version in the JSON file and it worked.

"ROBOFLOW_MODEL": "my-model/2",

1 Like


There’s another Roboflow GitHub repo with example code for this too:

  1. roboflow-computer-vision-utilities/ at main · roboflow-ai/roboflow-computer-vision-utilities · GitHub
  2. config file: roboflow-computer-vision-utilities/roboflow_config.json at main · roboflow-ai/roboflow-computer-vision-utilities · GitHub
1 Like