Hi all! I’m looking for a solution to my problem! I am using opencv for stereo vision and want to try to get 2 parallel videos from my cameras (on UBUNTU and WIN). I am using camR and camL with cv2.VideoCapture(). But when I try to get Videoflow I can’t do it. I only receive video from 1 camera (on WIN). I was thinking about threads but read that threads don’t help in this case. But on Ubuntu I got 2 videos (but not stable). Can you help me?
import numpy as np import cv2 import torch device = torch.device('cuda') print(device) # Call the two cameras CamR= cv2.VideoCapture(1) CamL= cv2.VideoCapture(2) while True: retR, frameR= CamR.read() retL, frameL = CamR.read() grayR= cv2.cvtColor(frameR,cv2.COLOR_BGR2GRAY) # grayL = cv2.cvtColor(frameL, cv2.COLOR_BGR2GRAY) # retR, cornersR = cv2.findChessboardCorners(grayR, (4, 4), None) cv2.imshow('imgR',frameR) cv2.imshow('imgR', frameL) # print(retR) if cv2.waitKey(10) & 0xFF == ord('q'): # Push the space bar and maintan to exit this Programm break CamR.release() cv2.destroyAllWindows()
(P.S. I checked number of each cam).