I've been working on a code from the Roboflow team that is suppose to display a live video capture and give it's predictions from the model that I trained, but I encounter an error.
Get webcam interface via opencv-python
video = cv2.VideoCapture(0)
Get the current image from the webcam
ret, img = video.read()
// Synchronously get a prediction from the Roboflow Infer API
image = infer()
// And display the inference results
cv2.imshow('image', image)
However I got this error :
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'
I've seen online saying that my image file location is wrong and that's why I get this error, but I'm confused as it is suppose to be showing a live camera constantly instead of just a still image.
I'm new to programming any help would be appreciated, thanks.