kaolin.render.camera¶
API¶
-
kaolin.render.camera.
generate_perspective_projection
(fovyangle, ratio=1.0, dtype=torch.float32)¶ Generate perspective projection matrix for a given camera fovy angle.
Parameters: Returns: camera projection matrix, of shape \((3, 1)\).
Return type: (torch.FloatTensor)
-
kaolin.render.camera.
generate_rotate_translate_matrices
(camera_position, look_at, camera_up_direction)¶ generate rotation and translation matrix for given camera parameters. Formula is \(\text{P_cam} = \text{mtx} * \text{P_world} + \text{shift}\)
Parameters: - camera_position (torch.FloatTensor) – camera positions of shape \((\text{batch_size}, 3)\), it means where your cameras are
- look_at (torch.FloatTensor) – where the camera is watching, of shape \((\text{batch_size}, 3)\),
- camera_up_direction (torch.FloatTensor) – camera up directions of shape \((\text{batch_size}, 3)\), it means what are your camera up directions, generally [0, 1, 0]
Returns: the camera rotation matrix of shape \((\text{batch_size}, 3, 3)\) and the camera transformation matrix of shape \((\text{batch_size}, 3)\)
Return type: (torch.FloatTensor, torch.FloatTensor)
-
kaolin.render.camera.
perspective_camera
(points, camera_proj)¶ Projects 3D points on 2D images in perspective projection mode.
Parameters: - points (torch.FloatTensor) – 3D points in camera coordinate, of shape \((\text{batch_size}, \text{num_points}, 3)\).
- camera_proj (torch.FloatTensor) – projection matrix of shape \((3, 1)\).
Returns: 2D points on image plane of shape \((\text{batch_size}, \text{num_points}, 2)\).
Return type: (torch.FloatTensor)
-
kaolin.render.camera.
rotate_translate_points
(points, camera_rot, camera_trans)¶ rotate and translate 3D points on based on rotation matrix and transformation matrix. Formula is \(\text{P_new} = R * (\text{P_old} - T)\)
Parameters: - points (torch.FloatTensor) – 3D points, of shape \((\text{batch_size}, \text{num_points}, 3)\).
- camera_rot (torch.FloatTensor) – rotation matrix, of shape \((\text{batch_size}, 3, 3)\).
- camera_trans (torch.FloatTensor) – translation matrix, of shape \((\text{batch_size}, 3, 1)\).
Returns: 3D points in new rotation, of same shape than points.
Return type: (torch.FloatTensor)