def shape_net_test(): std_out_path1 = "/home/zgong8/PerceptualMetric/examples/data_out/sd1_{}.obj" std_out_path2 = "/home/zgong8/PerceptualMetric/examples/data_out/sd2_{}.obj" std_out_path3 = "/home/zgong8/PerceptualMetric/examples/data_out/sd3_{}.obj" for i in range(10): in_path = random_shape_net_object() print(in_path) out_path1 = std_out_path1.format(i) out_path2 = std_out_path2.format(i) out_path3 = std_out_path3.format(i) p = Pipeline(1) df = SubdivisionDeformer({STEPS: 1}) p.plug(df) p.process_shape_file(in_path, out_path1) p = Pipeline(1) df = SubdivisionDeformer({STEPS: 2}) p.plug(df) p.process_shape_file(in_path, out_path2) p = Pipeline(1) df = SubdivisionDeformer({STEPS: 3}) p.plug(df) p.process_shape_file(in_path, out_path3)
def shape_net_test(): for i in range(10): in_path = random_shape_net_object() print(in_path) out_path = os.path.join(curr_dir, data_out_dir, "arap_high_{}.obj".format(i)) out_path_ori = os.path.join(curr_dir, data_out_dir, "arap_high_{}_ori.obj".format(i)) p = Pipeline(1) d = None while d is None: c = {} for k, f in ARAPDeformer.get_applicable_configs().items(): q = np.random.uniform() c[k] = f(q) tmp_d = ARAPDeformer(c) if tmp_d.get_score() == 3: d = tmp_d p.plug(d) p.process_shape_file(in_path, out_path) p = Pipeline(0) p.process_shape_file(in_path, out_path_ori)
def shape_net_test(): std_out_path = "/home/zgong8/PerceptualMetric/examples/data_out/decimation_low_{}.obj" std_out_path_ori = "/home/zgong8/PerceptualMetric/examples/data_out/decimation_low_ori_{}.obj" for i in range(10): in_path = random_shape_net_object() print(in_path) out_path = std_out_path.format(i) out_path_ori = std_out_path_ori.format(i) p = Pipeline(1) d = None while d is None: c = {} for k, f in DecimationDeformer.get_applicable_configs().items(): q = np.random.uniform() c[k] = f(q) tmp_d = DecimationDeformer(c) if tmp_d.get_score() == 1: d = tmp_d p.plug(d) p.process_shape_file(in_path, out_path) p = Pipeline(0) p.process_shape_file(in_path, out_path_ori)
def random_shape_sample(): for i in range(5, 10): in_path = random_shape_net_object() out_path_ori = r"/home/zgong8/data_out/base-" + str(i) + "-ori.obj" out_path1 = r"/home/zgong8/data_out/base-" + str(i) + "-1.obj" file_path1 = r"/home/zgong8/data_out/base-" + str(i) + "-1.txt" out_path2 = r"/home/zgong8/data_out/base-" + str(i) + "-2.obj" file_path2 = r"/home/zgong8/data_out/base-" + str(i) + "-2.txt" empty_pipeline = Pipeline(0) empty_pipeline.process_shape_file(in_path, out_path_ori) deformation_level = i % 3 + 1 status = False while not status: ppl, status = run_leveled_pipeline(3, in_path, out_path1) with open(file_path1, 'w') as f: f.write(in_path) f.write("\n") f.write(str(ppl)) f.write("\n") f.write("status: ") f.write(str(status)) f.write("\n") f.write("score: ") f.write(str(ppl.estimate_deform_score())) if status: f.write("\n") f.write("manifold: ") f.write(str(is_manifold(file=out_path1))) f.write("\n") f.write("cut_at: ") f.write(str(ppl.cut_by_point_cloud)) f.close() status = False while not status: ppl, status = run_leveled_pipeline(1, in_path, out_path2) with open(file_path2, 'w') as f: f.write(in_path) f.write("\n") f.write(str(ppl)) f.write("\n") f.write("status: ") f.write(str(status)) f.write("\n") f.write("score: ") f.write(str(ppl.estimate_deform_score())) if status: f.write("\n") f.write("manifold: ") f.write(str(is_manifold(file=out_path2))) f.write("\n") f.write("cut_at: ") f.write(str(ppl.cut_by_point_cloud)) f.close() print("{} done!".format(str(i)))
def shape_net_test(): for i in range(10): in_path = random_shape_net_object() print(in_path) out_path = os.path.join(curr_dir, data_out_dir, "pcd{}.obj".format(i)) p = Pipeline(1) d = PointCloudDeformer({}) p.plug(d) p.process_shape_file(in_path, out_path)
def shape_net_test2(): std_out_path = "/home/zgong8/PerceptualMetric/examples/data_out/mc{}.obj" for i in range(10): in_path = random_shape_net_object() print(in_path) out_path = std_out_path.format(i) p = Pipeline(1) d = MarchingCubesDeformer({}) p.plug(d) p.process_shape_file(in_path, out_path)
def shape_net_test(): std_out_path = "/home/zgong8/PerceptualMetric/examples/data_out/mc{}{}.obj" for i in range(10): in_path = random_shape_net_object() print(in_path) out_path_ori = std_out_path.format(i, "") out_path_a = std_out_path.format(i, "a") out_path_b = std_out_path.format(i, "b") subprocess.run(["cp", in_path, out_path_ori]) subprocess.run([ "/home/zgong8/libigl/tutorial/build/bin/705_MarchingCubes", in_path, out_path_a, out_path_b ])
def test(): std_out_path = "/home/zgong8/PerceptualMetric/examples/data_out/decimation_sub_{}.obj" std_out_path_ori = "/home/zgong8/PerceptualMetric/examples/data_out/decimation_sub_{}_ori.obj" for i in range(10): in_path = random_shape_net_object() print(in_path) out_path = std_out_path.format(i) out_path_ori = std_out_path_ori.format(i) p = Pipeline(2) d = DecimationDeformer({"ratio": 3.0}) p.plug(d) df = SubdivisionDeformer({STEPS: 1}) p.plug(df) p.process_shape_file(in_path, out_path) p = Pipeline(0) p.process_shape_file(in_path, out_path_ori)
def shape_net_test(): std_out_path = "/home/zgong8/PerceptualMetric/examples/data_out/bi_high_{}.obj" for i in range(10): in_path = random_shape_net_object() print(in_path) out_path = std_out_path.format(i) p = Pipeline(1) c = { PIVOTS: 1, FIRST: random(), SECOND: random(), THIRD: random(), FOURTH: random(), DIS: 1.6 } d = BiharmonicDeformer(c) p.plug(d) p.process_shape_file(in_path, out_path)
def random_shape_net_test(): file = random_shape_net_object() print(file) print(is_manifold(file=file))