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_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__(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, depth_map: ndarray[Any, Any] | None = None, sky_color: list[float] | None = None, **additional_params: Any) 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.

depth_map:

Optional depth map for adding haze. If depth_map is not provided, then a depth map the size of the image with all values equal to 1 will be used.

sky_color:

Sky color to use for weathering. If sky_color is not provided, then an average pixel value will be calculated and used as the sky color.

additional_params:

Additional perturbation keyword arguments (currently unused).

Returns:
return tuple[np.ndarray, Iterable[tuple[AxisAlignedBoundingBox, dict[Hashable, float]]] | None]:

Image with haze applied and source bounding boxes.