As extension of this question, I was wondering what would be the Euler-Lagrange equations associated with the functional
$$ E(u) = \frac{1}{2}\int_{\gamma} \lVert \nabla u \rVert^2 ds $$
The difference is that the integral is not defined in a region but on a curve, and the gradient $\nabla u$ in this case is defined by
$$ \nabla u = \begin{pmatrix} u_x(x,y) \\ u_y(x,y) \end{pmatrix} = \begin{pmatrix} u_x(x(t),y(t)) \\ u_y(x(t),y(t)) \end{pmatrix} $$
However the curve $\gamma$ is fixed, it's not the unknown, what I want to find is a function $u$ (or pixel values) defined on that curve.
So the argument of the integral is not $\mathcal{L}(x,y,u,u_x,u_y)$ but $\mathcal{L}(t,x,y,u,u_x,u_y)$ where $t$ is a the curve parameter and $x = x(t),y = y(t)$ are known functions of $u$, but I'm totally confused how to derive the EL equations in this case.
The clue I had was to substitute the gradient with the directional derivative, but I want to consider the whole region sorrounding the curve $\gamma$ which I would be missing.
Here $ds = \sqrt{x'^2 + y'^2} dt$.
Can anyone help me out working out the math?
Just an observation, it might be possible that maybe what I want is actually minimizing the functional
$$ E(u) = \frac{1}{2} \int_{\gamma} | \left\langle \nabla u, d \gamma \right\rangle | $$
Because my functional depends on the gradient defined on the curve, so I guess directional derivative is more natural.
Thank you
Maybe I have made a small progress, first of all I observe that if $\gamma = \gamma(t), t \in [a,b]$ I have
$$ E(u) = \frac{1}{2} \int_a^b | \left\langle \nabla u, d\gamma \right\rangle | = \frac{1}{2} \int_a^b | du | = \frac{1}{2} \int_{a}^{b} | u' | dt = \int_{a}^b \mathcal{L}(u') dt $$
Now I can apply the EL equations for single variable, single function
$$ \frac{d \mathcal{L}}{du} - \frac{d}{dt} \frac{d \mathcal{L}}{du'} = 0 $$
Using distributional derivatives and the fact that $\mathcal{L} = \mathcal{L}(u')$ I get
$$ 0 = \frac{d \mathcal{L}}{du} - \frac{d}{dt} \frac{d \mathcal{L}}{du'} = - \frac{d}{dt} \frac{d \mathcal{L}}{du'} = -\frac{1}{2}\frac{d}{dt} sgn(u') = - \delta(u') u'' \Rightarrow \delta(u') u'' = 0 $$
Therefore with appropriate boundary conditions I need to solve
$$ \delta(u') u'' = 0 $$
However now since I have the dirac delta in the equation I'm not sure how I can get rid of it.
I believe there're two ways to set up this problem (which I guess would provide similar results anyway).
Suppose $\gamma$ is a simple parametric open curve (with uniform parametrization), we want to find $u$ such that the integral
$$ E(u) = \frac{1}{2} \int_{\gamma} | \left\langle \nabla u, \hat{t} \right\rangle | ds $$
is minimized, here $\hat{t} = \hat{t}(s)$ denotes the unit tangent vector in $\gamma$ at coordinate $s$, we observe that
$$\left\langle \nabla u, \hat{t} \right\rangle = \frac{du}{ds}$$
(because of the total derivative). Therefore the energy function might be rewritten as
$$ E(u) = \frac{1}{2} \int_{\gamma} | \left\langle \nabla u, \hat{t} \right\rangle | ds = \frac{1}{2} \int_{a}^{b} |u'| ds = \int_{a}^{b} \mathcal{L}(u')ds $$
the Euler Lagrange equations are given by
$$ 0 = \frac{\partial \mathcal{L}}{\partial u} - \frac{d}{ds}\frac{\partial \mathcal{L}}{\partial u'} = - \frac{1}{2} \frac{d}{ds} sign(u') = - \frac{1}{2} \frac{d}{ds} sign\left(\left\langle \nabla u, \hat{t} \right\rangle \right) $$
such equation with appropriate boundary conditions allow to solve the problem.
A similar problem is to minimize the integral
$$ E(u) = \frac{1}{2} \int_{\gamma} \left| \left\langle \nabla u, \hat{t} \right\rangle \right|^2 ds = \frac{1}{2} \int_a^b \left| u' \right|^2 ds = \int_{a}^{b} \mathcal{L}(u') ds $$
The Euler lagrange equations in this case are given by
$$ -\frac{d}{ds} \left\langle \nabla u,\hat{t} \right\rangle = 0 $$
And with appropriate boundary conditions even in this case we can solve the problem. Boundary conditions are given by some conditions fixed at the extremes of the curve, namely $\gamma(a)$ and $\gamma(b)$.
Implementing the second case should be very straight forward since it would involve setting up a linear system with appropriate boundary conditions, the directional derivative can be computed using the sobel operators multiplied by the weights given by the tangent unit vector $\hat{t}$.