How to achieve projectiveTexturing and save the projected color into the mesh's texture?

So,i need to project a picture from a projector(maybe a camera) on some meshes and save the project information into the mesh texture according to the mesh’s unfolded uv.It just like the light map which encode the lightinfo into the texture instead of the projectinfo.

The following pic is an example.I noticed blender actually has this function that allow you to draw a texture on to a mesh.But i have no idea on how to save those project color into the mesh’s texture.Anybody can help>?
[1]: