arguslib.camera package¶
- class arguslib.camera.PerspectiveProjection(focal_lengths, principal_point, distortion_coeffs=None)[source]¶
Bases:
object
- class arguslib.camera.Camera(intrinsic_calibration, *args, scale_factor=1, camera_type='allsky', **kwargs)[source]¶
Bases:
InstrumentRepresents a camera instrument, handling intrinsic and extrinsic calibration.
This class provides the core functionality for a single camera, including loading configuration, converting between world coordinates and pixel coordinates, and rendering the camera’s view on a plot. It supports both ‘allsky’ fisheye cameras and standard ‘perspective’ cameras.
- intrinsic¶
The intrinsic calibration model.
- Type:
- scale_factor¶
A scaling factor applied to image dimensions.
- Type:
float
- camera_type¶
The type of camera, e.g., ‘allsky’ or ‘perspective’.
- Type:
str
- image_size_px¶
The dimensions of the camera image in pixels.
- Type:
np.ndarray
- class arguslib.camera.CameraArray(cameras, layout_shape)[source]¶
Bases:
PlottableInstrument- annotate_positions(positions, dt, ax, *args, **kwargs)[source]¶
Annotate the positions of the cameras on the map.
- class arguslib.camera.DirectCamera(intrinsic_calibration, *args, scale_factor=1, camera_type='allsky', **kwargs)[source]¶
Bases:
CameraA Camera subclass that renders annotations directly onto the image array.
This class is optimized for performance, especially for creating videos. Instead of using Matplotlib for plotting, it overrides the show and annotate_positions methods to use OpenCV functions (cv2.line, cv2.putText) to draw directly on the image data.
As a result, its show and annotate_positions methods do not accept or return Matplotlib Axes objects. The final image can be accessed via the .image property or .to_image_array() method.
- annotate_positions(positions, dt, ax, *args, plotting_method=None, max_range_km=90, **kwargs)[source]¶
Annotates one or more geographical positions on the camera image. This version is vectorized for performance.
- property image¶
- class arguslib.camera.DirectUndistortedCamera(*args, **kwargs)[source]¶
Bases:
UndistortedCamera,DirectCamera
- class arguslib.camera.UndistortedCamera(*args, **kwargs)[source]¶
Bases:
CameraA specialized Camera that applies a fisheye undistortion to images.
This version pre-computes the undistortion mapping for high performance.
- class arguslib.camera.Video(filepath)[source]¶
Bases:
object
- class arguslib.camera.VideoInterface(instrument)[source]¶
Bases:
PlottableInstrumentA PlottableInstrument that uses a DirectCamera to produce video frames and provides utilities for writing these frames to a video file.
- add_frame_to_video(dt, show_kwargs=None, time_overlay=True, image_array=None)[source]¶
Adds a frame for the given datetime ‘dt’ to the video. If image_array is provided (in BGR format), it’s used directly. Otherwise, a frame is generated using the direct_camera.
- Parameters:
dt (
datetime) – Datetime for the frame.show_kwargs (
Optional[dict]) – Arguments to pass to self.direct_camera.show().time_overlay (
bool) – If True, adds a timestamp overlay to the frame (if generated).image_array (
Optional[ndarray]) – Optional pre-rendered BGR numpy array.
- Return type:
None
- annotate_positions(positions, dt, ax=None, *args, **kwargs)[source]¶
Delegates annotation to the underlying direct camera. ‘ax’ is expected to be None for DirectCamera.
- Return type:
None
- finish_video_output()[source]¶
Releases the video writer and resets video properties.
- Return type:
None
- generate_video(output_path, start_dt, end_dt, step_timedelta, fps, show_kwargs=None, time_overlay=True)[source]¶
Generates a complete video file by iterating through time.
- Return type:
None
- show(dt, ax=None, **kwargs)[source]¶
Prepares the direct camera’s internal image for the given datetime. Consistent with DirectCamera, this method updates the internal state and returns None as no Matplotlib axes are involved.
- Parameters:
dt (
datetime) – The datetime for which to prepare the frame.ax (
Any) – Should be None. Included for PlottableInstrument compatibility.**kwargs (
Any) – Additional arguments passed to the direct_camera.show() method (e.g., brightness_adjust).
- Return type:
None