Files
hivecore_robot_os1/cv.py

16 lines
367 B
Python
Raw Normal View History

2025-11-05 15:13:31 +08:00
import cv2
import time
cap = cv2.VideoCapture(2) # 0表示第一个摄像头
start=time.time()
while True:
ret, frame = cap.read()
if not ret: break
end=time.time()
diff=end-start
print('cap img',1/diff)
start=end
###cv2.imshow('USB Camera', frame)
if cv2.waitKey(1) == 27: break # 按ESC退出
cap.release()
cv2.destroyAllWindows()