Ole*_*sii 2 python camera opencv frame-rate
我的 FPB 低 ~5,我在不同的相机 logitech c270 和 logitech 9000 上检查了此代码,情况相同。
我完成了有关关闭右灯等的所有提示。
import urllib.request as urllib
import cv2
import numpy as np
import time
while True:
# Use urllib to get the image and convert into a cv2 usable format
cap = cv2.VideoCapture(0)
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
hiegh = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
ret, frame = cap.read()
# put the image on screen
cv2.imshow('Webcam', frame)
if cv2.waitKey(1) & 0xFF == 27:
break
cap.release()
cv2.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud)
我应该怎么做才能提高 FPS?
You need to move this line up, outside your acquisition loop:
cap = cv2.VideoCapture(0)
Run Code Online (Sandbox Code Playgroud)
It does a one-time only initialisation.
| 归档时间: |
|
| 查看次数: |
3096 次 |
| 最近记录: |