mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-04-22 22:46:36 +00:00
abc26d5c20
docs -> _docs
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
import numpy as np
|
|
|
|
from models.core import CameraParameters
|
|
|
|
|
|
class CameraModel:
|
|
def __init__(self, params: CameraParameters):
|
|
self._params = params
|
|
self._K: np.ndarray | None = None
|
|
|
|
@property
|
|
def intrinsic_matrix(self) -> np.ndarray:
|
|
if self._K is None:
|
|
fx = self._params.focal_length * self._params.resolution_width / self._params.sensor_width
|
|
fy = self._params.focal_length * self._params.resolution_height / self._params.sensor_height
|
|
cx, cy = self._params.get_principal_point()
|
|
self._K = np.array([
|
|
[fx, 0, cx],
|
|
[0, fy, cy],
|
|
[0, 0, 1]
|
|
], dtype=np.float64)
|
|
return self._K
|
|
|
|
def project(self, points_3d: np.ndarray) -> np.ndarray:
|
|
raise NotImplementedError
|
|
|
|
def unproject(self, points_2d: np.ndarray, depth: float) -> np.ndarray:
|
|
raise NotImplementedError
|
|
|
|
def undistort_points(self, points: np.ndarray) -> np.ndarray:
|
|
raise NotImplementedError
|
|
|
|
def get_fov(self) -> tuple[float, float]:
|
|
raise NotImplementedError
|
|
|