Wednesday, September 9, 2009

Convert rectilinear panoramas to cubic with erect2cubic

When creating panoramatical images most programs will probably output a rectilinear or cylindrical projection as a result. Unfortunately some viewers only accept a cubic projection (6 different images of the sides of a cube).

There is a simple way how to convert a rectilinear panorama to a cubic one with use of free software. The following instructions were tested on (K)ubuntu 9.04, but should also work on other Linux distributions. Note that must be connected to the internet during these installations steps.

1) Install nona - in Ubuntu is is part of the hugin-tools package
2) Install the libgraphviz-perl package
3) Start CPAN as root: open a terminal (e.g. Konsole, xterm, Terminal) and start "sudo cpan". If it is the first time you start CPAN you will be asked whether you want to use the automatic configuration. In that case just say yes (press Enter).
4) Once in CPAN, execute the command "install Panotools::Script" (without the quotes). If you get any warnings about YAML, just ignore them.

Now we have the necessary software tools to do the conversion. Now you can do the conversion. Open a terminal and go to the directory where you rectilinear panorama file is. Suppose it is called rect.tiff then execute:

erect2cubic --erect=rect.tif --ptofile=cubic.pto

This will generate the file cubic.pto which we need to generate the 6 images of the cubic projection:

nona -v -o cubic cubic.pto

This might take some time (~few minutes). After that you will see cubic0000.tif, cubic0001.tif ... cubic0005.tif in your directory. These are the six sides of the cubic projection.

1 comment:

atomick said...

phantastic, thanks a lot!