3
$\begingroup$

Does anybody know of a way to shift data by a fraction of a sample by using sinc interpolation? For example, shift an image to the right by 0.1 pixels.

I'm struggling to find a formula or reference that explains how to generate such a kernel, and I already know how to do it in the frequency domain....

I'm thinking something like:

function kernel=subpixelshifter(shift)
trange=[-1,0,1]-shift;
kernel=lanczos3(trange);
end
function x=lanczos3(x)
bad= x>3;
x=sinc(x).*sinc(x/3);
x(bad)=0;
end
$\endgroup$
  • 1
    $\begingroup$ it's the Nyquist/Shannon/Whitaker sampling and reconstruction theorem. $\endgroup$ – robert bristow-johnson Mar 27 '15 at 15:15
  • 7
    $\begingroup$ This is also called a fractional delay filter. Generate a sinc(n-fraction) function, multiply it by a window (truncation causes artifacts), and convolve your signal with it. The longer the tails of the sinc function you include, the better the quality will be. $\endgroup$ – endolith Mar 27 '15 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.