Using Hugin part 4: mosaic images

“What is a mosaic image?” people typically ask when I use the term. I explained it before, so I’ll just c&p:

Mosaic images

A mosaic is created by stitching (planar) photos together where each picture is taken from a different location, with the camera pointing in different directions. A special, easier case is stitching flat scans (or images where the camera moves in relation to the object, but has the same distance and points in the same direction). This method can be used to remove objects in the foreground, by applying masks or cutting out parts of the pictures. If distortion is removed from each image singly before they are combined, this is also wonderful for creating high-res images of objects, or for getting totals of objects you can’t step far enough away from to take one photo (AMNH Styracosaurus comes to mind).

But what about skeletal mounts? That’s what us dinosaur palaeontologists are into, after all. For them, the mosaic technique is not that well suited, because objects at different distances will experience parallax shifts between images. And this makes it very hard to create a good complete view, because you’d have to split each image into several, based on how far what part of it is from the camera. For aerial surveys of quarries, however…. a nice juicy bonebed….

This already gives you a number of hints about the requirements, including:

- photos should be taken at equal distance from object
- photos should be taken with the camera positions absolutely parallel to each other
- photos should overlap a lot

If you do not follow these rules you induce a lot of parallax issues or can’t deal with the inevitable ones, and that can ruin your final result.

Here’s how I usually try to do it:

Taking the photos

Ideally, I have help for taking the photos. A tripod is nice, and a second person who helps me place it correctly. Or I simply use architectural guides, such as the lines between tiles on the ground, or railings, or edges of steps, or whatever I can find. The aim is to have the camera always at the same distance from the object, and any help I can get I use. Don’t be too shy to ask two complete strangers to spend five minutes holding a piece of string that serves as a guideline for similar distance. Don’t be afraid of looking totally silly when you take measured steps (I usually do one shoulder-width sidestep for close objects, two to three of them for stuff far away), or measuring distances out by placing your feet heel to toe. It is worth the effort and ridicule! Besides, if you snap pictures with an important expression on your face people will think you’re a professional photographer, not a moron ;)

When you can get it, try to have the full height of you object in each photo. If not, either do lateral rows, or vertical ones – but remember, for a true mosaic flat scan you need to do the rows not by pointing the camera down and up, as I did for the monster crinoid shown again below (which explains the slight errors you can see on the upper and lower 25% of the stitch), but actually have the camera at two or more different heights, and point the lens at the object at a perfect right angle. Thus, on your knees and standing up, or using a ladder…… it can take a lot of effort! I find that usually, two well-overlapping lateral rows (i.e., each covers >65% of the other) can tolerably be done by angling the camera up and down, if the object is really flat. Less overlap for taller objects requires three rows, and you quickly get to the point where it is worth doing four and a true flat scan shoot.

Hauff_30_small

Preparing the stitch

Once you have your photos done you can go straight into Hugin. Load all the photos (and there will be a lot more than you need for a panorama), and see what the assistant does. Just follow this tutorial. If you are lucky, if your hugin is configured correctly, and if your PC has enough oomph, that’s it! Do the usual playing around with the suggested panorama, and stitch! I usually stitch once at a very low resolution, e.g. 1/5 of full res, to see if there are major screw-ups. If so, do as below. Otherwise just run it at full size and enjoy!

Troubleshooting

One of the biggest annoyances with this topic is that hugin will often not be able to find control points perfectly between >30 images. On my Laptop it normally balks at >8 photos . Thus, I do the fix described in this post: I select groups of photos that I know overlap and manually start the control point finder for them.

One thing that is really helpful is the Fast Preview Panorama window. Once you have created control points and aligned the images you can use it to check if there are overlapping images with no control points – the main source for problems with the final stitch. If there are jumps in the image, such overlapping but non-controlpointed images are the reason! Go to the ‘Layout’ tab of the Fast Preview Panorama, use the “scale” slider to make the image thumbnails really small, and lo and behold! lines appear between them that show you the status of the alignment: overlapping images are connected by lines, and if they are thin and white or grey, no control points exist between these two images (red, yellow and green lines means few, some, and plenty of CPs exist).

hugin_layout

You can now simply click such a line and hugin will bring up the two images in the ‘Control points’ tab. Remember their numbers (at the top), go to the ‘Images’ tab, select them, and use the auto-CP-finder to make hugin find CPs for only this pair. Usually, this works.

If not, well, tough luck: you will have to manually place CPs in the ‘Control points’ tab (explained here, end of post). Takes a few minutes, but is totally worth it.

Once all image pairs are connected by red lines at least you can try again to optimize and stitch. Should be better now. However, it is entirely possible that the CPs cluster at one end of the photo, and jump lines appear at the other end of the photo in the final image. Two solutions exist: manually add CPs at the “empty” end, or use a mask to crop away one of the two photos in that area. I usually try to former.

(in case you wonder: the above example with all the unconnected images – I didn’t do anything with it! It stitched perfectly despite all the missing CPs! Don’t believe me? see here…..)

As a small break from all the words here is again the first mosaic I made where I used the Fast Preview Layout tab. And where I needed it, too!

Thermopolis_Small

