Combine into a cost function
•Path: p(1), p(2), … p(n).
•
Where
• d(p(j),p(j+1)) is distance between consecutive grid points (ie, 1 or sqrt(2).
• g(p(j)) measures strength of gradient
•l is some parameter
• f measures smoothness, curvature.