Camera
You can import icepy4d classes by
from icepy4d import core as icecore
and directly access to the Camera class by
icecore.Camera
icepy4d.core.camera.Camera
Class to manage Pinhole Cameras.
Attributes: |
|
---|
Note
All the Camera members are private in order to guarantee consistency between the different possible expressions of the exterior orientation. Use ONLY Getter and Setter methods to access Camera parameters from outside the Class. Use the method "update_extrinsics" to update Camera Exterior Orientataion given a new extrinsics matrix. If you need to update the camera EO from a pose matrix or from R,t, compute the extrinsics matrix first with the methods Camera.pose_to_extrinsics (pose) or Camera.Rt_to_extrinsics(R,t), that return the extrinsics matrix.
C: np.ndarray
property
Returns the camera center of the camera (i.e., coordinates of the projective centre in world reference system, that is the translation from camera to world)
Returns: |
|
---|
K: np.ndarray
property
Returns the intrinsic matrix of the camera.
Returns: |
|
---|
P: np.ndarray
property
Get Projective matrix P = K [ R | t ]
Returns: |
|
---|
R: np.ndarray
property
Returns the rotation matrix of the camera (i.e., rotation matrix from world to camera).
Returns: |
|
---|
dist: np.ndarray
property
Returns the non-linear distortion parameter vector of the camera.
Returns: |
|
---|
euler_angles: Tuple[float]
property
Returns the Euler angles of the camera.
Returns: |
|
---|
extrinsics: np.ndarray
property
Returns the extrinsic matrix of the camera.
Returns: |
|
---|
height: np.ndarray
property
Get image height
pose: np.ndarray
property
Get Pose Matrix (i.e., transformation from camera to world) as: Pose = [ R' | C ]
t: np.ndarray
property
Returns the translation vector of the camera. (i.e., translation from world to camera)
Returns: |
|
---|
width: np.ndarray
property
Get image width
C_from_P(P)
turn the camera center from a projection matrix P, as C = [- inv(KR) * Kt] = [-inv(P[1:3]) * P[4]]
Rt_to_extrinsics(R, t)
Return 4x4 Extrinsics matrix, given a 3x3 Rotation matrix and 3x1 translation vector, as follows:
[ R | t ] [ I | t ] [ R | 0 ] | --|-- | = | --|-- | * | --|-- | [ 0 | 1 ] [ 0 | 1 ] [ 0 | 1 ]
__init__(width, height, K=None, dist=None, R=None, t=None, extrinsics=None, calib_path=None)
Initialize the pinhole camera model.
Parameters: |
|
---|
Raises: |
|
---|
build_pose_matrix(R, C)
Return the Pose Matrix given R and C
euler_from_R(R)
Compute Euler angles from a given rotation matrix.
Parameters: |
|
---|
Returns: |
|
---|
extrinsics_to_pose(extrinsics=None)
Computes the Pose matrix (i.e., transformation from camera to world) from the extrinsics matrix (i.e, transformation from world to camera).
Parameters: |
|
---|
Returns: |
|
---|
factor_P()
Factorize the camera matrix into intrinsic and extrinsic parameters, i.e., K, R, and t, as P = K[R | t].
Returns: |
|
---|
make_mat_homogeneous(mat)
Return a homogeneous matrix, given a euclidean matrix (i.e., it adds a row of zeros with the last elemmatrixent as 1) [ mat ] [------------] [ 0 0 0 1 ]
pose_to_extrinsics(pose)
Returns the Pose matrix given an extrinsics matrix.
Parameters: |
|
---|
Returns: |
|
---|
project_point(points3d)
Project 3D points onto the image plane using the camera's projection matrix and non-linear distortion parameters.
Note
This method replicates the project_points
function in lib.geometry
. However, the project_points
function cannot be imported due to a circular import. If any changes are made to one of the two functions, the other one must also be manually updated.
Parameters: |
|
---|
Returns: |
|
---|
read_calibration_from_file(path)
Reads the camera's internal orientation from a file and saves it in the camera class.
Parameters: |
|
---|
Returns: |
|
---|
reset_EO()
Reset camera External Orientation (EO), in such a way as to make camera reference system parallel to world reference system
update_K(K)
Update the internal orientation matrix of the camera.
Parameters: |
|
---|
Returns: |
|
---|
update_dist(dist)
Update the distortion coefficients of the camera.
Parameters: |
|
---|
Returns: |
|
---|
update_extrinsics(extrinsics)
Update the exterior orientation matrix of the camera.
Note
update_extrinsics() is is the only method to update the camera Exterior Orientation. If you need to update the camera EO from a pose matrix or from R,t, compute the extrinsics matrix first with the method self.pose_to_extrinsics(pose) or Rt_to_extrinsics(R,t)
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|