Skip to content

Subpixel shifting a delta peak #47

@roflmaostc

Description

@roflmaostc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions