This commit is contained in:
Easymode 2025-02-19 18:34:13 +00:00 committed by GitHub
parent 738c302833
commit 9cd19fd9e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -158,13 +158,13 @@ def import_mesh(mesh: Union[pymeshlab.MeshSet, trimesh.Trimesh, Latent2MeshOutpu
return mesh
def bpt_remesh(self, mesh: trimesh.Trimesh, verbose: bool = False, with_normal: bool = True, temperature: float = 0.5, batch_size: int = 1, pc_num: int = 4096):
def bpt_remesh(self, mesh: trimesh.Trimesh, verbose: bool = False, with_normal: bool = True, temperature: float = 0.5, batch_size: int = 1, pc_num: int = 4096, seed: int = 1234):
from .bpt.model import data_utils
from .bpt.model.model import MeshTransformer
from .bpt.model.serializaiton import BPT_deserialize
from .bpt.utils import sample_pc, joint_filter
pc_normal = sample_pc(mesh, pc_num=pc_num, with_normal=with_normal)
pc_normal = sample_pc(mesh, pc_num=pc_num, with_normal=with_normal, seed=seed)
pc_normal = pc_normal[None, :, :] if len(pc_normal.shape) == 2 else pc_normal
@ -194,7 +194,7 @@ def bpt_remesh(self, mesh: trimesh.Trimesh, verbose: bool = False, with_normal:
filter_kwargs=dict(k=50, p=0.95),
return_codes=True,
temperature=temperature,
batch_size=batch_size
batch_size=batch_size,
)
coords = []
@ -231,9 +231,10 @@ class BptMesh:
batch_size: int = 1,
with_normal: bool = True,
verbose: bool = False,
pc_num: int = 4096
pc_num: int = 4096,
seed: int = 1234
) -> Union[pymeshlab.MeshSet, trimesh.Trimesh]:
mesh = bpt_remesh(self, mesh=mesh, temperature=temperature, batch_size=batch_size, with_normal=with_normal, pc_num=pc_num)
mesh = bpt_remesh(self, mesh=mesh, temperature=temperature, batch_size=batch_size, with_normal=with_normal, pc_num=pc_num, seed=seed)
return mesh
class FaceReducer: