Page 1 of 1

Morph and autoshift pictures

Posted: 2013-08-13T14:34:53-07:00
by flaschenpost

hopefully it is a common problem and I just have not found the entry to the common solution. I have a series of photos which are slightly shifted and rotated - the tripod was to unstable. I want to generate a movie from those 280 pictures.

From my understanding of image manipulation it should be easy to find the "features" of such photos, like certain edges and corners. So morphing should be possible not only by shifting the whole image to a new point, but by shifting the content (removing or adding borders) in a way to minimize the modification. Like:

Photo1: p
Photo2: R

So not moving the whole picture up, but just adding the new slash from "R". All that flickers should be near the borders, the background should not jerk.

I do not want a onehundret-and-first explanation, but I can just not find the entry points.

Thanks for any hint!


Re: Morph and autoshift pictures

Posted: 2013-08-13T14:58:27-07:00
by fmw42
see 3pt affine warp at

You will need to find some way to extract corresponding features in your pairs of images.

IM can do edge detection, but has no real feature detection. But see -morphology for corner detection ... rn_kernels

If all you want is to shift and no rotate, then you can use compare in -subimage-search mode to locate a smaller image inside a larger one. If all your frames are the same size, you need to pad one to twice each dimension so that there is room for the regular size image to be matched in all locations.


Re: Morph and autoshift pictures

Posted: 2013-08-13T15:05:02-07:00
by flaschenpost
Thanks for the quick info.

So basically I need a way to get information about the (strong and present) edges and corners, in a numerical way, so that I can try and shift/rotate my picture.

Is there a way to get some text-representation of the "edges"- Script? Optically that looks promising.


Re: Morph and autoshift pictures

Posted: 2013-08-13T16:08:17-07:00
by fmw42
you can convert the binary (or grayscale) edge image to txt format for further processing by other tools or the shell.


Re: Morph and autoshift pictures

Posted: 2013-08-21T06:14:48-07:00
by snibgo
Sorry, I've only just seen this thread.

I sometimes want to stabilise a hand-held video image, which is much the same problem.

I don't use feature extraction. Instead, I choose a number of fairly small rectangles in an image. (An array of 6x4 rectangles usually works well.) For each rectangle, I find where it exists on another image. A rather complex procedure eliminates false matches. This gives me a list of source/destination coordinates, which can be fed into "-distort perspective" or other distortion, so all the frames in the sequence match.

For the gaps at the edges introduced by the distortion, I simply "-compose Over" the distorted image over the master. The effect is almost invisible. I think I introduced an alpha-fade at the edge of the distorted image, further reducing the artifact.

I forget the exact details. Let me know here if you want further info.

Re: Morph and autoshift pictures

Posted: 2014-10-18T13:05:44-07:00
by nov.sela
Hi snibago

Can you share your code/project ?

I need to align 24 pictures in order to have smooth 360 deg pictures
Although I calibrated the cameras, I still have small alignment gaps between the cameras

I believe it can be done using script

I would appreciate your help


Re: Morph and autoshift pictures

Posted: 2014-10-18T19:12:30-07:00
by snibgo
My page gives the technique I use for aligning two similar images. Stabilising (aligning, de-jittering) a video is an extension of this.

The Hugin toolset provides tools for making a 360 degree panorama from a series of photos.