Copyright © Fred Weinhaus My scripts are available free of charge for non-commercial (non-profit) use, ONLY. For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net. If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment. Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php Please read the Pointers For Use on my home page to properly install and customize my scripts. |
Transforms 6 cube face images into a spherical panorama image. |
last modified: December 15, 2018
USAGE: cube2sphericalpano [-d dimensions] [-t tilesize] [-b bgcolor ] [-i interpolation]
infile1 infile2 infile3 infile4 infile5 infile6 outfile
-d ... dimensions ...... dimensions of the output panorama; WxH; integers>0; PURPOSE: To transform 6 cube face images into a spherical panorama image. DESCRIPTION: CUBE2SPHERICALPANO transforms either 1) six cube face images in order of left, front, right, back, over, under into a spherical panorama or 2) one montage of the six cube face images into a spherical panorama. The over and under images must be as if facing forward and turning up and down, respectively. If not in that orientation, then you must rotate them 90, 180, 270 as needed to orient them as needed. ARGUMENTS: -d dimensions ... DIMENSIONS of the output panorama as WxH. Values are integers>0. The default=1000x500. -t tilesize ... TILESIZE is the size of the square face tile in the optional single montage input image. The default will be computed from the montage input image dimensions as tile_width=montage_width/4 and tile_height=montage_height/3. This is provided only to override erroneous rounding of any fractional pixel dimensions computed from the montage image. -b bgcolor ... BGCOLOR is the background color for virtual pixels. Any valid IM color is allowed. The default=black. -i interpolation ... INTEPOLATION method. Any valid IM interpolation method is allowed. The default=bilinear. NOTE: This script will be slow due to the use of -fx. On my dual core INTEL Mac mini with 2.8 GHz processor and OSX Sierra, it takes 1 min 40 sec to create a 1000x500 pixel spherical panorama from six 500x500 pixel cube face images. Time will increase/decrease approximately by the square of the panorama dimensions. References: https://en.wikipedia.org/wiki/Cube_mapping http://paulbourke.net//miscellaneous/cubemaps/ https://stackoverflow.com/questions/29678510/convert-21-equirectangular-panorama-to-cube-map http://mathworld.wolfram.com/SphericalCoordinates.html CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
Example 1 |
Original Spherical Panorama Image |
(Click For Full Sized Image)
![]() |
Six Input Images Created From My Script Sphericalpano2cube |
Left![]() |
Front![]() |
Right![]() |
Back![]() |
Over![]() |
under![]() |
Arguments: |
(Click For Full Sized Image)
![]() |
Example 2 |
Original Spherical Panorama Image |
(Click For Full Sized Image)
![]() |
Montage Input Images Created From My Script Sphericalpano2cube |
(Click For Full Sized Image)
![]() |
Arguments: |
(Click For Full Sized Image)
![]() |
What the script does is as follows:
See the script for mathematical and code details. |