def estimateNormal(A_8U): h, w = A_8U.shape N0_32F = computeSilhouetteNormal(A_8U) A, b = normalConstraints(A_8U, N0_32F) N_flat = solveMG(A, b) N_flat = normalizeVectors(N_flat) N_32F = N_flat.reshape(h, w, 3) return N0_32F, N_32F
def normalizeImage(N_32F): N_flat = N_32F.reshape((-1, 3)) N_flat_normalized = normalizeVectors(N_flat) N_32F_normalized = N_flat_normalized.reshape(N_32F.shape) return N_32F_normalized