I am working on some Machine Learning project where I have tracked people with Kalman Filter tracker. I want to calculate that how much time each person is there in the video.
I tried using the following logic : Suppose the person is present in the 5 frames and the video FPS is 15, then we can say that the person is (5*15) for 75 seconds in the video.
Note:- I have assumed & hard coded the FPS value in the code. I didn't find any way to get the FPS because I am passing frames of video for tracking.
But the problem is if I hard code the FPS value, so whenever the FPS changes (which I don't know when), I have to change in code, otherwise it will give wrong result.
My suggestion is to calculated elapsed time for processing each captured frame and maintaining an accumulator to calculate the on-screen time for each person detected. The frame rate depends on the amount of processing you do, for this type of projects.