1 Star 0 Fork 0

飞觞醉月/stereo-py-cv

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
snapshot.py 788 Bytes
一键复制 编辑 原始数据 按行查看 历史
XiXL 提交于 2019-10-30 16:17 . first version
import numpy as np
import cv2
camera = cv2.VideoCapture(1)#
ret=camera.set(3,1280)#width
ret=camera.set(4,480)#height
fps =camera.get(cv2.CAP_PROP_FPS) #获取视频帧数
print(fps)
while True:
ret, frame = camera.read()
if not ret:
break
#frame = cv2.flip(frame,0,dst=None)
imgL = frame[0:480,0:640]# 坐标:[Ly:Ry , Lx:Rx]
imgR = frame[0:480,640:1280]# 裁剪坐标为[y0:y1, x0:x1]
cv2.imshow("left", imgL)
cv2.imshow("right", imgR)
cv2.imshow('frame',frame)
key = cv2.waitKey(1)
if key == ord("q"):
break
elif key == ord("s"):
print("save")
cv2.imwrite("snapshot/left.png", imgL)
cv2.imwrite("snapshot/right.png", imgR)
camera.release()
cv2.destroyAllWindows()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/xxl1998/stereo-py-cv.git
git@gitee.com:xxl1998/stereo-py-cv.git
xxl1998
stereo-py-cv
stereo-py-cv
master

搜索帮助