yfeng95 / PRNet

Joint 3D Face Reconstruction and Dense Alignment with Position Map Regression Network (ECCV 2018)
http://openaccess.thecvf.com/content_ECCV_2018/papers/Yao_Feng_Joint_3D_Face_ECCV_2018_paper.pdf
MIT License
4.96k stars 944 forks source link

[bug report] The texture of the obtained mesh is horizontally flipped #58

Open marvin521 opened 6 years ago

marvin521 commented 6 years ago

I found a bug. It seems like that the texture of the obtained mesh is horizontally flipped. I am now trying to find the bug, so far I have not solved the problem.....

ileniTudor commented 6 years ago

You can use the method transfor_test from here: (just add to the parameters list: triangles, colors)

https://github.com/YadiraF/face3d/blob/master/examples/3_transform.py

I did something like:

        vertices = prn.get_vertices(pos)
        scale_init = 180 / (np.max(vertices[:, 1]) - np.min(vertices[:, 1]))
        colors = prn.get_colors(image, vertices)

        camera_matrix, pose = estimate_pose(vertices)
        yaw, pitch, roll = pose
        pitch = pitch * 180 / np.pi
        yaw = yaw * 180 / np.pi
        roll = roll * 180 / np.pi

        obj['s'] = scale_init
        obj['angles'] = [-pitch,yaw,-roll+180]
        obj['t'] = [0, 0, 0]
        # center vertices to [0,0,0]
        vertices = vertices - np.mean(vertices, 0)[np.newaxis, :]

        camera['eye'] = [0, 0, 256]
        camera['proj_type'] = 'perspective'
        camera['at'] = [0, 0, 0]
        camera['near'] = 1000
        camera['far'] = -100
        # eye position
        camera['fovy'] = 30
        camera['up'] = [0, 1, 0]
        image = transform_test(vertices, obj, camera, triangles, colors,h=256,w=256)