OK, all that done, hat’s next?

Masking

Very often there are railings, lamp posts or other things in your view, and obviously not being on the same plane as the object you photograph they will suffer from parallax issues. The solution is simple: get rid of them, or at least get rid of all instances but one. Ideally, if you want to retain them you should retain the version that is as close to the center of a photo as possible. Use the ‘mask’ tab of hugin to draw masks closely around the annoying objects, and you’re done.

Now stitch and enjoy!

Oh, for all those who read through the full post I have a special extra hint on taking good photos perfectly parallel: if your intended object is behind glass, take the lens hood off your camera and put it flat against the glass. Perfect orientation and distance right there ;) That’s what I did for all the behind-glass stuff at the Urweltmuseum Hauff, and it worked very well.

About these ads

About Heinrich Mallison

I'm a dinosaur biomech guy working at the Museum für Naturkunde Berlin.
This entry was posted in How to, playing with photos. Bookmark the permalink.

7 Responses to Using Hugin part 4: mosaic images

  1. steve cohen says:

    Thanks for this, Heinrich.

    I love hugin but it suffers from lack of documentation and tutorials.

    And since it is so feature-rich, that is particularly unfortunate.

    Your series of posts filled a huge gap and I thank you for the well-done efforts.

    • you are very welcome!

      In fact there are quite a lot of tutorials etc. out there, but mainly for the componetns that hugin is the user interface for. Thus, for a computer noob they are hard to find and understand.

  2. chilejam says:

    Heinrich,

    I’m trying to figure out how to use Hugin to create a mosaic that is NOT flat.

    Let’s say I want to shoot a row of books in a library.  Or perhaps a row of shelves in a grocery store.

    I have a few problems.

    1,  The surface is not flat.  Every time I move the camera, even if I remain perfectly flat to the shelves (X,Y,Z) I will still have parallax errors.  

    2.  I have to shoot multiple shots, from multiple locations and stitch them together.  Even if I shoot multiple panos and try stitching them together, I still have the parallax problem.

    3.  Since the rows are tall, I have to shoot the top, middle, and bottom of each row.  Now I have to stich vertical as well as horizontal.  Even more parallax.

    I can’t imagine a much tougher task my first try with Hugin.  I guess it would be more difficult if I had to mask out people walking in the pictures.

    In any case, I have tried to find someone who might be able to point me in the right direction.  Is what I’m trying to do even possible?

    If so, where do I start?

    I have sample images, that I’m trying to stitch, that I can show you if that would help.

    Thanks for any help!

    Michael

    • Michael, give me a day or two for a reply. There are things you can do to make it easier! :)

    • Michael,

      a few quick thoughts:

      the first question I have is: how far away can you get from the object? Worst case is that you can only step back about 3 feet (book shelves in a library), in which case your task is enormous – but still doable.

      Your parallax problems all go away when you can get far enough away. If you can step back 30 feet, the books will be quasi-flat, so parallax will not be a big issue.

      Let’s assume that you only get those three feet. In this case, what part of your image is closest to the final thing you want? The center – no parallax issues there. Thus, if you have to stay close to the subject, you can only use the center part of each image. That means taking very many photos, and using masks to hide away a large frame around the center of each image. If you use a 35 mm lens at 3 feet you should probably mask the top, bottom, right and left thirds of the image, effectively only using the center 1/9th.

      That also means that you can’t use three rows of photos, you will need more. And each row must be shot from a different height, not by angling the camera up and down. So get a tripod and start at ~knee height, do another row at hip height, a third at solar plexus height, one more at head height, then get a ladder and add more rows at similar distances until you get to the top of the shelf. If you can get further away, you can use a larger proportion of each image.

      Now, there is one thing you definitely shouldn’t do: use a very wide angle lens! The wider the angle, the more fits into each image, but it only means that the little-distorted center bit you can use has a lower resolution than if you use a longer lens.
      So, take a ton of photos – why don’t you try with a small piece first, say 6×6 feet? Then scale up….

      What will be really important?
      – keep the camera at the same distance from the “frame” of your subject – in the book shelves example, the shelves – i.e., move it on a line exactly parallel. It will be hard to guarantee that when using a tripod at different heights. Maybe you can use sticky tape on the ground? If so, use a piece of string and a weight to drop a perpendicular for your first shot, then mark the line to move the tripod on with tape.
      – keep the camera angled a perfect 90° from the line connecting your camera positions. You can achieve this with the aid of the tripod’s feet: use a large space to mark out a line onto which you place two feet of the tripod, and a loooooooooooooooong perpendicular line away from it. Place the camera exactly above the intersection of the lines and adjust the head of the tripod so the camera points right down the second line.
      – keep the camera perfectly horizontal. You can achieve this by using a stick of lumber that you make a mark on at the exact height the center of the lens is at when you have the camera on the tripod, moving it some distance away, and adjusting the head of the tripod so the mark is in the center of the image.
      For both these things, get help from a second person!

      I’ll have to think about this a bit more. Can you tell me what it really is you want to photograph? Maybe via email? heinrich.mallison(AT)gmail.com
      What sort of camera do you have available? Tripod? etc.?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s