Exemplo n.º 1
0
 def correspondence(Auto3dgmData, mirror, phase=1):
     if phase == 1:
         npoints = Auto3dgmData.phase1SampledPoints
     else:
         npoints = Auto3dgmData.phase2SampledPoints
     meshes = Auto3dgmData.datasetCollection.datasets[npoints][npoints]
     corr = Correspondence(meshes=meshes, mirror=mirror)
     print("Correspondence compute for Phase " + str(phase))
     return (corr)
Exemplo n.º 2
0
    def start(self):
        ### INITIAL STEPS ###

        # check parameters look good before proceeding
        self.validate_parameters()

        self.__write_output_dirs()

        ### DATA LOAD AND SUBSAMPLE
        #TODO: No ftype param
        self.dataset = DatasetFactory.ds_from_dir(self.mesh_dir, ftype='ply')

        # need to get both sets of subsample results
        ss_points = [self.ss_points_i, self.ss_points_f]
        #TODO: Should use named parameters as the constructor for Subsample, I'm not sure what ss_type refers to.
        #TODO: init doesn't return anything, so I've encoded the results dictionary in subsample_res.ret
        subsample_res = Subsample(
            self.dataset['mesh'], ss_points, self.ss_type
        )  # dataset class should eventually support multiple named mesh sets and should be dict-style callable like this for mesh TODO: Currently does not support multiple named mesh sets, and the param is dataset.meshes
        ss_meshes_i = subsample_res[ss_points[0]]['output'][
            'results']  #TODO: Results isnt a list of meshes, its a dict
        ss_meshes_f = subsample_res[ss_points[1]]['output']['results']

        #TODO: Add mesh set doesnt exist as a method. Self.dataset isnt a dataset, its a data set collection, maybe create a method to instantiate a new data set, and add it to the Dataset COllection? THis naming is kind of bad
        self.dataset.add_mesh_set(self.ss_label_i, ss_meshes_i)
        self.dataset.add_mesh_set(self.ss_label_f, ss_meshes_f)

        ### INITIAL SUBSAMPLE POINTS ANALYSIS ###
        ss_i_correspondence_res = Correspondence(  # Correspondence should take an initial alignment object with d, p, and r arrays; also correspondence should handle bundling pairwise results into a single data structure
            meshes=self.dataset[self.ss_label_i],
            initial_alignment=None,
            globalize=True,
            mirror=self.allow_reflection)
        # Correspondence data structure should be an object with the following attributes: local_align with d, p, and r arrays, mst with minimum spanning tree, and global_align with d, p, and r arrays

        self.dataset.add_analysis_set(self.ss_label_i, ss_i_correspondence_res)

        ### FINAL SUBSAMPLE POINTS ANALYSIS ###
        ss_f_correspondence_res = Correspondence(  # Correspondence should take an initial alignment object with d, p, and r arrays; also correspondence should handle bundling pairwise results into a single data structure
            meshes=self.dataset[self.ss_label_f],
            initial_alignment=self.dataset.analysis_set[
                self.ss_label_i].global_align,
            globalize=True,
            mirror=self.allow_reflection)
Exemplo n.º 3
0
print(dc.datasets)
print(dc.analysis_sets) # Why is the initial dataset copied as an analysis_set?

# Generate two sets of subsamples with 100 and 200 points each
subsample_points = [100, 200]
subsample_results = Subsample(dc.datasets[0], subsample_points, 'FPS') # this absolutely does not work

# Add these results as additional datasets to our DatasetCollection
dc.add_dataset(subsample_results[100]['output']['results'], 'ss100')
dc.add_dataset(subsample_results[200]['output']['results'], 'ss200')

# Generate Correspondence results for first (100) subsample points dataset
# Correspondence data structure should be an object with the following attributes: local_align with d, p, and r arrays, mst with minimum spanning tree, and global_align with d, p, and r arrays
ss_100_correspondence_res = Correspondence( 
	meshes=dc.datasets['ss100'],
	initial_alignment=None, 
	globalize=True,
	mirror=True)
dc.add_analysis_set(ss_100_correspondence_res, 'ss100')

# Generate Correspondence results for second (200) subsample points dataset
# Correspondence here takes an optional initial alignment object with d, p, and r arrays
ss_200_correspondence_res = Correspondence( # Correspondence should take an initial alignment object with d, p, and r arrays; also correspondence should handle bundling pairwise results into a single data structure
	meshes=dc.datasets['ss200'],
	initial_alignment=dc.analysis_sets['ss100'].global_align, 
	globalize=True,
	mirror=True)
dc.add_analysis_set(ss_200_correspondence_res, 'ss200')


# Alternative test flow: Subsample one resolution at a time
A = np.array([[3, 1, 2], [10, 7, 2], [7, 3, 3], [18, 3, 0]])
B = np.array([[2, 3, 1], [2, 10, 7], [3, 7, 3], [0, 18, 3]])


class Pseudomesh:
    def __init__(self, A):
        self.vertices = A


T = Pseudomesh(A)
D = Pseudomesh(B)
mesh1 = T
mesh2 = D
a = [T, D]

BB = Correspondence.best_pairwise_PCA_alignment(mesh1, mesh2, 0)
AA = Correspondence.locgpd(mesh1, mesh2, 0, 0, 5, 0)

print(BB)
'''
In [36]: BB
Out[36]: 
(array([0, 1, 2, 3]),
 array([[  1.38777878e-16,   1.00000000e+00,   2.49800181e-16],
        [ -1.11022302e-16,  -3.60822483e-16,   1.00000000e+00],
        [  1.00000000e+00,  -1.38777878e-17,   1.66533454e-16]]))

'''
print(AA[1])
'''
Out[40]: