def __init__(self, hdf5file, frameno): bbfilename = backbone_data_dir + hdf5file + '-' + str(frameno) + '-backbone.json' (points, edgedists) = poselib.bbLoad(bbfilename) (spline, bblength) = poselib.bbToSpline(points) self.bbpoints = poselib.bbTraceSpline(spline, bblength)
frameNo = int(sys.argv[2]) bbfilename = sys.argv[3] outputfile = None if len(sys.argv) >= 5: outputfile = sys.argv[4] h5file = tables.open_file(filename, mode = "r") node = h5file.get_node('/', '/images/' + str(frameNo)) ar = h5file.get_node('/', '/autorectification') try: cw = h5file.get_node('/', '/cropwindow') except tables.NoSuchNodeError: cw = None uvframe = hdf5lflib.compute_uvframe(node, ar, cw) (points, edgedists) = poselib.bbLoad(bbfilename) (spline, bblength) = poselib.bbToSpline(points) bbpoints = poselib.bbTraceSpline(spline, bblength, uvframe) # Draw the backbone #plt.figure() #plt.plot(bbpoints[:,0,1], bbpoints[:,0,0], 'o') # (x, y) order #plt.axis([0,100,100,0]) #plt.show() restackframe = restackBySpline(bbpoints, uvframe, points, edgedists) if outputfile: scipy.misc.imsave(outputfile, restackframe) else: # Draw the restacked image