imgaug.augmenters.pillike

Augmenters that have identical outputs to well-known PIL functions.

The like in pillike indicates that the augmenters in this module have identical outputs and mostly identical inputs to corresponding PIL functions, but do not have to wrap these functions internally. They may use internally different (e.g. faster) techniques to produce these outputs.

Some of the augmenters in this module may also exist in other modules under similar name. These other augmenters may currently have the same outputs as the corresponding PIL functions, but that is not guaranteed for the future. Use the augmenters in this module if identical outputs to PIL are required.

List of augmenters:

Standard usage of these augmenters follows roughly the schema:

import numpy as np
import imgaug.augmenters as iaa

aug = iaa.pillike.Affine(translate_px={"x": (-5, 5)})
image = np.full((32, 32, 3), 255, dtype=np.uint8)

images_aug = aug(images=[image, image, image])

Added in 0.4.0.

class imgaug.augmenters.pillike.Affine(scale=1.0, translate_percent=None, translate_px=None, rotate=0.0, shear=0.0, fillcolor=0, center=(0.5, 0.5), seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.geometric.Affine

Apply PIL-like affine transformations to images.

This augmenter has identical outputs to PIL.Image.transform with parameter method=PIL.Image.AFFINE.

Warning

This augmenter can currently only transform image-data. Batches containing heatmaps, segmentation maps and coordinate-based augmentables will be rejected with an error. Use Affine if you have to transform such inputs.

Note

This augmenter uses the image center as the transformation center. This has to be explicitly enforced in PIL using corresponding translation matrices. Without such translation, PIL uses the image top left corner as the transformation center. To mirror that behaviour, use center=(0.0, 0.0).

Added in 0.4.0.

Supported dtypes:

See warp_affine().

Parameters:
  • scale (number or tuple of number or list of number or imgaug.parameters.StochasticParameter or dict {“x”: number/tuple/list/StochasticParameter, “y”: number/tuple/list/StochasticParameter}, optional) – See Affine.
  • translate_percent (None or number or tuple of number or list of number or imgaug.parameters.StochasticParameter or dict {“x”: number/tuple/list/StochasticParameter, “y”: number/tuple/list/StochasticParameter}, optional) – See Affine.
  • translate_px (None or int or tuple of int or list of int or imgaug.parameters.StochasticParameter or dict {“x”: int/tuple/list/StochasticParameter, “y”: int/tuple/list/StochasticParameter}, optional) – See Affine.
  • rotate (number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional) – See Affine.
  • shear (number or tuple of number or list of number or imgaug.parameters.StochasticParameter or dict {“x”: int/tuple/list/StochasticParameter, “y”: int/tuple/list/StochasticParameter}, optional) – See Affine.
  • fillcolor (number or tuple of number or list of number or imgaug.ALL or imgaug.parameters.StochasticParameter, optional) – See parameter cval in Affine.
  • center ({‘uniform’, ‘normal’, ‘center’, ‘left-top’, ‘left-center’, ‘left-bottom’, ‘center-top’, ‘center-center’, ‘center-bottom’, ‘right-top’, ‘right-center’, ‘right-bottom’} or tuple of float or StochasticParameter or tuple of StochasticParameter, optional) – The center point of the affine transformation, given as relative xy-coordinates. Set this to (0.0, 0.0) or left-top to use the top left image corner as the transformation center. Set this to (0.5, 0.5) or center-center to use the image center as the transformation center. See also paramerer position in PadToFixedSize for details about valid datatypes of this parameter.
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.Affine(scale={"x": (0.8, 1.2), "y": (0.5, 1.5)})

Create an augmenter that applies affine scaling (zoom in/out) to images. Along the x-axis they are scaled to 80-120% of their size, along the y-axis to 50-150% (both values randomly and uniformly chosen per image).

>>> aug = iaa.pillike.Affine(translate_px={"x": 0, "y": [-10, 10]},
>>>                          fillcolor=128)

Create an augmenter that translates images along the y-axis by either -10px or 10px. Newly created pixels are always filled with the value 128 (along all channels).

>>> aug = iaa.pillike.Affine(rotate=(-20, 20), fillcolor=(0, 256))

Rotate an image by -20 to 20 degress and fill up all newly created pixels with a random RGB color.

See the similar augmenter Affine for more examples.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
get_parameters(self)[source]

See get_parameters().

class imgaug.augmenters.pillike.Autocontrast(cutoff=(0, 20), per_channel=False, seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.contrast._ContrastFuncWrapper

Adjust contrast by cutting off p% of lowest/highest histogram values.

This augmenter has identical outputs to PIL.ImageOps.autocontrast.

See autocontrast() for more details.

Added in 0.4.0.

Supported dtypes:

See autocontrast().

Parameters:
  • cutoff (int or tuple of int or list of int or imgaug.parameters.StochasticParameter, optional) – Percentage of values to cut off from the low and high end of each image’s histogram, before stretching it to [0, 255].

    • If int: The value will be used for all images.
    • If tuple (a, b): A value will be uniformly sampled from the discrete interval [a..b] per image.
    • If list: A random value will be sampled from the list per image.
    • If StochasticParameter: A value will be sampled from that parameter per image.
  • per_channel (bool or float, optional) – Whether to use the same value for all channels (False) or to sample a new value for each channel (True). If this value is a float p, then for p percent of all images per_channel will be treated as True, otherwise as False.

  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().

  • name (None or str, optional) – See __init__().

  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.

  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.Autocontrast()

Modify the contrast of images by cutting off the 0 to 20% lowest and highest values from the histogram, then stretching it to full length.

>>> aug = iaa.pillike.Autocontrast((10, 20), per_channel=True)

Modify the contrast of images by cutting off the 10 to 20% lowest and highest values from the histogram, then stretching it to full length. The cutoff value is sampled per channel instead of per image.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.EnhanceBrightness(factor=(0.5, 1.5), seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._EnhanceBase

Change the brightness of images.

This augmenter has identical outputs to PIL.ImageEnhance.Brightness.

Added in 0.4.0.

Supported dtypes:

See enhance_brightness().

Parameters:
  • factor (number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional) – Brightness of the image. Values below 1.0 decrease the brightness, leading to a black image around 0.0. Values above 1.0 increase the brightness. Sane values are roughly in [0.5, 1.5].

    • If number: The value will be used for all images.
    • If tuple (a, b): A value will be uniformly sampled per image from the interval [a, b).
    • If list: A random value will be picked from the list per image.
    • If StochasticParameter: Per batch of size N, the parameter will be queried once to return (N,) samples.
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().

  • name (None or str, optional) – See __init__().

  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.

  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.EnhanceBrightness()

Create an augmenter that worsens the brightness of an image by a random factor.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.EnhanceColor(factor=(0.0, 3.0), seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._EnhanceBase

Convert images to grayscale.

This augmenter has identical outputs to PIL.ImageEnhance.Color.

Added in 0.4.0.

Supported dtypes:

See enhance_color().

Parameters:
  • factor (number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional) – Colorfulness of the output image. Values close to 0.0 lead to grayscale images, values above 1.0 increase the strength of colors. Sane values are roughly in [0.0, 3.0].

    • If number: The value will be used for all images.
    • If tuple (a, b): A value will be uniformly sampled per image from the interval [a, b).
    • If list: A random value will be picked from the list per image.
    • If StochasticParameter: Per batch of size N, the parameter will be queried once to return (N,) samples.
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().

  • name (None or str, optional) – See __init__().

  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.

  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.EnhanceColor()

Create an augmenter to remove a random fraction of color from input images.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.EnhanceContrast(factor=(0.5, 1.5), seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._EnhanceBase

Change the contrast of images.

This augmenter has identical outputs to PIL.ImageEnhance.Contrast.

Added in 0.4.0.

Supported dtypes:

See enhance_contrast().

Parameters:
  • factor (number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional) – Strength of contrast in the image. Values below 1.0 decrease the contrast, leading to a gray image around 0.0. Values above 1.0 increase the contrast. Sane values are roughly in [0.5, 1.5].

    • If number: The value will be used for all images.
    • If tuple (a, b): A value will be uniformly sampled per image from the interval [a, b).
    • If list: A random value will be picked from the list per image.
    • If StochasticParameter: Per batch of size N, the parameter will be queried once to return (N,) samples.
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().

  • name (None or str, optional) – See __init__().

  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.

  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.EnhanceContrast()

Create an augmenter that worsens the contrast of an image by a random factor.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.EnhanceSharpness(factor=(0.0, 2.0), seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._EnhanceBase

Change the sharpness of images.

This augmenter has identical outputs to PIL.ImageEnhance.Sharpness.

Added in 0.4.0.

Supported dtypes:

See enhance_sharpness().

Parameters:
  • factor (number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional) – Sharpness of the image. Values below 1.0 decrease the sharpness, values above 1.0 increase it. Sane values are roughly in [0.0, 2.0].

    • If number: The value will be used for all images.
    • If tuple (a, b): A value will be uniformly sampled per image from the interval [a, b).
    • If list: A random value will be picked from the list per image.
    • If StochasticParameter: Per batch of size N, the parameter will be queried once to return (N,) samples.
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().

  • name (None or str, optional) – See __init__().

  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.

  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.EnhanceSharpness()

Create an augmenter that randomly decreases or increases the sharpness of an image.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.Equalize(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.meta.Augmenter

Equalize the image histogram.

This augmenter has identical outputs to PIL.ImageOps.equalize.

Added in 0.4.0.

Supported dtypes:

See equalize_().

Parameters:
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.Equalize()

Equalize the histograms of all input images.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
get_parameters(self)[source]

See get_parameters().

class imgaug.augmenters.pillike.FilterBlur(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._FilterBase

Apply a blur filter kernel to images.

This augmenter has identical outputs to calling PIL.Image.filter with kernel PIL.ImageFilter.BLUR.

Added in 0.4.0.

Supported dtypes:

See filter_blur().

Parameters:
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.FilterBlur()

Create an augmenter that applies a blur filter kernel to images.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.FilterContour(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._FilterBase

Apply a contour detection filter kernel to images.

This augmenter has identical outputs to calling PIL.Image.filter with kernel PIL.ImageFilter.CONTOUR.

Added in 0.4.0.

Supported dtypes:

See filter_contour().

Parameters:
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.FilterContour()

Create an augmenter that applies a contour detection filter kernel to images.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.FilterDetail(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._FilterBase

Apply a detail enhancement filter kernel to images.

This augmenter has identical outputs to calling PIL.Image.filter with kernel PIL.ImageFilter.DETAIL.

Added in 0.4.0.

Supported dtypes:

See filter_detail().

Parameters:
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.FilterDetail()

Create an augmenter that applies a detail enhancement filter kernel to images.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.FilterEdgeEnhance(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._FilterBase

Apply an edge enhance filter kernel to images.

This augmenter has identical outputs to calling PIL.Image.filter with kernel PIL.ImageFilter.EDGE_ENHANCE.

Added in 0.4.0.

Supported dtypes:

See filter_edge_enhance().

Parameters:
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.FilterEdgeEnhance()

Create an augmenter that applies a edge enhancement filter kernel to images.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.FilterEdgeEnhanceMore(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._FilterBase

Apply a strong edge enhancement filter kernel to images.

This augmenter has identical outputs to calling PIL.Image.filter with kernel PIL.ImageFilter.EDGE_ENHANCE_MORE.

Added in 0.4.0.

Supported dtypes:

See filter_edge_enhance_more().

Parameters:
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.FilterEdgeEnhanceMore()

Create an augmenter that applies a strong edge enhancement filter kernel to images.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.FilterEmboss(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._FilterBase

Apply an emboss filter kernel to images.

This augmenter has identical outputs to calling PIL.Image.filter with kernel PIL.ImageFilter.EMBOSS.

Added in 0.4.0.

Supported dtypes:

See filter_emboss().

Parameters:
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.FilterEmboss()

Create an augmenter that applies an emboss filter kernel to images.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.FilterFindEdges(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._FilterBase

Apply a edge detection kernel to images.

This augmenter has identical outputs to calling PIL.Image.filter with kernel PIL.ImageFilter.FIND_EDGES.

Added in 0.4.0.

Supported dtypes:

See filter_find_edges().

Parameters:
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.FilterFindEdges()

Create an augmenter that applies an edge detection filter kernel to images.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.FilterSharpen(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._FilterBase

Apply a sharpening filter kernel to images.

This augmenter has identical outputs to calling PIL.Image.filter with kernel PIL.ImageFilter.SHARPEN.

Added in 0.4.0.

Supported dtypes:

See filter_sharpen().

Parameters:
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.FilterSharpen()

Create an augmenter that applies a sharpening filter kernel to images.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.FilterSmooth(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._FilterBase

Apply a smoothening filter kernel to images.

This augmenter has identical outputs to calling PIL.Image.filter with kernel PIL.ImageFilter.SMOOTH.

Added in 0.4.0.

Supported dtypes:

See filter_smooth().

Parameters:
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.FilterSmooth()

Create an augmenter that applies a smoothening filter kernel to images.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.FilterSmoothMore(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.pillike._FilterBase

Apply a strong smoothening filter kernel to images.

This augmenter has identical outputs to calling PIL.Image.filter with kernel PIL.ImageFilter.BLUR.

Added in 0.4.0.

Supported dtypes:

See filter_smooth_more().

Parameters:
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.pillike.FilterSmoothMore()

Create an augmenter that applies a strong smoothening filter kernel to images.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.Posterize(nb_bits=(1, 8), from_colorspace='RGB', to_colorspace=None, max_size=None, interpolation='linear', seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.color.Posterize

Augmenter with identical outputs to PIL’s posterize() function.

This augmenter quantizes each array component to N bits.

This class is currently an alias for Posterize, which again is an alias for UniformColorQuantizationToNBits, i.e. all three classes are right now guarantueed to have the same outputs as PIL’s function.

Added in 0.4.0.

Supported dtypes:

See Posterize.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
class imgaug.augmenters.pillike.Solarize(p=1.0, threshold=128, seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: imgaug.augmenters.arithmetic.Invert

Augmenter with identical outputs to PIL’s solarize() function.

This augmenter inverts all pixel values above a threshold.

The outputs are identical to PIL’s solarize().

Added in 0.4.0.

Supported dtypes:

See ~imgaug.augmenters.arithmetic.invert_(min_value=None and max_value=None).

Parameters:
  • p (float or imgaug.parameters.StochasticParameter, optional) – See Invert.
  • threshold (None or number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional) – See Invert.
  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().
  • name (None or str, optional) – See __init__().
  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.
  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.Solarize(0.5, threshold=(32, 128))

Invert the colors in 50 percent of all images for pixels with a value between 32 and 128 or more. The threshold is sampled once per image. The thresholding operation happens per channel.

Methods

__call__(self, *args, **kwargs) Alias for augment().
augment(self[, return_batch, hooks]) Augment a batch.
augment_batch(self, batch[, hooks]) Deprecated.
augment_batch_(self, batch[, parents, hooks]) Augment a single batch in-place.
augment_batches(self, batches[, hooks, …]) Augment multiple batches.
augment_bounding_boxes(self, …[, parents, …]) Augment a batch of bounding boxes.
augment_heatmaps(self, heatmaps[, parents, …]) Augment a batch of heatmaps.
augment_image(self, image[, hooks]) Augment a single image.
augment_images(self, images[, parents, hooks]) Augment a batch of images.
augment_keypoints(self, keypoints_on_images) Augment a batch of keypoints/landmarks.
augment_line_strings(self, …[, parents, hooks]) Augment a batch of line strings.
augment_polygons(self, polygons_on_images[, …]) Augment a batch of polygons.
augment_segmentation_maps(self, segmaps[, …]) Augment a batch of segmentation maps.
copy(self) Create a shallow copy of this Augmenter instance.
copy_random_state(self, source[, recursive, …]) Copy the RNGs from a source augmenter sequence.
copy_random_state_(self, source[, …]) Copy the RNGs from a source augmenter sequence (in-place).
deepcopy(self) Create a deep copy of this Augmenter instance.
draw_grid(self, images, rows, cols) Augment images and draw the results as a single grid-like image.
find_augmenters(self, func[, parents, flat]) Find augmenters that match a condition.
find_augmenters_by_name(self, name[, regex, …]) Find augmenter(s) by name.
find_augmenters_by_names(self, names[, …]) Find augmenter(s) by names.
get_all_children(self[, flat]) Get all children of this augmenter as a list.
get_children_lists(self) Get a list of lists of children of this augmenter.
get_parameters(self) See get_parameters().
localize_random_state(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
localize_random_state_(self[, recursive]) Assign augmenter-specific RNGs to this augmenter and its children.
pool(self[, processes, maxtasksperchild, seed]) Create a pool used for multicore augmentation.
remove_augmenters(self, func[, copy, …]) Remove this augmenter or children that match a condition.
remove_augmenters_(self, func[, parents]) Remove in-place children of this augmenter that match a condition.
remove_augmenters_inplace(self, func[, parents]) Deprecated.
reseed(self[, random_state, deterministic_too]) Deprecated.
seed_(self[, entropy, deterministic_too]) Seed this augmenter and all of its children.
show_grid(self, images, rows, cols) Augment images and plot the results as a single grid-like image.
to_deterministic(self[, n]) Convert this augmenter from a stochastic to a deterministic one.
imgaug.augmenters.pillike.autocontrast(image, cutoff=0, ignore=None)[source]

Maximize (normalize) image contrast.

This function calculates a histogram of the input image, removes cutoff percent of the lightest and darkest pixels from the histogram, and remaps the image so that the darkest pixel becomes black (0), and the lightest becomes white (255).

This function has identical outputs to PIL.ImageOps.autocontrast. The speed is almost identical.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:
  • image (ndarray) – The image for which to enhance the contrast.
  • cutoff (number) – How many percent to cut off at the low and high end of the histogram. E.g. 20 will cut off the lowest and highest 20% of values. Expected value range is [0, 100].
  • ignore (None or int or iterable of int) – Intensity values to ignore, i.e. to treat as background. If None, no pixels will be ignored. Otherwise exactly the given intensity value(s) will be ignored.
Returns:

Contrast-enhanced image.

Return type:

ndarray

imgaug.augmenters.pillike.enhance_brightness(image, factor)[source]

Change the brightness of images.

This function has identical outputs to PIL.ImageEnhance.Brightness.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:
  • image (ndarray) – The image to modify.
  • factor (number) – Brightness of the image. Values below 1.0 decrease the brightness, leading to a black image around 0.0. Values above 1.0 increase the brightness. Sane values are roughly in [0.5, 1.5].
Returns:

Brightness-modified image.

Return type:

ndarray

imgaug.augmenters.pillike.enhance_color(image, factor)[source]

Change the strength of colors in an image.

This function has identical outputs to PIL.ImageEnhance.Color.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:
  • image (ndarray) – The image to modify.
  • factor (number) – Colorfulness of the output image. Values close to 0.0 lead to grayscale images, values above 1.0 increase the strength of colors. Sane values are roughly in [0.0, 3.0].
Returns:

Color-modified image.

Return type:

ndarray

imgaug.augmenters.pillike.enhance_contrast(image, factor)[source]

Change the contrast of an image.

This function has identical outputs to PIL.ImageEnhance.Contrast.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:
  • image (ndarray) – The image to modify.
  • factor (number) – Strength of contrast in the image. Values below 1.0 decrease the contrast, leading to a gray image around 0.0. Values above 1.0 increase the contrast. Sane values are roughly in [0.5, 1.5].
Returns:

Contrast-modified image.

Return type:

ndarray

imgaug.augmenters.pillike.enhance_sharpness(image, factor)[source]

Change the sharpness of an image.

This function has identical outputs to PIL.ImageEnhance.Sharpness.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:
  • image (ndarray) – The image to modify.
  • factor (number) – Sharpness of the image. Values below 1.0 decrease the sharpness, values above 1.0 increase it. Sane values are roughly in [0.0, 2.0].
Returns:

Sharpness-modified image.

Return type:

ndarray

imgaug.augmenters.pillike.equalize(image, mask=None)[source]

Equalize the image histogram.

See equalize_() for details.

This function is identical in inputs and outputs to PIL.ImageOps.equalize.

Added in 0.4.0.

Supported dtypes:

See equalize_().

Parameters:
  • image (ndarray) – uint8 (H,W,[C]) image to equalize.
  • mask (None or ndarray, optional) – An optional mask. If given, only the pixels selected by the mask are included in the analysis.
Returns:

Equalized image.

Return type:

ndarray

imgaug.augmenters.pillike.equalize_(image, mask=None)[source]

Equalize the image histogram in-place.

This function applies a non-linear mapping to the input image, in order to create a uniform distribution of grayscale values in the output image.

This function has identical outputs to PIL.ImageOps.equalize. It does however work in-place.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:
  • image (ndarray) – uint8 (H,W,[C]) image to equalize.
  • mask (None or ndarray, optional) – An optional mask. If given, only the pixels selected by the mask are included in the analysis.
Returns:

Equalized image. Might have been modified in-place.

Return type:

ndarray

imgaug.augmenters.pillike.filter_blur(image)[source]

Apply a blur filter kernel to the image.

This is the same as using PIL’s PIL.ImageFilter.BLUR kernel.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:image (ndarray) – The image to modify.
Returns:Blurred image.
Return type:ndarray
imgaug.augmenters.pillike.filter_contour(image)[source]

Apply a contour filter kernel to the image.

This is the same as using PIL’s PIL.ImageFilter.CONTOUR kernel.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:image (ndarray) – The image to modify.
Returns:Image with pronounced contours.
Return type:ndarray
imgaug.augmenters.pillike.filter_detail(image)[source]

Apply a detail enhancement filter kernel to the image.

This is the same as using PIL’s PIL.ImageFilter.DETAIL kernel.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:image (ndarray) – The image to modify.
Returns:Image with enhanced details.
Return type:ndarray
imgaug.augmenters.pillike.filter_edge_enhance(image)[source]

Apply an edge enhancement filter kernel to the image.

This is the same as using PIL’s PIL.ImageFilter.EDGE_ENHANCE kernel.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:image (ndarray) – The image to modify.
Returns:Image with enhanced edges.
Return type:ndarray
imgaug.augmenters.pillike.filter_edge_enhance_more(image)[source]

Apply a stronger edge enhancement filter kernel to the image.

This is the same as using PIL’s PIL.ImageFilter.EDGE_ENHANCE_MORE kernel.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:image (ndarray) – The image to modify.
Returns:Smoothened image.
Return type:ndarray
imgaug.augmenters.pillike.filter_emboss(image)[source]

Apply an emboss filter kernel to the image.

This is the same as using PIL’s PIL.ImageFilter.EMBOSS kernel.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:image (ndarray) – The image to modify.
Returns:Embossed image.
Return type:ndarray
imgaug.augmenters.pillike.filter_find_edges(image)[source]

Apply an edge detection filter kernel to the image.

This is the same as using PIL’s PIL.ImageFilter.FIND_EDGES kernel.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:image (ndarray) – The image to modify.
Returns:Image with detected edges.
Return type:ndarray
imgaug.augmenters.pillike.filter_sharpen(image)[source]

Apply a sharpening filter kernel to the image.

This is the same as using PIL’s PIL.ImageFilter.SHARPEN kernel.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:image (ndarray) – The image to modify.
Returns:Sharpened image.
Return type:ndarray
imgaug.augmenters.pillike.filter_smooth(image)[source]

Apply a smoothness filter kernel to the image.

This is the same as using PIL’s PIL.ImageFilter.SMOOTH kernel.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:image (ndarray) – The image to modify.
Returns:Smoothened image.
Return type:ndarray
imgaug.augmenters.pillike.filter_smooth_more(image)[source]

Apply a strong smoothness filter kernel to the image.

This is the same as using PIL’s PIL.ImageFilter.SMOOTH_MORE kernel.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:image (ndarray) – The image to modify.
Returns:Smoothened image.
Return type:ndarray
imgaug.augmenters.pillike.posterize(image, bits)[source]

Reduce the number of bits for each color channel.

This function has identical outputs to PIL.ImageOps.posterize.

Added in 0.4.0.

Supported dtypes:

See quantize_uniform_to_n_bits().

Parameters:
  • image (ndarray) – Image array of shape (H,W,[C]).
  • bits (int) – The number of bits to keep per component. Values in the interval [1, 8] are valid.
Returns:

Posterized image.

Return type:

ndarray

imgaug.augmenters.pillike.posterize_(image, bits)[source]

Reduce the number of bits for each color channel in-place.

This function has identical outputs to PIL.ImageOps.posterize. It does however work in-place.

Added in 0.4.0.

Supported dtypes:

See quantize_uniform_to_n_bits_().

Parameters:
  • image (ndarray) – Image array of shape (H,W,[C]).
  • bits (int) – The number of bits to keep per component. Values in the interval [1, 8] are valid.
Returns:

Posterized image. This can be the same array as input in image, modified in-place.

Return type:

ndarray

imgaug.augmenters.pillike.solarize(image, threshold=128)[source]

Invert all array components above a threshold.

This function has identical outputs to PIL.ImageOps.solarize.

Added in 0.4.0.

Supported dtypes:

See ~imgaug.augmenters.arithmetic.invert_(min_value=None and max_value=None).

Parameters:
  • image (ndarray) – Image array of shape (H,W,[C]).
  • threshold (int, optional) – A threshold to use in order to invert only numbers above or below the threshold.
Returns:

Inverted image.

Return type:

ndarray

imgaug.augmenters.pillike.solarize_(image, threshold=128)[source]

Invert all array components above a threshold in-place.

This function has identical outputs to PIL.ImageOps.solarize. It does however work in-place.

Added in 0.4.0.

Supported dtypes:

See ~imgaug.augmenters.arithmetic.invert_(min_value=None and max_value=None).

Parameters:
  • image (ndarray) – Image array of shape (H,W,[C]). The array might be modified in-place.
  • threshold (int, optional) – A threshold to use in order to invert only numbers above or below the threshold.
Returns:

Inverted image. This can be the same array as input in image, modified in-place.

Return type:

ndarray

imgaug.augmenters.pillike.warp_affine(image, scale_x=1.0, scale_y=1.0, translate_x_px=0, translate_y_px=0, rotate_deg=0, shear_x_deg=0, shear_y_deg=0, fillcolor=None, center=(0.5, 0.5))[source]

Apply an affine transformation to an image.

This function has identical outputs to PIL.Image.transform with method=PIL.Image.AFFINE.

Added in 0.4.0.

Supported dtypes:

  • uint8: yes; fully tested
  • uint16: no
  • uint32: no
  • uint64: no
  • int8: no
  • int16: no
  • int32: no
  • int64: no
  • float16: no
  • float32: no
  • float64: no
  • float128: no
  • bool: no
Parameters:
  • image (ndarray) – The image to modify. Expected to be uint8 with shape (H,W) or (H,W,C) with C being 3 or 4.
  • scale_x (number, optional) – Affine scale factor along the x-axis, where 1.0 denotes an identity transform and 2.0 is a strong zoom-in effect.
  • scale_y (number, optional) – Affine scale factor along the y-axis, where 1.0 denotes an identity transform and 2.0 is a strong zoom-in effect.
  • translate_x_px (number, optional) – Affine translation along the x-axis in pixels. Positive values translate the image towards the right.
  • translate_y_px (number, optional) – Affine translation along the y-axis in pixels. Positive values translate the image towards the bottom.
  • rotate_deg (number, optional) – Affine rotation in degrees around the top left of the image.
  • shear_x_deg (number, optional) – Affine shearing in degrees along the x-axis with center point being the top-left of the image.
  • shear_y_deg (number, optional) – Affine shearing in degrees along the y-axis with center point being the top-left of the image.
  • fillcolor (None or int or tuple of int, optional) – Color tuple or intensity value to use when filling up newly created pixels. None fills with zeros. int will only fill the 0 th channel with that intensity value and all other channels with 0 (this is the default behaviour of PIL, use a tuple to fill all channels).
  • center (tuple of number, optional) – Center xy-coordinate of the affine transformation, given as relative values, i.e. (0.0, 0.0) sets the transformation center to the top-left image corner, (1.0, 0.0) sets it to the the top-right image corner and (0.5, 0.5) sets it to the image center. The transformation center is relevant e.g. for rotations (“rotate around this center point”). PIL uses the image top-left corner as the transformation center if no centerization is included in the affine transformation matrix.
Returns:

Image after affine transformation.

Return type:

ndarray