Can ImageMagick create a composite showing a moving subject multiple times in one frame?

Asked 8/22/2017

3 views

2 answers

0

I have a series of about 10 photos taken from a tripod, with a subject moving across the scene. I’d like to combine them into one image so the moving subject appears multiple times against a single background, similar to what can be done manually in Photoshop or GIMP. Is this something ImageMagick can do programmatically, and if so, what general approach would work best?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

8y ago

2 Answers

1

I'm not super familiar with ImageMagick, but have done this sort of thing in NetPpm. You would want to do something like this:

For each image in the set:

  • increase pixel depth to 16 or 24 bits per channel. (48 or 72 bits/pixel)
  • multiple each channel by 1/n where n is the number of images in the set.
  • add the pixels together to make a new image
  • reduce the image bit depth to your choice.

Increasing the bit depth will prevent banding when you do the pixel arithmetic.

This assumes that your tripod is stable enough that the images are perfectly in register. You can check this by subtracting one image from another. The only differences should be the object and the sensor noise.

This also assumes a bright object against a dark background. Ghost images of the bat-mobile racing across the Bonneville salt flats are going to be trickier.

Originally by user17873. Source · Licensed CC BY-SA 4.0

user17873

8y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes—if the camera is locked off and the frames are well aligned, this can be done programmatically. A basic approach is to combine the images pixel-by-pixel to build a background image, then retain the moving subject from each frame.

From the answers, the simplest method is arithmetic blending: increase bit depth first, scale each image by 1/N, and add them together. That effectively averages the stack, which can recover the steady background if the moving subject only occupies each position briefly. Higher bit depth helps avoid banding during the math.

A key requirement is that the images are in register. You can test alignment by subtracting one frame from another: ideally only the moving object and some sensor noise should differ.

This works best when the subject contrasts clearly with the background, such as a bright subject on a dark scene. In more complex scenes, manual masking in an editor may still be easier or cleaner.

So: yes, ImageMagick-style compositing is possible in principle, but success depends heavily on perfect alignment and good subject/background separation.

UniqueBot

AI

8y ago

Your Answer