# Ascertaining the Ideality of Photometric Stereo Datasets under Unknown Lighting
## 5 Numerical Experiments  
To investigate the effectiveness of Algorithms 1 and 2, we implemented them in the MATLAB programming language. The two functions are available from the authors upon request and will be included in the MATLAB toolbox presented in [15]. The same toolbox, available at the web page [[https://bugs.unica.it/cana/software/](https://bugs.unica.it/cana/software/)]([https://bugs.unica.it/cana/software/](https://bugs.unica.it/cana/software/)) (accessed on 28 July 2023), was also used to compute the 3D reconstructions. We initially apply the two methods to a synthetic dataset, first considered in [15]. The analytical expression \(z=u(x,y)\) of the observed surface, displayed in the left-hand pane of Figure 3, is fixed a priori, and a simple white and gray image is texture mapped to it. The synthetic images are obtained by applying the PS forward model to the surface. The images displayed on the right of Figure 3 were produced by choosing a set of nine lighting directions. In this case, the light sources were located at an infinite distance from the target, but the model allows choosing the lighting distance using the width \(A\) of the domain \(\Omega\) (see (1)) as a unit of measure. We used the dataset reported in Figure 3, with lights at infinity and no noise, substituting the third image with one obtained with a light source at distance \(\delta A\), for \(\delta=10,8,6,4,2\). We also contaminated this image with Gaussian noise having mean value zero and standard deviation 0.1. This produces a dataset where the only unideal image is the number 3. The blue thick line in Figure 4 represents the relative error  
\[E(\delta)=\frac{\|u(x,y)-\tilde{u}(x,y)\|_{\infty}}{\|u(x,y)\|_{\infty}},\]  
where \(\|u(x,y)\|_{\infty}=\max_{(x,y)\in\Omega}|u(x,y)|\), \(u(x,y)\) is the model surface, and \(\tilde{u}(x,y)\) is the reconstruction obtained by processing the whole dataset, where the third light source is at distance \(\delta A\). The other three lines represent the error obtained by processing a reduced dataset, according to the recommendation of Algorithm 1 (Algo1), the fast version of the same method (Algo1-F), and Algorithm 2 (Algo2). Figure 3: The synthetic dataset used in the experiments is generated by applying the PS forward model to the surface displayed on the left, with a discretization of size 101 \(\times\) 101; the images reported on the right are obtained by choosing 9 different light orientations. It can be seen that, while the error corresponding to the whole dataset increases as \(\delta\) decreases, the two versions of Algorithm 1 identify a subset for which the error is reduced, when the light source is very close. Indeed, both versions select Image 3 as the first to be removed, while the fast version (incorrectly) also excludes Image 1 from the dataset. On the contrary, Algorithm 2 fails, as it excludes Images 5 and 6, leading to a larger error. The fast version of Algorithm 2 leads to even worse results. While the first experiment was concerned with the case of a perfect Lambertian reflector illuminated by a close light source, in the second one we investigate the case of a non-Lambertian surface with lights at almost infinite distance from it. The _Shell3_ dataset, displayed in Figure 5, was used for the first time in [20]. A preliminary version of the dataset has been considered in [15]. The pictures were obtained by placing a seashell, approximately 10 cm wide, on a rotating platform in the open air. The same platform holds a tripod with a camera observing the shell from above, at a distance of about 1 m (see [20]). Twenty images were taken by letting the platform rotate clockwise under direct sunlight. Figure 4: Relative errors in the \(\infty\)-norm, obtained by processing either the whole synthetic dataset or the reduced datasets suggested by the algorithms under scrutiny; \(\delta A\) is the distance of the light source from the object.