我的 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()
我应该怎么做才能提高 FPS?
最佳答案
您需要将这条线向上移动,在您的获取循环之外:
cap = cv2.VideoCapture(0)
它只进行一次性初始化。
关于python - 通过使用 cv2.VideoCapture 降低 fps,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54249824/