Batch files for making cubes

355 views
Skip to first unread message

Brandan

unread,
Mar 1, 2014, 4:58:00 AM3/1/14
to hugi...@googlegroups.com
I am needing to make my panos into cubes. To do that I discovered panotools and erect2cubic. I did one pano from the command line and it worked great. The end user though is going to be a friend on a MAC who has almost no computer knowledge and would not be comfortable with the command line. I had been hearing about batch files and learned enough to  write up a .bat that allows a person to drag and drop an equirectangular image and it makes the cubes, which works great on my windows machine. I have attached it as a text document. Feel free to comment on it as I am still very new to all of this or if you are needed a drag and drop answer you can give it a try. Rename the .txt to .bat and put it in the bin folder under hugin and it works.

Tonight, I spent way to long talking on the phone with my friend trying to get the .bat file to work on her mac and kept having problems. Does anyone else have experience with the mac equal to .bat files and panotools and have any tips on how to get them set up? (She has perl installed, and we figured out that we needed to rename the .bat to .command. Then we got stuck on file permissions which I did not know a mac even had.)

Failing that is there another simple way to ask Hugin to make a cube instead of an equirectangular image or to convert one as erect2cubic does?

Thanks,

BT_tocube.txt

Bruno Postle

unread,
Mar 2, 2014, 4:09:57 PM3/2/14
to Hugin ptx
On Sat 01-Mar-2014 at 01:58 -0800, Brandan wrote:
>I am needing to make my panos into cubes. To do that I discovered panotools
>and erect2cubic. I did one pano from the command line and it worked great.
>The end user though is going to be a friend on a MAC who has almost no
>computer knowledge and would not be comfortable with the command line.

>Tonight, I spent way to long talking on the phone with my friend trying to
>get the .bat file to work on her mac and kept having problems. Does anyone
>else have experience with the mac equal to .bat files and panotools and
>have any tips on how to get them set up?

I have no idea if the .bat file will work on a mac, the permissions
you need for a script are 'executable' or '+x'

>Failing that is there another simple way to ask Hugin to make a cube
>instead of an equirectangular image or to convert one as erect2cubic does?

Here is a really simple shell script that ought to work on OS X, it
doesn't rename the tif files, you need to put it in a text file and
make it executable:

#!/bin/sh
TMP_PTO=/tmp/cube_project.pto
erect2cubic --erect="$1" --ptofile=$TMP_PTO
nona -o "$1" $TMP_PTO
rm $TMP_PTO

--
Bruno

Brandan

unread,
Mar 2, 2014, 10:00:56 PM3/2/14
to hugi...@googlegroups.com


On Sunday, March 2, 2014 1:09:57 PM UTC-8, Bruno Postle wrote:
>I have no idea if the .bat file will work on a mac, the permissions
>you need for a script are 'executable' or '+x'

I did finally figure out an easy way to explain how to set the permissions to make a file executable. (Explaining file systems and what name to type in over the phone for something that I have not seen before was a challenge) After that bat was not working as expected.  I have been hitting the books and it does not look like a bat file will work on a MAC.

Here is a really simple shell script that ought to work on OS X, it
doesn't rename the tif files, you need to put it in a text file and
make it executable:

Thanks that will make my life a lot easier as it gives me a good place to start. From there I should be able to figure out the file renaming.

On my computer I installed panotools with the PERL interface. Reading some threads on here I am a bit hesitate to try that over the phone with a mac.

Does a person need to install panotools or can they just put the erect2cubic file in the same folder and use the script you wrote?

Harry van der Wolf

unread,
Mar 3, 2014, 2:56:21 PM3/3/14
to hugi...@googlegroups.com
Hi,

the erect2cubic script alone will not suffice (@Bruno: please correct me if I'm wrong)

You need to install panotools and a couple of underlying PERL dependencies. You can do this with CPAN or macports or homebrew, but in these cases you need access to the Mac. (Ever used TeamViewer? Multi-platform, no firewall issues and an absolute life saver. I use it a lot from my linux box to my daughters mac, a friends mac, my father in law's XP box, etc.)

As you already discovered: it works (slightly) different on a Mac. You can create a likewise applescript script which you create as a "droplet", which means that you are able to drag and drop one or more files on the icon and it will execute and "do it's magic".

The droplet could use Bruno's script.
I created quite some droplets but that was way back in 2007-2010.

You can also create a droplet with platypus (http://sveinbjorn.org/platypus). It will allow you to put the panotools "stuff" and the script inside an OS X app. Drop the rectangular on it and it will do it's work. You could also make it to process multiple equirects to make multiple cubics.

And finally: you can create an "Automator" extension droplet to finder (the mac file manager) in combination with a perl, shell or python script.

My skills are a bit rusty as I moved away from Apple about 2 years ago. I will dust off my old mac and I'll try to have a look at it Wednesday afternoon/evening. If you manage it yourself before that time please mention it.

Harry
 


--
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hugin-ptx+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/da6b846a-9373-485f-922e-207fc141d256%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Brandan

unread,
Mar 4, 2014, 6:43:50 AM3/4/14
to hugi...@googlegroups.com
With a bit of luck I will have a chance to have my hands on the mac in question for an hour or so later today. If I do not get it solved today, then I will give TeamViewer a try. Something like that would make this sort of thing a lot easier.

I am not able to find it right now, but I thought I came across a thread talking about if a person uses CPAN to install panotools on a mac and a few other things had already been installed(I forget what they were) that there would be problems and to instead only install a subset of panotools. Does that sound familiar at all?

For what it is worth, building a droplet to make cubes and include it with hugin would likely be something that a lot of people would use.I have tried 2 other programs that make cubes and the fastest one that I found would take about 30 times as long for a big pano, and the slowest one I gave up on after an hour. In one case a lot of the users are already using hugin to make the panos, saving them the step of another program to make the cube would be something the whole group would benefit from.

Brandan

Brandan

unread,
Mar 5, 2014, 6:56:23 AM3/5/14
to hugi...@googlegroups.com
I only got to play with the mac for a few minutes. I coped and pasted your code into a text file, named it test.command and made it executable. I dragged and dropped an image on it. Looking at the results, near as I can tell the next step will be to install panotools. Just having the erect2cubic file there does not appear to work as it cannot find the command.

The thread that I was thinking of that made it sound a bit scary is this one https://groups.google.com/forum/#!topic/hugin-ptx/omZgW8jJvss as I am far from a perl guru.

For now do not worry about this. Turns out the computer also has windows installed. For what we are doing right now, I will just install everything on the windows side as I know how to work in that environment. If at a later date someone comes up with an answer or simple instructions for a mac, that would be great, but zero rush.

Thanks for your help,
Brandan

Harry van der Wolf

unread,
Mar 5, 2014, 8:00:00 AM3/5/14
to hugi...@googlegroups.com
2014-03-05 12:56 GMT+01:00 Brandan <bra...@flyingtsalers.com>:
 
The thread that I was thinking of that made it sound a bit scary is this one https://groups.google.com/forum/#!topic/hugin-ptx/omZgW8jJvss as I am far from a perl guru.


That's the portable package I made 5 years ago. It gives you a portable panotools + dependencies environment. You need to install ImageMagick and Hugin.app additionally though.

Harry
Reply all
Reply to author
Forward
0 new messages