HazePerturber
- class nrtk.impls.perturb_image.generic.haze_perturber.HazePerturber(factor: float = 1.0)
HazePerturber applies haze using Shree Nayar weathering.
- Attributes:
factor (float): Strength of haze applied to an image.
- Methods:
- perturb:
Applies haze to an input image.
- __call__:
Calls the perturb method with the given input image.
- get_config:
Returns the current configuration of the HazePerturber instance.
Methods
from_configInstantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.
Returns the current configuration of the HazePerturber instance.
get_default_configGenerate and return a default configuration dictionary for this class.
get_implsDiscover and return a set of classes that implement the calling class.
get_type_stringReturns the fully qualified type string of the PerturbImage class or its subclass.
is_usableCheck whether this class is available for use.
Apply haze to an image based on depth_map and sky_color.
- __init__(factor: float = 1.0) None
HazePerturber applies haze to an input image.
- Attributes:
factor: Strength of haze applied to an image.
- get_config() dict[str, Any]
Returns the current configuration of the HazePerturber instance.
- Returns:
- return dict[str, Any]:
Configuration dictionary with current settings.
- perturb(image: ndarray[Any, Any], boxes: Iterable[tuple[AxisAlignedBoundingBox, dict[Hashable, float]]] | None = None, additional_params: dict[str, Any] | None = None) tuple[ndarray[Any, Any], Iterable[tuple[AxisAlignedBoundingBox, dict[Hashable, float]]] | None]
Apply haze to an image based on depth_map and sky_color.
- Args:
- image:
Input image as a numpy array of shape (H, W, C).
- boxes:
List of bounding boxes in AxisAlignedBoundingBox format and their corresponding classes.
- additional_params:
- Dictionary containing:
- “depth_map” (np.ndarray): Optional depth map for adding haze. If depth_map is not in
additional_params, then a depth map the size of the image with all values equal to 1 will be used.
- “sky_color” (list[float]): Sky color to use for weathering. If sky_color is not in
additional_params, then an average pixel value will be calculated and used as the sky color.
- Returns:
- return tuple[np.ndarray, Iterable[tuple[AxisAlignedBoundingBox, dict[Hashable, float]]] | None]:
Image with haze applied and source bounding boxes.