Skip to content

common

view_points

view_points(points: NDArrayF64, intrinsic: NDArrayF64, distortion: NDArrayF64 | None = None, *, normalize: bool = True) -> NDArrayF64

Project 3d points on a 2d plane. It can be used to implement both perspective and orthographic projections.

It first applies the dot product between the points and the view.

Parameters:

  • points (NDArrayF64) –

    Matrix of points, which is the shape of (3, n) and (x, y, z) is along each column.

  • intrinsic (NDArrayF64) –

    nxn camera intrinsic matrix (n <= 4).

  • distortion (NDArrayF64 | None, default: None ) –

    Camera distortion coefficients, which is the shape of (n,) (n >= 5).

  • normalize (bool, default: True ) –

    Whether to normalize the remaining coordinate (along the 3rd axis).

Returns:

  • NDArrayF64

    Projected points in the shape of (3, n). If normalize=False, the 3rd coordinate is the height.

is_box_in_image

is_box_in_image(box: Box3D, intrinsic: NDArrayF64, img_size: tuple[int, int], visibility: VisibilityLevel = VisibilityLevel.NONE) -> bool

Check if a box is visible inside of an image without considering its occlusions.

Parameters:

  • box (Box3D) –

    The box to be checked.

  • intrinsic (NDArrayF64) –

    3x3 camera intrinsic matrix.

  • img_size (tuple[int, int]) –

    Image size in the order of (width, height).

  • visibility (VisibilityLevel, default: NONE ) –

    Enum member of VisibilityLevel.

Returns:

  • bool

    Return True if visibility condition is satisfied.

load_json

load_json(filename: str) -> Any

Load json data from specified filepath.

Parameters:

  • filename (str) –

    File path to .json file.

Returns:

  • Any

    Loaded data.

save_json

save_json(data: Any, filename: str) -> None

Save data into json file.

Parameters:

  • data (Any) –

    Data to be saved.

  • filename (str) –

    File path to save as json.

us2sec

us2sec(timestamp: Number) -> float

Convert timestamp from micro seconds [us] to seconds [s].

Parameters:

  • timestamp (Number) –

    Timestamp in [us].

Returns:

  • float

    Timestamp in [s].

sec2us

sec2us(timestamp: Number) -> float

Convert timestamp from seconds [s] to micro seconds [us].

Parameters:

  • timestamp (Number) –

    Timestamp in [s].

Returns:

  • float

    Timestamp in [us].