Closed xhuan8 closed 11 months ago
I don't know what you expect. May try keeping R=cam_R, T=translation
but try also setting fov
to something less than 60
(the default, in degrees)?
It was compared with a WeakPerspectiveCamera from pyrender, the result seems fit the 2D image.
the scale is round 1.0, so translation for z axis is around 20 according to the function, but 20 is quite far away in PyTorch3D.
either need add the parameter K to camera, or scale the translation, please advice.
s, tx, ty = cam_wp
camera = WeakPerspectiveCamera(
scale=[s, s],
translation=[tx, ty],
zfar=1000.
)
def convert_weak_perspective_to_camera_translation(cam_wp, focal_length, resolution):
cam_t = np.array([cam_wp[1], cam_wp[2], 2 * focal_length / (resolution * cam_wp[0] + 1e-9)])
return cam_t
def convert_camera_translation_to_weak_perspective(translation, focal_length, resolution):
cam_wp = np.array([2 * focal_length / (resolution * translation[2] + 1e-9), translation[0], translation[1]])
return cam_wp
here assume focal_length = 5000, I pass focal_length parameter to PerspectiveCameras but still didn't get things right
focal_length = torch.from_numpy(np.array([[5000.]])).float().to(device)
cameras = PerspectiveCameras(device=device, R=cam_R, T=translation, focal_length=focal_length)
focal_length = 10
I'm sorry, I can't debug this for you.
Hi,
when try to render with
cameras = FoVPerspectiveCameras(device=device, R=cam_R, T=translation)
the rendered object on image is very small,translation[0][2] /= 10.
makes it more closer but still smaller than expected.if add
K=cam_K
get blank image. what have I missed?