# filtering noise from a transformation matrix, vs a quaternion

I am tracking an object, with opencv, in a video stream. The returned values are noisy, so I want to filter them to smooth out the animation curve.

Currently, i have the data as an `Eigen::vector3d`

for position, and an `Eigen::Quaterniond`

for rotation.

The kalman filtering that I use only takes one value at a time, so i create an instance of the filter for position X, one for position Y, one for position Z.

that bit is easy. My question is:

Am I likely to see any weirdness if I take this same approach with a quaternion? I imagine yes, as the values will change from the filtering, and screw up the rotation.

So, am i better to:

Create a 4x4 transformation matrix from my vector3d and quaternion3d. filter each of these values. recreate my quat and vector.

or:

filter the quaternion in a different way.

or:

convert to euler, filter each axis, then convert back.

None of these options seem ideal. But which is most likely to give a decent result?

thank you!

In my opinion:

`4x4`

transformation matrix is not correct for the rotation part (the rotation matrix should keep some properties: determinant=1, etc.)Thank you. I have been trying to extend the kalman i am using to take multiple values and quats, but it is making my brain explode. If

`1`

is out, i will try`3`

. thanks again.