
8

机器视觉+OpenCV:加载双摄像头,实现摄像头担当左右眼的双目视觉
source link: https://www.taholab.com/24114
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

机器视觉+OpenCV:加载双摄像头,实现摄像头担当左右眼的双目视觉
我制作了双目摄像头,现在在Python下使用OpenCV加载这两个摄像头,并排放置,实现双目摄像头效果:
自制硬件:
import cv2
import numpy
cv2.namedWindow("left")
cv2.namedWindow("right")
cv2.moveWindow("left", 0, 0)
cv2.moveWindow("right", 600, 0)
left_camera = cv2.VideoCapture(1) #加载左摄像头
right_camera = cv2.VideoCapture(6) #加载右摄像头
while True:
ret, left_frame = left_camera .read() #读取左摄像头
ret, right_frame = right_camera .read() #读取右摄像头
cv2.imshow("left", left_frame)
cv2.imshow("right", right_frame)
key = cv2.waitKey(1)
if key == ord('q'):
break
left_camera.release()
right_camera.release()
cv2.destroyWindow("left")
cv2.destroyWindow("right")
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK