def main():
\nmodel = YOLO(\"yoloV8m.pt\")
webcam_id_1 = 0\n webcam_id_2 = 1\n\n cap2 = cv2.VideoCapture(1)# cv2.CAP_DSHOW\n cap = cv2.VideoCapture(0)# cv2.CAP_DSHOW\n\n thread2 = Thread(target=webcam_inference, args=(webcam_id_2, model, cap2))\n thread1 = Thread(target=webcam_inference, args=(webcam_id_1, model, cap))\n\n thread2.start()\n thread1.start()\n \n thread1.join()\n thread2.join()\n
if name == \"main\":
\nmain()
I found the solution with the help of another form, but if anyone comes by here and needs it, here's where you can read the solution: https://forum.opencv.org/t/real-time-inference-on-dual-webcams-in-parallel/14729
","upvoteCount":1,"url":"https://github.com/roboflow/notebooks/discussions/209#discussioncomment-7173598"}}}-
I have 2 webcams connected via USB to my PC which, taken individually, work perfectly, but when I go to "get" them with the py and openCV code I can never detect them together in parallel... here is the error: [ WARN:0@9.318 ] global cap_msmf.cpp:471 I also leave the code below to understand what I do but it's very simple... Py code: import cv2 def inference_webcam(webcam_id, model, cap):
def main():
if name == "main": |
Beta Was this translation helpful? Give feedback.
-
I found the solution with the help of another form, but if anyone comes by here and needs it, here's where you can read the solution: https://forum.opencv.org/t/real-time-inference-on-dual-webcams-in-parallel/14729 |
Beta Was this translation helpful? Give feedback.
I found the solution with the help of another form, but if anyone comes by here and needs it, here's where you can read the solution: https://forum.opencv.org/t/real-time-inference-on-dual-webcams-in-parallel/14729