# Ascertaining the Ideality of Photometric Stereo Datasets under Unknown Lighting
## 2 A Review of the Hayakawa Procedure for Determining the Light Position  
In this section, we briefly review the mathematical model implementing [PERSON]'s law that is usually adopted in photometric stereo under the assumption of orthographic projection and light source at an infinite distance from the target (see [15] for more details). We also outline the Hayakawa procedure [14] for estimating the lighting directions from the data. Let us associate an orthonormal reference system to \(\mathbb{R}^{3}\) and assume the observed object is located at its origin. The optical axis of the camera coincides with the \(z\)-axis, and the point of view is at infinite distance, to ensure orthographic projection. The camera has a resolution of \((r+2)\times(s+2)\) pixels, and is associated with the rectangular domain \(\Omega=[-A/2,A/2]\times[-B/2,B/2]\), where \(A\) is the horizontal size of the rectangle and \(B=(s+1)h\), with \(h=A/(r+1)\). The domain discretization consists of a grid of points with coordinates \((x_{i},y_{j})\), for \(i=0,\ldots,r+1\) and \(j=0,\ldots,s+1\), given by  
\[x_{i}=-\frac{A}{2}+ih,\qquad y_{j}=-\frac{B}{2}+jh. \tag{1}\]  
The surface of the object is represented by a bivariate explicit function \(z=u(x,y)\), \((x,y)\in\Omega\), whose partial derivatives are denoted by \(u_{x}\) and \(u_{y}\). Then, the gradient of \(u\) and the (normalized) normal vector to each point of the surface are defined as  
\[\
abla u(x,y)= \begin{bmatrix}u_{x}\\ u_{y}\end{bmatrix} \qquad\text{and}\qquad\mathbf{n}(x,y)=\frac{[-u_{x},-u_{y}, 1]^{T}}{\sqrt{1+\|\
abla u\|^{2}}},\]  
respectively, where \(\|\cdot\|\) denotes the 2-norm. All functions are discretized on the grid, and their values are stacked in a vector in lexicographic order, that is, according to the rule \(k=(i-1)s+j\), where \(k=1,\ldots,p\), and \(p\) denotes the number of pixels in the image. We will write indifferently \(u(x_{i},y_{j})\), \(u_{i,j}\), or \(u_{k}\), and similarly for \(u_{x}(x_{i},y_{j})\), \(u_{y}(x_{i},y_{j})\), and \(\mathbf{n}(x_{i},y_{j})\). The images in the dataset are stacked in the vectors \(\mathbf{m}_{t}\in\mathbb{R}^{p}\), \(t=1,\ldots,q\). In each of the pictures, the target is illuminated by a light source located in a different direction. We denote the vector that points from the object to the light source by \(\boldsymbol{\ell}_{t}=[\ell_{1t},\ell_{2t},\ell_{3t}]^{T}\), with \(t=1,\ldots,q\). Its 2-norm is proportional to the light intensity. To simplify notation, in the following, we assume the light vectors to be normalized, that is, \(\|\boldsymbol{\ell}_{t}\|=1\). Assuming that the observed surface is a Lambertian reflector, we state [PERSON]'s cosine law in the form  
\[\rho(x,y)\langle\mathbf{n}(x,y),\boldsymbol{\ell}_{t}\rangle=I_{t}(x,y), \qquad t=1,\ldots,q, \tag{2}\]  
where \(\langle\cdot,\cdot\rangle\) is the standard inner product in \(\mathbb{R}^{3}\), and the albedo \(\rho(x,y)\) accounts for the partial light absorption of the surface, due to its color or material. After discretization, Formula (2) reads  
\[\rho_{k}\mathbf{n}_{k}^{T}\boldsymbol{\ell}_{t}=m_{kt},\qquad k=1,\ldots,p,\ t=1, \ldots,q, \tag{3}\]  
where \(m_{kt}\) represents the \(k\)th component of the image vector \(\mathbf{m}_{t}\), that is, the radiation \(I_{t}(x_{i},y_{j})\) reflected by a neighborhood of the \(k\)th pixel in the image number \(t\).