google / marzipano

A 360° media viewer for the modern web.
http://www.marzipano.net
Apache License 2.0
1.99k stars 995 forks source link

How the yaw value is calculated? #460

Open SuhaibMaraqa opened 1 year ago

SuhaibMaraqa commented 1 year ago

I have a drone 360 images that I display with the marzipano viewer, when the yaw is 0 the image should be looking exactly to the north, but it's not the case as it might be looking the any of the four directions. So how does the yaw value get calculated in the marzipano viewer?

jordyno commented 1 year ago

Marzipano is not aware of the panorama's orientation other then yaw 0 being exactly center of the equirectangular image. That is, if you have your source image 12 000 px wide, your yaw 0 will be at pixel 6000 on the x axis. In order for this to be actual North, you need to stitich your panorama in a way, that the center of your stitched equirect image will be at the actual North.

SuhaibMaraqa commented 1 year ago

Okay I see, if I have the metadata of the image, like the drone yaw of the image coordinate. Can I calculate the north degree in Marzipano? @jordyno

jordyno commented 1 year ago

I am not aware of metadata storing the drone yaw. What drone are you using? Normally there are only GPS position and altitude available and you need to find the North yaw manually. For these calculations though you can use RectilinearView#screenToCoordinates or RectilinearView#coordinatesToScreen.

SuhaibMaraqa commented 1 year ago

I use the Mavic3, this is a snippet of the metadata I can use, GPS Position: GPS Altitude: Gimbal Yaw Degree : -172.30 Flight Yaw Degree : -162.20 can I use these values to calculate the north? I couldn't get how to use RectilinearView#screenToCoordinates or RectilinearView#coordinatesToScreen with these values

jordyno commented 1 year ago

Oh, maybe you mean the flight log, not the image metadata? The flight yaw changes by each column of images as the panorama is taken, so it's a bit tricky.