-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample_from_idx.py
More file actions
22 lines (20 loc) · 809 Bytes
/
sample_from_idx.py
File metadata and controls
22 lines (20 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import numpy as np
import open3d as o3d
import argparse
import torch
from utils import read_ply, write_ply, graphFilter, data_sample
from Graph import GraphConstructor
from torch.utils.data import TensorDataset, DataLoader
from tqdm import tqdm
from IPython import embed
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--path_ply", help="path to ply file")
parser.add_argument("-idx", "--index_file", type=str, help="index file")
parser.add_argument("-s", "--save", default="", help="path to save output ply file")
args = parser.parse_args()
pcd_origin, _ = read_ply(args.path_ply)
idxs = np.loadtxt(args.index_file, delimiter=',').astype(int)
idxs = idxs - 1
sampled_pc = pcd_origin[idxs]
write_ply(args.save, sampled_pc)