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 ]
Dumebi Okwechime

Posts: 1
Registered: 10/30/09
Re: sub-pixel shifting of a matrix
Posted: Oct 30, 2009 6:07 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi Shalin,

Was wondering what your input parameters were when using interp2.
Thanks

Dumebi

"Shalin Mehta" <shalinDOTmehtaHATESSPAM@gmail.com> wrote in message <h8svoe$rkb$1@fred.mathworks.com>...
> Just found a useful solution: Use interp2 with '*linear' option. Works factor of 2.5 faster than imtransform. Any other ideas?
>
> best
> shalin
> "Shalin Mehta" <shalinDOTmehtaHATESSPAM@gmail.com> wrote in message <h8ss9r$jhf$1@fred.mathworks.com>...

> > 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]);
> > shifteddata=imtransform(data,T,'bilinear','XData',xdata,'YData',ydata);
> >
> > 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?
> >
> > best
> > Shalin




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.