I take part in a lesson of Automatic Image Analysis in this semester. And here is my version of the solution of the 3rd. exercise.
The main task is to detectExtrema and Ridge from images.
My document(PDF format) of this task is below, if you have interest, maybe you can read it.
Homework 3. of Automatic Image Analysis – Extrema and Ridge Detection