Asked by Fabo
on 2 Apr 2013

How can I find the translations in the x & y coordinates in order to align edge detected images. I have 3 edge detected images and I want to align the second and third parts(G&R) to the first(B).

How can I do this using the 'circshift' function. As I want to Use the sum of squared difference metric to measure how well images match:

Sum of squared differences: sum( (image1-image2).^2 )

I want to record the displacements in x&y that were used to align the parts for each image

*No products are associated with this question.*

Answer by Image Analyst
on 2 Apr 2013

Your method will be, well, let's say "suboptimal." You might want to give imregister() a try. You can run it on either on the original images or the edge detected output images.

Image Analyst
on 3 Apr 2013

Answer by Sean de Wolski
on 2 Apr 2013

doc imregister

I have also found this one to be very fast and efficient:

It does not minimize the sum of squared differences, though. It instead maximizes the normalized cross power spectrum.

Implementing your own minimization of SSD should be fairly straight forward, simply a `for`-loop over a few different ranges.

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 1 Comment

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/69580#comment_140772

circshift is unlikely to be correct for this purpose.

Please give us a sample. http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers