updates to algorithm
This commit is contained in:
41
testFPS.py
Normal file
41
testFPS.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import cv2
|
||||
import numpy as np
|
||||
from ultralytics import YOLO
|
||||
import paho.mqtt.client as mqtt
|
||||
from filterpy.kalman import UnscentedKalmanFilter as UKF
|
||||
from filterpy.kalman import MerweScaledSigmaPoints
|
||||
import time
|
||||
|
||||
width = 1280
|
||||
height = 720
|
||||
# fps = 60
|
||||
frameCount = 0
|
||||
|
||||
# Open the video file (use video file or webcam, here using webcam)
|
||||
cap = cv2.VideoCapture(0)
|
||||
|
||||
# Set the resolution and fps of the camera
|
||||
cap.set(cv2.CAP_PROP_FRAME_WIDTH, width)
|
||||
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)
|
||||
# cap.set(cv2.CAP_PROP_FPS, fps)
|
||||
print(cap.get(cv2.CAP_PROP_FPS))
|
||||
print(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
|
||||
print(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
||||
|
||||
frameTime = time.time()
|
||||
|
||||
while True:
|
||||
ret,frame = cap.read()
|
||||
if not ret:
|
||||
break
|
||||
|
||||
frameCount += 1
|
||||
|
||||
if (time.time() - frameTime) > 10:
|
||||
trueFPS = frameCount / (time.time()-frameTime)
|
||||
print(trueFPS)
|
||||
break
|
||||
|
||||
# Release the video capture object and close the display window
|
||||
cap.release()
|
||||
cv2.destroyAllWindows()
|
||||
Reference in New Issue
Block a user