daniilidis-group / neural_renderer

A PyTorch port of the Neural 3D Mesh Renderer
Other
1.12k stars 248 forks source link

how to get the render if the image width != height? #100

Open special-yang opened 3 years ago

special-yang commented 3 years ago

how to get the render if the image width != height?

for example

K - K matrix, R - Rotation matrix, t = translation vector

vertices,faces=nr.load_obj(os.path.join(data_dir,'plane.obj'), normalization=False)

neural renderer

renderer = nr.Renderer(camera_mode='projection', image_size=1024, anti_aliasing=False, near=0.1) #image_size is used up in rasterizing function im = renderer(vertices[None, :, :], faces[None, :, :], mode='depth', K=K, R=R_tensor, t=t_tensor, orig_size=1024) a = im[0].data.cpu().numpy() plt.imsave(os.path.join(output_dir,'plane_depth.png'), a, cmap='gray')

in this code orig_size width =height=1024