mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.
https://pannellum.org/
MIT License
4.29k stars 726 forks source link

Flatten Panorama #1065

Open priyanka931 opened 2 years ago

priyanka931 commented 2 years ago

Hi All, Is there any way to see the flat image of Panorama along with all the hotspots. My aim is to provide a feature which enables the user to see all the hotspots located on the flat image of Panorama, all at once.

mpetroff commented 2 years ago

If by "flat image," you mean an equirectangular projection, then no, nothing like that is built in. You'd have to develop such functionality yourself. Since the hot spot angles directly map to x/y coordinate in an equirectangular image, no complicated calculations are required to develop this.

priyanka931 commented 2 years ago

Can you please help me with the calculation. For an example, I have this panorama with one hotspot

Screenshot 2022-01-18 at 6 48 13 PM

Now, on a click of a button I am changing it to equirectangular projection, like the given below with the help of haov and vaov.

Screenshot 2022-01-18 at 6 48 50 PM

And to attach the hotspot on the projection, I am adding hotspot to this projection as well, but with the older pitch and yaw. I am not able to calculate the pitch and yaw according to new haov and vaov. Aim is to add the hotspots on the first image and when the projection is seen, it should include all the hotspots drawn at the correct locations with respect to the projection.

priyanka931 commented 2 years ago

Hi @mpetroff , Thank you for the quick response for the earlier query. It would be really great if you could help me out understanding the relation between (haov, vaov) and (pitch and yaw). With the changed haov and vaov, I need to find out the new pitch and yaw of the previously marked hotspots. Thanks in advance! And it's really a great library, Congratulations!

mpetroff commented 2 years ago

The haov and vaov set the image extents, while the pitch and yaw set the current view center, and the hot spot pitch and yaw set the position of the hot spot.

Changing the haov and vaov do not affect the positions of the hot spots on the sphere; it only changes how much of the sphere the image covers.

priyanka931 commented 2 years ago

Thank you @mpetroff for the deep understanding. My problem still persists, I want to transform the panorama with it's hotspots into a flattened image, with all the hotspots still rightly placed at the exact locations ( I am reattaching the desired result below ). Kindly guide me with this to achieve the desired result, thanks in advance

flattened image

!

mpetroff commented 2 years ago

The pitch and yaw of the hot spots are equivalent to latitude and longitude, so you'd position them the same way you'd position them on a map with an equirectangular projection.