Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Vive Pro的两个前置摄像头和Python中的OpenCV_Python_Opencv_Computer Vision_Cv2_Htc Vive - Fatal编程技术网

使用Vive Pro的两个前置摄像头和Python中的OpenCV

使用Vive Pro的两个前置摄像头和Python中的OpenCV,python,opencv,computer-vision,cv2,htc-vive,Python,Opencv,Computer Vision,Cv2,Htc Vive,我试图使用HTC Vive Pro前面的两个摄像头,以便使用立体视觉实现SLAM。我更愿意使用Python实现这一点,但是,我找不到打开两个摄像头的好方法(我只能使用cv2.VideoCapture(1))打开正确的摄像头)。该设备目前仅通过usb连接 到目前为止,我得到的是 import cv2 cv2.namedWindow("Camera 1") cv2.namedWindow("Camera 2") stereo = cv2.VideoCapture(1) if stereo.is

我试图使用HTC Vive Pro前面的两个摄像头,以便使用立体视觉实现SLAM。我更愿意使用Python实现这一点,但是,我找不到打开两个摄像头的好方法(我只能使用
cv2.VideoCapture(1)
)打开正确的摄像头)。该设备目前仅通过usb连接

到目前为止,我得到的是

import cv2

cv2.namedWindow("Camera 1")
cv2.namedWindow("Camera 2")

stereo = cv2.VideoCapture(1)

if stereo.isOpened():
    rval, frame = stereo.read()
else:
    rval = False

while rval:
    rval_left, left = stereo.retrieve(0)
    rval_right, right = stereo.retrieve(1)
    cv2.imshow("Camera 1", left)
    cv2.imshow("Camera 2", right)
    key = cv2.waitKey(20)
    if key == 27: 
        # exit on ESC
        break

cv2.destroyAllWindows()
但是
立体声
并不像预期的那样是真正的立体声
cv2.VideoCapture(0)
是笔记本电脑网络摄像头,所有其他
cv2.VideoCapture(…)
不返回任何内容。我希望有人能帮忙。

你查过了吗