Track numbered markers in a video

前端 未结 1 928
执念已碎
执念已碎 2021-01-24 03:49

I have a video which has frames as shown in my previous image in this question.

How do we detect points from a picture with a particular color on those points

I

相关标签:
1条回答
  • 2021-01-24 04:32

    My problem is as follows. After I have detected markers in one frame I need to detect them in another frame and find out how much the marker has moved from its previous location. However on using my code again on the second frame I sometimes in some frames get a different numbering among markers and hence I am not able to track markers from one image to another. Also detecting the markers in each image becomes a cumbersome task and takes a lot of time for a video which has around 200 frames.

    How can I track these markers over images so as to know how much a particular marker has moved between frames or simply how can I number these markers such that the numbering never changes viz, the marker numbered 60 remains marker number 60 from frame 1 to frame 200.

    Maybe consider using optical flow technique - http://robotics.stanford.edu/~dstavens/cs223b/ ?

    Alternatively try to divide your points cloud into smaller parts and than detect contours. You can divide it using lines or by using this simple idea (not tested or analysed):

    1. Find convex hull of all points (http://en.wikipedia.org/wiki/Convex_hull_algorithms) from your point cloud.
    2. Points which are on the border are in one group.
    3. After processing points from group from point 2, delete them.
    4. Go to point 1.

    As a side question is there a way to actually decrease the processing time such that I don't have to detect the face and eyes in each and every frame

    There are few easy things you can do to decrease processing time:

    • Don't load haar cascade during processing each frame - load it only once, before starting getting frames from camera/video file.
    • if need to find only one face in each frame, use CV_HAAR_FIND_BIGGEST_OBJECT flag - searching will return only one (the biggest) object. It should be much faster, because search will start from the biggest window and additionally when haar detector find one object it will abort searching and return this object.
    • play with parameters and check different cascades
    • once you find face in frame number n than in frame number n+1 don't perform search in whole frame - expand rectangle in which you found face in n frame and search only in this expanded rectangle. How much you should expand it? It depends on how fast user can move his head ;) 50% is big tolerance, but also it's slow. The best option is to find this value on your own.
    • if your image won't change very much you can skip detecting face in most of frames and just assume that it's in the same place as in previous frame - just check whether frame has changed much. The simplest method is Motion detection using OpenCV (as the author mentioned - it's good idea to use binary threshold on the result of subtraction to ignore changes occurring because of noise). I've used this method in my BSc thesis (Eyetracking system) and it worked very well and improved speed of whole system. Note - it's good idea to force normal (using haar cascade) search from time to time (i've decided to do this once per each 3 frames, but you can try with searching less often) - it will allow you to avoid situation in which used has moved outside camera area and the system didn't noticed it.
    0 讨论(0)
提交回复
热议问题