1
0
Fork 0
RobotKernal-UESTC/Code/RK3588 Develop/stereo_yolo/catpure_photo.py

24 lines
655 B
Python
Raw Normal View History

2024-06-04 16:44:33 +08:00
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
i = 0
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
# # cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 680)
while(cap.isOpened()):
ret, frame = cap.read()
# height, width, channels = frame.shape
# print(f"Image size: {width} x {height}")
if ret==True:
left = frame[:,0:640]
right = frame[:,640:1280]
#cv2.nameswindow(0)
cv2.imshow('frame', frame)
if cv2.waitKey(10) == ord('q'):
cv2.imwrite("D:\code\python\l\l_" + str(i) + ".jpg",left)
cv2.imwrite("D:\code\python\s\s_" + str(i) + ".jpg",right)
i = i +1
else:
break