Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You are able to detect people in a frame using HOG features. In order to compute how long a person was present in a video, we need to know the first and last frames of their presence in the video and the video's frame rate.

timeOfStay = (lastFrame - firstFrame) / frameRate

If you would like to record time of stay for each person, detection is not enough. We need to able to track them. Since there is no intersection of trajectories, a simple Kalman filter would suffice. Here is a good example: http://www.morethantechnical.com/2011/06/17/simple-kalman-filter-for-tracking-using-opencv-2-2-w-code/

You get the first frame of detection from initializing a kalman filter and last frame when you lose track of the person of interest. OpenCV provides both frame number and frame rate and hopefully this helps with your problem.

You are able to detect people in a frame using HOG features. In order to compute how long a person was present in a video, we need to know the first and last frames of their presence in the video and the video's frame rate.

timeOfStay = (lastFrame - firstFrame) / frameRate

If you would like to record time of stay for each person, detection is not enough. We need to able to track them. Since there is no intersection of trajectories, a simple Kalman filter would suffice. Here is a good example: http://www.morethantechnical.com/2011/06/17/simple-kalman-filter-for-tracking-using-opencv-2-2-w-code/

You get the first frame of detection from initializing a kalman filter and last frame when you lose track of the person of interest. OpenCV provides both frame number and frame rate and hopefully this helps with your problem.

Edit: Including information on kalman filter and object tracking HOG provides detections in a given frame. A video has multiple frames and we now have all these different detections in each of these frames. If we expect to see only one person, then just the occurrence of that person (HOG detection) is enough to identify which of the frames that person was present. In this case, we have multiple entities. We need to associate detections in each frame with detections in the previous frame and account for addition or deletion of entities.

Here are some good tutorials on kalman filter and object tracking: http://www.mathworks.com/help/vision/examples/using-kalman-filter-for-object-tracking.html?s_tid=gn_loc_drop https://www.youtube.com/watch?v=FkCT_LV9Syk https://www.youtube.com/watch?v=NT7nYv9Ri2Y https://www.youtube.com/watch?v=rUgKnoiRoY0

There is some C++ and OpenCV code here: https://github.com/Smorodov/Multitarget-tracker

You are able to detect people in a frame using HOG features. In order to compute how long a person was present in a video, we need to know the first and last frames of their presence in the video and the video's frame rate.

timeOfStay = (lastFrame - firstFrame) / frameRate

If you would like to record time of stay for each person, detection is not enough. We need to able to track them. Since there is no intersection of trajectories, a simple Kalman filter would suffice. Here is a good example: http://www.morethantechnical.com/2011/06/17/simple-kalman-filter-for-tracking-using-opencv-2-2-w-code/

You get the first frame of detection from initializing a kalman filter and last frame when you lose track of the person of interest. OpenCV provides both frame number and frame rate and hopefully this helps with your problem.

Edit: Edit: Including information on kalman filter and object tracking tracking

HOG provides detections in a given frame. A video has multiple frames and we now have all these different detections in each of these frames. If we expect to see only one person, then just the occurrence of that person (HOG detection) is enough to identify which of the frames that person was present. In this case, we have multiple entities. We need to associate detections in each frame with detections in the previous frame and account for addition or deletion of entities.

Here are some good tutorials on kalman filter and object tracking: http://www.mathworks.com/help/vision/examples/using-kalman-filter-for-object-tracking.html?s_tid=gn_loc_drop https://www.youtube.com/watch?v=FkCT_LV9Syk https://www.youtube.com/watch?v=NT7nYv9Ri2Y https://www.youtube.com/watch?v=rUgKnoiRoY0

There is some C++ and OpenCV code here: https://github.com/Smorodov/Multitarget-tracker