This commit is contained in:
2024-11-02 21:54:46 +00:00
parent 287983277a
commit 04d3a359e1
6 changed files with 120 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
import os
import json
import time
import subprocess
import tempfile
import shutil
@@ -68,9 +69,13 @@ class RenderUtil:
params_data_path = os.path.join(temp_dir, "params.json")
with open(params_data_path, 'w') as f:
json.dump(params, f)
start_time = time.time()
result = subprocess.run([
'blender', '-b', '-P', script_path, '--', temp_dir
], capture_output=True, text=True)
end_time = time.time()
print(result)
print(f"-- Time taken for blender: {end_time - start_time} seconds")
if result.returncode != 0:
print("Blender script failed:")
print(result.stderr)
@@ -82,6 +87,7 @@ class RenderUtil:
cam_info["far_plane"],
binocular=True
)
start_time = time.time()
mask_L, mask_R = DataLoadUtil.load_seg(path, binocular=True)
normal_L = DataLoadUtil.load_normal(path, binocular=True, left_only=True)
''' target points '''
@@ -114,6 +120,7 @@ class RenderUtil:
if not has_points:
target_points = np.zeros((0, 3))
target_normals = np.zeros((0, 3))
end_time = time.time()
print(f"-- Time taken for processing: {end_time - start_time} seconds")
#import ipdb; ipdb.set_trace()
return target_points, target_normals