1

Given are two monochromatic images of same size. Both are prealigned/anchored to one common point. Some points of the original image did move to a new position in the new image, but not in a linear fashion.

Below you see a picture of an overlay of the original (red) and transformed image (green). What I am looking for now is a measure of "how much did the "individual" points shift".

Two overlayed images (red and green), where some areas are shifted and other not.

At first I thought of a simple average correlation of the whole matrix or some kind of phase correlation, but I was wondering whether there is a better way of doing so.

I already found that link, but it didn't help that much. Currently I implement this in Matlab, but this shouldn't be the point I guess.

Update For clarity: I have hundreds of these image pairs and I want to compare each pair how similar they are. It doesn't have to be the most fancy algorithm, rather easy to implement and yielding in a good estimate on similarity.

Community
  • 1
  • 1
AnatraIlDuck
  • 283
  • 2
  • 8
  • maybe not ecaxtly what you need, but in this [Post](http://ch.mathworks.com/company/newsletters/articles/tracking-objects-acquiring-and-analyzing-image-sequences-in-matlab.html) they use regionprops to track one point – marco wassmer May 04 '16 at 12:26
  • Slide one image over the other, one step at a time, and evaluate the correlation at each step. Compare the values and the largest is the most matching one, from which you can tell how far is the original image shifted. The problem is if it is not a linear shifting then you need a carefully designed "sliding" method. – Yvon May 04 '16 at 16:04
  • so your idea works only for linear transformation (which will act globally). However I am looking for a local solution, something like optical-flow analysis/elastic model. I am aware that I could just do a phase correlation with small areas of the original picture, but is there a better way? – AnatraIlDuck May 04 '16 at 17:41

2 Answers2

1

An unorthodox approach uses RASL to align an image pair. A python implementation is here: https://github.com/welch/rasl and it also provides a link to the RASL authors' original MATLAB implementation.

You can give RASL a pair of related images, and it will solve for the transformation (scaling, rotation, translation, you choose) that best overlays the pixels in the images. A transformation parameter vector is found for each image, and the difference in parameters tells how "far apart" they are (in terms of transform parameters)

This is not the intended use of RASL, which is designed to align large collections of related images while being indifferent to changes in alignment and illumination. But I just tried it out on a pair of jittered images and it worked quickly and well. I may add a shell command that explicitly does this (I'm the author of the python implementation) if I receive encouragement :) (today, you'd need to write a few lines of python to load your images and return the resulting alignment difference).

welch
  • 936
  • 8
  • 12
  • thank you, that comes very close. I am going to try this. Will I be able to see how each pixel has moved? (e.g. old pixel vector mapping to new pixel vector) – AnatraIlDuck May 05 '16 at 11:42
  • also I see the Matlab implementation relies on the image toolbox which I do not have by hand unfortunately. I am going to check the python implementation – AnatraIlDuck May 05 '16 at 14:13
  • Yep! I don't have a matlab license either, hence the python version. You'll want a different calling signature for this use (something that directly returns transform parameters). Contact me directly if you have questions, I'd like to see this work for you. – welch May 05 '16 at 16:39
  • thanks, however I am working behind a proxy and do not have the local privileges to get python properly to work. This would cost me lots of time and considering that it is not yet 100% what I was looking for, I think I won't follow that route further. Thank you very much for your help! – AnatraIlDuck May 06 '16 at 15:20
0

You can try using Optical Flow. http://www.mathworks.com/discovery/optical-flow.html .

It is usually used to measure the movement of objects from frame T to frame T+1, but you can also use it in your case. You would get a map that tells you the "offset" each point in Image1 moved to Image2. Then, if you want a metric that gives you a "distance" between the images, you can perhaps average the pixel values or something similar.

  • that's a good point to start further research. However I do have only basic matlab without any toolboxes available, so an algorithm itself might be helpful – AnatraIlDuck May 04 '16 at 16:32