2/3 modifs des slides

This commit is contained in:
Laureηt 2023-01-26 10:08:14 +01:00
parent 4b203cafc2
commit 8b8c43d363
Signed by: Laurent
SSH key fingerprint: SHA256:kZEpW8cMJ54PDeCvOhzreNr4FSh6R13CMGH/POoO8DI
3 changed files with 27 additions and 10 deletions

BIN
docs/figs/lvl7_2D.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

View file

@ -20,3 +20,19 @@ title: Bureau d'étude de PI3D
Sujet 6 - Reformulation du MVS par level sets
---
## Level sets ?
<img src="https://upload.wikimedia.org/wikipedia/commons/7/78/Level_set_method.png" class="m-auto -mt-7"/>
---
## Exemple Level sets 2D
<img src="figs/lvl7_2D.png" class="m-auto h-110"/>
<Footnotes separator>
<Footnote>
Variational principles, surface evolution, PDEs, level set methods, and the stereo problem - Olivier Faugeras, Renaud Keriven, 1998
</Footnote>
</Footnotes>

View file

@ -1,9 +1,10 @@
import bpy
import math
import itertools
import math
import pathlib
import pickle
import sys
import bpy
import numpy as np
# dirty hack to import proj.py
@ -17,15 +18,15 @@ from proj import get_3x4_P_matrix_from_blender
EXPORT_PATH = pathlib.Path("/tmp/")
# setup camera poses
phis = [-45, 0, 45]
thetas = [0, 45, 90, 135, 180, 225, 270, 315]
rotsY = range(-45, 45 + 1, 20)
rotsZ = range(-45, 45 + 1, 20)
# convert to radians
phis = [math.radians(phi) for phi in phis]
thetas = [math.radians(theta) for theta in thetas]
rotsY = [math.radians(rotY) for rotY in rotsY]
rotsZ = [math.radians(rotZ) for rotZ in rotsZ]
# create all possible combinations
poses = list(itertools.product(phis, thetas))
poses = list(itertools.product(rotsY, rotsZ))
# create export folders
pathlib.Path(EXPORT_PATH / "images").mkdir(parents=True, exist_ok=True)
@ -39,12 +40,12 @@ bpy.data.scenes["Scene"].node_tree.nodes["Mask Output"].base_path = str(EXPORT_P
# get camera
cam = bpy.data.objects["Camera"]
for i, (phi, theta) in enumerate(poses):
for i, (rotY, rotZ) in enumerate(poses):
print(f"Rendering pose {i}...")
# set camera pose
bpy.context.scene.objects["Empty"].rotation_euler[0] = phi
bpy.context.scene.objects["Empty"].rotation_euler[2] = theta
bpy.context.scene.objects["Empty"].rotation_euler[1] = rotY
bpy.context.scene.objects["Empty"].rotation_euler[2] = rotZ
# fuck you blender and your stupid shit
bpy.context.view_layer.update()