Morph and autoshift pictures

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
flaschenpost
Posts: 2
Joined: 2013-08-13T14:24:09-07:00
Authentication code: 6789

Morph and autoshift pictures

Post by flaschenpost »

Hi,

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!

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

Re: Morph and autoshift pictures

Post by fmw42 »

see 3pt affine warp at http://www.imagemagick.org/Usage/distorts/#affine

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 http://www.imagemagick.org/Usage/morpho ... 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.

see
http://www.imagemagick.org/Usage/compare/
http://www.imagemagick.org/Usage/compare/#statistics
http://www.imagemagick.org/script/compare.php
flaschenpost
Posts: 2
Joined: 2013-08-13T14:24:09-07:00
Authentication code: 6789

Re: Morph and autoshift pictures

Post 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.

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

Re: Morph and autoshift pictures

Post by fmw42 »

you can convert the binary (or grayscale) edge image to txt format for further processing by other tools or the shell.

see
http://www.imagemagick.org/Usage/files/#txt
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Morph and autoshift pictures

Post 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.
snibgo's IM pages: im.snibgo.com
nov.sela
Posts: 1
Joined: 2014-10-18T12:52:39-07:00
Authentication code: 6789

Re: Morph and autoshift pictures

Post 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

Nov
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Morph and autoshift pictures

Post by snibgo »

My page http://im.snibgo.com/simpalign.htm 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.
snibgo's IM pages: im.snibgo.com
Post Reply