''' tenon.render.DepthMode.disable() tenon.render.writevideo('video/') tenon.logging.info('Complete rendering video') tenon.render.DepthMode.enable() tenon.render.writevideo('depth/') tenon.logging.info('Complete rendering depth') # Output the joint location for fid in range(10): tenon.obj.scene.frame_set(fid) # set to frame joints = exportJoint( ) # TODO: update this with JointInfo class in lsppose serializeJointInfo('joint/%04d.csv' % fid, joints) if not tenon.inblender(): import argparse parser = argparse.ArgumentParser() parser.add_argument('scenefile', default='../../../data/mocap_demo_scene.blend', help='The scene file for rendering') args = parser.parse_args() tenon.run(__file__, args.scenefile) else: main()
depth_filename = os.path.join(out_folders['depth'], '%04d.png' % pose_id) tenon.render.DepthMode.enable() tenon.render.write(depth_filename) L.info('Depth: %s' % L.prettify_filename(depth_filename)) tenon.render.DepthMode.disable() paint_filename = os.path.join(out_folders['semantic'], '%04d.png' % pose_id) for obj in objs: tenon.render.PaintMode.enable(obj) tenon.render.write(paint_filename) L.info('Semantic parts: %s' % L.prettify_filename(paint_filename)) for obj in objs: tenon.render.PaintMode.disable(obj) # Also save the joint annotation and part annotation joint_filename = os.path.join(out_folders['2dpose'], '%04d.csv' % pose_id) joints = lsppose.JointInfo.export() lsppose.JointInfo.serializeJointInfo(joint_filename, joints) L.info('2D joint location: %s' % L.prettify_filename(joint_filename)) if __name__ == '__main__': # Avoid execution during module import if not tenon.inblender(): parser = argparse.ArgumentParser() parser.add_argument('-f', '--blendfile', default = os.path.join('../data/fully_annotated.blend')) args = parser.parse_args() tenon.run(__file__, args.blendfile) else: main()
''' Define a set of functions to read lsp 2D ground truth annotation Demo code for interactive shell import sys; sys.path.append('/q/workspace/tenon/examples/'); sys.path.append('/q/workspace/tenon/') import lsppose ''' import tenon import tenon.logging as L import os, glob if tenon.inblender(): ''' Functions and classes only available for blender ''' # The real work should only happen in blender import bpy, mathutils import tenon.util as U class Models: ''' Provide access to mesh data in the scene ''' def __init__(self): ''' Find human model in the scene ''' keys = bpy.data.armatures.keys() L.debug('Get %d armatures %s' % (len(keys), keys))
# Make sure the log information from tenon would not contaminate here tenonpath = '..' import sys sys.path.append(tenonpath) import tenon tenon.run(__file__, '../demo.blend') if tenon.inblender(): tenon.obj.get('non_exist_obj') # Expected to produce a warning message