1
$\begingroup$

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

enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

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
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.