diff --git a/docs/slides.md b/docs/slides.md index af2d4b8..b600eba 100644 --- a/docs/slides.md +++ b/docs/slides.md @@ -53,7 +53,7 @@ $\mathcal{V}_t = \{ \textbf{Q} \in \mathbb{R}^3, u(\textbf{Q}) = t \}, \quad t\i -Variational principles, surface evolution, PDEs, level set methods, and the stereo problem - Olivier Faugeras, Renaud Keriven, 1998 +Variational principles, surface evolution, PDEs, level set methods, and the stereo problem - Olivier Faugeras, Renaud Keriven, 1998 --- @@ -67,18 +67,34 @@ $\mathcal{V}_t = \{ \textbf{Q} \in \mathbb{R}^3, u(\textbf{Q}) = t \}, \quad t\i ## Mise à jour du volume -consensus blabla +- Sélection des voxels sur la bordure du "marbre" +- Vérification de la visibilité du voxel par toutes les caméras +- Récupération des couleurs / niveaux de gris visibles par les caméras +- Consensus sur la couleur / niveau de gris du voxel étudié +- Remplissage si consensus, creusage sinon --- ## Initialisation du volume -ones ou alors shape from silouhette +- Définition d'une taille limite: + - $x \in [-1, 1]$ + - $y \in [-1, 1]$ + - $z \in [-1, 1]$ +- Définition d'une résolution (un pas): $5.10^{-2}$ +- Initialisation des valeurs du marbre: + - Uniforme (`np.zeros` ou `np.ones`) + - Shape From Silouhette (BE4) + --- ## Exemple Shape from Silouhette + + +Implementation of a Shadow Carving System for Shape Capture, doi: 10.1109/TDPVT.2002.1024034 + --- ## Raytracing diff --git a/src/draw.py b/src/draw.py index d3cdcab..4111290 100644 --- a/src/draw.py +++ b/src/draw.py @@ -19,7 +19,11 @@ Z *= np.random.rand(*Z.shape) for i, x in enumerate(x_vals): for j, y in enumerate(y_vals): - color = f"#{hex(int(Z[j, i] * 255))[2:]}{hex(int(Z[j, i] * 255))[2:]}{hex(int(Z[j, i] * 255))[2:]}" + color = f"{hex(int(Z[j, i] * 255))[2:]}" + if color == "0": + color = "#f00" + else: + color = "#" + 3 * color plt.fill([x, x + 0.1, x + 0.1, x], [y, y, y + 0.1, y + 0.1], color=color) @@ -44,16 +48,43 @@ for i in range(nb_cams): plt.plot(x[0, :], x[1, :], "r-") -# draw 1d image of the scene for each camera -for i in range(nb_cams): - # sort pixels by distance to camera - cam_pose = cam_poses[i] - pixels_dist = np.linalg.norm(np.array([X.flatten(), Y.flatten()]).T - cam_pose, axis=1) - X_ = X.flatten()[np.argsort(pixels_dist)] - Y_ = Y.flatten()[np.argsort(pixels_dist)] - - plt.xlim(-7, 7) plt.ylim(-7, 7) plt.axis("equal") + + +# draw 1d image of the scene for each camera +for i in range(2): + plt.figure() + # sort pixels by distance to camera + cam_pose = cam_poses[i] + pixels_dist = np.linalg.norm(np.array([X.flatten(), Y.flatten()]).T - cam_pose, axis=1) + pixels_sort = np.argsort(pixels_dist)[::-1] + + px = np.array([[-5, -5, 1], [5, -5, 1], [5, 5, 1], [-5, 5, 1]]).T + px = np.linalg.inv(cam2world_projs[i]) @ px + px /= px[1, :] + + x0 = px[1, :].min() + x1 = px[1, :].max() + + plt.fill([x0, x1, x1, x0], [0, 0, 1, 1], color="r") + + for j in pixels_sort: + x, y = X.flatten()[j], Y.flatten()[j] + color = f"{hex(int(Z.flatten()[j] * 255))[2:]}" + if color == "0": + continue + color = "#" + 3 * color + + px = np.array([[x, y, 1], [x + 0.1, y, 1], [x + 0.1, y + 0.1, 1], [x, y + 0.1, 1]]).T + px = np.linalg.inv(cam2world_projs[i]) @ px + px /= px[1, :] + + x0 = px[1, :].min() + x1 = px[1, :].max() + + plt.fill([x0, x1, x1, x0], [0, 0, 1, 1], color=color) + plt.axis("equal") + plt.show()