MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / set_KRT

Method set_KRT

detrsmpl/core/cameras/camera_parameters.py:127–157  ·  view source on GitHub ↗

Set intrinsic and extrinsic of a camera. Args: K_mat (np.ndarray): In shape [3, 3]. R_mat (np.ndarray): Rotation from world to view in default. In shape [3, 3]. T_vec (np.ndarray): Translatio

(self,
                K_mat: np.ndarray,
                R_mat: np.ndarray,
                T_vec: np.ndarray,
                inverse_extrinsic: bool = False)

Source from the content-addressed store, hash-verified

125 return dist_coeffs
126
127 def set_KRT(self,
128 K_mat: np.ndarray,
129 R_mat: np.ndarray,
130 T_vec: np.ndarray,
131 inverse_extrinsic: bool = False) -> None:
132 """Set intrinsic and extrinsic of a camera.
133
134 Args:
135 K_mat (np.ndarray):
136 In shape [3, 3].
137 R_mat (np.ndarray):
138 Rotation from world to view in default.
139 In shape [3, 3].
140 T_vec (np.ndarray):
141 Translation from world to view in default.
142 In shape [3,].
143 inverse_extrinsic (bool, optional):
144 If true, R_mat and T_vec transform a point
145 from view to world. Defaults to False.
146 """
147 k_shape = K_mat.shape
148 assert k_shape[0] == k_shape[1] == 3
149 r_shape = R_mat.shape
150 assert r_shape[0] == r_shape[1] == 3
151 assert T_vec.ndim == 1 and T_vec.shape[0] == 3
152 self.set_mat_np('in_mat', K_mat)
153 if inverse_extrinsic:
154 R_mat = np.linalg.inv(R_mat)
155 T_vec = -np.dot(R_mat, T_vec).reshape((3))
156 self.set_mat_np('rotation_mat', R_mat)
157 self.set_value('translation', T_vec.tolist())
158
159 def get_KRT(self, k_dim=3) -> List[np.ndarray]:
160 """Get intrinsic and extrinsic of a camera.

Callers

nothing calls this directly

Calls 2

set_mat_npMethod · 0.95
set_valueMethod · 0.95

Tested by

no test coverage detected