mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-15 06:52:39 +02:00
Fixed two bugs in to_xyz, checked on a test version of MATLAB code.
This commit is contained in:
parent
8306bb652c
commit
8b00c5a827
1 changed files with 11 additions and 9 deletions
|
|
@ -215,10 +215,10 @@ class acclaim_skeleton(skeleton):
|
||||||
self.load_skel(file_name)
|
self.load_skel(file_name)
|
||||||
|
|
||||||
def to_xyz(self, channels):
|
def to_xyz(self, channels):
|
||||||
rot_val = self.vertices[0].meta['orientation']
|
rot_val = list(self.vertices[0].meta['orientation'])
|
||||||
for i in range(len(self.vertices[0].meta['rot_ind'])):
|
for i in range(len(self.vertices[0].meta['rot_ind'])):
|
||||||
rind = self.vertices[0].meta['rot_ind'][i]
|
rind = self.vertices[0].meta['rot_ind'][i]
|
||||||
if rind != 0:
|
if rind != -1:
|
||||||
rot_val[i] += channels[rind]
|
rot_val[i] += channels[rind]
|
||||||
|
|
||||||
self.vertices[0].meta['rot'] = rotation_matrix(rot_val[0],
|
self.vertices[0].meta['rot'] = rotation_matrix(rot_val[0],
|
||||||
|
|
@ -227,11 +227,11 @@ class acclaim_skeleton(skeleton):
|
||||||
self.vertices[0].meta['axis_order'],
|
self.vertices[0].meta['axis_order'],
|
||||||
degrees=True)
|
degrees=True)
|
||||||
# vertex based store of the xyz location
|
# vertex based store of the xyz location
|
||||||
self.vertices[0].meta['xyz'] = self.vertices[0].meta['offset']
|
self.vertices[0].meta['xyz'] = list(self.vertices[0].meta['offset'])
|
||||||
|
|
||||||
for i in range(len(self.vertices[0].meta['pos_ind'])):
|
for i in range(len(self.vertices[0].meta['pos_ind'])):
|
||||||
pind = self.vertices[0].meta['pos_ind'][i]
|
pind = self.vertices[0].meta['pos_ind'][i]
|
||||||
if pind != 0:
|
if pind != -1:
|
||||||
self.vertices[0].meta['xyz'][i] += channels[pind]
|
self.vertices[0].meta['xyz'][i] += channels[pind]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -253,7 +253,7 @@ class acclaim_skeleton(skeleton):
|
||||||
rot_val = np.zeros(3)
|
rot_val = np.zeros(3)
|
||||||
for j in range(len(self.vertices[ind].meta['rot_ind'])):
|
for j in range(len(self.vertices[ind].meta['rot_ind'])):
|
||||||
rind = self.vertices[ind].meta['rot_ind'][j]
|
rind = self.vertices[ind].meta['rot_ind'][j]
|
||||||
if rind != 0:
|
if rind != -1:
|
||||||
rot_val[j] = channels[rind]
|
rot_val[j] = channels[rind]
|
||||||
else:
|
else:
|
||||||
rot_val[j] = 0
|
rot_val[j] = 0
|
||||||
|
|
@ -275,7 +275,8 @@ class acclaim_skeleton(skeleton):
|
||||||
|
|
||||||
self.vertices[ind].meta['rot'] = np.dot(np.dot(np.dot(torient_inv,tdof),torient),self.vertices[parent].meta['rot'])
|
self.vertices[ind].meta['rot'] = np.dot(np.dot(np.dot(torient_inv,tdof),torient),self.vertices[parent].meta['rot'])
|
||||||
|
|
||||||
self.vertices[ind].meta['xyz'] += np.dot(self.vertices[ind].meta['offset'],self.vertices[ind].meta['rot'])
|
|
||||||
|
self.vertices[ind].meta['xyz'] = self.vertices[parent].meta['xyz'] + np.dot(self.vertices[ind].meta['offset'],self.vertices[ind].meta['rot'])
|
||||||
|
|
||||||
for i in range(len(children)):
|
for i in range(len(children)):
|
||||||
cind = children[i]
|
cind = children[i]
|
||||||
|
|
@ -524,6 +525,7 @@ class acclaim_skeleton(skeleton):
|
||||||
self.vertices[0].meta['orientation'] = [float(parts[1]),
|
self.vertices[0].meta['orientation'] = [float(parts[1]),
|
||||||
float(parts[2]),
|
float(parts[2]),
|
||||||
float(parts[3])]
|
float(parts[3])]
|
||||||
|
print self.vertices[0].meta['orientation']
|
||||||
lin = self.read_line(fid)
|
lin = self.read_line(fid)
|
||||||
return lin
|
return lin
|
||||||
|
|
||||||
|
|
@ -574,9 +576,9 @@ class acclaim_skeleton(skeleton):
|
||||||
"""Get indices for the skeleton from the channels when loading in channel data."""
|
"""Get indices for the skeleton from the channels when loading in channel data."""
|
||||||
|
|
||||||
channels = self.vertices[index].meta['channels']
|
channels = self.vertices[index].meta['channels']
|
||||||
base_channel = start_val - 1
|
base_channel = start_val
|
||||||
rot_ind = np.zeros(3)
|
rot_ind = -np.ones(3, dtype=int)
|
||||||
pos_ind = np.zeros(3)
|
pos_ind = -np.ones(3, dtype=int)
|
||||||
for i in range(len(channels)):
|
for i in range(len(channels)):
|
||||||
if channels[i]== 'Xrotation':
|
if channels[i]== 'Xrotation':
|
||||||
rot_ind[0] = base_channel + i
|
rot_ind[0] = base_channel + i
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue