HazePerturber

class nrtk.impls.perturb_image.generic.haze_perturber.HazePerturber(box_alignment_mode: str = 'extent', factor: float = 1.0)

HazePerturber applies haze using Shree Nayar weathering 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_config

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

get_config

Returns the current configuration of the HazePerturber instance.

get_default_config

Generate and return a default configuration dictionary for this class.

get_impls

Discover and return a set of classes that implement the calling class.

get_type_string

Returns the fully qualified type string of the PerturbImage class or its subclass.

is_usable

Check whether this class is available for use.

perturb

Apply haze to an image based on depth_map and sky_color

__init__(box_alignment_mode: str = 'extent', factor: float = 1.0) None

HazePerturber applies haze to an input image.

Attributes:

factor (float): Strength of haze applied to an image

get_config() dict[str, Any]

Returns the current configuration of the HazePerturber instance.

Returns:

dict[str, Any]: Configuration dictionary with current settings.

perturb(image: ndarray, boxes: Iterable[tuple[AxisAlignedBoundingBox, dict[Hashable, float]]] | None = None, additional_params: dict[str, Any] | None = None) tuple[ndarray, Iterable[tuple[AxisAlignedBoundingBox, dict[Hashable, float]]] | None]

Apply haze to an image based on depth_map and sky_color

Parameters:
  • 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:

Image with haze applied as numpy array