Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University 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 ]
Matt J

Posts: 4,992
Registered: 11/28/09
Re: sub-pixel shifting of a matrix
Posted: Feb 6, 2013 5:33 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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.



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.