From 8b7865be228dc499854dda8370517dd7549abcc6 Mon Sep 17 00:00:00 2001 From: gdamms Date: Wed, 1 Feb 2023 13:54:26 +0100 Subject: [PATCH] the end? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Laureηt Co-authored-by: pejour --- docs/slides.md | 134 ++++++++++++++++++++++++++++--------------------- src/sfs2d.py | 42 +++++++++------- 2 files changed, 101 insertions(+), 75 deletions(-) diff --git a/docs/slides.md b/docs/slides.md index 0baf925..0213f5d 100644 --- a/docs/slides.md +++ b/docs/slides.md @@ -29,6 +29,7 @@ title: Bureau d'étude de PI3D - Hyposthèses - L'algorithme - Résultats +- Conclusion @@ -48,6 +49,7 @@ Et pour ce faire on avait besoin de faire les étapes suivantes: 1. Initialisation du volume 2. Mise à jour du volume - Résultats +- Conclusion --> @@ -85,6 +87,7 @@ Volume = Ensemble des points de l'espace tel que, l'image de ces points par une
Marching cubes
+
@@ -107,6 +110,10 @@ En ce qui concerne le rendu de la surface 3D, on utilise l'ago de marching cubes --- @@ -144,16 +151,19 @@ changement de topologie du level set - +
+ +$\mathbb{R}^3 \to \mathbb{V}$ + +
### Binarisation du levelset -$\mathbb{R}^3 \to \mathbb{V} \newline \implies \mathcal{V} = \{ \textbf{v} = (x, y, z) \in \mathbb{V}, u(\textbf{v}) > 0 \}, \quad u \colon \mathbb{V} \to \{0, 1\}$ +
+ +$\mathcal{V} = \{ \textbf{v} = (x, y, z) \in \mathbb{V}, u(\textbf{v}) > 0 \}, \quad u \colon \mathbb{V} \to \{0, 1\}$ + +
Wikipedia @@ -207,8 +217,8 @@ Plus on a de caméra, meilleure sera la définition de l'enveloppe. ### Shape from Silhouette 3D
- - + +
- ---- - -## Itération du Level Set - -
- - -
- ---- - ## Résultats ### L'environnement - - - + --- ## Résultats ### Les données - - - - - - - - + + +
+ +
+ + + + + + +
+
--- ## Résultats ### L'initialisation (Shape from Silhouette) - + --- -## Conclusion et axes de développement +## Résultats +### Bordures -
+ + +--- + +## Résultats +### Visibilité des voxels + +
+ + +
+--- + +## Résultats +### Évolution du level set + +
+ + +
+ +--- + +## Conclusion + +
+ +### Ce que nous avons fait - Réalisation du SfS en 2D/3D -- Réalisation du MVS par level sets en 2D avec utilisation du SfS -- Résultat en 3D ? -- Passer en continu au lieu de binaire +- Réalisation du MVS par level sets en 2D avec initialisation par SfS + +
+ +### Axes d'amélioration soon™ + +- Résultat en 3D +- $\{0, 1\} \to [0, 1]$
diff --git a/src/sfs2d.py b/src/sfs2d.py index aaeeb47..8fdbdfa 100644 --- a/src/sfs2d.py +++ b/src/sfs2d.py @@ -137,20 +137,23 @@ for p in range(11): plt.figure() plt.axis("equal") + plt.axis("off") plot_voxels(Z, "#fff", 1.0, True) # plot_voxels(border, "#00f", 0.5, False) for i in range(nb_frame): plot_camera(cam2world_projs[i], str(i), "#f00") # plt.show() + # plt.savefig(f"border.png", dpi=300, bbox_inches="tight", pad_inches=0, transparent=True) + # exit() - for i, j in track(np.argwhere(border)): + for i, j in track(np.argwhere(border)[30:]): # if i != 74 or j != 34: # continue x, y = X_MIN + (i + 0.5) * VOXEL_SIZE, Y_MIN + (j + 0.5) * VOXEL_SIZE start = np.array([x, y]) # plt.plot([start[0]], [start[1]], "o", color="#f00") - # plt.fill([x, x + VOXEL_SIZE, x + VOXEL_SIZE, x], - # [y, y, y + VOXEL_SIZE, y + VOXEL_SIZE], "#0f0", alpha=0.7) + # plt.fill([x - VOXEL_SIZE/2, x + VOXEL_SIZE/2, x + VOXEL_SIZE/2, x - VOXEL_SIZE/2], + # [y - VOXEL_SIZE/2, y - VOXEL_SIZE/2, y + VOXEL_SIZE/2, y + VOXEL_SIZE/2], "#00f", alpha=0.7) values = [] @@ -164,7 +167,7 @@ for p in range(11): d = np.array([x, y + VOXEL_SIZE]) # plt.plot([d[0]], [d[1]], "o", color="#0f0") - for k in range(nb_frame): + for k in range(5,nb_frame): # plot_camera(cam2world_projs[k], str(k), "#0f0") @@ -192,6 +195,8 @@ for p in range(11): # color="#f00", # alpha=0.3, # ) + # plt.savefig(f"ray.png", dpi=300, bbox_inches="tight", pad_inches=0, transparent=True) + # exit() if len(voxels_intersected) == 0: visible = True @@ -216,25 +221,27 @@ for p in range(11): proj = np.round(proj).astype(np.int32) values.append(frames[k][proj[1, 0]]) - # fig = plt.gcf() - # plt.figure() - # plt.imshow( - # np.repeat(frames[k][np.newaxis, :], 100, axis=0), cmap="gray") - # plt.plot(proj[1, 0], 50, "o", color="#f00") - # plt.plot(proj[1, 1], 50, "o", color="#ff0") - # plt.plot(proj[1, 2], 50, "o", color="#0ff") - # plt.plot(proj[1, 3], 50, "o", color="#f0f") - # plt.plot(proj[1, 4], 50, "o", color="#0f0") - # plt.figure(fig) + # fig = plt.gcf() + # plt.figure() + # plt.imshow( + # np.repeat(frames[k][np.newaxis, :], 100, axis=0), cmap="gray") + # plt.plot(proj[1, 0], 50, "o", color="#f00") + # plt.plot(proj[1, 1], 50, "o", color="#ff0") + # plt.plot(proj[1, 2], 50, "o", color="#0ff") + # plt.plot(proj[1, 3], 50, "o", color="#f0f") + # plt.plot(proj[1, 4], 50, "o", color="#0f0") + # plt.figure(fig) # else: # plot_camera(cam2world_projs[k], str(k), "#f00") # print(values) # plt.show() + # plt.savefig(f"selected.png", dpi=300, bbox_inches="tight", pad_inches=0, transparent=True) + # exit() occurences = [[x, values.count(x)] for x in set(values)] occurences = sorted(occurences, key=lambda x: x[1], reverse=True) - if occurences[0][1] >= len(values) * 0.7: + if len(values) > 0 and occurences[0][1] >= len(values) * 0.7: voxel_[i, j] = 1 color = "#0f0" else: @@ -259,13 +266,14 @@ for p in range(11): voxel = voxel_ - plt.savefig(f"evol{p:02}.png", dpi=300, bbox_inches="tight", pad_inches=0, transparent=True) + plt.savefig(f"data/peanut/res-0.7/evol{p:02}.png", dpi=300, bbox_inches="tight", pad_inches=0, transparent=True) plt.figure() plt.axis("equal") + plt.axis("off") plot_voxels(Z, "#fff", 1.0, True) plot_voxels(voxel, "#00f", 0.5, False) - plt.savefig(f"shape{p:02}.png", dpi=300, bbox_inches="tight", pad_inches=0, transparent=True) + plt.savefig(f"data/peanut/res-0.7/shape{p:02}.png", dpi=300, bbox_inches="tight", pad_inches=0, transparent=True) plt.close("all") # plt.show()