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

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.

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 ?

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.

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

what is your OpenCV version

My OpenCV version is 3.2.0