How to get the FPS
moooises opened this issue · 1 comments
Hi,
At the moment I'm working with a Jetson Nano and I would like to test which tracker works better in the board.
Knowing the FPS would get me an idea of how each tracker works, but I'm not sure how to calculate it.
I have seem some pages explaining how to do it, but I get different results using them.
I recently used the method of this page and the results are credible, but I'm not sure if they are correct. And other methods that use the time to process each frame to get the fps, like this, don't return the same results. So, I'm kind of lost here.
I would really apreciate if you can share your methods to calculate the fps.
The method that got me the most credible results is something like this:
cap = cv.VideoCapture(videofilepath)
num_frames=50 #the frequency of the capture video
while True:
ret, frame = cap.read()
toc=cv.getTickCount()
# process the frame
tic=cv.getTickCount()-toc
fps=num_frames/tic
I think I have figured it out. I was simplier than I thought.
You process one frame at each time, so just get the frequency of the time it takes to process one frame.
fps=1/(time_to_process_that_frame_in_seconds)