mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-05 14:55:15 +02:00
allow to set color for the skeleton visualization
This commit is contained in:
parent
6240f494f2
commit
c0e045c0ab
1 changed files with 6 additions and 5 deletions
|
|
@ -408,12 +408,13 @@ class mocap_data_show_vpython(vpython_show):
|
|||
class mocap_data_show(matplotlib_show):
|
||||
"""Base class for visualizing motion capture data."""
|
||||
|
||||
def __init__(self, vals, axes=None, connect=None):
|
||||
def __init__(self, vals, axes=None, connect=None, color='b'):
|
||||
if axes==None:
|
||||
fig = plt.figure()
|
||||
axes = fig.add_subplot(111, projection='3d', aspect='equal')
|
||||
matplotlib_show.__init__(self, vals, axes)
|
||||
|
||||
self.color = color
|
||||
self.connect = connect
|
||||
self.process_values()
|
||||
self.initialize_axes()
|
||||
|
|
@ -423,7 +424,7 @@ class mocap_data_show(matplotlib_show):
|
|||
self.axes.figure.canvas.draw()
|
||||
|
||||
def draw_vertices(self):
|
||||
self.points_handle = self.axes.scatter(self.vals[:, 0], self.vals[:, 1], self.vals[:, 2])
|
||||
self.points_handle = self.axes.scatter(self.vals[:, 0], self.vals[:, 1], self.vals[:, 2], color=self.color)
|
||||
|
||||
def draw_edges(self):
|
||||
self.line_handle = []
|
||||
|
|
@ -442,7 +443,7 @@ class mocap_data_show(matplotlib_show):
|
|||
z.append(self.vals[i, 2])
|
||||
z.append(self.vals[j, 2])
|
||||
z.append(np.NaN)
|
||||
self.line_handle = self.axes.plot(np.array(x), np.array(y), np.array(z), 'b-')
|
||||
self.line_handle = self.axes.plot(np.array(x), np.array(y), np.array(z), '-', color=self.color)
|
||||
|
||||
def modify(self, vals):
|
||||
self.vals = vals.copy()
|
||||
|
|
@ -494,7 +495,7 @@ class stick_show(mocap_data_show):
|
|||
|
||||
class skeleton_show(mocap_data_show):
|
||||
"""data_show class for visualizing motion capture data encoded as a skeleton with angles."""
|
||||
def __init__(self, vals, skel, axes=None, padding=0):
|
||||
def __init__(self, vals, skel, axes=None, padding=0, color='b'):
|
||||
"""data_show class for visualizing motion capture data encoded as a skeleton with angles.
|
||||
:param vals: set of modeled angles to use for printing in the axis when it's first created.
|
||||
:type vals: np.array
|
||||
|
|
@ -506,7 +507,7 @@ class skeleton_show(mocap_data_show):
|
|||
self.skel = skel
|
||||
self.padding = padding
|
||||
connect = skel.connection_matrix()
|
||||
mocap_data_show.__init__(self, vals, axes=axes, connect=connect)
|
||||
mocap_data_show.__init__(self, vals, axes=axes, connect=connect, color=color)
|
||||
def process_values(self):
|
||||
"""Takes a set of angles and converts them to the x,y,z coordinates in the internal prepresentation of the class, ready for plotting.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue