6

I have several collections of 400 or so photos that I took using interval shooting. Sometimes the camera moves very slightly while shooting. My goal is to align all the images at full resolution so that I can combine them into a single image. (The combining will be done in software I wrote myself.)

Usually I use Photoshop's auto-align feature for aligning images, which produces excellent results, but with this many images it seems either to not work or to be extremely slow. Photoshop stopped responding and was still taking 100% CPU days later when I killed it. I tried changing it to perspective transform only (rather than auto) but it didn't seem to help.

From a bit of google searching some people say you can do the aligning in Photoshop in batches. However, as far as I can tell this is not possible. If I align the first twenty images separately from the next twenty, then the two sets of images won't be aligned with each other. Unless there is a way to speed up Photoshop's auto-align feature, I'm looking for software that's designed for the task of aligning this many images.

One option I've tried is align_image_stack, which is part of Hugin. However, this had problems of its own. On my most recent try, it took days to run and didn't correctly align the images; it also saves the files in an inconvenient format. (See the edit history for details.) I suspect that both Hugin and Photoshop are optimised for aligning a few dozen images at most and aren't really designed for large batches.

These are RAW files straight out of my Pentax K50 and they're about 14-15Mb each, so it's a lot of data when you put all of them together - they can't all fit into memory, and I'm looking for a tool that's designed with this in mind.

I should mention also that I'm on a Mac.

  • Do not align the images in sets, Use one main as a reference and aligh the rest with this basic one, or try using the last one of the previous set. – Rafael Nov 12 '16 at 16:24
  • 1
    @Rafael how does one do that, though? Photoshop doesn't seem to give me the option to set one layer as the reference for aligning the rest. The only option is to choose the types of transformation that are allowed, and then it tries to align all the layers with each other. – Nathaniel Nov 12 '16 at 16:38
  • you can try macros (recording Action) to automate this – aaaaa says reinstate Monica Mar 1 '17 at 16:27
  • I have the same problem than you; however, I haven't found any answer. Did you solve the problem? How? – Daniel Jan 12 '18 at 6:13
  • @Daniel I can't remember what I did in the end, but I think it was more along the lines of working around the problem rather than solving it. I'd still like a good solution. I'm sorry I can't be more helpful. – Nathaniel Jan 12 '18 at 7:36
2

ImageJ was developed for processing images for microscopy and astronomy, where this problem comes up frequently.

Here's a tutorial which relies on importing all the images into a "stack" first and aligning to a feature. It can probably do your "combining" too (I've used it to add multiple extreme-low-light images, for example).

A more modern fork is Fiji, which might be easier to use. Both are free/opensource and cross-platform.

  • It seems ImageJ is limited to data sets that can fit into memory, which makes it unsuitable for my images. Or am I wrong about that? Please correct me if so! – Nathaniel Feb 12 '18 at 7:45
  • @Nathaniel I could believe that the entire stack must fit into memory (including swap but that would be stupidly slow). You might have to run or script it to do a batch at a time, as I did when I needed the average of 1000 images – Chris H Feb 12 '18 at 8:38
2

I could not find a solution with raw files, I know the recent version of hugin is supposed to support raw files using dcraw but I cannot test it myself. The next good solution in my opinion is to convert all of your raws to tif files or other lossless image format and use them.

For my method I mainly hugin_tools on the terminal but I also use the GUI so keep in mind you need both installed. You can find the hugin suit here for download. Also I am using Ubuntu on my machine but the procedure on mac should be the same.

First thing you need to put all the photos in one folder, this is mainly for convenience' sake but will help with the commands later.

Generate a pto file

Next you need to generate a pto file, that is the file where all the image transformation data is saved. You can do so by typing:

pto_gen *.jpg

in the terminal where all the photos are.

Cropping to still area

Now you need to find matches between all of your images, before you do that there is an optional part which will greatly reduce errors if there are moving objects in your set.

Open the hugin project you generated and change the interface to advanced.

interface changing

In the window that opened go to the masks tab and there chose the crop tab and select your first image. Now make sure 'all images of selected lens' is checked and then drag from the edges of the image and crop to the area with the least or no amount of movement. This will constrict the match finder to that area and reduce error in the remapping stage. Now you can save and exit the program.

image cropping

Finding control points

Now you can find the matches, type:

cpfind --linearmatch *.pto

into the terminal, this will find matches between pairs of images. You can also find matches between all images by simply omitting the ‘linearmatch’ option but if you have hundreds of images it will take a very long time and is also probably unnecessary. You can learn more about cpfind here.

Next you need to clean the control points you found, there are two commands for that purpose:

celeste_standalone -i default.pto -o default.pto

will try to erase control points on clouds (More information here). And

cpclean -o default.pto default.pto

will remove control points with high error value. (cpclean help page)

Reset crop

Now that we are done with control points open the new generated project called default and head back to the masks tab like before, here select the crop tab again and click the reset button, this will disable the crop from all the images.

Optimizing

After that you need to optimize the control points. Type:

pto_var --opt="y, p, r, TrX, TrY, TrZ" -o default.pto default.pto
autooptimiser -n -o default.pto default.pto

That will optimize the position and distortion of your image set, you can learn more about this process here.

You are almost done, now just type:

pano_modify -o default.pto --projection=0 --fov=AUTO --center --canvas=AUTO --crop=AUTOHDR --output-type=REMAPORIG default.pto

to change the project configuration.

Remmaping

Lastly just type:

nona -m TIFF_m -o remapped default.pto

to output the remapped images. If you want to also stack the images together you can also use:

hugin_stacker --output=median --mode=median remapped*.tif

More information about hugin command-line tools can be found here.

That's it, that my take on your problem, there are a few missing links because this is my first answer so i was limited to 8. If there are any mistakes or you have any problems please let me know, also my English is not the best so sorry if I made any grammar or spelling mistakes. Cheers!

  • Welcome! This is a nicely formatted answer, and quite detailed. Well done. Keep it up. – damned truths May 8 at 0:00
  • This looks great, thank you so much for including detailed instructions. I will try to follow these instructions the next time I need to do this, and will let you know how it goes. (I am not sure when that will be.) – Nathaniel May 8 at 3:17
0

Import in After Effect as sequence, stabilize, export as images. Don't know the exact details, but you'll be able to find it online. Wouldn't know how to do it automatically in PS, doubt it's possible..

  • Will that work at full resolution? In the end I'm combining these into a single image, so I'd need to keep the full resolution of the frames. (I don't have After Effects.) – Nathaniel Nov 12 '16 at 14:18
  • You need to do the tests, because you are the one that have your own photos. I dont know what is the full resolution for example, or how fast your computer is. :o( I know that the program has limitations on the resolution but when using video because the codec. But I am not sure about still images. – Rafael Nov 12 '16 at 17:10
0

I've used Canon Photo Stitch and had success with many images. You may want to process smaller groups of photos and then process the groups.

If you have access to a computer with gigs and gigs of RAM, and you should be able to process in Photoshop.

0

Not a photoshop expert.

Try this: Open one image. Set it as background, and lock.

Import N images. Align them. Hide the result layers.

Import another N. Align.

Unhide the first batch.

Play your interval set.

If it doesn't work there will be 2 jerks -- one right after the first shot, (because the align with the second batch changed it.) and one between N and N+1

To save time, I'd start with N equal to around 10 or 20, and only do 2 batches.

If it works, you can play with increasing the size of N. In this scenario, you keep adding batches and hiding/locking the non-current batch.

0

Your're looking for a panaroma stitching software, which is able to do Gigapixels.

If you google "How to create a gigapixel image", the usual suspects that turn up are (in no particular order):

  • PTgui
  • Hugin
  • Gigapan Stitch
  • Microsoft ICE (Image Composite Editor)

This list is proabably not complete. YMMV.

  • 2
    Panorama stitching isn't exactly what I want to do. The images are all of more or less the same scene (the camera movement was accidental/unavoidable), and I want to keep them all as separate files, just align them. (I will then combine them into a single image using a special algorithm that I wrote myself.) Still, perhaps some of this software can do this task. – Nathaniel Mar 19 '17 at 23:14
  • For alignment you could use autopano-sift or similar tools to identify control-points and use these to calculate the necessary tilt and shift. Can be done, but requires deep knowledge of the tools and how to tweak them to make them do, what you want them to do. I'd ask in the respective mailing lists of these tools. – Grimaldi Mar 20 '17 at 17:41
  • Hugin will definitely work for this. – user39557 Jan 14 '18 at 3:57
  • @cegaton I mentioned Hugin in the question - it sometimes produces malformed tif files, which is why I'm looking for another solution. – Nathaniel Feb 12 '18 at 7:46
0

To properly align the images in batches you must include one particular image as the anchor image for all the batches. So, if you take image nr. 1 as your anchor image, then you can align images 1 to 20 in a batch, and for the next batch you choose images 1, 21, 22, ..., 39. The next batch consists of images 1, 40, 41,...59. This way all the images will be aligned to image nr. 1.

  • I assume you are talking about Photoshop? If so, please could you tell me how to set an image as the anchor image for alignment? I don't want to say I'm certain, but I believe this can't be done. It aligns all the images to each other, not to one specified image. – Nathaniel Mar 22 '18 at 0:41
  • @Nathaniel I had Hugin in mind, but in general, if you have N pictures then there are N-1 alignments to be done as you can always shift, rotate etc. all the N images by the same amount without affecting alignment. A program that doesn't constrain the alignments by anchoring one of the pictures will risk rotating or translating all the pictures by some uncontrolled amount. – Count Iblis Mar 22 '18 at 1:06
  • Ok, but then could you tell me how to set an anchor image in Hugin? There is nothing in the instructions for align_image_stack (the backend it uses for alignment) that indicates this is possible. – Nathaniel Mar 22 '18 at 1:13
  • @Nathaniel With Hugin you just load the images, right clicking on the entry of an the image opens a menu where you can select it to be the anchor for position. – Count Iblis Mar 22 '18 at 4:16
  • I see! I hadn't even thought of trying it through the GUI, as I'd assumed every option would be available using align_image_stack from the command line. I'll give that a go tonight. – Nathaniel Mar 22 '18 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.