mapillary / OpenSfM

Open source Structure-from-Motion pipeline
https://www.opensfm.org/
BSD 2-Clause "Simplified" License
3.3k stars 848 forks source link

computed_rotation from OpenSFM in street view images? #1006

Open krishbhk opened 1 year ago

krishbhk commented 1 year ago

"computed_rotation": [ 1.5361960317811, -0.57250186595465, 0.54694338796389 ]

I saw in openstreetmap when we load the streetview images, theres is a field in response 'computed_rotation' which is coming from the OpenSFM. It seems it's reading the quaternion values present in camera Orientation and converting it into rotation vector, but it's not coming up correctly. Can someone explain how it's being calculated?

fabianschenk commented 1 year ago

Hi @krishbhk ,

What do you mean not coming up correctly? Can you provide an example with quaternion, the expected rotation and the computed rotation?

In case you do your own computations, make sure to apply the weight of the quaternion correctly. Sometimes it's at position 0, sometimes at position 3.

krishbhk commented 1 year ago

Hi @fabianschenk

So, got this data from a GoPro image 'GRAV': '-0.4097, 0.9118, -0.0274', 'IORI': '1.0000, 0.0000, 0.0000, 0.0000', 'CORI': '0.3888, -0.0908, 0.8825, 0.2483', 'SHFX': '0.7278', 'SHFY': '1.9069', 'SHFZ': '2.0786', 'ANGX': '5.6211', 'ANGY': '7.2492', 'ANGZ': '19.3791', I was trying to to calculate the computed_rotation value. I could be wrong, but it seems computed_rotation value is based on camera orientation (cori). I have trouble understanding how its converted to rotation_vector for the computed_rotation

fabianschenk commented 1 year ago

Hi @krishbhk ,

I don't know how the value is computed but it can easily be in another reference system, so not at all matching the one from the image.

Don't have time to look into this any further. Good luck, Fabian

krishbhk commented 1 year ago

I was following mapillaryJS API, where the representation system was mentioned

image