Polar Reprojection
We can take a 360-degree panorama like this picture of the intersection of Almaden Boulevard and Park Street and turn it in to a miniature world by "reprojecting" the image.
Reprojection is a technique that has been used by cartographers for centuries. In fact, the stereographic reprojection we're using here is the reverse of what mapmakers do to make a flat map of the curved surface of the globe.
There are a number of different software tools that will make this transformation, but probably the easiest to use is called ImageMagick.
ImageMagick is free, open source software that is available for Windows, MacOS and Linux computers. It is different from most photographic and graphics software in that it is a set of command line tools.
For Windows users who are not familiar with using the command line, Victor Laurie has written an introduction to The Command Line in Windows.
MacOS users can learn more about the command line interface from Kirk McElhern's article Take Your First Steps On The MacOS Command Line.
If you're already comfortable with the command line, download the version of ImageMagick for your machine. Versions are available for Windows, MacOS, and Linux and other Unix systems.
ImageMagick contains a wide-ranging set of tools for image manipulation. We'll only scratch the surface here, but you can learn more about what ImageMagick can do on the examples pages. We're going to use two of ImageMagick's most basic commands: Convert, and Mogrify.
Convert takes a file, makes a change to it, and puts the result into a new file. Mogrify makes the changes and puts them back into the same file.
Assume for a moment that we've created a panorama file named MyPano.jpg that contains our panorama. Converting the panorama to a polar reprojection can be done with a simple one-line command in ImageMagick:
The arguments to the convert command may look mysterious, but they are really very simple:
- 360 - The first number tells the convert command to bend the picture in a full 360-degree circle.
- 0 - The next number tells convert to rotate the circular image by zero degrees (i.e. don't rotate).
- 0 - The next number tells convert to place the bottom of the picture at 0 pixels from the center of the circle.
- 800 - The final number tells convert to place the top of the picture 800 pixels from the center of the circle. this means our final image will be 1600 pixels in diameter.
If the resulting picture is a rectangle rather than a circle, you may need to put a thin white border at the top and the bottom of your panorama before you do the polar reprojection. We can add a 2 pixel border quite simply using the ImageMagick mogrify command:
