Installing toolboxes and setting up the path.

You need to unzip these toolboxes in your working directory, so that you have toolbox_signal, toolbox_general and toolbox_graph in your directory.

For Scilab user: you must replace the Matlab comment '%' by its Scilab counterpart '//'.

Recommandation: You should create a text file named for instance numericaltour.sce (in Scilab) or numericaltour.m (in Matlab) to write all the Scilab/Matlab command you want to execute. Then, simply run exec('numericaltour.sce'); (in Scilab) or numericaltour; (in Matlab) to run the commands.

Forward Image Formation

We consider here a simplified imaging system where the camera performs an orthogonal projection and the lighting is orthogonal
to the camera focal plane and is at infinity. We also assume that the surface is perfectly diffuse (Lambertian).

For more information about the shape from shading problem, including more complicated settings, one can read the review paper

The issue is that this equation is ill-posed (several solution) due to the singular points \( (q_j)_{j \in J} \) where \(
L(q_j) \) is close to 1, so that \(W(q_j)\) is close to 0. A way to regularize the inversion is thus to choose the boundary
condition points \(p_i\) to be the singular points \(q_j\).

Set a tolerance \(\epsilon>0\).

epsilon = 1e-9;

We show in white the location of singular points \(q_j\), that satisfies \(L(q_j)>1-\epsilon\).

clf;
imageplot(L>1-epsilon);

Compute the Eikonal speed \(W\) (right hand side of the equation).

W = sqrt(1./L.^2-1);

To avoid too much ill-posedness, we threshold it.

W = max(W,epsilon);

Display the speed.

clf;
imageplot(min(W,3));

We use here a single point \( p \). Select the tip of the nose as base point \(p\).