I’m trying to get FullHD picture from two UC70 web cameras connected to a PC, however reading frame from the second camera fails with videoio(MSMF): can't grab frame. Error: -2147483638
. Checked with OpenCV 4.5.1 and 4.6.
If CAP_DSHOW is used, then the error is gone, however with DirectShow there’s just 1 FPS so it’s unusable.
If after the error I re-create the capture and set 640x480 resolution, then it works (but we need both in FullHD).
If the first capture is released before creating the second one, then it works (but we need both simultaneously).
Error still happens if second camera is opened from another process.
import cv2
def copen(index, fullhd):
cap = cv2.VideoCapture(index)
if fullhd:
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)
if not cap.isOpened():
print(f"Cannot open webcam {index}")
if not cap.read()[0]:
print(f"Cannot read webcam {index}")
return cap
cap1 = copen(0, True)
cap2 = copen(1, True)
cap1.release()
cap2.release()
Any ideas? Thanks!