# How to map/project bone coordinates to camera coordinates sytem/view?

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),
)
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[0]),
round(cco.y * render_size[1]),
))


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?

• thank you, I am trying to get each bones, convert to camera coordinates system and then to 2D: So far I am getting good results. Is there a way to change the 2d coordinate system? In blender it starts from bottom-left corner, but for image processing we need it from top-left corner. How can I change that? Jan 24, 2017 at 16:24
• Will find this useful too. blender.stackexchange.com/questions/1283/…. If you are getting good results suggest posting some code. Surely mapping bottom-left to top-left isn't too much of an issue? Jan 24, 2017 at 16:38
• no. not really. Thank you very much. I would update , once I fix this. For noe´w I am using the code from the linked answer. Jan 24, 2017 at 16:49

for f in frame_numbers: