No BSD License  

Highlights from
Efficient subpixel image registration by cross-correlation

5.0

5.0 | 20 ratings Rate this file 145 Downloads (last 30 days) File Size: 231.98 KB File ID: #18401

Efficient subpixel image registration by cross-correlation

by Manuel Guizar

 

21 Jan 2008 (Updated 21 Jan 2008)

Registers two images (2-D rigid translation) within a fraction of a pixel specified by the user.

| Watch this File

File Information
Description

Registers two images (2-D rigid translation) within a fraction of a pixel specified by the user. Instead of computing a zero-padded FFT (fast Fourier transform), this code uses selective upsampling by a matrix-multiply DFT (discrete FT) to dramatically reduce computation time and memory without sacrificing accuracy. With this procedure all the image points are used to compute the upsampled cross-correlation in a very small neighborhood around its peak. This algorithm is referred to as the single-step DFT algorithm in [1].

[1] Manuel Guizar-Sicairos, Samuel T. Thurman, and James R. Fienup, "Efficient subpixel image registration algorithms," Opt. Lett. 33, 156-158 (2008).

Please refer to the attached HTML for more details and a sample implementation.

Acknowledgements
This submission has inspired the following:
Automatic 2d Rigid Body Image Registration, STXM data analysis script collection - STACKLab
MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (37)
28 Jan 2008 Chris Cookson

easy to use, extremely fast, and easy to use. amazing work.

28 Jan 2008 Chris Cookson

did i mention it was easy to use?

12 Feb 2008 Matt Sochor

Very good and excellent documentation to get you started with the syntax. Great job and thanks for including the paper reference.

03 Mar 2008 Jiang Jun

Thank you for you job, I will enjoy it.

27 Apr 2008 Zhi Zhang

Excellent Work!

23 Feb 2009 Robert Reed

Elegant solution in simple understandable code + sound documentation.

23 Feb 2009 Petter

Always nice to see a published .m, but the images tell us nothing. A zoomed in display, abs error or something would be more relevant than two identially looking images.

23 Feb 2009 Robert Reed

Is this method less robust to noise than standard upsampling?

26 Feb 2009 Chaos

works but i had to re=write code for UINT16 images, very fast and accurate.

26 Feb 2009 Chaos

works but i had to re=write code for UINT16 images, very fast and accurate. why are you using double? do you really need that accuracy in the dft?

26 Feb 2009 Chaos

 forgot to rate. wow this code is brutally fast and accurate, if you define a ROI even faster. this code needs some kind of award. how much faster would it be if it was compiled in to a mex?

20 Apr 2009 Manuel Guizar

Thanks to everyone for the positive comments! The published M-file is intended to get the user started with the syntax and explain what the code does. For technical documentation please refer to the reference above [1] and references within.

20 Apr 2009 Manuel Guizar

This method is equally robust to noise as the standard FFT upsampling, but much faster. It computes the same upsampled cross correlation but only in a small neighborhood around the peak.

05 May 2009 Tobias Henn

Great Work - fast and accurate!!!

27 Jul 2009 Lucas Koorneef

Works right out of the box. Thanks for sharing !

28 Jul 2009 Eric

Tremendously useful! Thanks very much.

12 Oct 2009 su su

I want to register the pair of visible and theraml images with this one, but I don't get the required resutl.

16 Oct 2009 Raymond Cheng

Thanks for your sharing.

15 Dec 2009 Sean

Is there a way to extend this to 3D CT images?

Thank you!

02 Mar 2010 Rob Campbell

Wonderful. Fast and accurate.

14 Jul 2010 Alex

Code registers images very well. Question about the supplementary output:
output = [error,diffphase,net_row_shift,net_col_shift]

On my data it seems that some times the row_shift variable seems to 'wrap around' in away that is not intuitive. For example though the data is only 512 pixels wide, I get row shifts of -512.3, 1024.3 etc which I assume are actually very small pixel shifts that have a somewhat random multiple of the image size thown on for fun.

18 Jul 2010 Phillip

Great code. Any plans to extend to cover angular rotations and scale shifts as well? (e.g. Fourier Mellin transform)

26 Jul 2010 Alex

Re: my comment on 14 Jul 2010:
I owe an apology. It seems at the point when I wrote my comment I was feeding an accidentally reshaped array into the code. Because of the artifacts in my data, it caused a wrap around artifact in the output (and the registration worked in one axis only, but I didn't notice because that happened to be the axis containing almost all of the shifts).

Great code - no resrvations! Thanks much.

--Alex.

03 Aug 2010 Yu Yinghuai

Great work! Question about the codes " kernr=exp((-i*2*pi/(nr*usfac))*( [0:nor-1].' - roff )*( ifftshift([0:nr-1]) - floor(nr/2) )) " :
Why does the vector [0:nr-1] need be ifftshift ?

01 Sep 2010 Nafise b

Thanks for your code.
I want to work with your code, but I have a problem with it.
In fact, my images are 2 blocks which don't have the same size, and I want to find the best place for small block in the big block.
Something that I got from your code is for your code 2 images have same size.
What should I do now, if I want to use your code for subpixel image registration?

Best regards,
Nafise

01 Sep 2010 Sean de

Nafise b, pad your smaller image with zeros so that it is the same size.

01 Sep 2010 Nafise b

ThX sean,
I did it, but it is not true, because my image has black regions, and it determines that part with zero pad part.
WHAT SHOULD i DO NOW?!

01 Sep 2010 Sean de

Nafise, post your situation/goals, your images, and what you've tried to the newsgroup (http://www.mathworks.com/matlabcentral/newsreader/). From there people can help you.

01 Sep 2010 Nafise b

ThX, I did it, hopefully some one answer me.

08 Sep 2010 Yan G  
16 Nov 2010 Aron Sceidt

can this be applied to colour images in some way?

28 Jan 2011 Michael

do images need to be square - as in 2^n for the fft shift to work properly?

15 Jun 2011 Rui  
15 Jun 2011 Rui

works very well. i'm amazed with the speed and accuracy of the algorithm.

thanks manuel!

24 Jun 2011 Greg  
24 Jun 2011 Greg

Great algorithm, it has helped so much with my image stabilization project

24 Nov 2011 Daniel

wow, that one is really fast and seems to be robust. thanks a lot!

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
geometric transformation Manuel Guizar 22 Oct 2008 09:43:20
image registration Manuel Guizar 22 Oct 2008 09:43:20
image Manuel Guizar 22 Oct 2008 09:43:20
alignment Manuel Guizar 22 Oct 2008 09:43:21
registration Manuel Guizar 22 Oct 2008 09:43:21
subpixel Manuel Guizar 22 Oct 2008 09:43:21
cross Manuel Guizar 22 Oct 2008 09:43:21
crossco Manuel Guizar 22 Oct 2008 09:43:21
correlation Manuel Guizar 22 Oct 2008 09:43:21
alignment Liu weihao 04 Aug 2009 23:07:51
image registration kumar kaushal 11 Aug 2009 01:03:13
registration Mike Hofer 25 Feb 2010 06:42:35
image Ruello Rubino 05 May 2010 04:06:51
correlation Phillip 16 Aug 2011 11:33:38

Contact us at files@mathworks.com