How do you remove jitter from input.gyroscope.attitude?

I have my camera rotation equal to input.gyroscope.attitude in each update. The idea is that the phone orientation is used to orient the game camera like in the real world. The problem is that the camera is way too jittery with this code and needs to be smooth.

I tried doing something like:

Quaternion.Slerp(transform.rotation, new Quaternion(-Input.gyro.attitude.x,-Input.gyro.attitude.y,
Input.gyro.attitude.z, Input.gyro.attitude.w), Time.deltaTime * smooth);

But this is still pretty jittery no matter what variable I put as smooth.

What can I do to smooth things out?

My problem was not the Gyroscope but instead the large numbers used as position coordinates for the camera. In other words, my camera was at something like x:7000000 y:4000000 and this doesn’t work accurately in the Unity Engine. It resulted in a lot of jitter.

If you end up on my question and you don’t use large numbers for your position, then slerp, averages, filters are all valid methods of reducing the jitter.