The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: sub-pixel shifting of a matrix
Replies: 14   Last Post: Feb 7, 2013 12:23 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Shalin Mehta

Posts: 6
Registered: 9/17/09
sub-pixel shifting of a matrix
Posted: Sep 17, 2009 4:34 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello world,

I have data defined over a grid, e.g.
[xx yy]=meshgrid(-1:0.1:1); %each pixel represents distance of 0.1
data=xx.^2+yy.^2 ;

I need to translate this data by sub-pixel distances which will inevitably involve interpolation. I can live with linear interpolation as the data is sampled quite finely. I am using imtransform to achieve this. The shifted-data need to be obtained only over the original grid. I want extrapolated locations to be zero.

xshift=0.235; yshift=-0.95; %Since shift is finer than sampling, sub-pixel shifting is required.
xdata=[1 wt];
ydata=[1 ht];
T=maketform('affine',[1 0 0; 0 1 0; xshift yshift 1]);

Results are satisfactory but slow as this shifting happens in the inner-most loop.
Can anyone suggest a method that involves direct indexing and hence would be faster? Any neat algorithm published in the literature for sub-pixel translation?


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.