Skip to content

Camera

Camera pydantic-model ¤

data: ndarray pydantic-field ¤

fov: int pydantic-field ¤

image_size_x: int pydantic-field ¤

image_size_y: int pydantic-field ¤

intrinsics_matrix: ndarray pydantic-field ¤

transform: Transform pydantic-field ¤

__config__ ¤

Config ¤

__json_encoder__(obj) special staticmethod ¤

calculate_intrinsic_matrix(self) ¤

Calculate intrinsics matrix Will set the attribute intrinsic matrix so that re-calculation is not necessary. https://github.com/carla-simulator/carla/issues/56

[ ax, 0, cx, 0, ay, cy, 0 , 0, 1 ]

Returns:

Type Description
ndarray

Intrinsics_matrix

Source code in ROAR_simulation/roar_autonomous_system/utilities_module/camera_models.py
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def calculate_intrinsic_matrix(self) -> np.ndarray:
    """
    Calculate intrinsics matrix
    Will set the attribute intrinsic matrix so that re-calculation is not
    necessary.
    https://github.com/carla-simulator/carla/issues/56

    [
            ax, 0, cx,
            0, ay, cy,
            0 , 0, 1
    ]

    Returns:
        Intrinsics_matrix
    """
    intrinsics_matrix = np.identity(3)
    intrinsics_matrix[0, 2] = self.image_size_x / 2.0
    intrinsics_matrix[1, 2] = self.image_size_y / 2.0
    intrinsics_matrix[0, 0] = self.image_size_x / (
        2.0 * np.tan(self.fov * np.pi / 360.0)
    )
    intrinsics_matrix[1, 1] = self.image_size_x / (
        2.0 * np.tan(self.fov * np.pi / 360.0)
    )
    self.intrinsics_matrix = intrinsics_matrix
    return intrinsics_matrix

visualize(self, title='CameraData', duration=1) ¤

Visualize camera data.

Parameters:

Name Type Description Default
title

title of cv2 image

'CameraData'
duration

in milisecond

1

Returns:

Type Description
None

None

Source code in ROAR_simulation/roar_autonomous_system/utilities_module/camera_models.py
56
57
58
59
60
61
62
63
64
65
66
67
68
def visualize(self, title="CameraData", duration=1) -> None:
    """
    Visualize camera data.
    Args:
        title: title of cv2 image
        duration: in milisecond

    Returns:
        None
    """
    if self.data is not None:
        cv2.imshow(title, self.data.data)
        cv2.waitKey(duration)