Spaces:
Runtime error
Runtime error
Commit
·
f3baca2
1
Parent(s):
e4e0dd7
Update
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ from OpenGL.osmesa import OSMesaCreateContextAttribs
|
|
| 8 |
import numpy as np
|
| 9 |
import os
|
| 10 |
import trimesh
|
|
|
|
| 11 |
from pyrender import PerspectiveCamera,\
|
| 12 |
DirectionalLight, SpotLight, PointLight,\
|
| 13 |
MetallicRoughnessMaterial,\
|
|
@@ -20,6 +21,17 @@ axis = trimesh.creation.axis()
|
|
| 20 |
axis = Mesh.from_trimesh(axis, smooth=False)
|
| 21 |
scene.add(axis)
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
r = OffscreenRenderer(
|
| 24 |
viewport_width=720,
|
| 25 |
viewport_height=720,
|
|
|
|
| 8 |
import numpy as np
|
| 9 |
import os
|
| 10 |
import trimesh
|
| 11 |
+
import pyrender
|
| 12 |
from pyrender import PerspectiveCamera,\
|
| 13 |
DirectionalLight, SpotLight, PointLight,\
|
| 14 |
MetallicRoughnessMaterial,\
|
|
|
|
| 21 |
axis = Mesh.from_trimesh(axis, smooth=False)
|
| 22 |
scene.add(axis)
|
| 23 |
|
| 24 |
+
camera_center = np.array([951.30, 536.77])
|
| 25 |
+
|
| 26 |
+
camera = pyrender.camera.IntrinsicsCamera(
|
| 27 |
+
fx=1060.53, fy=1060.38,
|
| 28 |
+
cx=camera_center[0], cy=camera_center[1])
|
| 29 |
+
light = pyrender.DirectionalLight(color=np.ones(3), intensity=2.0)
|
| 30 |
+
camera_pose = np.eye(4)
|
| 31 |
+
scene.add(camera, pose=camera_pose)
|
| 32 |
+
scene.add(light, pose=camera_pose)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
r = OffscreenRenderer(
|
| 36 |
viewport_width=720,
|
| 37 |
viewport_height=720,
|