FourierTools.jl icon indicating copy to clipboard operation
FourierTools.jl copied to clipboard

Subpixel shifting a `delta` peak

Open roflmaostc opened this issue 1 year ago • 5 comments

Hi,

a single pixel in the digital domain should correspond to a sampled sinc function in the center, right?

But why is the following not the same. sinc(x .- 0.5) is not equal to shift(x, 0.5)

julia> sinc.([-2, -1, 0, 1, 2])
5-element Vector{Int64}:
 0
 0
 1
 0
 0

julia> FourierTools.shift([0.0,0,1,0,0],0.0)
5-element Vector{Float64}:
 0.0
 0.0
 1.0
 0.0
 0.0

julia> sinc.([-2, -1, 0, 1, 2] .- 0.5)
5-element Vector{Float64}:
  0.12732395447351627
 -0.2122065907891938
  0.6366197723675814
  0.6366197723675814
 -0.2122065907891938

julia> FourierTools.shift([0.0,0,1,0,0], 0.5)
5-element Vector{Float64}:
  0.20000000000000007
 -0.24721359549995797
  0.6472135954999579
  0.647213595499958
 -0.24721359549995797

julia> FourierTools.shift([0.0,0,1,0,0], 1)
5-element Vector{Float64}:
 -8.881784197001253e-17
  0.0
  0.0
  1.0
  8.881784197001253e-17

julia> sinc.([-2, -1, 0, 1, 2] .- 1)
5-element Vector{Int64}:
 0
 0
 0
 1
 0

roflmaostc avatar Oct 09 '24 14:10 roflmaostc