def center_tracks(tracks, out=None):
c = np.array(tracks.shape[1:], dtype='int') / 2
if out is None:
out = np.ndarray(shape=tracks.shape, dtype=tracks.dtype)
for i in xrange(tracks.shape[0]):
cm = np.array(center_of_mass(tracks[i, :, :]), dtype='int32')
out[i, :, :] = shift(tracks[i, :, :], c - cm)
return out
评论列表
文章目录