SK-Hardwired / xavc_rtmd2srt

Extract real time meta-data and GPS tracks from Sony XAVC video
38 stars 7 forks source link

Gyro and Acc Units #7

Open gabrielecoppi opened 3 years ago

gabrielecoppi commented 3 years ago

I am trying to extract raw gyro and accelerometer data to estimate the yaw pitch and roll angles using probably a Kalman filter. I was wondering what are the units of the data coming out for the RX0M2 and if you have some sort of reference for it

Thanks

SK-Hardwired commented 3 years ago

Hi! The most easy one is accelerometer: It is measured in 1/1000th of G. So idle standyng camera should have around 9800 units at one of axes (Z by default).

Gyroscope measures the rotational speed at the moment. I don't remember right now. But you may try yourself - just record short footage when you flip camera 90 degrees and see how rotational speed will change and then stop. You will need to do some calculations (take integral) to get actual angle

mungewell commented 3 years ago

If you have a turn table, you can position the camera in one of three orientations and record a short section of video for each. You need to figure out which are roll, pitch and yaw axis and their signs.

It would be highly beneficial to know the if the data is time stamped, rather than process with just a crude sample rate.

For actually computing the AHRS from the data, I've used this code in the past: https://github.com/morgil/madgwick_py https://github.com/KieranWynn/pyquaternion

dpredie commented 3 years ago

Any tips on how to use the gyro data to stabilize outside catalyst?

mungewell commented 3 years ago

Firstly you'd need to integrate/process the data to form a model of the camera's motion, if you want some really nasty Python code example here's my attempts... but likely much better stuff elsewhere. https://github.com/mungewell/pyPSVR/blob/master/example4_vridge_sensors/vridge_psvr.py#L209

Then I suspect that you'd want to process that to find intentional motion vs jitters... since you are post processing you can search forwards and backwards through the data.

Finally you'd want to do the image re-projections, based on the focal length of the lens and the estimated movements.

tomstom commented 2 years ago

To stabilize I recommand https://github.com/ElvinC/gyroflow , everything is already done there. You have only to convert the gyro data into something that GyroFlow understands. Based on the gyro data of a ZV1 I wrote this: https://www.dropbox.com/s/6wt0p6rlzyznb2g/ConvertSonyBF.7z?dl=0 Maybe you have to change the scaling for your cam in my script.

mungewell commented 2 years ago

@tomstom Awesome recommendation... it looks like that project has moved on a little and has moved to: https://github.com/gyroflow/gyroflow

They specifically state the Sony cams are supported!!

Sony (a1, a7c, a7r IV, a7 IV, a7s III, a9 II, FX3, FX6, RX0 II, RX100 VII, ZV1, ZV-E10)