Jump to content
Sign in to follow this  
Goolge

How do I `cv2.read()` two webcams at the same time?

Recommended Posts

Two webcams were connected in the tinker edge.

`cv2.open()` works well for two webcams, but only one webcam can be read.

How do I `cv2.read()` two webcams at the same time?

Share this post


Link to post
Share on other sites

@tooz 

Is there any other way to read two webcams in one code?

I'm using Tinker Edge R. This device cannot read more than one webcam.

Edited by Goolge

Share this post


Link to post
Share on other sites

hello @Goolge,

try this .py:

https://www.asuswebstorage.com/navigate/a/#/s/845A267A0B6E4346BF90E84D32F8A8C84

--

import cv2

def main():
    cap = cv2.VideoCapture('/dev/video10', cv2.CAP_V4L2)
    cap1 = cv2.VideoCapture('/dev/video12', cv2.CAP_V4L2)

    while(True):
        ret, frame = cap.read()
        ret, frame1 = cap1.read()
        cv2.imshow('Camera 1', frame)
        cv2.imshow('Camera 2', frame1)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            exit = True
            break

    cap.release()
    cv2.destroyAllWindows()

if __name__ == '__main__':
    main()

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...