Spickzettel Hugin (Panorama-Bild Software), PMT, 4.2.06 Installation von einem Haufen benötigten Libraries und Hilfsprogrammen folge der Anleitung hier: http://rbpark.ath.cx/articles/compile-hugin-ubuntu (Kopie der Anleitung unten) Tutorial zur Erstellung von Panoramen mit diesen Programmen: http://rbpark.ath.cx/articles/create-panorama (Kopie des Tutorials unten) das Programm autopanag.exe (autopano-sift) stürzt, nachdem man die Bilder geladen hat und "compute" klickt, ab, scheint irgendeine Inkompatibilität von mono, gtk und autopano zu sein. Stattdessen einfach das Commandline-Programm benutzen: autopano-complete.sh -o panoproject.pto *.jpg danach Aufruf von hugin - pto-Datei aus autopano-Lauf laden - Reiter "Kamera und Objektiv" auswählen - "Lade EXIF" anklicken - Reiter "Optimieren" auswählen - "Positionen (inkrementell, von Anker beginnend)" auswählen, "jetzt optimieren!" klicken - "Positionen (y,p,r)" auswählen, "jetzt optimieren!" klicken - Das ganze im Vorschaufenster begutachten - ggf. vertikale und horizontale Linien erzeugen - Reiter "Kontrollpunkte" auswählen - auf beiden Seiten das gleiche Bild auswählen - für horizontale Linie durch Klick ins linke Bild einen Punkt setzen einen weiteren Punkt ins rechte Bild setzen (etwas weiter rechts) mit der rechten Maustaste in eines der beiden Bilder klicken - Optimieren und im Vorschau begutachten - ggf. für alle Bilder horizontale bzw. vertikale Linien definieren - erneut alles optimieren - Reiter "Zusammenfügen" auswählen - "Blickwinkel berechnen" klicken - "Größe berechnen" klicken (größer 20.000 wäre zuviel) - Stitcher "nona" auswählen - Bildformat "Mehrere TIFFs" auswählen - "Jetzt zusammenfügen" klicken - es werden einzelne TIFFs erzeugt, diese mit - enblend -m 256 -v -o ausgabe.tif eingabe*.tif zusammenfügen ---- Kopie der Installations-Anleitung ----------------------------------- Introduction I use autopano-sift, panotools, hugin, and enblend to create my panoramas. Since I only have Ubuntu 5.10 on my computer, this tutorial will focus mostly on that, but I will try to make it generally applicable to any GNU/Linux system. When reading this tutorial, commands you should execute will be displayed in a fixed-width font. Each line is prefixed with an ”$”, that simply represents the command prompt of your terminal. If you use Ubuntu, you should update your sources.list in order to gain access to several third party repositories that will make it easier to install the necessary packages that hugin depends on. For users of other distributions, you’ll have to improvise, sorry. Bruno Postle maintains high quality packages for all of the tools we’ll be installing in this tutorial, but unfortunately not for debian, so we’ll be installing the various dependencies with apt-get, and then compiling hugin & friends from source. Satisfying Dependencies Autopano-sift requires Mono version 1.0 or higher. Install mono like this: $ sudo apt-get install mono icu-locales icu \ libglade-cil libgtk-cil libglib-cil libgdiplus Many of the tools will depend on various image processing libraries and their development headers. You’ll need the libraries for jpeg, png, and tiff processing, which are installed like so: $ sudo apt-get install lib{jpeg62,png,tiff4}-dev Panotools and hugin will both require automake and autoconf, which are installed like this: $ sudo apt-get install libtool autoconf automake1.7 Panotools depends on some java headers, provided by the GCJ development files, installed thusly: $ sudo apt-get install libgcj-dev Hugin has a couple dependencies, including wxWidgets, and boost… Install hugin’s dependencies with this command: $ sudo apt-get install libwxgtk2.6-dev wx-common \ libboost-graph-dev libgtk2.0-dev And finally, enblend depends on libtiff4-dev and libboost-dev, but those were already installed above! Alright, lets move on… Installation Autopano-sift This one is the easiest and fastest to install. First you’ll need to download the source for autopano-sift 2.4, and then you’ll want to untar it. Luckily for us, we don’t even need to compile it as Mono binaries are platform independant bytecode (similar to Java bytecode), and the source tarball already comes with the binaries precompiled. Install autopano-sift like this: $ tar -zxvf autopano-sift-2.4.tar.gz $ cd autopano-sift-2.4/bin $ sudo cp * /usr/local/bin Once you’ve done this, you should be able to run autopano-sift just like this: $ autopanog.exe I know that will work on a debian system, but on fedora (and probably other distributions), mono isn’t as integrated into the system, and you won’t be able to run mono binaries directly. You’ll have to run autopano with something like this instead: $ mono $(which autopanog.exe) It’s not as pretty, but it gets the job done. Panotools First, we’ll want to check the source code out of CVS. Just hit enter when it prompts you for a password: $ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/panotools login $ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/panotools co libpano Next, compile and install it with these commands: $ ./bootstrap $ ./configure $ make $ sudo make install Hugin Installing hugin is very similar to panotools. First, you’ll want to check the source out of CVS. Again, just hit enter when it prompts you for a password: $ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/hugin login $ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/hugin co hugin Next, compile and install it with these commands: $ ./bootstrap $ ./configure --with-unicode=yes $ make $ sudo make install NOTE: You must compile hugin with the same version of gcc as wxWidgets was compiled with! If you try compiling it with a different version, the compile will run normally and will seemingly complete without errors, but then if you try to run hugin afterwards, you’ll get a strange error, and it won’t be immediately obvious what is wrong. NOTE: Also, I use “—with-unicode=yes” to compile hugin here, this is because the wxwidgets libraries that ship with ubuntu are compiled with unicode support. If the version of wxwidgets you have doesn’t have unicode support, then don’t enable that. You can find out if yours has unicode support or not by running this: $ wx-config --list|grep unicode If you see something like “gtk2-unicode-release-2.6” in the output, then you need to enable unicode. If you don’t see any output at all, don’t include unicode support. Enblend Almost finished! This is the last piece of the puzzle that we need to install. This one is fairly straightforward. You’ll need the source code for enblend 2.5, then untar it, compile it, and install it: $ tar -zxvf enblend-2.5.tar.gz $ cd enblend-2.5/ $ ./configure $ make $ sudo make install Finished You should be good to go! Now you have the tools necessary to create panoramas on your linux system, and I have a tutorial that shows you how to use these newly installed tools. If you’re having any trouble with the installation, you might try asking for help on the ptx mailing list. You could ask me directly, but there are much more knowledgeable people on the ptx list, so you have better chances of getting an answer there. Of course, I’d love to hear from you, but I might not be able to answer all of your questions. ------------------------------------------------- ----- Kopie des Tutorials ----------------------- Preparation The first step in making any panorama is to take the pictures. You can read Manfrotto’s guide to making panoramas, which goes into a lot of detail about the actual mechanics of taking the photographs. Manfrotto, being a tripod company, will try to sell you a panoramic head for your tripod, to assist in the creation of panoramas. All I will say is that yes, these panoramic heads are useful, but they are not strictly necessary. The tighter of an area you’re trying to photograph, the more important this equipment will become. If you’re standing at the summit of a mountain on a bright, sunny day, you won’t even need a tripod, much less a panoramic head; if you’re trying to make a panorama of your cramped basement crawlspace, you won’t get very far without one of these. I don’t have one of these panoramic tripod heads, so take a look at my panorama gallery and decide for yourself if you need one or not. For best results, you’ll need 30 to 50 percent overlap between your images. Also, you’ll probably want to set your camera into manual exposure mode, and meter for the average brightness across the entire panorama. This will ensure a consistent exposure between shots. If you don’t do this and you’re trying to make a panorama of an outdoor scene, the shot you take facing the sun will be significantly darker than the other shots, as the bright light from the sun causes your automatic camera to increase the shutter speed, letting less light in overall, and then you’ll end up with this weird panorama where part of it in the middle is all dark. The tools we’ll be using to stitch the photos together are autopano-sift, hugin, and enblend. If you need help installing them, read my instructions. Autopano-SIFT This is what autopano-sift looks like. The interface is divided into two parts, the “Basic options” tab and the “Advanced options” tab. Frankly I find that the default options work really well in most cases. It should be fairly straightforward: click on “Add Images” to select which images you want to stitch together. Autopano-SIFT basic options tab If your images need to be rotated before stitching, turn on “Automatic pre-aligning of images” on the advanced tab, select the orientation of your images, and turn on “generate horizon lines”. I haven’t had a great experience with the horizon lines generated by autopano-sift, but you can delete them later if you’re not happy with them. It’s better to have the option of deleting them instead of being stuck without them. Press “Compute” when you are ready to begin having autopano-sift generate the control points for this panorama. Autopano-SIFT advanced options tab Autopano-sift works in three phases: First it examines each image for keypoints, then it checks each image’s keypoints against each other image to look for overlaps, and generates control points based on what it finds. After that, it can optionally refine the keypoints, but this is disabled by default. I don’t find it necessary to enable refinement as it increases processing time and the results are really good without it anyway. Autopano-SIFT progress meter If you’d like a more in-depth walkthrough of every feature in autopano-sift’s GUI, Sebastian Nowozin (the program’s author) has provided a very slick walkthrough demonstrating every button and knob you can click on, which is available in flash or html. Hugin Introduction Once autopano-sift is finished, you can load the resulting .pto file into hugin, which looks like this. You may notice that hugin has a button to launch autopano-sift for us… I have never gotten this to work. If it works for you, great! If not, that’s what this tutorial is for. Hugin images tab Lens Right now, the lens settings for your camera are all wrong. If you are using a digital camera, the correct lens information is stored in the EXIF data, so you’ll need to select one of the images and press the “Load EXIF” button to continue. If you are using a film camera (and have scanned your negatives, of course), or your camera doesn’t attach EXIF info (this is rare), then you will need to enter the settings manually. Hugin lens tab Control Points Now we can check that autopano-sift has chosen good control points for us. I usually skip this because I’ve never found a bad control point yet, as the SIFT algorithm used by autopano-sift is very accurate. Hugin control points tab Optimize The control points look good, but we need to optimize the panorama before we can stitch it. Optimizing is hugin’s way of looking at the control points and then figuring out how to alter the images so that they overlap better. First, do the “Positions (incremental, starting from anchor)” optimization, and then do the “Positions (y,p,r)” optimization. Hugin optimizer tab Each optimization serves it’s own purpose, you’ll get the hang of which ones to use when as you use hugin more. The “Positions and Barrel Distortion (y,p,r,b)” optimization becomes important if your camera’s lens introduces barrel distortion, which is very common, and “Positions, View, and Barrel (y,p,r,v,b)” is also a useful one. It might be tempting to optimize for “Everything”, but that is recommended only when there is 50% overlap, and the control points are placed evenly over the whole overlap area. Otherwise the optimizer reduces control point error close to the boundary, but add strange bubbles or other distortions in the middle. Preview Once you have optimized the panorama, the preview window shows you how the images overlap. You will see very obvious stitch lines in the preview, but that’s fine because it’s not the final result: it’s only meant to show how well the images are lined up. As you can see, the images are lined up fairly well (there are no obvious breaks in the view at the image edges), but it is not quite what we were expecting… the image is a little warped and curving upwards on the left edge. Hugin preview window So, we want to straighten this out. First, I’ll add a vertical guideline onto the building visible in the leftmost image, so that it comes out properly. To add the guideline, make sure you have the same image selected on both the left and right side in the control points tab, then click once in the left pane, and once in the right pane. Each click should be at opposite ends of the guideline you’re trying to make. Once you’ve added the guideline, re-optimize the image and go back to the preview window to see what effect it’s had. Hugin control points tab This alone is not enough as it would just make the right edge curve upwards instead of the left, so I’ll also add a horizontal guideline along the pavement in the rightmost image. Hugin control points tab Knowing where to add guidelines and whether to use vertical ones or horizontal ones is largely an art… there are no hard rules, whatever works well for you is the way to do it. Generally, you’d want to use vertical guidelines on the edges of buildings, and horizontal guidelines only on the actual horizon (as hugin will adjust wherever your horizontal guideline is to be in the center of the image). Unfortunately for me, in my rightmost image, there are no buildings to put a vertical line on, and the horizon is obscured by the trees. Luckily though, the paved path along the bottom is fairly straight and makes a good candidate for a horizontal guideline. This leaves us with a large black area below the panorama (as the paved path in the bottom of the photo is now the “horizon” in the vertical middle of the panorama). Re-run your optimizations (this is necessary to “update” hugin’s understanding of the panorama after you make changes to the control points), and then load up the preview again. It seems to have worked fairly well! What we have now is approaching a passable panorama ;) Hugin preview window What I like to do is set the blend mode to “difference” and then only enable two images at a time to compare their difference. What this means is that hugin subtracts one photo from the other in the areas where they overlap, showing how they differ. Ideally, the overlapping area will appear as a solid black (meaning there is no difference), but in reality there will always be a little bit of difference. If you’re seeing large white splotches in difference view, to the point that you can see an outline of what is actually there in the photo, it’s likely you have bad control points or have done the wrong optimizations. The less parallax error you had in your source images, the better this will work out. Hugin preview window It might seem strange at first that hugin would allow your panorama to have a bend in it, but this is a feature, not a bug: it is because hugin allows you to have multi-row panoramas. As a side effect hugin allows you to take pictures at strange angles and line them all up regardless of orientation/angle. Other less robust programs will force you to only have one row of images, so they will be fairly good at keeping that one row straight. Stitch Once you’re satisfied with what you see in the preview pane, it is time to stitch the image together. You will want to press the “Calculate Field of View” button so that the output won’t have too much of a large, empty margin on it. My experience has been that this works great for small panoramas, but for a panorama larger than 180 degrees, it will always set the “vertical” value to 180, regardless of how much vertical field of view you actually have. Check the preview pane to see how close your manually-guessed number is—if it is too high, you will have large black borders, and if it is too low, the images will be cut off. Then you want to press the “Calculate Optimal Size” button. This will set a size for the panorama that is as large as possible, without needing to scale up the source images. Usually I just go with whatever value it sets, but I think anything over 20,000 is just too high. It will take forever to stitch such a large image, and it will be really huge when it is finished, also. So if you see it above 20,000, just set it back down to 20,000 and you should be fine. Make sure your stitching engine is set to “nona”, and your image format is “Multiple TIFF”. The reason we use multiple tiff instead of one of the other formats is that we just want nona to line up the images for us, we don’t want nona to actually stitch them together, because enblend will do a better job of it when given the tiffs. It is possible to run enblend from within hugin by selecting “TIFF” format instead, and checking the “Soft Blending” checkbox, but I don’t like this because enblend is a slow program and it doesn’t show any progress bar for it, so you might think the program has crashed or something. Once you have the settings as you like them, click on “Stitch now!” and watch as nona outputs all the large tiff files for you. Hugin stitcher tab Enblend The next step is to run enblend on the TIFF files that were created by hugin. You’ll want to open up a terminal for this, as it’s a commandline application. Run enblend like this: $ enblend -m 256 -v -o enblend.tif nona*.tif There are a few parts to this command. First, the -m switch tells enblend to only use 256 MBs of RAM. This is important because if it tries to use too much, your system will run out of RAM, and it won’t be pretty. Setting this to about half as much physical RAM as you actually have is a good start. Then, the -v switch tells enblend to have more verbose output, so you can see what it’s doing. Otherwise, it’ll just sit there silently and you won’t be able to see what it’s doing. After that, the ‘-o enblend.tif’ tells enblend to save the final result into the file named enblend.tif. Finally, the ‘nona*.tif’ tells enblend to use all the files starting with “nona” and ending with ”.tif” as the input files (eg, nona0000.tif, nona0001.tif, etc). Enblend is a slow program, especially when working on large input files, and it will require a lot of temporary disk space to do it’s job. But the results are worth it. Results Here are the results from enblend, one large TIFF file. As you can see in the status bar of my image viewer, the file is 104.2 MBs and it is zoomed out to 10% here. The grey checkerboard around the edges of the picture are areas where there is no photographic data, so the image is transparent there. Eye of Gnome Now it is time to touch up the image in your favorite image manipulation program (it doesn’t really matter what you use, as long as you’re comfortable using it). You will need to crop the transparent image borders off the picture, touch up any minor blemishes you find, and save the picture in a different format, such as JPEG, that will take less disk space. If you’re going to put it on your website, scale it down a bit, too. Finished! This is the final result. Final Result I hope this tutorial has been useful to you! If you need more information, the official hugin website has more tutorials available. Page last updated on Sunday, January 8, 2006 at 9:45 PM -----------------------------------------------------------------------