add vertices to bounds
This commit is contained in:
parent
368ab6092e
commit
25d4ebafe5
24
apps/postprocess/vertices_to_bounds.py
Normal file
24
apps/postprocess/vertices_to_bounds.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import os
|
||||||
|
import numpy as np
|
||||||
|
from tqdm import tqdm
|
||||||
|
from easymocap.mytools.reader import read_json
|
||||||
|
from os.path import join
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import argparse
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('path', type=str)
|
||||||
|
parser.add_argument('--debug', action='store_true')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
verticesnames = os.listdir(args.path)
|
||||||
|
bounds = []
|
||||||
|
for vertname in tqdm(verticesnames):
|
||||||
|
vertices = read_json(join(args.path, vertname))
|
||||||
|
bounds_frame = []
|
||||||
|
for data in vertices:
|
||||||
|
verts = np.array(data['vertices'])
|
||||||
|
bound = np.array([verts.min(axis=0), verts.max(axis=0)])
|
||||||
|
bounds_frame.append(bound)
|
||||||
|
bounds.append(bounds_frame)
|
||||||
|
np.save('test.npy', np.stack(bounds))
|
Loading…
Reference in New Issue
Block a user