use raw cloth3d input
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import os
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
|
||||
|
||||
|
||||
class Frame:
|
||||
def __init__(self, id, frame_nr, garment):
|
||||
self.id = id
|
||||
self.frame_nr = frame_nr
|
||||
self.garment = garment
|
||||
|
||||
|
||||
def mask_faces(F, mask):
|
||||
F_mask = np.take(mask, F.reshape(-1), axis=0)
|
||||
F_mask = F_mask.reshape((-1, 3)).sum(axis=1) == 3
|
||||
|
||||
V_ind = np.zeros(mask.shape, dtype=np.int32)
|
||||
V_ind[mask] = np.arange(mask.sum())
|
||||
F_new = np.take(V_ind, F[F_mask, :].reshape(-1), axis=0).reshape((-1, 3))
|
||||
|
||||
return F_new
|
||||
|
||||
|
||||
def read_frames_file(file):
|
||||
frames = []
|
||||
with open(file, 'r') as f:
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
id, frame_nr, garment = line.split()
|
||||
frames.append(Frame(id, int(frame_nr), garment))
|
||||
return frames
|
||||
@@ -25,13 +25,3 @@ class Accumulator():
|
||||
self.dict = dict()
|
||||
|
||||
|
||||
|
||||
def mask_faces(F, mask):
|
||||
F_mask = np.take(mask, F.reshape(-1), axis=0)
|
||||
F_mask = F_mask.reshape((-1, 3)).sum(axis=1) == 3
|
||||
|
||||
V_ind = np.zeros(mask.shape, dtype=np.int32)
|
||||
V_ind[mask] = np.arange(mask.sum())
|
||||
F_new = np.take(V_ind, F[F_mask, :].reshape(-1), axis=0).reshape((-1, 3))
|
||||
|
||||
return F_new
|
||||
Reference in New Issue
Block a user