TransWikia.com

How to auto-align a stack of head shots?

Photography Asked by user40 on March 21, 2021

I am working on my own “everyday face” project – taking pictures of myself to combine them in a sequence afterwards.

I’m wondering what is the easiest and fastest way to align all pictures so my eyes would be in the exactly the same position for all of the pictures.

Parameters like the distance from my face to the camera and position of head in all pictures are very similar, but change a little bit from picture to picture.

What is the fastest way to align the pictures based on the position of the eyes?

4 Answers

How many pictures? If it is only a few, the easiest is to use Photoshop, two rulers, and onion skin (make two layer, one photo is not transparent, the one above is semi-transparent), and move the pictures with mouse or fine-tune with arrow keys.

If you get into it, a few hundred pictures goes pretty fast.

Do not use onion skin by itself, use rulers as well, otherwise you will tend to drift a bit away with the center of the eyes.

Also, if the distance between the eyes is not completely constant, you will have to use Free Transform anyway....

Answered by TFuto on March 21, 2021

I don't know if it's the easiest but this works pretty well for my needs:

$ align_image_stack -a aligned -C *.jpg

'align_image_stack' utility is part of hugin, and under Debian/Ubuntu (and other derivatives probably) you acquire it by installing 'hugin-tools' package. In the command above:

  • '-a aligned' sets prefix of the name of output images to 'aligned'
  • '-C' crops output images to the area covered by all images
  • '*.jpg' tells the program to work on all jpg images in current directory.

Answered by Maciej Hrynczyszyn on March 21, 2021

The easiest way is probably to just use Hugin.

The command line tool that's actually doing all the work below the Hugin GUI is align_image_stack, and if you install Hugin, you should just be able to type it on the command line directly, but the Hugin GUI is probably easier to use.

From the hugin web pages (should work with the current 2013 version of Hugin):

Aligning with hugin

  1. Start up a new hugin project for each series and load the images. Set the Field of View, lens parameters and projection type, i.e., if your lens is a fisheye, set this for both the input and output projection.

  2. Create control points via the Photos tab. Align_image_stack is specialized for this task. But also Panomatic or Cpfind work for this use case.

  3. Select "Positions (y,p,r)" and "Optimise now!" in the Photos tab.

  4. If necessary, fine tune the control points in the Control Points tab and optimise again.

  5. In the fast panorama preview, the images will be on top of each other. Select "Move/Drag" and "Fit", then select "Crop" and "HDR Autocrop".

  6. In the Stitcher tab, select "Calculate Optimal Size", then deselect the default panorama outputs and select "No exposure correction, low dynamic range" in the "Remapped images" section. Select "Stitch!".

You will probably want to manually set the control points for your eyes, and possibly erase all the other points, since you don't care about any other details matching.

Answered by inkista on March 21, 2021

There is special software for face detection available which may help to align head shots. While I don't know of an out-of-the-box solution, you could start e.g. with the face detection software from https://www.thregr.org/~wavexx/software/facedetect/. It can output position and size of detected faces and you can use it in a script. It could work as long as you don't need rotation. Probably, the software can be adapted to even tell the eyes' positions, which could be used for determination of required rotation, but there may be other options as well. Maybe connect with the author of the software if you need such additional figures.

Answered by Chris on March 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP