Face and feature landmarks
I have a face image that has labelled face features. The image is stored in standard JPEG format and the landmarks are stored in [x y]
format (x,y of point corresponds to its coordinates on the image as shown below)
Interpolated 3d face mesh
I have generated depth information (a 3d mesh) for each of the labelled points, and have a matrix in [x y z]
format, where the coordinates x and y are the same as that of the points.
The sparse mesh looks like this:
I then interpolated over xrange
, yrange
and zrange
to get a better mesh. Using mesh(xrange,yrange,zrange)
gives me the following
The colours for face image pixels can be obtained using imread(face_image.jpg)
.
Given that the (x,y) value of each of the interpolated point corresponds to (x,y) in the image, is it possible to make the colour of the pixel at (x,y,z)[3dmesh] the same as colour of (x,y)[face image]?
This would effectively superimpose/warp the face on the3d mesh, giving me a 3d face model.
I would suggest this:
To map the color in your RGB image into a linear index. Make sure the mesh and the RGB image have the same x-y dimensions.
Then use
surf
to plot the surface with the indexed values for color (should be in the formsurf(X,Y,Z,C)
) and themap
as color map.Edit: a working example (with a colorful image this time...):
Result: