How to find image coordinates of the rendered vertex? I have a simple mesh of a cube.  I would like to know what are the coordinates of each vertex in the rendered image (i.e. for each 3d vertex I'd like to know it's pixel coordinates).  Is there a way to do this?

Clarification:

I'm experimenting with a pose estimation algorithm (i.e. finding out the 3d pose of the object) from a (set of) 2d image(s).  Instead of taking an image of a real object with a real camera I synthetically render the image of a cube using blender.  In this way I know the pose of the object and the intrinsics of the camera, so I can easily validate the results of the pose estimation algorithm.
Pose estimation algorithms usually require to provide them with world points on the object and the corresponding image points.  So what I'm looking for is a way to produce a dump of correspondences of the 3d point &lt;--> image point as a byproduct of the rendering procedure.
Thanks,
Alex
This script gives projected the 2D pixel coordinate from a 3D world-space location.

The (0, 0) origin is the bottom left of the image(common for math, OpenGL and Blender in general).
A negative Z return value means the point is behind the camera:

Example:
# Test the function using the active object (which must be a camera)
# and the 3D cursor as the location to find.
import bpy
import bpy_extras

scene = bpy.context.scene
obj = bpy.context.object
co = bpy.context.scene.cursor_location

co_2d = bpy_extras.object_utils.world_to_camera_view(scene, obj, co)
print(&quot;2D Coords:&quot;, co_2d)

# If you want pixel coords
render_scale = scene.render.resolution_percentage / 100
render_size = (
    int(scene.render.resolution_x * render_scale),
    int(scene.render.resolution_y * render_scale),
)
print(&quot;Pixel Coords:&quot;, (
      round(co_2d.x * render_size[0]),
      round(co_2d.y * render_size[1]),
))

See the Python Source-Code if you're interested in exactly how this works.