count the time of detected object on video on java with OpenCV
Let say I've been able to detect object for each frame on a video.
The object features are:
- The center of the object (an opencv.core.Point)
- the size of object (number of pixel area)
- an outbox (opencv.core.Rect) of the object
What I want to know is, can we count the time of object occurred by using OpenCV?
For addition, I'm using opencv.video.BackgroundSubtractorMOG2 (with learning rate=0) and Imgproc.findContours for detecting any object of each frame.
Right now I'm on my way to do that without any libraries (and that's pretty hard for me). what I will do:
- save all the objects for each frame (with List or something).
- compare all the objects from previous frame with all the object from current frame.
- Comparing based on similarity of the center point and size of the object (I think that's enough).
- If find some object that similar, increase the time of that object occurred, plus update that object's feature
- if an object (on previous frame) didn't occur on current frame, delete it.
Maybe some people will think this is related to object tracking like this, but I think that will be an overkill and make things more complicated.
Any help related to this problem will be appreciated (event though it's not from OpenCV).