Lucas-Kanade-Algorithm in 1D I am trying to get a simple implementation of Lucas-Kanade-Algorithm in 1D using a sigmoid function just as an arbitrary choice!

In the following code i want to get the displacement $v$ of the two sigmoid-functions using the iterative method proposed in LK-paper!

but the problem is that $v$ is not converging to the real displacement value!
Can you tell what am i doing wrong?

by the way the code below is written in Julia.

x = linspace(-5, 5, 100)
λ = 1
dt = 0.5  # the real displacement
σ(t) = 1 ./ (1 + e.^(- λ .* t)) # sigmoid
dσ(t) = λ .* σ(t) .* (1 - σ(t)) # sigmoid derivative
g(t) = σ(t - dt) # shifted sigmiod

x0 = 0   # displacement at the center of coordinate system (0, 0)
v = 0    # displacement vlaue, should converge to dt
x = x0
# now starting with newton-mthod iterations
for i=1:5
    I_t = σ(x) - g(x) # temporal derivative
    I_x = dσ(x0)  # spatial derivative does not change
    v = v - (I_t/I_x)
    x = x + v
    print("$(v) \n")
end
Ok, get the solution, the sigmoid-funtion should be updated during the iterations:

x0 = 0
v = 0
# now starting with newton-method iterations
for i=1:10
    I_t = σ(x0 + v) - g(x0) # temporal derivative !!! sigmoid-function should be updatetd here
    I_x = dσ(x0)  # spatial derivative does not change
    v = v - (I_t/I_x)
    print("$(v) \n")
end