- Project type: Object detection
- Platform: Windows 11, Chrome
- Query: I am trying an example infer-symple.py from Python Webcam Inference Examples. I get following error while running the script
Traceback (most recent call last):
File "C:\Users\timothym\mycode\infer-simple.py", 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'
and also the following error in infer-async.py
C:\Users\timothym\mycode>python infer-async.py
8.998451022711182 fps
1.684585950832452 fps
24.63441049676381 fps
19.16966713741836 fps
26.83787744028461 fps
11.41860275180904 fps
24.94204398139889 fps
14.829141358072706 fps
29.586732786411122 fps
24.7675128582142 fps
19.801078263825286 fps
14.724295784536748 fps
Traceback (most recent call last):
File "C:\Users\timothym\mycode\infer-async.py", line 92, in main
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'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\timothym\mycode\infer-async.py", line 95, in <module>
asyncio.run(main())
File "C:\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "C:\Users\timothym\mycode\infer-async.py", line 68, in main
async with httpx.AsyncClient() as requests:
File "C:\Users\timothym\AppData\Roaming\Python\Python310\site-packages\httpx\_client.py", line 2006, in __aexit__
await proxy.__aexit__(exc_type, exc_value, traceback)
File "C:\Users\timothym\AppData\Roaming\Python\Python310\site-packages\httpx\_transports\default.py", line 332, in __aexit__
await self._pool.__aexit__(exc_type, exc_value, traceback)
File "C:\Users\timothym\AppData\Roaming\Python\Python310\site-packages\httpcore\_async\connection_pool.py", line 326, in __aexit__
await self.aclose()
File "C:\Users\timothym\AppData\Roaming\Python\Python310\site-packages\httpcore\_async\connection_pool.py", line 312, in aclose
raise RuntimeError(
RuntimeError: The connection pool was closed while 11 HTTP requests/responses were still in-flight.
Can someone please help resolve this.