asi_core.camera.obstacle_mask¶
This module provides functions to automatically generate camera masks for all-sky imagers.
Functions¶
|
Save a mask as both a .npy and a legacy .mat file. |
|
Apply gamma correction to an image by building a lookup table mapping the pixel values [0, 255] to their adjusted |
|
Create an image mask based on the input image. Input image should be a daily/longterm average image based |
|
Process a list of images by applying optional grayscale conversion, histogram equalization, |
|
Create a mask of static objects from a set of image files. |
|
Applies computer vision methods to automatically detect a mask of obstacles obscuring the sky in the ASI image. |
Module Contents¶
- asi_core.camera.obstacle_mask.save_mask(mask, mask_dir, mask_name)¶
Save a mask as both a .npy and a legacy .mat file.
- Parameters:
mask (numpy.ndarray) – The mask array to be saved.
mask_dir (string) – The directory where the mask files will be saved.
mask_dir – The name of the mask files.
- Returns:
None
- asi_core.camera.obstacle_mask.adjust_gamma(image, gamma=1.0)¶
Apply gamma correction to an image by building a lookup table mapping the pixel values [0, 255] to their adjusted gamma values
- asi_core.camera.obstacle_mask.compute_mask(avg_img)¶
Create an image mask based on the input image. Input image should be a daily/longterm average image based on equalized histogram to enhance contrast
- asi_core.camera.obstacle_mask.aggregate_images(img_list, gray_scale=False, equalization=False, blur=False)¶
Process a list of images by applying optional grayscale conversion, histogram equalization, and blurring. Computes the average and standard deviation of the processed images.
- Parameters:
img_list (list of numpy.ndarray) – List of input images as NumPy arrays.
gray_scale (bool, optional) – Whether to convert images to grayscale (default is False).
equalization (bool, optional) – Whether to apply histogram equalization to enhance contrast (default is False).
blur (bool, optional) – Whether to apply a blurring filter to reduce noise (default is False).
- Returns:
A dictionary containing processed images, their average, and standard deviation.
- Return type:
dict
- asi_core.camera.obstacle_mask.create_mask(img_files, num_images=-1)¶
Create a mask of static objects from a set of image files.
This function aggregates a specified number of images from the provided list, computes an average image with optional grayscale conversion, histogram equalization, and blurring, and then generates a mask highlighting static objects present across the images.
- Parameters:
img_files (list[str] or list[pathlib.Path]) – A list of image file paths to be used for mask generation.
num_images (int, optional) – The number of images to use for aggregation. If -1, use all provided images.
- Returns:
The generated mask based on static objects detected in the aggregated image.
- Return type:
numpy.ndarray
- Raises:
ValueError – If img_files is empty or if num_images is 0.
- asi_core.camera.obstacle_mask.detect_mask_cv(img, max_intensity, gaussian_kernel, adaptive_thres_block_size, adaptive_thres_mean_offset, erode_dilate_kernel, margin_horizon)¶
Applies computer vision methods to automatically detect a mask of obstacles obscuring the sky in the ASI image.
- Parameters:
img – Image to be used for mask generation.
mask_intesity
gaussian_kernel
adaptive_thres_block_size
adaptive_thres_mean_offset
erode_dilate_kernel
margin_horizon
- Returns:
automatically detected mask, dtype boolean, shape of greyscaled RGB input image