Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: sub-pixel shifting of a matrix
Date: Thu, 25 Feb 2010 06:02:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 10
Message-ID: <hm53ot$ig8$1@fred.mathworks.com>
References: <h8ss9r$jhf$1@fred.mathworks.com> <h8svoe$rkb$1@fred.mathworks.com> <hm3fkm$c2u$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1267077725 18952 172.30.248.35 (25 Feb 2010 06:02:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 25 Feb 2010 06:02:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2232754
Xref: news.mathworks.com comp.soft-sys.matlab:611470

interp2 works well alright (thanks shalin mehta) but it fills the shifted region of the matrix with NaNs. may be it can be padded by copying the adjacent columns or rows, as the case may be, using 'padarray' function. but again this loop takes longer time. especially when you are dealing with series of matrices/images to be shifted in a loop as Mat also points out. 

@Mat
does conv2 work for fractions >1?? but even this, i guess,  leaves the shifted column (for shift in x direction) in shambles. 

Wish we could have something like 'circshift' handle fractions along with integers. :(

I need to shift an image by say 6.3 pixels in x direction in such a way that as if only the object in the image has moved and the background is retained as it is. and i need to implement it in a loop for several images with varying values of shift in x direction. so needless to say the faster the better as the original post has asked for.

thanks.