I am trying to find the pixel(camera) coordinates of a bone in my character. (Character via MakeHuman Exhange).
Everything seems to work as it should - except - on output, the pixel value is always a little different than where it should be, and I can’t find any reason for this offset.
I have attached an image plotted with the pixel coordinate. The forum did not allow me to upload another image of where the joint should be, but as you can guess it should be at the waist area, not that low on the leg
I have tried every possible combination of x and y directions to make sure it is not as simple as flipping the axes. I have attached my code below
gcs = bpy.data.objects[armature].pose.bones["Hips"].head context = bpy.context scene = context.scene # Set camera = current camera object camera = bpy.data.objects["Camera"] ccs = bpy_extras.object_utils.world_to_camera_view(scene, camera, gcs) # Square Image so res_x = res_y pixel_coordinates = ccs * resolution
After that I draw a circle centered in the joint spot via PIL (of the rendered image). Render is constant as 1000x1000, so no error from that.
Also, just another quick question - how does the z coordinate of the camera view compare to the x/y that is scaled 0 to 1?
thank you for your help i appreciate it