Closed gsygsy96 closed 5 years ago
?By the way, I found depth seems a binary map. why
same error for me
# rasterization
faces = nr.vertices_to_faces(vertices, faces)
out = nr.rasterize_rgbad(
faces, textures, self.image_size, self.anti_aliasing, self.near, self.far, self.rasterizer_eps,
self.background_color)
return out['rgb'], out['depth'], out['alpha']
the code above is in file renderer.py line 241:246(also the end of the file). Obviously, the return object is a list like object.
But there is nothing serious, we can see the return object is:[rgb, depth, alpha]. and the rgb, depth and alpha are all torch.tensors . so if we want to get rgb image, just get the first element of the returning object. the code modify as bellow is work rightly:
image = images[0].detach().cpu().numpy()[0].transpose((1, 2, 0)) # [image_size, image_size, RGB]
render return tuple, just add index can solve it.
When I run exampe2.py, an error are reported:
Traceback (most recent call last): File "./examples/example2.py", line 100, in <module> main() File "./examples/example2.py", line 94, in main image = images.detach().cpu().numpy()[0].transpose((1, 2, 0)) AttributeError: 'tuple' object has no attribute 'detach'
So, I scan the render code, and find that it returns a tuple. I think example2 should changed to : image = images[0].detach().cpu().numpy()[0].transpose((1, 2, 0))