def _solve_sbl_multicore_impl(self, index): """ Implementation of Lambertian Photometric stereo based on sparse regression (Sparse Bayesian learning) Satoshi Ikehata, David P. Wipf, Yasuyuki Matsushita, Kiyoharu Aizawa: Robust photometric stereo using sparse regression. CVPR 2012: 318-325 :param index: an index of a measurement (row of M) :return: a row vector of surface normal at pixel index specified by "index" """ A = self.L.T b = np.array([self.M[index, :]]).T n = rpsnumerics.sparse_bayesian_learning( A, b) # row vector of a surface normal at pixel "index" return n.ravel()
def _solve_sbl(self): """ Lambertian Photometric stereo based on sparse regression (Sparse Bayesian learning) Satoshi Ikehata, David P. Wipf, Yasuyuki Matsushita, Kiyoharu Aizawa: Robust photometric stereo using sparse regression. CVPR 2012: 318-325 :return: None Compute surface normal : numpy array of surface normal (p \times 3) """ A = self.L.T self.N = np.zeros((self.M.shape[0], 3)) if self.foreground_ind is None: indices = range(self.M.shape[0]) else: indices = self.foreground_ind for index in indices: b = np.array([self.M[index, :]]).T n = rpsnumerics.sparse_bayesian_learning(A, b) self.N[index, :] = n.ravel() self.N = normalize(self.N, axis=1)