Пример #1
0
from helper.shapenet.shapenetMapper import desc_to_id
from deformations.FFD import get_template_ffd
from deformations.meshDeformation import get_thresholded_template_mesh
from mayavi import mlab
import numpy as np
from graphicUtils.visualizer.mayaviVisualizer import visualize_mesh, visualize_point_cloud



ds = get_template_ffd("/media/saurabh/e56e40fb-030d-4f7f-9e63-42ed5f7f6c711/preprocessing_new", desc_to_id("pistol"),
                      edge_length_threshold=None,  n_samples=16384)

key = "1f646ff59cabdddcd810dcd63f342aca"
with ds:
    b = np.array(ds[key]['b'])
    p = np.array(ds[key]['p'])

mesh_dataset = get_thresholded_template_mesh("/media/saurabh/e56e40fb-030d-4f7f-9e63-42ed5f7f6c711/preprocessing_new", desc_to_id("pistol"),
                      None)

with mesh_dataset:
    f = np.array(mesh_dataset[key]['faces'])
    v_orignal = np.array(mesh_dataset[key]['vertices'])

# print(b)
# visualize_mesh(v_orignal, f)
# mlab.show()

visualize_mesh(np.matmul(b, p), f)
mlab.show()
Пример #2
0
import argparse
import configparser

from helper.shapenet.shapenetMapper import desc_to_id
from graphicUtils.mesh.meshGenerator import generateMeshData

parser = argparse.ArgumentParser(description="Generate mesh data")
parser.add_argument('configFile', help='Config file path')
args = parser.parse_args()

config = configparser.ConfigParser()
config.read(args.configFile)

cat_id = desc_to_id(config['data']['category'])

generateMeshData(cat_id, config.get("pathConfiguration", "inputPath"),
                 config.get("pathConfiguration", "outputPath"))
Пример #3
0
from templateManager.templateMesh import get_template_mesh
from helper.shapenet.shapenetMapper import desc_to_id
import numpy as np

id = desc_to_id("pistol")
print(id)
mesh = get_template_mesh("/media/saurabh/e56e40fb-030d-4f7f-9e63-42ed5f7f6c71/preprocessing", id)
with mesh:
    a, b = mesh['2137b954f778282ac24d00518a3dd6ec']['faces'], mesh['2137b954f778282ac24d00518a3dd6ec']['vertices']
    print(np.array(a))
    print(np.array(b))
from datasetSplitter.shapenet.shapenetTrainTestSplitter import Splitter
from helper.shapenet.shapenetMapper import desc_to_id

source_path = "/data/Training_Data/ShapeNetCore.v1"
destination_path = "/data/output"
cat_id = desc_to_id("car")

splitter = Splitter(destination_path, source_path, cat_id,
                    0.8, 0.1, 0.1, replace=False)

print(splitter.train_set)
Пример #5
0
from deformations.meshDeformation import get_thresholded_template_mesh
from mayavi import mlab
import numpy as np
from graphicUtils.visualizer.mayaviVisualizer import visualize_mesh, visualize_point_cloud
from deformations.FFD import calculate_ffd


def permute_xyz(x, y, z, order='xyz'):
    _dim = {'x': 0, 'y': 1, 'z': 2}
    data = (x, y, z)
    return tuple(data[_dim[k]] for k in order)


ds = get_template_ffd(
    "/media/saurabh/e56e40fb-030d-4f7f-9e63-42ed5f7f6c711/preprocessing_new",
    desc_to_id("pistol"),
    edge_length_threshold=None)

key = "1f646ff59cabdddcd810dcd63f342aca"
with ds:
    b = np.array(ds[key]['b'])
    p = np.array(ds[key]['p'])

mesh_dataset = get_thresholded_template_mesh(
    "/media/saurabh/e56e40fb-030d-4f7f-9e63-42ed5f7f6c711/preprocessing_new",
    desc_to_id("pistol"), None)

with mesh_dataset:
    f = np.array(mesh_dataset[key]['faces'])
    v_orignal = np.array(mesh_dataset[key]['vertices'])
Пример #6
0
 def cat_id(self):
     return desc_to_id(self.model_parameters["cat_desc"])
Пример #7
0
from helper.shapenet.shapenetMapper import desc_to_id
from helper.shapenet.datareader.reader import DataReader

path = "/data/Training Data/ShapeNetCore.v1"
category = "plane"
data_reader = DataReader(path)
print(data_reader.list_archived_data(desc_to_id(category)))