Motion Anchor -- OPEN CV
DEADLINE: Before class on Sept. 30 for in-class demo.
- Use lkdemo.cpp in the samples folder of OpenCV
- Play with it. You can press the 'r' button to calculate "good feature points".
- Modify the code such that it can automatically find new "good feature points" every 10 frames.
- Define a Region of Interest (ROI) in the middle of the screen, and draw a red square to show that region. (Similar to what we've done in Assignment 1)
- Calculate the average 2d flow values inside the ROI for every frame. A 2d flow (dx,dy) is the difference between the previous point and the current point. After calcOpticalFlowPyrLK() is computed, you can get the coordinates of current points and previous points from points and points respectively. (i.e. dxi = points[i].x - points[i].x; similar for dyi)
- Visualize that average flow with a vector. You could multiply the vector length by a constant to make it visible, since some flow might be very small (remember, the flow is measured in pixels of a 1/30 sec... that's very tiny, so it might be better to show an amplified flow vector)
- Think about / implement a very simple game that can be controlled by this motion anchor.