Hello and welcome back. One of the fun things of this week is

that we are learning a lot of background material.

While the background material is important for image processing, it's

important for many other disciplines. For example, in the previous video we

learned about level sets. Level sets are important in image

processing to the curve evolution like active contours as we have seen numerous

examples last week. We saw a few this week and we are going

to see more even in the next coming videos.

Another topic that is very important in mathematics and is also important in

image processing is the calculus of variations.

And that's what we're going to be talking right now in this video.

And then in the next video we're going to see an example of that for image

denoiseing and image enhancement. So what is calculus of variations?

The idea is very simple, because it's an extension of finding extrema of

functions. But now we are going to be finding

extrema of functionals. And what do I mean by that?

We're going to have images like you. And.

It's derivatives. So this is going to be an image for us.

And we're going to be looking at minimizing a function of the image.

Might be the image is square, might be the gradient of the image, might be the

Laplacian of the image. So we're going to be trying to find

what's the image that minimizes that function in the same way that we tried to

find, what's the point that minimizes a given function.

For example, if I draw this function then you say oh, this is the point that

minimizes it. But here, U is by itself what we are

looking for. So we are not looking for a coordinate,

we are looking for a function that minimizes this.

This is going to be very clear even in the next slide with an example.

And we are going to make all the connection of the minimization of

function X with the minimization of functions.

Now, we're going to discuss in a couple of minutes that a condition for U to be a

minimizer of this is to hold. This equation which is called the

Euler-Lagrange equation and this is the type of partial differential equation

that we are going to be solving in image processing.

Let me illustrate a bit more about this and then how we came to this equation

which is completely parallel to the minimization of regular functions that we

are away from regular standards in calculus.

So let's just illustrate, first of all, what do I mean by a functional.

Let's assume that I'm giving two points. And I am asking you what's the curve

connecting these two points that has the minimum length.

So I am asking you for the function of that curve, the minimizer is going to be

a function, not a point. The length of.

Any curve, absolutely. Any curve connecting these two points is

basically written here. The curve is parameterized as X Ux, we

know about that, that's the particular case of that parameterization for

basically any curve that goes. And connect those points.

the length is. As we know, the derivative of the first

coordinate squared so that's one squared derivative of the second coordinate

squared. So it's this function that we are going

to try to optimize. We already know what a function that

minimizes the length between two points. It's a straight line.

But let's see how we get that. You see calculus offers variations, so

I'm trying to find U connecting these two points.

This is the condition for a function to be a minimizer of this function.

So it's that integral over a function of functions.

We haven't arrived at it yet, but we're going to discuss it in a few slides that

this is what happened. So F is square root of one plus UX

squared. So if you just do the numbers and takes,

you take this and do the derivative according to U minus the derivative that

is written here, you get this expression. So this expression is nothing else than

applying this to f as written here. Now this equal to zero is a condition for

the particular U we are looking for to solve the problem that we are searching

for, meaning the minimizer of the length connecting these two points.

Now we have this equals zero, the denominator doesn't matter.

In when we have eight over B equal zero when its to be equal zero is U, so U

double derivative equal zero, that means that the first derivative is constant and

then is that the function is 8X plus B that's a straight line.

And A and B are found by what's called the boundary conditions.

We know that it has to go through these points.

So if I replace here X by a zero, I have to get this point and if I replace by X

one, I have to get this point and in that way, I get A and B.

So we see that for length, the function that basically solves the Euler-Lagrange,

and that's a necessary condition, is a straight line.

So basically, if we take this curve here, it will have certain length.

But actually, the one that minimizes is not this because this is not a straight

line. The one that minimizes is this one.

So, a function to be a minimizer has to haul the Euler-Larange equation.

Why is that important, and how do we get to the Euler-Lagrange equation?

Let us go for a second back to regular functions, and how we find the minima of

a regular function. So you might not remember exactly how we

do that. But you do remember the result, which is

going to explain next. The basic idea is, you have a function.

And you have the function around a certain point.

And you do a small perturbation of that function.

And you take the derivative according to that perturbation.

And the condition for a point to be a maximum or a minimum is that when you do

any perturbation, the derivative is equal to zero.

If you compute the derivative according to the permutation, you get this, and

this has to hold for every n. So the derivative of the function for

every end has to be equal zero which means that this has to be zero, and we

know that. We know that the condition of a point to

be an extreme of a function is that it's derivative have to be equal to zero.

Now why is that so important? We know that but why is that so

important? Because then I can write this

differential equation. Xt so I can make X change in the

direction of minus the derivative and that basically says that you start from a

point and your next point, because X is changing in time, it just, you move a bit

in the direction of the derivative of the function.

Remember, derivative is tangent so you move a bit to the next spot.

This is how you move. Your next point is this point minus a

tiny step in the direction of the derivative.

That's what this equation is telling us. Because if we were to discretize this

equation, we get that, that. X.