c++opencvgeometrypanorama-control

How to create views from a 360 degree panorama. (like street view)


Given a sphere like this one from google streetview. enter image description here

If i wanted to create 4 views, front view, left view, right view and back view, how do i do the transformations needed to straiten the image out like if i was viewing it in google streetview. Notice the green line i drawed in, in the raw image its bended, but in street view its strait. How can i do this?

enter image description here


Solution

  • The streetview image is a spherical map. The way streetview and Google Earth work is by rendering the scene as if you were standing at the center of a giant sphere This sphere is textured with an image like in your question. The longitude on the sphere corresponds to the x coordinate on the texture and the latitude with the y coordinate. A way to create the pictures you need would be to render the texture as a sphere like Google Earth does and then taking a screenshot of all the sides. A way to do it purely mathematical is to envision yourself at the center of a cube and a sphere at the same time. The images you are looking for are the sides of the cube. If you want to know how a specific pixel in the cube map relates to a pixel in the spherical map, make a vector that points from the center of the cube to that pixel, and then see where that same vector points to on the sphere (latitude & longitude). I'm sure if you search the web for spherical map cube map conversion you will be able to find more examples and implementations. Good luck!