Merge nearly same images into a better one

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
PASDUCLAC
Posts: 1
Joined: 2011-03-25T09:07:21-07:00
Authentication code: 8675308

Merge nearly same images into a better one

Post by PASDUCLAC »

New on this forum (just discovering IM)
I have 10 images scanned from an old B/W old movie (really old) . The camera was fixed. Each image seems very close to each other. But one can have scratches, dust, halo and the other nothing at the same place. Of course, the image are not at the same place and the exact match can vary with perhaps up to 50 pixels (up, down , left, right)
I have 2 questions .
1)Considering 2 images, is it possible to find the best displacement (on X and Y) for the second one to 'best fit' on the first one. Using correlate ? Other techniques ?
2) Having now some images (3 or 4) 'best fitted' is it possible to find the best ... something like 'the most probable pixel' of the series to produce the most probable best image ???
Thanks in advance

Pascal
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Merge nearly same images into a better one

Post by fmw42 »

PASDUCLAC wrote:New on this forum (just discovering IM)
I have 10 images scanned from an old B/W old movie (really old) . The camera was fixed. Each image seems very close to each other. But one can have scratches, dust, halo and the other nothing at the same place. Of course, the image are not at the same place and the exact match can vary with perhaps up to 50 pixels (up, down , left, right)
I have 2 questions .
1)Considering 2 images, is it possible to find the best displacement (on X and Y) for the second one to 'best fit' on the first one. Using correlate ? Other techniques ?
2) Having now some images (3 or 4) 'best fitted' is it possible to find the best ... something like 'the most probable pixel' of the series to produce the most probable best image ???
Thanks in advance

Pascal

1) If one image is smaller than the other, then you can use compare -metric rmse -subimage-search largeimage smallimage resultimage to get the best match (or my script normcrosscor that works in the FFT domain). Or you can write your own script to do simple cross-correlate in the FFT domain.

see viewtopic.php?f=1&t=14613&p=51076&hilit ... ric#p51076
and
http://www.fmwconcepts.com/imagemagick/ ... mcrosscorr

2) Is very hard and I know of no way to tell which is best? Presumably you need to average each image or take the median between each image on a pixel by pixel basis. See -evaluate-sequence mean or median at http://www.imagemagick.org/script/comma ... e-sequence.

PS. the images will need to be different sizes for 1) and the same size for 2). So you will need to crop appropriately.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Merge nearly same images into a better one

Post by anthony »

Really the problem more aligning the various images so you can then 'average' or some how merge the images correctly.

This can be tricky, especially if the image size and distortions can vary a bit.

I'd like to see what others have to say first.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply