MCPcopy Create free account
hub / github.com/apple/ml-pointersect / replace_texture

Method replace_texture

pointersect/inference/structures.py:3272–3293  ·  view source on GitHub ↗

Replace the texture maps in the o3d mesh. Args: texture_imgs: a list of texture maps (may be in a different shape than the o3d textures) # method: # 'crop_resize': if a new texture is larger in dimension -> crop; if smaller ->

(self, texture_imgs: T.List[np.ndarray])

Source from the content-addressed store, hash-verified

3270 self.scene.add_triangles(mesh_t)
3271
3272 def replace_texture(self, texture_imgs: T.List[np.ndarray]):
3273 """
3274 Replace the texture maps in the o3d mesh.
3275
3276 Args:
3277 texture_imgs:
3278 a list of texture maps (may be in a different shape than the o3d textures)
3279 # method:
3280 # 'crop_resize': if a new texture is larger in dimension -> crop; if smaller -> resize.
3281 """
3282
3283 texture_maps = self.mesh.textures
3284 num_textures = len(texture_maps)
3285
3286 if len(texture_imgs) != num_textures and len(texture_maps) > 0:
3287 warnings.warn(f'num of texture_imgs {len(texture_imgs)} != number of need {num_textures}')
3288 return
3289
3290 new_textures = []
3291 for i in range(len(texture_maps)):
3292 new_textures.append(o3d.geometry.Image(texture_imgs[i]))
3293 self.mesh.textures = new_textures
3294
3295 def get_rgbd_image(
3296 self,

Callers 1

__getitem__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected