OpenCV Kalman Filter used for position/orientation tracking: wrong results

asked 2015-12-21 22:12:18 -0600

saihv gravatar image

updated 2015-12-21 22:13:44 -0600

Hi, I am following the Kalman Filter tutorial mentioned in the Real time pose estimation tutorial on OpenCV 2.4.11, but in my case, it is the camera that moves with respect to a certain origin in the world.

When I solve the iterative PNP problem for my scene, I get R and T matrices that looks quite good in terms of accuracy. But when I pass them on to the Kalman Filter (transition and measurement matrices were used as mentioned in the tutorial), the prediction matrix comes out to be all zeros, and the corrected R matrix is very close to the input R matrix, and the corrected T matrix almost in all cases looks something like this.

[4.7072399e+35; -0.33483902; -5.4207187e-33]

Whereas the input T from PNP is

[-196.0274563197073; 2.626786046055864; 0.9834547400622746]

Am I missing some sort of change I need to make from the tutorial? Because it is still a pose estimation problem, I figured I did not have to change much code-wise: although my process noise and measurement noise would be different, I just wanted to test for some initial idea of how the KF is working. Any suggestions/pointers would be very helpful.

edit retag flag offensive close merge delete

Comments

So, you have your camera pose matrix with solvePnP. You extracted the translation part and compute the euler angles directly from the camera pose matrix or did you make some transformation on the camera pose matrix before ?

Eduardo gravatar imageEduardo ( 2015-12-22 12:18:53 -0600 )edit

There's no transformation after the solvePnP: I use the T matrix directly and R converted to Euler angles. But my case is slightly different from the classic solvePnP: Neither the camera nor the object is really the origin, I am "localizing" this camera with respect to another main camera (that's the origin) in the scene.

saihv gravatar imagesaihv ( 2015-12-22 15:34:27 -0600 )edit

did anyone find the solution to this issue? I am facing the exact same problem...

ritviker gravatar imageritviker ( 2019-01-22 05:27:55 -0600 )edit

what is your OpenCV version

sturkmen gravatar imagesturkmen ( 2019-01-22 05:58:59 -0600 )edit

My OpenCV version is 3.2.0

ritviker gravatar imageritviker ( 2019-01-22 06:27:52 -0600 )edit