I have a camera (actually: a stereo pair) moving towards a target. While doing so the target is imaged at a constant Hz rate.
From these images I would like to retrieve the motion of the cameras based on the images. The target itself is steady.
At first I tried to simply compute the relative rotation and translation between the two camera poses using cameraPose
in Matlab, however this seemed to give inconsistent solutions. (basically the signs would randomly flip for x&y and z).
Therefore I decided I want to try using optical flow via opticalFlowLK
and estimateFlow
which results in a flow field. Obviously I am not interested in the entire flow field but rather in the motion of the camera. Is there a way to derive camera motion form the flow field? If I see this correctly I am basically looking for a motion that would result in the flow field I am computing.
Or is this a stupid attempt and my first approach was actually correct and I should continue with that? I have the feeling that the optical flow approach is very computationally inefficient since I am only interested in the motion of one camera?