asi_core.visualization.masking ============================== .. py:module:: asi_core.visualization.masking .. autoapi-nested-parse:: This module provides functions to visualize masks in all-sky imagers, like detected cloud layers. Functions --------- .. autoapisummary:: asi_core.visualization.masking.overlay_mask asi_core.visualization.masking.create_saturation_mask_image Module Contents --------------- .. py:function:: overlay_mask(img, mask, mask_color=(255, 0, 0), alpha=0.5, asarray=True) Overlays a binary mask onto an image with a specified color and transparency. :param img: The input image, either as a NumPy array or a PIL Image. :param mask: A binary mask (NumPy array) where nonzero values indicate the mask region. :param mask_color: A tuple representing the RGB color of the mask (default is red: (255, 0, 0)). :param alpha: A float (0 to 1) that controls the transparency of the overlay (default is 0.5). :param asarray: If True, returns the result as a NumPy array; otherwise, returns a PIL Image. :return: The image with the overlaid mask, either as a NumPy array or a PIL Image. .. py:function:: create_saturation_mask_image(img, camera_mask=None, text_position=(10, 10), font_size=40, asarray=True) Create a saturation mask image by identifying and overlaying saturated regions on the input image. :param img: The input image as a NumPy array. :type img: numpy.ndarray :param camera_mask: An optional binary mask specifying the valid region of the image (default is None, meaning all pixels are considered valid). :type camera_mask: numpy.ndarray, optional :param text_position: The position (x, y) where the saturation percentage text is drawn on the image (default is (10, 10)). :type text_position: tuple[int, int], optional :param font_size: The font size of the saturation percentage text (default is 40). :type font_size: int, optional :param asarray: Whether to return the output as a NumPy array (default is True). If False, returns a PIL Image. :type asarray: bool, optional :return: The image with the saturation mask overlay, either as a NumPy array or a PIL Image. :rtype: numpy.ndarray or PIL.Image.Image