Composing multiple images

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
lego
Posts: 9
Joined: 2010-04-13T03:43:09-07:00
Authentication code: 8675308

Composing multiple images

Post by lego »

Hi,

I don't know how to solve my problem.. I have no idea of image manipulation.. sorry. Probably it' very easy for most of you!

Suppose that I have a photo camera that can take photos every 0.5 s, and I photograph a jump of a motorcycle. Suppose that the jump lasts 3 seconds, so I have 6 images. I would like to compose the 6 images and obtain a result like this:
http://www.showlinephoto.com/fencecheck ... e-jump.jpg

I don't know how to do it with imagemagick.. Any help would be highly appreciated!

Thanks,
Lego.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Composing multiple images

Post by Bonzo »

Mc Afee did not like that site and the image is not there, only a 404 page.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Composing multiple images

Post by fmw42 »

I don't know how well this will work, but if your camera has not moved so that the ground is not different in each image, then you could try,

convert image1 image2 image3 image4 image5 image6 -evaluate sequence mean result.

see http://www.imagemagick.org/script/comma ... e-sequence

however that will mix each motorcycle with the sky and so look a bit faded. you might have to increase the contrast (-brightness-contrast function)

The best way would be to make a mask (say white) where the motorcycle are located (manually draw around them in some other program like GIMP) with the rest black and then use the masks with convert image 1 image2 mask2 -compose over -composite image3 mask3 -compose over -composite etc result.

see
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/layers/#convert
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Composing multiple images

Post by Bonzo »

I have just remember that Anthony had a background removal example: http://www.imagemagick.org/Usage/compose/#changemask

If you had a photo of the background only you could use that? May take some time to process a photo though.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Composing multiple images

Post by anthony »

See Photo Handling Double Exposures...
http://www.imagemagick.org/Usage/photos/#double

Basically you either 'average' the images to get 'ghosts', whcih enhances the background the more images you have.

Or you work out various masks to select the component from each image. Typically you again create an average background, then use that to work out the masks for each frame.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Composing multiple images

Post by fmw42 »

If all of the motorcycle and rider were darker than the sky, then you could use

convert image1 image2 image3 image4 image5 image6 -evaluate sequence min result


But unfortunately, the sun is reflecting on the rider making part of him or the cycle brighter than the sky.
lego
Posts: 9
Joined: 2010-04-13T03:43:09-07:00
Authentication code: 8675308

Re: Composing multiple images

Post by lego »

Thank you!!!

Well I didn't had motorcycle photos, this was just an example in order to express my problem.
I tried with

Code: Select all

convert img1 img2 img3 img4 ... -evaluate-sequence mean img-final
but the images looked faded, but with

Code: Select all

convert img1 img2 img3 img4 ... -evaluate-sequence min img-final
the result is just what I wanted!!

Thank you very much!!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Composing multiple images

Post by anthony »

lego wrote:I tried with

Code: Select all

convert img1 img2 img3 img4 ... -evaluate-sequence mean img-final
but the images looked faded
It is as I said, averaging (mean) will generate a strong background with the moving foreground appearing as 'ghosts'. It is generally used as just one step in a larger process.

The key to getting a perfect layering of all foreground objects, is the generating masks of the the individual objects.

The use of 'min' will work fine but only if the foreground object is completely darker than the background, but it is a step. Be warned however that it could pick one channel value from one image, and another value from the other image. Much like the composition method Lighten and Darken.
http://www.imagemagick.org/Usage/compose/#lighten

The boolean (comparision) composition methods such as ChangeMask, Lighten-Intensity and Darken-Intensity, etc can also help in generating either the final image, or just the masks.
http://www.imagemagick.org/Usage/compos ... _intensity
http://www.imagemagick.org/Usage/compose/#changemask
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
lego
Posts: 9
Joined: 2010-04-13T03:43:09-07:00
Authentication code: 8675308

Re: Composing multiple images

Post by lego »

Thanks for that information, for the moment I will use the min method, when I have some time I will take a look at those other methods.
Thank you!
Post Reply