I need the bone-head coordinates to be mapped on to the camera view. Actual scenario is to obtain the 3D coordinates of bone/joint. This is how I do it now.
scene = bpy.context.scene obj = bpy.context.object render_scale = scene.render.resolution_percentage / 100 render_size = ( int(scene.render.resolution_x * render_scale), int(scene.render.resolution_y * render_scale), ) Bones16_WCO=[obj.pose.bones["Head"].head,obj.pose.bones["Neck"].head] for wco in Bones16_WCO: cco = bpy_extras.object_utils.world_to_camera_view(scene, cam, wco) print("2D Coords:", cco ) print("Pixel Coords:", ( round(cco.x * render_size), round(cco.y * render_size), ))
This is with the help of link- How to find image coordinates of the rendered vertex?
However, I need this to be done for different animated model. So at each frame of animation, the above code to get the bone locations has to be executed. How do I iterate this for entire animation using python scripting?