From e8402a10278f0203fc878e850575b58f86cd995d Mon Sep 17 00:00:00 2001 From: YadiraF Date: Fri, 11 May 2018 12:50:31 +0800 Subject: [PATCH] add colors from texture --- api.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/api.py b/api.py index 1cec2ab..5d646b4 100644 --- a/api.py +++ b/api.py @@ -148,11 +148,24 @@ def get_vertices(self, pos): Returns: vertices: the vertices(point cloud). shape = (num of points, 3). n is about 40K here. ''' - all_vertices = np.reshape(pos, [self.resolution_op**2, -1]); + all_vertices = np.reshape(pos, [self.resolution_op**2, -1]) vertices = all_vertices[self.face_ind, :] return vertices + def get_colors_from_texture(self, texture): + ''' + Args: + texture: the texture map. shape = (256, 256, 3). + Returns: + colors: the corresponding colors of vertices. shape = (num of points, 3). n is 45128 here. + ''' + all_colors = np.reshape(texture, [self.resolution_op**2, -1]) + colors = all_colors[self.face_ind, :] + + return colors + + def get_colors(self, image, vertices): ''' Args: