예제 #1
0
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 string_to_pipeline(string):
    each_deformation_finder = re.compile("<.*?}")
    deformation_strings = each_deformation_finder.findall(string)
    p = Pipeline(len(deformation_strings))
    for deformation_string in deformation_strings:
        p.plug(substring_to_deformation(deformation_string))
    return p
def test():
    in_path = os.path.join(curr_dir, data_out_dir, "mc5b.obj")
    out_path = os.path.join(curr_dir, data_out_dir, "mc5b_decimation.obj")

    p = Pipeline(1)
    d = DecimationDeformer({"ratio": 5.0})
    p.plug(d)

    p.process_shape_file(in_path, out_path)
def string_to_pipelines(string):
    each_deformation_finder = re.compile("<.*?}")
    deformation_strings = each_deformation_finder.findall(string)
    pipelines = []
    for deformation_string in deformation_strings:
        p = Pipeline(1)
        p.plug(substring_to_deformation(deformation_string))
        pipelines.append(p)
    return pipelines
예제 #6
0
def head_test():
    in_path = os.path.join(curr_dir, data_in_dir, file_name)
    out_path = os.path.join(curr_dir, data_out_dir, "marching_cubes_head_test.obj")

    p = Pipeline(1)
    d = PointCloudDeformer({})
    p.plug(d)

    p.process_shape_file(in_path, out_path)
예제 #7
0
def test():
    in_path = os.path.join(curr_dir, data_out_dir, "mc5b_decimation.obj")
    out_path = os.path.join(curr_dir, data_out_dir, "mc5b_arap.obj")

    p = Pipeline(1)
    c = {}
    for k, f in ARAPDeformer.get_applicable_configs().items():
        q = np.random.uniform()
        c[k] = f(q)
    d = ARAPDeformer(c)
    p.plug(d)

    p.process_shape_file(in_path, out_path)
예제 #8
0
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 get_random_pipeline():
    q = np.random.uniform()
    slots = int(np.floor(q * 10 + 1))
    p = Pipeline(slots)
    while not p.is_full():
        p.plug(get_random_deformation())
        # p_str = str(p)
        # vd = p_str.find("VoxelizeDeformer")
        # if vd != -1:
        #     dd = p_str.find("DecimationDeformer", vd)
        #     if dd != -1:
        #         p = None
    return p
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)
예제 #11
0
def test():
    in_path = os.path.join(curr_dir, data_out_dir, file_name)
    out_path = os.path.join(curr_dir, data_out_dir, "mc5b_biharmonic.obj")

    p = Pipeline(1)
    c = {
        PIVOTS: np.floor(random() * 4 + 1),
        FIRST: random(),
        SECOND: random(),
        THIRD: random(),
        FOURTH: random()
    }
    d = BiharmonicDeformer(c)
    p.plug(d)

    p.process_shape_file(in_path, out_path)
예제 #12
0
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_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)
예제 #14
0
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)
예제 #15
0
def shape_net_test():
    # in_path = random_shape_net_object()
    in_path = "/home/zgong8/ShapeNetCore.v2/03593526/2872c4b8e2f86201b7d0f3d89bbac230/models/model_normalized.obj"
    for i in range(1):
        print(in_path)

        out_path = os.path.join(curr_dir, data_out_dir,
                                "rc_low_{}.obj".format(i))
        out_path_ori = os.path.join(curr_dir, data_out_dir,
                                    "rc_low_{}_ori.obj".format(i))

        p = Pipeline(1)
        d = None
        while d is None:
            c = {
                't_x': 0.2905716521257016,
                't_y': 0.4142014801845495,
                't_z': 0.4329088231382898,
                'theta': 0.22074621042125056,
                'phi': 0.04610239008672457,
                'pivots': 0.8523162841916193
            }

            for k, f in RandomCageDeformer.get_applicable_configs().items():
                q = np.random.uniform()
                c[k] = f(q)
            tmp_d = RandomCageDeformer(c)
            if tmp_d.get_score() == 1:
                d = tmp_d

        p.plug(d)
        print(p)

        p.process_shape_file(in_path, out_path)

        p = Pipeline(0)
        p.process_shape_file(in_path, out_path_ori)
예제 #16
0
import os

from pipeline.Pipeline import Pipeline
from module.deformers.VoxelizeDeformer import VoxelizeDeformer, NUM_CUBES

curr_dir = os.path.dirname(os.path.realpath(__file__))
data_in_dir = "data_in"
data_out_dir = "data_out"
file_name = "head.obj"

in_path = os.path.join(curr_dir, data_in_dir, file_name)
out_path = os.path.join(curr_dir, data_out_dir, "vox_head_test_32.obj")

p = Pipeline(1)
d = VoxelizeDeformer({NUM_CUBES: 128})
p.plug(d)

p.process_shape_file(in_path, out_path)