5.0

5.0 | 5 ratings Rate this file 7 Downloads (last 30 days) File Size: 1.54 KB File ID: #23440

2D Fourier shift

by Tim

 

26 Mar 2009 (Updated 11 Feb 2010)

Cyclically shift a 2D matrix or image using the Fourier shift theorem.

| Watch this File

File Information
Description

This shifts cyclically shifts an image or other 2D matrix by an arbitrary number of pixels (which can be fractional). I haven't tested it much but the code is very short so it should be easy enough to adapt.

Usage:

y = FourierShift(x, [delta_x delta_y])

x is the input matrix. y is the output. delta_x and _y are the shift amounts in each dimension.

It takes about 1s to run for a 1024x1024 image on my PC. There are faster ways to shift images, but probably not any simpler sub-pixel methods.

MATLAB release MATLAB 7.6 (R2008a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
14 Sep 2009 Wen-Tung Wang

Works great. Concise code.

19 Nov 2010 Mikhail Konnik

Thanks a lot - I was too lazy to write it :-)
But it seems that in this routine, delta_x means displacement in ROW, and delta_y is displacement in COLUMN. A little bit confusing, but never mind. Thanks again!

10 Dec 2011 Chad  
10 Dec 2011 Chad  
29 Dec 2011 Javi Martinez  
Please login to add a comment or rating.
Updates
11 Feb 2010

Added small fix for even-length signals.

Tag Activity for this File
Tag Applied By Date/Time
image Tim 27 Mar 2009 16:16:12
shift Tim 27 Mar 2009 16:16:12
fourier Tim 27 Mar 2009 16:16:12
rotate Tim 27 Mar 2009 16:16:12
sinc Tim 27 Mar 2009 16:16:12
2d Tim 27 Mar 2009 16:16:12
cyclic Tim 27 Mar 2009 16:16:12

Contact us at files@mathworks.com