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 946 forks source link

3D object alignment with source photo #24

Open rosenb0rg opened 6 years ago

rosenb0rg commented 6 years ago

I'm having some trouble getting the OBJ mesh objects to align with the original photo. It seems like horizontal axis is swapped (although it depends what software you view it in. Any way to control axis orientation (or do you know what the default is for the libraries you're using?)

Related issue is how you created the 3D animated object you use in your demo video. I know this isn't strictly a coding issue, but I'm curious how you handle a sequence of OBJ files to turn them into an animation.

yfeng95 commented 6 years ago

Hi,

  1. If you means the OBJ opened with meshlab is flipped with original 2d image, this is because their aixs relations are y = h - 1 - y. If you want a visual aligned one, you can add save_vertices[:,1] = h - 1 - save_vertices[:,1] before write obj.
  2. In my demo video, the image are plotted by Matlab. I've answer in #10, the vertices are definitely aligned to the image. And the 3D object are plotted by
    imshow(image);  
    hold on; 
    patch('Vertices', double(mesh.vertices),  'FaceVertexCData', mesh.colors, 'Faces', mesh.triangles, 'FaceColor', 'interp', 'EdgeColor', 'none', 'EdgeLighting', 'none', 'LineWidth', 1);
    camlight('left');

    Thanks for your reporting, if there's other people also care about that, I will modify this.