Mostafiz
Mostafiz

Reputation: 1687

How to compensate 'Ego-Motion'

I am doing a project to detect moving object from a moving camera with optical flow. To detect the real motion of any moving object I need compensate the ego-motion of the camera. Can any body suggest a simple way to do so? I use opencv c and c++ for my project.

Upvotes: 6

Views: 3676

Answers (1)

Tobias Senst
Tobias Senst

Reputation: 2830

Hi actually if you use optical flow you not ecessarily need to compensate the ego-motion. It is possible to create long term trajectories and cluster them. Look at these publications LDOF or MORLOF. But if you want to copensate the ego-motion than:

  • detect points to track using GFT or simple a point grid
  • compute motion vector via Lucas Kanade or other local optical flow methods
  • compute the affine or perspective transformation matrix using cv::getAffineTransform or cv::getPerspectiveTransform (RANSAC is a good estimator)
  • compensate ego-motion with the transformation matrix by using cv::warpAffine or cv::warpPerspective

Upvotes: 4

Related Questions