Skip to content

Commit

Permalink
minor save
Browse files Browse the repository at this point in the history
  • Loading branch information
czw0078 committed Jul 30, 2018
1 parent a7425f2 commit 301cd41
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions neural_renderer/load_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ def load_textures(filename_obj, filename_mtl, texture_size):
for material_name, filename_texture in texture_filenames.items():
filename_texture = os.path.join(os.path.dirname(filename_obj), filename_texture)
image = imread(filename_texture).astype(np.float32) / 255.

# texture image may have one channel (grey color)
if len(image.shape) == 2:
image = np.stack((image,)*3,-1)
# or has extral alpha channel shoule ignore for now
if image.shape[2] == 4:
image = image[:,:,:3]

# pytorch does not support negative slicing for the moment
image = image[::-1, :, :]
image = torch.from_numpy(image.copy()).cuda()
Expand Down

0 comments on commit 301cd41

Please sign in to comment.