menpo / menpo3d

Tools for manipulating 3D meshes within the Menpo project.
http://www.menpo.org
Other
165 stars 55 forks source link

How to use menpo3d/extractimage.py to generate the mesh occlusion mask for UV map? #80

Open llei66 opened 3 years ago

llei66 commented 3 years ago
from menpo3d.extractimage import *

import menpo3d.io as m3io
import menpo.io as mio
import cv2
import menpo3d
import pdb

obj_path = '/data/DATA/3dFace/UVGAN_DATA/Visualise_demo/demo_input/001_01_01_051_10.obj'

img_path = "/data/DATA/3dFace/UVGAN_DATA/Visualise_demo/demo_input/img/"
mesh = m3io.import_mesh(obj_path)
image = mio.import_images(img_path, verbose=True)

#from menpowidgets import visualize_images
#visualize_images(image)
pdb.set_trace()

#mesh_temp.view()
points = mesh.points
mask = per_vertex_occlusion_accurate(mesh)
colours = extract_per_vertex_colour(mesh, image[0])

I use the menpo3d, and import mesh and image, but the mask results is false, so every points(53125) is occluded, I output the result as below. Could you help me to get the occlusion mask for uvmap? Thanks a lot! image