I have created a model "in a project where I am trying to detect in real time â---------------------------------------------------------------------------
error Traceback (most recent call last)
c:\Users\cloud\OneDrive\Desktop\PythonLand\PoloPlus\AI\CV\Food-Detection\Biscuit-Decetion\Special_Object_Recognition\yolov8\yolo_realcv.ipynb Cell 3 line 7
68 image = infer()
69 # And display the inference results
â> 70 cv2.imshow(âimageâ, image)
72 # Print frames per second
73 print((1/(time.time()-start)), " fpsâ)
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 get an error like "{
â__comment1â: âObtain these values via Roboflowâ,
âROBOFLOW_API_KEYâ: â########â,
âROBOFLOW_MODELâ: âbiscuit_detctâ,
âROBOFLOW_SIZEâ: 416,
"__comment2": "",
"FRAMERATE": 24,
"BUFFER": 0.5"
I can not solve this error? I can send the complete code.
The error message youâre seeing is typically due to OpenCVâs imshow function not receiving a valid image. This could be because the image is not being loaded correctly or the image path is incorrect.
In the context of Roboflow, if youâre using a webcam or other video source for real-time detection, you might encounter issues if the video source is not found or not accessible. As mentioned in the Roboflow blog post, if you encounter an error like assert cap.isOpened(), f'Failed to open {s}' and AssertionError: Failed to open 0, it indicates that your camera was unable to be found. You can try reconnecting your camera or changing the source argument to detect.py. To try changing the source argument, use --source 1 with detect.py instead of --source 0.
If youâre still encountering issues, please ensure that your image or video source is correctly set up and accessible.
Hi! Iâm Roboflowâs AI powered bot. This is an automated response powered using AI with knowledge from our docs, blog, knowledge base, and previous forum responses. If you find this to be a helpful answer, please mark it as the solution using the checkbox icon below. If this doesnât solve your issue, please follow up with what youâve tried/why, and the community will continue to chime in as usual.