anhttran / extreme_3d_faces

Extreme 3D Face Reconstruction: Looking Past Occlusions
Other
785 stars 184 forks source link

Camera models and coordinates of extreme_3d_faces #22

Closed Ivy147 closed 4 years ago

Ivy147 commented 5 years ago

Hi,anhttran, First thank you for the open source code on the github of extreme_3d_faces,I ran your code and got a nice and robust model(pointcloud). Since I want to project texture to the model, I project the model using the perspective projection below: Pointcloud = rshape+t; z= pointcloud.z u= -pointcloud.x/ pointcloud.zf+w/2; v= pointcloud.y/ pointcloud.z*f+h/2; with f=1000,w=h=500; But my result is wrong, Pixel Coordinates u & v get very large or negative, can you tell me where is wrong?or the camera model I throught is right? Anyone who knows this can help me? Thank you very much.

Ivy

dzk9528 commented 5 years ago
def transfer_vertice(vertices, w, h, f=1000.0, cx=250.0, cy=250.0):
    vertices[:, 0] = - np.true_divide(vertices[:, 0], vertices[:, 2]) * f + cx
    vertices[:, 1] = np.true_divide(vertices[:, 1], vertices[:, 2]) * f + cy

    return vertices

The vertices used is foundation_aligned.ply, but the result is a little bit off the face. recovered_face

anhttran commented 5 years ago

Note that I just focus on the front part of the face. The back part, including the ears, is not modeled, thus its shape may not match the input image

I think the nose and the eyes are aligned well. The mouth should open a bit more; this error comes from expression fitting from Dlib landmarks.

dzk9528 commented 5 years ago

Thanks for replying, is that means I use the right method to recover the vertices to image plane? On the other side, I notice that the number of vertices is a little bit larger than I expected. So is it possible to generate UV texture map with your model?

anhttran commented 5 years ago

You can remove the back part, including ears since it is not accurate.