… and paying for it.
I’m just now coming up for air after about 4 days of round the clock hacking trying to get an HDR (high dynamic range) and panorama stitching program called Hugin to run.Ã‚Â This includes about 4 hours sleep.Ã‚Â I have aÃ‚Â nasty habit of assaulting computer problems full force and working them til they’re fixed.Ã‚Â If that takes two days, so be it.Ã‚Â That tendency is why I quit writing software professionally.Ã‚Â Well, one of the reasons.
Before I get into the nitty-gritty, let’s step back a moment and look at how most of us are used to getting new software.Ã‚Â In windows, the procedure is more or less this:
- Go to the website and download the setup file
- Run the setup program
- Enjoy the software
- If you don’t like it or you’re finished with it, run the uninstaller
In the process of installation, the setup program might over-write system files that are needed for other programs and thus make your system unreliable but that’s another topic and issue.Ã‚Â For the most part the above workflow works.Ã‚Â Everything that the program needs is included in the package.Ã‚Â Simple and user-friendly.Ã‚Â Plus, by the time the programmer gets to the point of constructing an installation program, he usually has most of the big bugs worked out so the program almost always works.Ã‚Â It may have some quirks but seldom if ever do you get something that just won’t work.
The *nix world traditionally has been different.Ã‚Â In that world, programs are distributed as source code and every user has to compile the code using the C compiler that comes with *nix.Ã‚Â That is beyond tricky.Ã‚Â The programmer may have relied on libraries and other resources that did not come with the *nix distribution and that he had installed previously.Ã‚Â Say, a library to work with TIFF or JPEG graphic files.Ã‚Â The only way you the user know what is required is by trying to compile and having it fail.
Even worse is the Tower of Babel collection of slightly different *nixes.Ã‚Â Berkley BSD, SysV (old), all the Linuxes, Apple’s version of BSD, etc.Ã‚Â If the programmer wrote the program on a BSD system and you’re running Linux, the program will not compile nor run unless the programmer made provisions for your system.Ã‚Â In short, installing a new program was a major project, sometimes taking days to accomplish.
The companies that sprung up to support Linux – Redhat and others – decided to fix this situation.Ã‚Â They created installers called RPMs and DEB packages.Ã‚Â Unfortunately the two are not the same so one won’t work in place of the other.Ã‚Â A package is like a windows Setup program.Ã‚Â It contains the binary (ready to run) program plus any support libraries and other files.Ã‚Â The user downloads the package, runs the package manager against it and the program installs.Ã‚Â Neat and clean most of the time.
There still remained the problem of unreliable software.Ã‚Â *nix programmers have a nasty habit of taking a snapshot of their unfinished work, slapping a 0.xx revision number on it and putting it out there.Ã‚Â Not as a beta but as the supposedly usable program.Ã‚Â John’s software rule #1 – Stay away from Rev 0.xx software.
This situation was not about to displace microsoft from the desktop, something all *nix people badly want to to so the guys behind Ubuntu decided to improve things.Ã‚Â One, they adopted a regular release schedule.Ã‚Â Two, they tested and made reliable the software that is stored in their repository.Ã‚Â Three, they created the repository so that users could go to one place and get reliable software.Ã‚Â Four, the incorporated a GUI package manager called Synaptics that makes installing new software pretty much a point’n’click operation.
This system works superbly but it has two major problems.Ã‚Â One, since by philosophy, nothing but security fixes are released between major releases, the programs in the repository are by nature, one or more years old.Ã‚Â Two, users are dependent on what the repository maintainers can test and include.
What that means is that a lot of useful software is not available through the easy and reliable repository channel.Ã‚Â One has the option of going outside the repository – going off the reservation, as it were – but when he does, he is sailing in uncharted waters.Ã‚Â It’s like dipping your toe in the Bermuda Triangle.Ã‚Â You’ll likely get swept away.
OK, so back to HDR photography.Ã‚Â This is a technique that seeks to capture high dynamic range lighting situations that could not be otherwise photographed.Ã‚Â Say a shaded lake against a bright sky.Ã‚Â The technique (should be) simple.Ã‚Â Set up your camera on manual, preferably on a tripod.Ã‚Â Set the exposure to get a good shot of the foreground.Ã‚Â The bright background will be blown out to white but that’s OK.Ã‚Â Next, without changing the f/stop, change the shutter speed so that the bright background is properly exposed.Ã‚Â One can take several shots, bracketing the exposure to ensure getting the best of each.
Back at the computer, two or more of the best shots from each exposure class are submitted to the HDR program.Ã‚Â Through PFM (pure f…..g magic :-), they are combined to make one photo where everything is properly exposed.Ã‚Â The algorithms involved are extremely complex and some work better than others.
This is one place where the Linux world is far ahead of the PC world.Ã‚Â The HDR plugin for Photoshop, for example, tends to flatten the photo and make it look cartoonish.Ã‚Â Not terribly useful.
A couple of days ago, a friend of mine (Hi Norman) turned me on to this article  and a program combo to do it.Ã‚Â The combo is Enfuse, a command line HDR program and Hugin, a GUI wrapper for it.Ã‚Â HDR was on my round tuit list so I was excited. (I should note that with most of the examples in that article and many HDR situations in general, a more satisfactory and much simpler solution is proper lighting.Ã‚Â Fill flash goes a long way.)
I fired off Synaptics and checked the repository.Ã‚Â Nothing useful.Ã‚Â So I went to the Hugin website.Ã‚Â No DEB package and no binaries.Ã‚Â Oh sh*t.Ã‚Â I decided to “step off the reservation” and install something outside the package management system (Synaptics).Ã‚Â I have done it before (and did it all the time back in the SysV Unix days) so how bad could it be?Ã‚Â Nearly 4 days of round the clock hacking is how bad.
I downloaded the tarball (like a Zip in the *nix world), unpacked it and started to compile.Ã‚Â It wouldn’t.Ã‚Â It needed libraries that I didn’t have.Ã‚Â So I fetched libraries.Ã‚Â It needed more.Ã‚Â Fetch more libraries.Ã‚Â Rinse and repeat.
Somewhere in that process I found this page .Ã‚Â I won’t bore you with the details but I did everything on that page!Ã‚Â I ended up with a program that would start and run but would not do anything.Ã‚Â It was badly broken.
The usual practice in software development is to periodically take a known working version, package it up in a tarball or zip and put it up somewhere for download.Ã‚Â This guy is lazy.Ã‚Â He has you just grab whatever he’s working on at the time.Ã‚Â That’s what that part about 1/4 down the page is about where he talks about fetching from the CVS.Ã‚Â That’s his source code control system.
Unfortunately I got a snapshot or “build” that is broken.Ã‚Â Norman was helping me with it because he has the program working on his system.Ã‚Â We looked up and it was 6AM and the sun was rising.Ã‚Â He mentions in passing that he got his version here .
He’s running Gentoo Linux which is different from Ubuntu so I didn’t pay much heed. A half a day later and just before I was about to give up, I decided to download his version and try it.Ã‚Â It compiled and installed cleanly!Ã‚Â Progress.Ã‚Â Unfortunately it wouldn’t work.
That’s when Norman sent me his workflow.Ã‚Â That is, the step by step procedure that he uses to do the job.Ã‚Â I went with his workflow which was different than what was intuitive and it worked!Ã‚Â That is, one part of the program that his workflow uses works while other parts are broken.Ã‚Â *sigh*Ã‚Â Unfortunately a lot of Linux software is that way.Ã‚Â Hats off to the guys who take this crap, test and massage it to make it reliable and put it in the repositories.
This is getting kinda long so I’ll stop now.Ã‚Â You should too unless you like reading about train wrecks.Ã‚Â I’m including my Linux Log below so that those with morbid curiosity can see what I went through.Ã‚Â Now to go out and take some HDR photos!
Started installing enblend and enfuse, two programs for doing panoramas and HDR blends.Ã‚Â Recommended by Norman.
Enblend was in the repository but enfuse was not for some reason.Ã‚Â Downloaded the sources from sourceforge.Ã‚Â Sources are in /usr/local/src/enblend-enfuse-3.2.
when I ran configure, it said that it needed libtiff.Ã‚Â Fetched that and stored it in /usr/local/src/ tiff-3.8.2.Ã‚Â Made and installed that.Ã‚Â Now configure says it needs liblcms.Ã‚Â Synaptics says that it is installed but apparently configure can’t find it.Ã‚Â I’m downloading the liblcms-dev package now.Ã‚Â If that doesn’t do it I’ll make from the sources.
That worked.Ã‚Â Now it wants libxmi.Ã‚Â Getting that from the GNU download site.Ã‚Â Will make from sources.
OK, have all the dependencies.Ã‚Â Now make breaks on a malloc declaration error.Ã‚Â It just ain’t working.Ã‚Â Went to the net again and found a different package.
Same problem.Ã‚Â This program appears to be made for Ubuntu Rel 8.10.
Now it wants libjpeg-devel headers.Ã‚Â Those appear to be in the repository.Ã‚Â Downloading.
Now it wants libpng-devel.Ã‚Â In the repository.Ã‚Â *sigh*
Try two.Ã‚Â At this site
I found the following instructions.
First, get a lot of stuff:
sudo apt-get install pkg-config libtiff4-dev libboost-graph-dev libboost-thread-devÃ‚Â Ã‚Â liblcms1-dev libglew-dev libplot-dev libglut3-dev libopenexr-dev libxi-dev libxmu-devÃ‚Â Ã‚Â Ã‚Â (all one line)
For my 8.04 system, also get:
sudo apt-get install libopenexr2ldbl
Then get the sources from
cvs -d:pserver:firstname.lastname@example.org:/cvsroot/enblend login
cvs -z3 -d:pserver:email@example.com:/cvsroot/enblend co -P enblend
(I may not have to do this)
make -f Makefile.cvs
Currently waiting for the first part to finish.
02:15.Ã‚Â Download finished.Ã‚Â Going to try a make with the sources I have before I hit the CVS.
IT WORKED!Ã‚Â Longest compile of my life at almost an hour.Ã‚Â Wow.
Onward to hugin
1. make some more libraries
sudo apt-get install cmake libopenexr-dev libboost-dev boost-build libboost-thread-dev libboost-graph-dev gettext libwxgtk2.8-dev libexiv2-dev libimage-exiftool-perl libglew-dev
2.Ã‚Â Get the sources
svn co https://hugin.svn.sourceforge.net/svnroot/hugin/hugin/trunk/ hugin
Had to download subversion.
3. Make it
cmake -DCMAKE_INSTALL_PREFIX=/usr/local .
This failed because it needed libpano13 or libpano12.Ã‚Â IN the repository so gotten using package manager.Ã‚Â Cmake worked fine after that.Ã‚Â repository installed libpano12.
sudo make install
Compile failed on syntax errors (!) so I went back and got his example stable version using this command
svn co -r 2906 https://hugin.svn.sourceforge.net/svnroot/hugin/hugin/trunk/ hugin
Some Perl stuff that is needed.
sudo apt-get install libimage-size-perl
sudo cpan Panotools::Script
06:30Ã‚Â that completed successfully.
06:45 make finished.Ã‚Â hugin would not run.Ã‚Â Failed with a shared library missing error.Ã‚Â Went back to the top of that wiki page and started from the beginning.
sudo apt-get install build-essential autoconf automake1.9 libtool flex bison gdb
sudo apt-get install libc6-dev libgcc1
Must make libpano15.Ã‚Â Apparently skipped that part before.Ã‚Â The older version in the repository didn’t work.
sudo apt-get install zlib1g zlib1g-dev libpng12-dev libjpeg62-dev libtiff4-dev
sudo svn co https://panotools.svn.sourceforge.net/svnroot/panotools/trunk/libpano libpano13
sudo make install
ssudo udo cmake -DCMAKE_INSTALL_PREFIX=/usr/local
sudo make install
IT WORKED!!!Ã‚Â Hugin comes up
17:30.Ã‚Â It didn’t work.Ã‚Â Missing underlying applications.
sudo apt-get install libxml2-dev
sudo svn co https://hugin.svn.sourceforge.net/svnroot/hugin/autopano-sift-C/trunk/ autopano-sift-C
sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local .
sudo make install
Updating perl math::matrix 4
install Math::Matrix Image::Size Storable
sudo apt-get install libimage-size-perl
this does all the above perl stuff
sudo cpan Panotools::Script
sudo apt-get install libboost-dev
Attempting to install CinePaint, another HDR program.Ã‚Â Using this script from the Cinepaint website.
echo ubuntu.sh – install from source on ubuntu
echo License BSD 10.18.2008 Robin.Rowe@cinepaint.org
sudo apt-get install gcc automake g++ libfltk1.1-dev libgtk2.0-dev zlib1g-dev libjpeg62-dev libpng12-dev libtiff4-dev libopenexr-dev libxpm-dev libgutenprint-dev libgutenprintui2-dev liblcms1-dev pkg-config ftgl-dev libxmu-dev libxxf86vm-dev flex python-dev libtool
sudo make install
Program continues to crash.Ã‚Â I reset defaults on the preferences->autopano to use Panomatic after fetching it.Ã‚Â That made the auto align work but broke the end result.Ã‚Â Only one photo file is getting passed to enfuse.Ã‚Â About to give up.
22:10 I HAVE OFFICIALLY GIVEN UP ON THIS ABOMINATION
Let’s try something else.
Per the article here:
I’m downloading the sources for CinePaint that has an HDR plugin.Ã‚Â This may be another adventure but at least the author supplies a make script.Ã‚Â Downloading from here:
While waiting on the download, I cleaned up all the mess from the last day.Ã‚Â Compressed and tarred all the sources, etc.
Download of the CinePaint finally finished.Ã‚Â Sourceforge knocked down the download about every 3-4 minutes.Ã‚Â Strange.
CinePaint would not compile so end of that experiment
Finished downloading and installing the version that Norman uses.Ã‚Â It compiled cleanly and installed over the top of that other mess, preserving the desktop registration.
Once norm sent me his work flow it worked OK.Ã‚Â It’s pissy about what you feed it but once it likes the input, it works.Ã‚Â *sigh* a day and a half wasted on that mess.Ã‚Â Here is his workflow.
go to the Images tab, load images, then click on “Create control
go to the Optimizer tab, click on “Optimize now”
maybe go to the Control points tab, and fix up control points
go to the Stitcher tab, and:
– change the idiotic default “Equirectangular” to the
– click on “Calculate Field of View”
– click on “Calculate Optimal Size”
– uncheck “Blended panorama”, and check “Blended
– click on “Stitch now”.