5

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

user1118321
  • 25,567
  • 4
  • 55
  • 86
Poul K. Sørensen
  • 16,950
  • 21
  • 126
  • 283
  • You should draw out a top-down diagram of the relationship between a straight-line in the real world, and the field-of-view of the panorama. Some relatively simple geometry will give you this in mathematical form. – Oliver Charlesworth Mar 28 '12 at 21:40
  • You also might be very interested in looking into [image stitching](http://stackoverflow.com/a/9035758/176769). – karlphillip Mar 28 '12 at 22:28
  • I dont need image stitching? I have the full panorama already. @OliCharlesworth are you saying i cant do this automatic? How does streetview do it then? Looking at data requested from google, it fetches something they call a pano_map and a depth_map. – Poul K. Sørensen Mar 28 '12 at 23:29
  • You can do it automatically, using some basic geometry. – Oliver Charlesworth Mar 28 '12 at 23:30
  • I think i need some resources and examples for implementing this. – Poul K. Sørensen Mar 28 '12 at 23:47
  • There's one work that comes to mind: [panorama stitching](http://blog.blackhc.net/2010/07/panorama-stitching/), and it shares source code. – karlphillip Mar 29 '12 at 12:29
  • Great with some code @karlphillip , but i am not sure i understand the need of panorama stiching, the data i have in the first image is already stitched together. Care to explain it further. – Poul K. Sørensen Mar 30 '12 at 14:58

1 Answers1

3

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!

Paul Wagener
  • 432
  • 6
  • 12
  • Thanks Paul, guess you saw my mail :) – Poul K. Sørensen Mar 30 '12 at 14:49
  • Does it make sense without knowing anything about the depth of the scene ? I would need to know the size of the sphere to map the data properly? – Poul K. Sørensen Mar 30 '12 at 14:55
  • No depth information is needed, you can use any non-zero size for the cube and the sphere. All that matters is that the 'camera' is in the exact center of it. Google Earth nicely demonstrates this. From the outside you can actually see the sphere that the streetview image is projected on. – Paul Wagener Apr 07 '12 at 22:34