Search All of the Math Forum:

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

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

 Messages: [ Previous | Next ]
 Matt J Posts: 4,997 Registered: 11/28/09
Re: sub-pixel shifting of a matrix
Posted: Feb 6, 2013 5:33 PM

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <keubvt\$fki\$1@newscl01ah.mathworks.com>...
> "Paulus Potter" wrote in message <keuaof\$amu\$1@newscl01ah.mathworks.com>...
> > It should be:
> >
> > Image=conv2(Image,[sx, 1-sx],'same');
> > Result=conv2(Image,[sy; 1-sy],'same');
> >

>
> This is about twice faster
> Result=conv2(Image,[sy; 1-sy]*[sx, 1-sx],'same');

Maybe, but only because there are some funny sub-optimal things happening inside conv2 implementation-wise, and because the interpolation kernel here happens to be small. There's no way the 3rd version below should be the slowest.

Image=rand(2000);
kx=rand(1,10);
ky=rand(10,1);

tic;
Image=conv2(Image,kx,'same');
Result=conv2(Image,[sy; 1-sy],'same');
toc
%Elapsed time is 0.045940 seconds.

tic;
Result=conv2(Image,ky*kx,'same');
toc
%Elapsed time is 0.090292 seconds.

tic;
Result=conv2(kx , ky, Image,'same');
toc
%Elapsed time is 0.162708 seconds.

Date Subject Author
9/17/09 Shalin Mehta
9/17/09 Shalin Mehta
10/30/09 Dumebi Okwechime
2/24/10 Shalin Mehta
2/24/10 Matt J
2/25/10 Rajesh
2/25/10 Matt J
2/25/10 Matt J
2/26/10 Rajesh
2/6/13 Bruno Luong
2/6/13 Matt J
2/6/13 Bruno Luong
2/7/13 Matt J
2/7/13 Bruno Luong