hypso.rgb.camera#

HYPSO-2’s RGB camera: reading its images (groundwork for camera support).

A capture directory holds the camera image as <capture id>-rgb/<target>_ <YYYY_MM_DD>T<HH_MM_SS>.bmp: one 8-bit raw Bayer mosaic (3840 x 2748), taken about 2 s before the HSI capture starts. The mosaic is RGGB; the ground processing’s demosaiced copy (processing-temp/rgb-camera-image-debayered.png) is this module’s bilinear RGGB demosaic rotated 180 degrees (checked on the 2025-04-04 Ariake capture: correlation 0.98-1.00 per channel). The file has no georeferencing. Reading never registers it; that is an explicit step, hypso.rgb.register_camera() (the HSI product gives the geolocation).

Examples

>>> image = read_camera_image(find_camera_image(capture_dir))
>>> image.sel(channel="G")

Functions#

camera_image_time(path)

Acquisition time (UTC) from a camera image's file name.

demosaic_bilinear(mosaic[, pattern])

Bilinear demosaic of a Bayer mosaic.

find_camera_image(capture_dir)

The RGB camera image of a capture directory, or None if it has none.

read_camera_image(path[, demosaic, rotate])

Read an RGB camera image.

Module Contents#

hypso.rgb.camera.camera_image_time(path)[source]#

Acquisition time (UTC) from a camera image’s file name.

Return type:

datetime.datetime

hypso.rgb.camera.demosaic_bilinear(mosaic, pattern=BAYER_PATTERN)[source]#

Bilinear demosaic of a Bayer mosaic.

Parameters:
  • mosaic (numpy.ndarray) – 2D raw values.

  • pattern ({"RGGB", "BGGR", "GRBG", "GBRG"}) – Colour filters of the top-left 2x2 cell, row by row.

Returns:

(rows, cols, 3) float32 R, G, B.

Return type:

numpy.ndarray

hypso.rgb.camera.find_camera_image(capture_dir)[source]#

The RGB camera image of a capture directory, or None if it has none.

Parameters:

capture_dir (str or pathlib.Path)

Return type:

pathlib.Path or None

hypso.rgb.camera.read_camera_image(path, demosaic=True, rotate=True)[source]#

Read an RGB camera image.

Parameters:
  • path (str or pathlib.Path) – The .bmp (see find_camera_image()).

  • demosaic (bool, default True) – Bilinear RGGB demosaic to R, G, B; False returns the raw mosaic.

  • rotate (bool, default True) – Rotate 180 degrees, the orientation of the ground processing’s demosaiced image.

Returns:

(y, x, channel) float32 R, G, B in raw counts (0-255), or the (y, x) uint8 mosaic; attributes instrument (“RGB”), acquisition_time (ISO 8601, UTC), bayer_pattern, source.

Return type:

xarray.DataArray