Using Trimesh library (https://github.com/mikedh/trimesh),I'm trying to get the pixel colors of a mesh triangle from the texture loaded with the 3D mesh (.obj + .png +.mtl). In other words, given a vertex #0, I want to map the incident faces to the loaded texture and recover the pixels inside the mapped faces. For this I load the textured 3D mesh as :
im = Image.open("cow_texture.png")
im_arr=np.array(im)
mesh= trimesh.load('cow.obj',process=False, maintain_order=False)
tex = trimesh.visual.TextureVisuals(image=im)
mesh.visual.texture = tex
The problem is when try to get the incident faces of a vertex (let's take vertex n° 0), the function returns me a wrong number of incident faces (4 instead of 6(please see image below, vertex #0 in red)):
mesh_false.vertex_faces[0] #prints array([3009, 3008, 2960, -1, -1, -1, -1, -1])
However, note that the call of the function trimesh.load is made with the parameter maintain_order=False . If the load is made with maintain_order=True, the number of incident faces is good, however the uv coordinates of adjacent neighboring vertices aren't good (they are far while they should be near).
How can I retrieve the the number right number of incident faces (or right number of neighboring adjacent vertices) when load a textured 3D mesh?
I tried to load a textured 3D mesh and find incident faces of a vertex #0.