slowly update dataset (untested)

This commit is contained in:
2023-02-07 11:58:28 +00:00
parent 4c884d52c4
commit bedfa9661a
3 changed files with 259 additions and 267 deletions
+25 -1
View File
@@ -75,7 +75,31 @@ def split_data(folder, ratio):
f.writelines(valid_frames)
pass
def genereated_registered_and_mask(folder, is_skirt = False):
ids = os.listdir(folder)
for id in tqdm(ids):
garment_dir = os.path.join(folder, id)
if not os.path.isdir(garment_dir):
continue
garments = [f.replace('.pc16','') for f in os.listdir(garment_dir) if f.find('_') == -1 and not f.endswith('.mat') and not f.endswith('.obj') and not f.startswith('Combined')]
assert len(garments) == 1
if os.path.exists(os.path.join(garment_dir, garments[0] + '_registered.pc16')):
continue
garment = garments[0]
verts = readPC2(os.path.join(garment_dir, garment + '.pc16'), True)['V']
map = sio.loadmat(os.path.join(garment_dir, garment + '_map.mat'))['map'].reshape((-1))
verts = verts[:, map, :] # ---------------> This is the garment after registration
raw_mask = sio.loadmat(os.path.join(garment_dir, garment + '_mask.mat'))['mask'].reshape((-1))
mask = raw_mask > 0
# boundaries = raw_mask == 2
writePC2(os.path.join(garment_dir, garment + '_registered.pc16'), verts, True)
np.save(os.path.join(garment_dir, garment + '_mask.npy'), mask)