save
This commit is contained in:
@@ -67,7 +67,7 @@ def get_bins(values, nr_of_bins):
|
||||
return bins
|
||||
|
||||
|
||||
def generate_curvatures(folder, frame, bins, neighbourhoods=[25], nr_of_labels=6):
|
||||
def generate_curvatures(folder, frame, bins, neighbourhoods=[25], nr_of_labels=[6]):
|
||||
id = frame.split('_')[0]
|
||||
frame_nr = int(frame.split('_')[1].split('.')[0])
|
||||
|
||||
@@ -91,14 +91,14 @@ def generate_curvatures(folder, frame, bins, neighbourhoods=[25], nr_of_labels=6
|
||||
cloud = PyntCloud.from_file(temp_file)
|
||||
|
||||
curvatures = []
|
||||
for neighbourhood in neighbourhoods:
|
||||
for neighbourhood, nr_labels in zip(neighbourhoods, nr_of_labels):
|
||||
k_neighbors = np.argsort(dist[mask, :][:, mask], axis=-1)[:, :neighbourhood] #cloud.get_neighbors(k=neighbourhood)
|
||||
#k_neighbors = k_neighbors_cache[id] # np.argsort(dist[mask, :][:, mask], axis=-1)[:, :neighbourhood] #cloud.get_neighbors(k=neighbourhood)
|
||||
ev = cloud.add_scalar_field("eigen_values", k_neighbors=k_neighbors)
|
||||
cloud.add_scalar_field("curvature", ev=ev)
|
||||
curvature = np.array(cloud.points["curvature(" + str(neighbourhood+1) + ")"])
|
||||
|
||||
bins_local = bins[neighbourhood] if bins is not None else get_bins(curvature, nr_of_labels)
|
||||
bins_local = bins[neighbourhood] if bins is not None else get_bins(curvature, nr_labels)
|
||||
labels = np.linspace(0, bins_local.shape[0] - 2, bins_local.shape[0] - 1)
|
||||
|
||||
frame_labels = np.zeros((curvature.shape[0]), dtype=np.float32)
|
||||
@@ -111,7 +111,7 @@ def generate_curvatures(folder, frame, bins, neighbourhoods=[25], nr_of_labels=6
|
||||
return curvatures
|
||||
|
||||
|
||||
def visualize_curvature_labels(folder, frame, bins, neighbourhoods):
|
||||
def visualize_curvature_labels(folder, frame, bins, neighbourhoods, nr_of_labels):
|
||||
id = frame.split('_')[0]
|
||||
frame_nr = frame.split('_')[1].split('.')[0]
|
||||
|
||||
@@ -119,7 +119,7 @@ def visualize_curvature_labels(folder, frame, bins, neighbourhoods):
|
||||
_, faces = _maskFaces(np.zeros((14475,3)), F, mask)
|
||||
verts = np.load(os.path.join(folder, 'mesh_posed', f'{id}_{frame_nr}.npz'))['mesh_posed'][mask,:]
|
||||
|
||||
curvature_labels_all = generate_curvatures(folder, frame, bins, neighbourhoods)
|
||||
curvature_labels_all = generate_curvatures(folder, frame, bins, neighbourhoods, nr_of_labels)
|
||||
colors_binned_all = []
|
||||
|
||||
for curvature_labels in curvature_labels_all:
|
||||
@@ -232,4 +232,4 @@ if __name__ == '__main__':
|
||||
else:
|
||||
dist = np.load('custom_data/dijkstra_skirt.npy')
|
||||
|
||||
visualize_curvature_labels(folder, '02572_1', bins, neighbourhoods=[10, 25, 100])
|
||||
visualize_curvature_labels(folder, '02572_1', bins, neighbourhoods=[25, 25, 25], nr_of_labels=[3,6,12])
|
||||
Reference in New Issue
Block a user