def augment(self, return_batch=False, hooks=None, **kwargs):

assert ia.is_single_bool(return_batch), (<EOL>("<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>") % (str(type(return_batch)),)<EOL>)<EOL>expected_keys = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>"]<EOL>expected_keys_call = ["<STR_LIT:image>"] + expected_keys<EOL>assert any([key in kwargs for key in expected_keys_call]), (<EOL>"<STR_LIT>"<EOL>+ "<STR_LIT>" % (<EOL>"<STR_LIT:U+002CU+0020>".join(expected_keys_call),))<EOL>unknown_args = [key for key in kwargs.keys()<EOL>if key not in expected_keys_call]<EOL>assert len(unknown_args) == <NUM_LIT:0>, (<EOL>"<STR_LIT>" % (<EOL>"<STR_LIT:U+002CU+0020>".join(unknown_args)<EOL>))<EOL>if "<STR_LIT:image>" in kwargs:<EOL><INDENT>assert "<STR_LIT>" not in kwargs, (<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>images = [kwargs["<STR_LIT:image>"]]<EOL><DEDENT>else:<EOL><INDENT>images = kwargs.get("<STR_LIT>", None)<EOL><DEDENT>order = "<STR_LIT>"<EOL>nb_keys = len(list(kwargs.keys()))<EOL>vinfo = sys.version_info<EOL>is_py36_or_newer = vinfo[<NUM_LIT:0>] > <NUM_LIT:3> or (vinfo[<NUM_LIT:0>] == <NUM_LIT:3> and vinfo[<NUM_LIT:1>] >= <NUM_LIT:6>)<EOL>if is_py36_or_newer:<EOL><INDENT>order = "<STR_LIT>"<EOL><DEDENT>elif not return_batch and nb_keys > <NUM_LIT:2>:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>elif not return_batch and nb_keys == <NUM_LIT:2> and images is None:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>batch = UnnormalizedBatch(<EOL>images=images,<EOL>heatmaps=kwargs.get("<STR_LIT>", None),<EOL>segmentation_maps=kwargs.get("<STR_LIT>", None),<EOL>keypoints=kwargs.get("<STR_LIT>", None),<EOL>bounding_boxes=kwargs.get("<STR_LIT>", None),<EOL>polygons=kwargs.get("<STR_LIT>", None),<EOL>line_strings=kwargs.get("<STR_LIT>", None)<EOL>)<EOL>batch_aug = self.augment_batch(batch, hooks=hooks)<EOL>if return_batch:<EOL><INDENT>return batch_aug<EOL><DEDENT>result = []<EOL>if order == "<STR_LIT>":<EOL><INDENT>for key in kwargs:<EOL><INDENT>if key == "<STR_LIT:image>":<EOL><INDENT>attr = getattr(batch_aug, "<STR_LIT>")<EOL>result.append(attr[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>result.append(getattr(batch_aug, "<STR_LIT>" % (key,)))<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for key in expected_keys:<EOL><INDENT>if key == "<STR_LIT>" and "<STR_LIT:image>" in kwargs:<EOL><INDENT>attr = getattr(batch_aug, "<STR_LIT>")<EOL>result.append(attr[<NUM_LIT:0>])<EOL><DEDENT>elif key in kwargs:<EOL><INDENT>result.append(getattr(batch_aug, "<STR_LIT>" % (key,)))<EOL><DEDENT><DEDENT><DEDENT>if len(result) == <NUM_LIT:1>:<EOL><INDENT>return result[<NUM_LIT:0>]<EOL><DEDENT>return tuple(result)<EOL>

Augment data.

This method is a wrapper around
``imgaug.augmentables.batches.UnnormalizedBatch`` and
``augment_batch()``. Hence, it supports the same datatypes as
``UnnormalizedBatch``.

If `return_batch` was not set to ``True``, the method will return
a tuple of augmentables. It will return the same types of augmentables
(only augmented) as input into the method. This behaviour
is partly specific to the python version:
  * In _python 3.6+_ (if ``return_batch=False``):
    * Three or more augmentables may be used as input.
    * The return order matches the order of the named arguments, e.g.
      ``B, D, C = augment(B=x, D=y, C=z)``.
    * None of the provided named arguments has to be `image` or `images`.
  * In _python <3.6_  (if ``return_batch=False``):
    * One or two augmentables may be used as input, not more than that.
    * At least one the augmentables has to be `image` or `images`.
    * The augmented images are always returned first.

If `return_batch` was not set to ``False``, an instance of
``UnnormalizedBatch`` will be returned. The output is the same for
all python version and any number or combination of augmentables may
be provided.

All augmentables must be provided as named arguments.
E.g. ``augment(<array>)`` will crash, but ``augment(images=<array>)``
will work.

Parameters
----------
image : None
    or (H,W,C) ndarray \
    or (H,W) ndarray, \
    optional
    The image to augment. Only this or `images` can be set, not both.
    If `return_batch` is ``False`` and the python version is below 3.6,
    either this or `images` _must_ be provided.

images : None \
    or (N,H,W,C) ndarray \
    or (N,H,W) ndarray \
    or iterable of (H,W,C) ndarray \
    or iterable of (H,W) ndarray, \
    optional
    The images to augment. Only this or `image` can be set, not both.
    If `return_batch` is ``False`` and the python version is below 3.6,
    either this or `image` _must_ be provided.

heatmaps : None \
    or (N,H,W,C) ndarray \
    or imgaug.augmentables.heatmaps.HeatmapsOnImage \
    or iterable of (H,W,C) ndarray \
    or iterable of imgaug.augmentables.heatmaps.HeatmapsOnImage, \
    optional
    The heatmaps to augment.
    If anything else than ``HeatmapsOnImage``, then the number of
    heatmaps must match the number of images provided via parameter
    `images`. The number is contained either in ``N`` or the first
    iterable's size.

segmentation_maps : None \
    or (N,H,W) ndarray \
    or imgaug.augmentables.segmaps.SegmentationMapOnImage \
    or iterable of (H,W) ndarray \
    or iterable of imgaug.augmentables.segmaps.SegmentationMapOnImage, \
    optional
    The segmentation maps to augment.
    If anything else than ``SegmentationMapOnImage``, then the number
    of segmaps must match the number of images provided via parameter
    `images`. The number is contained either in ``N`` or the first
    iterable's size.

keypoints : None \
    or list of (N,K,2) ndarray \
    or tuple of number \
    or imgaug.augmentables.kps.Keypoint \
    or iterable of (K,2) ndarray \
    or iterable of tuple of number \
    or iterable of imgaug.augmentables.kps.Keypoint \
    or iterable of imgaug.augmentables.kps.KeypointOnImage \
    or iterable of iterable of tuple of number \
    or iterable of iterable of imgaug.augmentables.kps.Keypoint, \
    optional
    The keypoints to augment.
    If a tuple (or iterable(s) of tuple), then iterpreted as (x,y)
    coordinates and must hence contain two numbers.
    A single tuple represents a single coordinate on one image, an
    iterable of tuples the coordinates on one image and an iterable of
    iterable of tuples the coordinates on several images. Analogous if
    ``Keypoint`` objects are used instead of tuples.
    If an ndarray, then ``N`` denotes the number of images and ``K``
    the number of keypoints on each image.
    If anything else than ``KeypointsOnImage`` is provided, then the
    number of keypoint groups must match the number of images provided
    via parameter `images`. The number is contained e.g. in ``N`` or
    in case of "iterable of iterable of tuples" in the first iterable's
    size.

bounding_boxes : None \
    or (N,B,4) ndarray \
    or tuple of number \
    or imgaug.augmentables.bbs.BoundingBox \
    or imgaug.augmentables.bbs.BoundingBoxesOnImage \
    or iterable of (B,4) ndarray \
    or iterable of tuple of number \
    or iterable of imgaug.augmentables.bbs.BoundingBox \
    or iterable of imgaug.augmentables.bbs.BoundingBoxesOnImage \
    or iterable of iterable of tuple of number \
    or iterable of iterable imgaug.augmentables.bbs.BoundingBox, \
    optional
    The bounding boxes to augment.
    This is analogous to the `keypoints` parameter. However, each
    tuple -- and also the last index in case of arrays -- has size 4,
    denoting the bounding box coordinates ``x1``, ``y1``, ``x2`` and
    ``y2``.

polygons : None  \
    or (N,#polys,#points,2) ndarray \
    or imgaug.augmentables.polys.Polygon \
    or imgaug.augmentables.polys.PolygonsOnImage \
    or iterable of (#polys,#points,2) ndarray \
    or iterable of tuple of number \
    or iterable of imgaug.augmentables.kps.Keypoint \
    or iterable of imgaug.augmentables.polys.Polygon \
    or iterable of imgaug.augmentables.polys.PolygonsOnImage \
    or iterable of iterable of (#points,2) ndarray \
    or iterable of iterable of tuple of number \
    or iterable of iterable of imgaug.augmentables.kps.Keypoint \
    or iterable of iterable of imgaug.augmentables.polys.Polygon \
    or iterable of iterable of iterable of tuple of number \
    or iterable of iterable of iterable of tuple of \
    imgaug.augmentables.kps.Keypoint, \
    optional
    The polygons to augment.
    This is similar to the `keypoints` parameter. However, each polygon
    may be made up of several (x,y) coordinates (three or more are
    required for valid polygons).
    The following datatypes will be interpreted as a single polygon on
    a single image:
      * ``imgaug.augmentables.polys.Polygon``
      * ``iterable of tuple of number``
      * ``iterable of imgaug.augmentables.kps.Keypoint``

    The following datatypes will be interpreted as multiple polygons
    on a single image:
      * ``imgaug.augmentables.polys.PolygonsOnImage``
      * ``iterable of imgaug.augmentables.polys.Polygon``
      * ``iterable of iterable of tuple of number``
      * ``iterable of iterable of imgaug.augmentables.kps.Keypoint``
      * ``iterable of iterable of imgaug.augmentables.polys.Polygon``

    The following datatypes will be interpreted as multiple polygons on
    multiple images:
      * ``(N,#polys,#points,2) ndarray``
      * ``iterable of (#polys,#points,2) ndarray``
      * ``iterable of iterable of (#points,2) ndarray``
      * ``iterable of iterable of iterable of tuple of number``
      * ``iterable of iterable of iterable of tuple of imgaug.augmentables.kps.Keypoint``

line_strings : None \
    or (N,#lines,#points,2) ndarray \
    or imgaug.augmentables.lines.LineString \
    or imgaug.augmentables.lines.LineStringOnImage \
    or iterable of (#polys,#points,2) ndarray \
    or iterable of tuple of number \
    or iterable of imgaug.augmentables.kps.Keypoint \
    or iterable of imgaug.augmentables.lines.LineString \
    or iterable of imgaug.augmentables.lines.LineStringOnImage \
    or iterable of iterable of (#points,2) ndarray \
    or iterable of iterable of tuple of number \
    or iterable of iterable of imgaug.augmentables.kps.Keypoint \
    or iterable of iterable of imgaug.augmentables.lines.LineString \
    or iterable of iterable of iterable of tuple of number \
    or iterable of iterable of iterable of tuple of \
    imgaug.augmentables.kps.Keypoint, \
    optional
    The line strings to augment.
    See `polygons`, which behaves similarly.

return_batch : bool, optional
    Whether to return an instance of
    `imgaug.augmentables.batches.UnnormalizedBatch`. If the python
    version is below 3.6 and more than two augmentables were provided
    (e.g. images, keypoints and polygons), then this must be set to
    ``True``. Otherwise an error will be raised.

hooks : None or imgaug.imgaug.HooksImages, optional
    Hooks object to dynamically interfere with the augmentation process.

Returns
-------
tuple or imgaug.augmentables.batches.UnnormalizedBatch
    If `return_batch` was set to ``True``, a instance of
    ``UnnormalizedBatch`` will be returned.
    If `return_batch` was set to ``False``, a tuple of augmentables
    will be returned, e.g. ``(augmented images, augmented keypoints)``.
    The datatypes match the input datatypes of the corresponding named
    arguments. In python <3.6, augmented images are always the first
    entry in the returned tuple. In python 3.6+ the order matches the
    order of the named arguments.

Examples
--------
>>> import numpy as np
>>> import imgaug as ia
>>> import imgaug.augmenters as iaa
>>> aug = iaa.Affine(rotate=(-25, 25))
>>> image = np.zeros((64, 64, 3), dtype=np.uint8)
>>> keypoints = [(10, 20), (30, 32)]  # (x,y) coordinates
>>> images_aug, keypoints_aug = aug.augment(
>>>     image=image, keypoints=keypoints)

This creates a single image and a set of two keypoints on it, then
augments both by applying a random rotation between -25deg and +25deg.
The sampled rotation value is automatically aligned between image and
keypoints. Note that in python <3.6, augmented images will always be
returned first, independent of the order of the named input arguments.
So ``keypoints_aug, images_aug = aug.augment(keypoints=keypoints,
image=image)`` would _not_ work (except in python 3.6+).

>>> import numpy as np
>>> import imgaug as ia
>>> import imgaug.augmenters as iaa
>>> aug = iaa.Affine(rotate=(-25, 25))
>>> images = [np.zeros((64, 64, 3), dtype=np.uint8),
>>>           np.zeros((32, 32, 3), dtype=np.uint8)]
>>> keypoints = [[(10, 20), (30, 32)],  # KPs on first image
>>>              [(22, 10), (12, 14)]]  # KPs on second image
>>> bbs = [
>>>           [ia.BoundingBox(x1=5, y1=5, x2=50, y2=45)],
>>>           [ia.BoundingBox(x1=4, y1=6, x2=10, y2=15),
>>>            ia.BoundingBox(x1=8, y1=9, x2=16, y2=30)]
>>>       ]  # one BB on first image, two BBs on second image
>>> batch_aug = aug.augment(
>>>     images=images, keypoints=keypoints, bounding_boxes=bbs,
>>>     return_batch=True)

This creates two images of size 64x64 and 32x32, two sets of keypoints
(each containing two keypoints) and two sets of bounding boxes (the
first containing one bounding box, the second two bounding boxes).
These augmentables are then augmented by applying random rotations
between -25deg and +25deg to them. The rotation values are sampled
by image and aligned between all augmentables on the same image.
The method finally returns an instance of ``UnnormalizedBatch`` from
which the augmented data can be retrieved via ``batch_aug.images_aug``,
``batch_aug.keypoints_aug``, and ``batch_aug.bounding_boxes_aug``.
In python 3.6+, `return_batch` can be kept at ``False`` and the
augmented data can be retrieved as
``images_aug, keypoints_aug, bbs_aug = augment(...)``.


def _augment_coord_augables(self, cls_expected, subaugment_func,<EOL>augables_ois, parents=None,<EOL>hooks=None):

if self.deterministic:<EOL><INDENT>state_orig = self.random_state.get_state()<EOL><DEDENT>if parents is None:<EOL><INDENT>parents = []<EOL><DEDENT>input_was_single_instance = False<EOL>if isinstance(augables_ois, cls_expected):<EOL><INDENT>input_was_single_instance = True<EOL>augables_ois = [augables_ois]<EOL><DEDENT>ia.do_assert(ia.is_iterable(augables_ois))<EOL>ia.do_assert(all([isinstance(augable_oi, cls_expected)<EOL>for augable_oi in augables_ois]))<EOL>augables_ois_copy = augables_ois<EOL>if len(parents) == <NUM_LIT:0> or hooks is not None:<EOL><INDENT>augables_ois_copy = [augable_oi.deepcopy()<EOL>for augable_oi<EOL>in augables_ois]<EOL><DEDENT>if hooks is not None:<EOL><INDENT>augables_ois_copy = hooks.preprocess(<EOL>augables_ois_copy, augmenter=self, parents=parents)<EOL><DEDENT>augables_ois_result = augables_ois_copy<EOL>is_activated = (hooks is None and self.activated)<EOL>is_activated_hooks = (is_activated is False) and (<EOL>hooks is not None<EOL>and hooks.is_activated(augables_ois_copy,<EOL>augmenter=self, parents=parents,<EOL>default=self.activated)<EOL>)<EOL>if is_activated or is_activated_hooks:<EOL><INDENT>if len(augables_ois) > <NUM_LIT:0>:<EOL><INDENT>augables_ois_result = subaugment_func(<EOL>augables_ois_copy,<EOL>ia.copy_random_state(self.random_state),<EOL>parents,<EOL>hooks<EOL>)<EOL>ia.forward_random_state(self.random_state)<EOL><DEDENT><DEDENT>if hooks is not None:<EOL><INDENT>augables_ois_result = hooks.postprocess(<EOL>augables_ois_result, augmenter=self, parents=parents)<EOL><DEDENT>if self.deterministic:<EOL><INDENT>self.random_state.set_state(state_orig)<EOL><DEDENT>if input_was_single_instance:<EOL><INDENT>return augables_ois_result[<NUM_LIT:0>]<EOL><DEDENT>return augables_ois_result<EOL>

Augment coordinate-based augmentables.

This is an abstract function called by keypoints, bounding boxes,
polygons and line strings.
TODO keypoints, bounding boxes currently missing -- add them

Parameters
----------
cls_expected : class
    Class type that is expected. `augmentables_ois` will be
    verified to use that class.

subaugment_func : callable
    Function that will be called to actually augment the data.

augables_ois : imgaug.augmentables.polys.PolygonsOnImage \
               or imgaug.augmentables.lines.LineStringsOnImage \
               or list of imgaug.augmentables.lines.LineStringsOnImage \
               or list of imgaug.augmentables.polys.PolygonsOnImage
    The augmentables to augment. `augables_ois` is the abbreviation for
    "augmentables_on_images". Expected are the augmentables on a
    single image (single instance) or 1+ images (list of instances).

parents : None or list of imgaug.augmenters.meta.Augmenter, optional
    Parent augmenters that have previously been called before the
    call to this function. Usually you can leave this parameter as None.
    It is set automatically for child augmenters.

hooks : None or imgaug.HooksKeypoints, optional
    HooksKeypoints object to dynamically interfere with the
    augmentation process.

Returns
-------
imgaug.augmentables.polys.PolygonsOnImage \
or imgaug.augmentables.lines.LineStringsOnImage \
or list of imgaug.augmentables.polys.PolygonsOnImage \
or list of imgaug.augmentables.lines.LineStringsOnImage
    Augmented augmentables.


def shuffle_channels(image, random_state, channels=None):

if image.ndim < <NUM_LIT:3> or image.shape[<NUM_LIT:2>] == <NUM_LIT:1>:<EOL><INDENT>return image<EOL><DEDENT>nb_channels = image.shape[<NUM_LIT:2>]<EOL>all_channels = np.arange(nb_channels)<EOL>is_all_channels = (<EOL>channels is None<EOL>or channels == ia.ALL<EOL>or len(set(all_channels).difference(set(channels))) == <NUM_LIT:0><EOL>)<EOL>if is_all_channels:<EOL><INDENT>channels_perm = random_state.permutation(all_channels)<EOL>return image[..., channels_perm]<EOL><DEDENT>else:<EOL><INDENT>channels_perm = random_state.permutation(channels)<EOL>channels_perm_full = all_channels<EOL>for channel_source, channel_target in zip(channels, channels_perm):<EOL><INDENT>channels_perm_full[channel_source] = channel_target<EOL><DEDENT>return image[..., channels_perm_full]<EOL><DEDENT>

Randomize the order of (color) channels in an image.

dtype support::

    * ``uint8``: yes; fully tested
    * ``uint16``: yes; indirectly tested (1)
    * ``uint32``: yes; indirectly tested (1)
    * ``uint64``: yes; indirectly tested (1)
    * ``int8``: yes; indirectly tested (1)
    * ``int16``: yes; indirectly tested (1)
    * ``int32``: yes; indirectly tested (1)
    * ``int64``: yes; indirectly tested (1)
    * ``float16``: yes; indirectly tested (1)
    * ``float32``: yes; indirectly tested (1)
    * ``float64``: yes; indirectly tested (1)
    * ``float128``: yes; indirectly tested (1)
    * ``bool``: yes; indirectly tested (1)

    - (1) Indirectly tested via ``ChannelShuffle``.

Parameters
----------
image : (H,W,[C]) ndarray
    Image of any dtype for which to shuffle the channels.

random_state : numpy.random.RandomState
    The random state to use for this shuffling operation.

channels : None or imgaug.ALL or list of int, optional
    Which channels are allowed to be shuffled with each other.
    If this is ``None`` or ``imgaug.ALL``, then all channels may be shuffled. If it is a list of integers,
    then only the channels with indices in that list may be shuffled. (Values start at 0. All channel indices in
    the list must exist in each image.)

Returns
-------
ndarray
    The input image with shuffled channels.


aug = self.deepcopy()<EOL>aug.localize_random_state_(<EOL>recursive=recursive<EOL>)<EOL>return aug<EOL>

Converts global random states to local ones.
See :func:`Augmenter.localize_random_state_` for more details.

Parameters
----------
recursive : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.localize_random_state_`.

Returns
-------
aug : imgaug.augmenters.meta.Augmenter
    Returns copy of augmenter and children, with localized random states.


return []<EOL>

Get a list of lists of children of this augmenter.

For most augmenters, the result will be a single empty list.
For augmenters with children it will often be a list with one sublist containing all
children. In some cases the augmenter will contain multiple distinct lists of children,
e.g. an if-list and an else-list. This will lead to a result consisting of a single
list with multiple sublists, each representing the respective sublist of children.

E.g. for an if/else-augmenter that executes the children ``A1``, ``A2`` if a condition is met
and otherwise executes the children ``B1``, ``B2``, ``B3`` the result will
be ``[[A1, A2], [B1, B2, B3]]``.

IMPORTANT: While the topmost list may be newly created, each of the sublist must be
editable inplace resulting in a changed children list of the augmenter. E.g. if
an Augmenter ``IfElse(condition, [A1, A2], [B1, B2, B3])`` returns ``[[A1, A2], [B1, B2, B3]]``
for a call to :func:`imgaug.augmenters.meta.Augmenter.get_children_lists` and
``A2`` is removed inplace from ``[A1, A2]``, then the
children lists of ``IfElse(...)`` must also change to ``[A1], [B1, B2, B3]``. This is used
in :func:`imgaug.augmeneters.meta.Augmenter.remove_augmenters_inplace`.

Returns
-------
children : list of list of imgaug.augmenters.meta.Augmenter
    One or more lists of child augmenter.
    Can also be a single empty list.


def augment_heatmaps(self, heatmaps, parents=None, hooks=None):

if self.deterministic:<EOL><INDENT>state_orig = self.random_state.get_state()<EOL><DEDENT>if parents is None:<EOL><INDENT>parents = []<EOL><DEDENT>input_was_single_instance = False<EOL>if isinstance(heatmaps, ia.HeatmapsOnImage):<EOL><INDENT>input_was_single_instance = True<EOL>heatmaps = [heatmaps]<EOL><DEDENT>ia.do_assert(ia.is_iterable(heatmaps),<EOL>"<STR_LIT>" % (type(heatmaps),))<EOL>ia.do_assert(all([isinstance(heatmaps_i, ia.HeatmapsOnImage) for heatmaps_i in heatmaps]),<EOL>"<STR_LIT>" % (<EOL>[type(el) for el in heatmaps],))<EOL>if len(parents) == <NUM_LIT:0> or hooks is not None:<EOL><INDENT>heatmaps_copy = [heatmaps_i.deepcopy() for heatmaps_i in heatmaps]<EOL><DEDENT>else:<EOL><INDENT>heatmaps_copy = heatmaps<EOL><DEDENT>if hooks is not None:<EOL><INDENT>heatmaps_copy = hooks.preprocess(heatmaps_copy, augmenter=self, parents=parents)<EOL><DEDENT>if (hooks is None and self.activated)or (hooks is not None<EOL>and hooks.is_activated(heatmaps_copy, augmenter=self, parents=parents, default=self.activated)):<EOL><INDENT>if len(heatmaps_copy) > <NUM_LIT:0>:<EOL><INDENT>heatmaps_result = self._augment_heatmaps(<EOL>heatmaps_copy,<EOL>random_state=ia.copy_random_state(self.random_state),<EOL>parents=parents,<EOL>hooks=hooks<EOL>)<EOL>ia.forward_random_state(self.random_state)<EOL><DEDENT>else:<EOL><INDENT>heatmaps_result = heatmaps_copy<EOL><DEDENT><DEDENT>else:<EOL><INDENT>heatmaps_result = heatmaps_copy<EOL><DEDENT>if hooks is not None:<EOL><INDENT>heatmaps_result = hooks.postprocess(heatmaps_result, augmenter=self, parents=parents)<EOL><DEDENT>if self.deterministic:<EOL><INDENT>self.random_state.set_state(state_orig)<EOL><DEDENT>if input_was_single_instance:<EOL><INDENT>return heatmaps_result[<NUM_LIT:0>]<EOL><DEDENT>return heatmaps_result<EOL>

Augment a heatmap.

Parameters
----------
heatmaps : imgaug.HeatmapsOnImage or list of imgaug.HeatmapsOnImage
    Heatmap(s) to augment. Either a single heatmap or a list of
    heatmaps.

parents : None or list of imgaug.augmenters.meta.Augmenter, optional
    Parent augmenters that have previously been called before the
    call to this function. Usually you can leave this parameter as None.
    It is set automatically for child augmenters.

hooks : None or imaug.HooksHeatmaps, optional
    HooksHeatmaps object to dynamically interfere with the augmentation process.

Returns
-------
heatmap_result : imgaug.HeatmapsOnImage or list of imgaug.HeatmapsOnImage
    Corresponding augmented heatmap(s).


result = []<EOL>for lst in self.get_children_lists():<EOL><INDENT>for aug in lst:<EOL><INDENT>result.append(aug)<EOL>children = aug.get_all_children(flat=flat)<EOL>if len(children) > <NUM_LIT:0>:<EOL><INDENT>if flat:<EOL><INDENT>result.extend(children)<EOL><DEDENT>else:<EOL><INDENT>result.append(children)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return result<EOL>

Returns all children of this augmenter as a list.

If the augmenter has no children, the returned list is empty.

Parameters
----------
flat : bool
    If set to True, the returned list will be flat.

Returns
-------
result : list of imgaug.augmenters.meta.Augmenter
    The children as a nested or flat list.


def augment_polygons(self, polygons_on_images, parents=None, hooks=None):

from imgaug.augmentables.polys import PolygonsOnImage<EOL>def _subaugment(polygons_on_images_, random_state_, parents_, hooks_):<EOL><INDENT>return self._augment_polygons(<EOL>polygons_on_images_,<EOL>random_state=random_state_,<EOL>parents=parents_,<EOL>hooks=hooks_<EOL>)<EOL><DEDENT>return self._augment_coord_augables(<EOL>cls_expected=PolygonsOnImage,<EOL>subaugment_func=_subaugment,<EOL>augables_ois=polygons_on_images,<EOL>parents=parents,<EOL>hooks=hooks<EOL>)<EOL>

Augment polygons.

This is the corresponding function to ``augment_keypoints()``, just for
polygons.
Usually you will want to call ``augment_images()`` with a list of
images, e.g. ``augment_images([A, B, C])`` and then
``augment_polygons()`` with the corresponding list of polygons on these
images, e.g. ``augment_polygons([A_poly, B_poly, C_poly])``, where
``A_poly`` are the polygons on image ``A``.

Make sure to first convert the augmenter(s) to deterministic states
before augmenting images and their corresponding polygons,
e.g. by

>>> import imgaug as ia
>>> import imgaug.augmenters as iaa
>>> A = B = C = np.ones((10, 10), dtype=np.uint8)
>>> Apoly = Bpoly = Cpoly = ia.PolygonsOnImage(
>>>     [ia.Polygon([(0, 0), (1, 0), (1, 1), (0, 1)])],
>>>     shape=(10, 10))
>>> seq = iaa.Fliplr(0.5)
>>> seq_det = seq.to_deterministic()
>>> imgs_aug = seq_det.augment_images([A, B, C])
>>> polys_aug = seq_det.augment_polygons([Apoly, Bpoly, Cpoly])

Otherwise, different random values will be sampled for the image
and polygon augmentations, resulting in different augmentations
(e.g. images might be rotated by ``30deg`` and polygons by
``-10deg``). Also make sure to call ``to_deterministic()`` again for
each new batch, otherwise you would augment all batches in the same
way.

Parameters
----------
polygons_on_images : imgaug.PolygonsOnImage or \
                     list of imgaug.PolygonsOnImage
    The polygons to augment.
    Expected is an instance of imgaug.PolygonsOnImage or a list of
    imgaug.PolygonsOnImage objects, with each such object
    containing the polygons of a single image.

parents : None or list of imgaug.augmenters.meta.Augmenter, optional
    Parent augmenters that have previously been called before the
    call to this function. Usually you can leave this parameter as None.
    It is set automatically for child augmenters.

hooks : None or imgaug.HooksKeypoints, optional
    HooksKeypoints object to dynamically interfere with the
    augmentation process.

Returns
-------
result : imgaug.PolygonsOnImage or list of imgaug.PolygonsOnImage
    Augmented polygons.


def copy_random_state(self, source, recursive=True, matching="<STR_LIT>", matching_tolerant=True,<EOL>copy_determinism=False):

Copy the random states from a source augmenter sequence.

Parameters
----------
source : imgaug.augmenters.meta.Augmenter
    See :func:`imgaug.augmenters.meta.Augmenter.copy_random_state_`.

recursive : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.copy_random_state_`.

matching : {'position', 'name'}, optional
    See :func:`imgaug.augmenters.meta.Augmenter.copy_random_state_`.

matching_tolerant : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.copy_random_state_`.

copy_determinism : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.copy_random_state_`.

Returns
-------
aug : imgaug.augmenters.meta.Augmenter
    Copy of the augmenter(s) with the same random state(s) as in the
    source augmenter(s).


def draw_grid(self, images, rows, cols):

if ia.is_np_array(images):<EOL><INDENT>if len(images.shape) == <NUM_LIT:4>:<EOL><INDENT>images = [images[i] for i in range(images.shape[<NUM_LIT:0>])]<EOL><DEDENT>elif len(images.shape) == <NUM_LIT:3>:<EOL><INDENT>images = [images]<EOL><DEDENT>elif len(images.shape) == <NUM_LIT:2>:<EOL><INDENT>images = [images[:, :, np.newaxis]]<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>"<EOL>+ "<STR_LIT>" % (images.shape,))<EOL><DEDENT><DEDENT>elif isinstance(images, list):<EOL><INDENT>for i, image in enumerate(images):<EOL><INDENT>if len(image.shape) == <NUM_LIT:3>:<EOL><INDENT>continue<EOL><DEDENT>elif len(image.shape) == <NUM_LIT:2>:<EOL><INDENT>images[i] = image[:, :, np.newaxis]<EOL><DEDENT>else:<EOL><INDENT>raise Exception(("<STR_LIT>"<EOL>+ "<STR_LIT>") % (i, image.shape,))<EOL><DEDENT><DEDENT><DEDENT>ia.do_assert(isinstance(images, list))<EOL>det = self if self.deterministic else self.to_deterministic()<EOL>augs = []<EOL>for image in images:<EOL><INDENT>augs.append(det.augment_images([image] * (rows * cols)))<EOL><DEDENT>augs_flat = list(itertools.chain(*augs))<EOL>cell_height = max([image.shape[<NUM_LIT:0>] for image in augs_flat])<EOL>cell_width = max([image.shape[<NUM_LIT:1>] for image in augs_flat])<EOL>width = cell_width * cols<EOL>height = cell_height * (rows * len(images))<EOL>grid = np.zeros((height, width, <NUM_LIT:3>), dtype=augs[<NUM_LIT:0>][<NUM_LIT:0>].dtype)<EOL>for row_idx in range(rows):<EOL><INDENT>for img_idx, image in enumerate(images):<EOL><INDENT>for col_idx in range(cols):<EOL><INDENT>image_aug = augs[img_idx][(row_idx * cols) + col_idx]<EOL>cell_y1 = cell_height * (row_idx * len(images) + img_idx)<EOL>cell_y2 = cell_y1 + image_aug.shape[<NUM_LIT:0>]<EOL>cell_x1 = cell_width * col_idx<EOL>cell_x2 = cell_x1 + image_aug.shape[<NUM_LIT:1>]<EOL>grid[cell_y1:cell_y2, cell_x1:cell_x2, :] = image_aug<EOL><DEDENT><DEDENT><DEDENT>return grid<EOL>

Apply this augmenter to the given images and return a grid image of the results.
Each cell in the grid contains a single augmented variation of an input image.

If multiple images are provided, the row count is multiplied by
the number of images and each image gets its own row.
E.g. for ``images = [A, B]``, ``rows=2``, ``cols=3``::

    A A A
    B B B
    A A A
    B B B

for ``images = [A]``, ``rows=2``,
``cols=3``::

    A A A
    A A A

Parameters
-------
images : (N,H,W,3) ndarray or (H,W,3) ndarray or (H,W) ndarray or list of (H,W,3) ndarray\
         or list of (H,W) ndarray
    List of images of which to show the augmented versions.
    If a list, then each element is expected to have shape ``(H, W)`` or
    ``(H, W, 3)``. If a single array, then it is expected to have
    shape ``(N, H, W, 3)`` or ``(H, W, 3)`` or ``(H, W)``.

rows : int
    Number of rows in the grid.
    If ``N`` input images are given, this value will automatically be
    multiplied by ``N`` to create rows for each image.

cols : int
    Number of columns in the grid.

Returns
-------
grid : (Hg, Wg, 3) ndarray
    The generated grid image with augmented versions of the input
    images. Here, ``Hg`` and ``Wg`` reference the output size of the grid,
    and *not* the sizes of the input images.


self.append(augmenter)<EOL>

Add an augmenter to the list of child augmenters.

        Parameters
        ----------
        augmenter : imgaug.augmenters.meta.Augmenter
            The augmenter to add.


return copy_module.deepcopy(self)<EOL>

Create a deep copy of this Augmenter instance.

Returns
-------
imgaug.augmenters.meta.Augmenter
    Deep copy of this Augmenter instance.


@abstractmethod<EOL><INDENT>def _augment_heatmaps(self, heatmaps, random_state, parents, hooks):<DEDENT>

raise NotImplementedError()<EOL>

Augment heatmaps on multiple images.

This is the internal version of ``augment_heatmaps()``.
It is called from ``augment_heatmaps()`` and should usually not be called
directly.
This method may heatmaps in-place.
This method does not have to care about determinism or the
Augmenter instance's ``random_state`` variable. The parameter
``random_state`` takes care of both of these.

Parameters
----------
heatmaps : list of imgaug.HeatmapsOnImage
    Heatmaps to augment. They may be changed in-place.

parents : list of imgaug.augmenters.meta.Augmenter
    See :func:`imgaug.augmenters.meta.Augmenter.augment_heatmaps`.

hooks : imgaug.HooksHeatmaps or None
    See :func:`imgaug.augmenters.meta.Augmenter.augment_heatmaps`.

Returns
----------
images : list of imgaug.HeatmapsOnImage
    The augmented heatmaps.


def augment_batch(self, batch, hooks=None):

batch_orig = batch<EOL>if isinstance(batch, UnnormalizedBatch):<EOL><INDENT>batch = batch.to_normalized_batch()<EOL><DEDENT>augmentables = [(attr_name[:-len("<STR_LIT>")], attr)<EOL>for attr_name, attr<EOL>in batch.__dict__.items()<EOL>if attr_name.endswith("<STR_LIT>") and attr is not None]<EOL>augseq = self<EOL>if len(augmentables) > <NUM_LIT:1> and not self.deterministic:<EOL><INDENT>augseq = self.to_deterministic()<EOL><DEDENT>for attr_name, attr in augmentables:<EOL><INDENT>aug = getattr(augseq, "<STR_LIT>" % (attr_name,))(<EOL>attr, hooks=hooks)<EOL>setattr(batch, "<STR_LIT>" % (attr_name,), aug)<EOL><DEDENT>if isinstance(batch_orig, UnnormalizedBatch):<EOL><INDENT>batch = batch_orig.fill_from_augmented_normalized_batch(batch)<EOL><DEDENT>return batch<EOL>

Augment a single batch.

Parameters
----------
batch : imgaug.augmentables.batches.Batch \
        or imgaug.augmentables.batches.UnnormalizedBatch
    A single batch to augment.

hooks : None or imgaug.HooksImages, optional
    HooksImages object to dynamically interfere with the augmentation
    process.

Returns
-------
imgaug.augmentables.batches.Batch \
        or imgaug.augmentables.batches.UnnormalizedBatch
    Augmented batch.


def GammaContrast(gamma=<NUM_LIT:1>, per_channel=False, name=None, deterministic=False, random_state=None):

params1d = [iap.handle_continuous_param(gamma, "<STR_LIT>", value_range=None, tuple_to_uniform=True,<EOL>list_to_choice=True)]<EOL>func = adjust_contrast_gamma<EOL>return _ContrastFuncWrapper(<EOL>func, params1d, per_channel,<EOL>dtypes_allowed=["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>dtypes_disallowed=["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT:bool>"],<EOL>name=name if name is not None else ia.caller_name(),<EOL>deterministic=deterministic,<EOL>random_state=random_state<EOL>)<EOL>

Adjust contrast by scaling each pixel value to ``255 * ((I_ij/255)**gamma)``.

Values in the range ``gamma=(0.5, 2.0)`` seem to be sensible.

dtype support::

    See :func:`imgaug.augmenters.contrast.adjust_contrast_gamma`.

Parameters
----------
gamma : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
    Exponent for the contrast adjustment. Higher values darken the image.

        * If a number, then that value will be used for all images.
        * If a tuple ``(a, b)``, then a value from the range ``[a, b]`` will be used per image.
        * If a list, then a random value will be sampled from that list per image.
        * If a StochasticParameter, then a value will be sampled per image from that parameter.

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.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Returns
-------
_ContrastFuncWrapper
    Augmenter to perform gamma contrast adjustment.


def LogContrast(gain=<NUM_LIT:1>, per_channel=False, name=None, deterministic=False, random_state=None):

<EOL>params1d = [iap.handle_continuous_param(gain, "<STR_LIT>", value_range=(<NUM_LIT:0>, None), tuple_to_uniform=True,<EOL>list_to_choice=True)]<EOL>func = adjust_contrast_log<EOL>return _ContrastFuncWrapper(<EOL>func, params1d, per_channel,<EOL>dtypes_allowed=["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>dtypes_disallowed=["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT:bool>"],<EOL>name=name if name is not None else ia.caller_name(),<EOL>deterministic=deterministic,<EOL>random_state=random_state<EOL>)<EOL>

Adjust contrast by scaling each pixel value to ``255 * gain * log_2(1 + I_ij/255)``.

dtype support::

    See :func:`imgaug.augmenters.contrast.adjust_contrast_log`.

Parameters
----------
gain : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
    Multiplier for the logarithm result. Values around 1.0 lead to a contrast-adjusted
    images. Values above 1.0 quickly lead to partially broken images due to exceeding the
    datatype's value range.

        * If a number, then that value will be used for all images.
        * If a tuple ``(a, b)``, then a value from the range ``[a, b]`` will be used per image.
        * If a list, then a random value will be sampled from that list per image.
        * If a StochasticParameter, then a value will be sampled per image from that parameter.

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.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Returns
-------
_ContrastFuncWrapper
    Augmenter to perform logarithmic contrast adjustment.


def adjust_contrast_sigmoid(arr, gain, cutoff):

<EOL>if arr.dtype.name == "<STR_LIT>":<EOL><INDENT>min_value, _center_value, max_value = iadt.get_value_range_of_dtype(arr.dtype)<EOL>dynamic_range = max_value - min_value<EOL>value_range = np.linspace(<NUM_LIT:0>, <NUM_LIT:1.0>, num=dynamic_range+<NUM_LIT:1>, dtype=np.float32)<EOL>gain = np.float32(gain)<EOL>cutoff = np.float32(cutoff)<EOL>table = min_value + dynamic_range * <NUM_LIT:1>/(<NUM_LIT:1> + np.exp(gain * (cutoff - value_range)))<EOL>arr_aug = cv2.LUT(arr, np.clip(table, min_value, max_value).astype(arr.dtype))<EOL>if arr.ndim == <NUM_LIT:3> and arr_aug.ndim == <NUM_LIT:2>:<EOL><INDENT>return arr_aug[..., np.newaxis]<EOL><DEDENT>return arr_aug<EOL><DEDENT>else:<EOL><INDENT>return ski_exposure.adjust_sigmoid(arr, cutoff=cutoff, gain=gain)<EOL><DEDENT>

Adjust contrast by scaling each pixel value to ``255 * 1/(1 + exp(gain*(cutoff - I_ij/255)))``.

dtype support::

    * ``uint8``: yes; fully tested (1) (2) (3)
    * ``uint16``: yes; tested (2) (3)
    * ``uint32``: yes; tested (2) (3)
    * ``uint64``: yes; tested (2) (3) (4)
    * ``int8``: limited; tested (2) (3) (5)
    * ``int16``: limited; tested (2) (3) (5)
    * ``int32``: limited; tested (2) (3) (5)
    * ``int64``: limited; tested (2) (3) (4) (5)
    * ``float16``: limited; tested (5)
    * ``float32``: limited; tested (5)
    * ``float64``: limited; tested (5)
    * ``float128``: no (6)
    * ``bool``: no (7)

    - (1) Handled by ``cv2``. Other dtypes are handled by ``skimage``.
    - (2) Normalization is done as ``I_ij/max``, where ``max`` is the maximum value of the
          dtype, e.g. 255 for ``uint8``. The normalization is reversed afterwards,
          e.g. ``result*255`` for ``uint8``.
    - (3) Integer-like values are not rounded after applying the contrast adjustment equation
          (before inverting the normalization to 0.0-1.0 space), i.e. projection from continuous
          space to discrete happens according to floor function.
    - (4) Note that scikit-image doc says that integers are converted to ``float64`` values before
          applying the contrast normalization method. This might lead to inaccuracies for large
          64bit integer values. Tests showed no indication of that happening though.
    - (5) Must not contain negative values. Values >=0 are fully supported.
    - (6) Leads to error in scikit-image.
    - (7) Does not make sense for contrast adjustments.

Parameters
----------
arr : numpy.ndarray
    Array for which to adjust the contrast. Dtype ``uint8`` is fastest.

gain : number
    Multiplier for the sigmoid function's output.
    Higher values lead to quicker changes from dark to light pixels.

cutoff : number
    Cutoff that shifts the sigmoid function in horizontal direction.
    Higher values mean that the switch from dark to light pixels happens later, i.e.
    the pixels will remain darker.

Returns
-------
numpy.ndarray
    Array with adjusted contrast.


<EOL>if arr.dtype.name == "<STR_LIT>":<EOL><INDENT>min_value, center_value, max_value = iadt.get_value_range_of_dtype(arr.dtype)<EOL>value_range = np.arange(<NUM_LIT:0>, <NUM_LIT>, dtype=np.float32)<EOL>alpha = np.float32(alpha)<EOL>table = center_value + alpha * (value_range - center_value)<EOL>arr_aug = cv2.LUT(arr, np.clip(table, min_value, max_value).astype(arr.dtype))<EOL>if arr.ndim == <NUM_LIT:3> and arr_aug.ndim == <NUM_LIT:2>:<EOL><INDENT>return arr_aug[..., np.newaxis]<EOL><DEDENT>return arr_aug<EOL><DEDENT>else:<EOL><INDENT>input_dtype = arr.dtype<EOL>_min_value, center_value, _max_value = iadt.get_value_range_of_dtype(input_dtype)<EOL>if input_dtype.kind in ["<STR_LIT:u>", "<STR_LIT:i>"]:<EOL><INDENT>center_value = int(center_value)<EOL><DEDENT>image_aug = center_value + alpha * (arr.astype(np.float64)-center_value)<EOL>image_aug = iadt.restore_dtypes_(image_aug, input_dtype)<EOL>return image_aug<EOL><DEDENT>

Adjust contrast by scaling each pixel value to ``127 + alpha*(I_ij-127)``.

    dtype support::

        * ``uint8``: yes; fully tested (1) (2)
        * ``uint16``: yes; tested (2)
        * ``uint32``: yes; tested (2)
        * ``uint64``: no (3)
        * ``int8``: yes; tested (2)
        * ``int16``: yes; tested (2)
        * ``int32``: yes; tested (2)
        * ``int64``: no (2)
        * ``float16``: yes; tested (2)
        * ``float32``: yes; tested (2)
        * ``float64``: yes; tested (2)
        * ``float128``: no (2)
        * ``bool``: no (4)

        - (1) Handled by ``cv2``. Other dtypes are handled by raw ``numpy``.
        - (2) Only tested for reasonable alphas with up to a value of around 100.
        - (3) Conversion to ``float64`` is done during augmentation, hence ``uint64``, ``int64``,
              and ``float128`` support cannot be guaranteed.
        - (4) Does not make sense for contrast adjustments.

    Parameters
    ----------
    arr : numpy.ndarray
        Array for which to adjust the contrast. Dtype ``uint8`` is fastest.

    alpha : number
        Multiplier to linearly pronounce (>1.0), dampen (0.0 to 1.0) or invert (<0.0) the
        difference between each pixel value and the center value, e.g. ``127`` for ``uint8``.

    Returns
    -------
    numpy.ndarray
        Array with adjusted contrast.


def EdgeDetect(alpha=<NUM_LIT:0>, name=None, deterministic=False, random_state=None):

alpha_param = iap.handle_continuous_param(alpha, "<STR_LIT>", value_range=(<NUM_LIT:0>, <NUM_LIT:1.0>), tuple_to_uniform=True,<EOL>list_to_choice=True)<EOL>def create_matrices(_image, nb_channels, random_state_func):<EOL><INDENT>alpha_sample = alpha_param.draw_sample(random_state=random_state_func)<EOL>ia.do_assert(<NUM_LIT:0> <= alpha_sample <= <NUM_LIT:1.0>)<EOL>matrix_nochange = np.array([<EOL>[<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>],<EOL>[<NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:0>],<EOL>[<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>]<EOL>], dtype=np.float32)<EOL>matrix_effect = np.array([<EOL>[<NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:0>],<EOL>[<NUM_LIT:1>, -<NUM_LIT:4>, <NUM_LIT:1>],<EOL>[<NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:0>]<EOL>], dtype=np.float32)<EOL>matrix = (<NUM_LIT:1>-alpha_sample) * matrix_nochange + alpha_sample * matrix_effect<EOL>return [matrix] * nb_channels<EOL><DEDENT>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return Convolve(create_matrices, name=name, deterministic=deterministic, random_state=random_state)<EOL>

Augmenter that detects all edges in images, marks them in
a black and white image and then overlays the result with the original
image.

dtype support::

    See ``imgaug.augmenters.convolutional.Convolve``.

Parameters
----------
alpha : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
    Visibility of the sharpened image. At 0, only the original image is
    visible, at 1.0 only its sharpened version is visible.

        * If an int or float, exactly that value will be used.
        * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will
          be sampled per image.
        * If a list, then a random value will be sampled from that list
          per image.
        * If a StochasticParameter, a value will be sampled from the
          parameter per image.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = EdgeDetect(alpha=(0.0, 1.0))

detects edges in an image  and overlays the result with a variable alpha
in the range ``0.0 <= a <= 1.0`` over the old image.


def Sharpen(alpha=<NUM_LIT:0>, lightness=<NUM_LIT:1>, name=None, deterministic=False, random_state=None):

alpha_param = iap.handle_continuous_param(alpha, "<STR_LIT>", value_range=(<NUM_LIT:0>, <NUM_LIT:1.0>), tuple_to_uniform=True,<EOL>list_to_choice=True)<EOL>lightness_param = iap.handle_continuous_param(lightness, "<STR_LIT>", value_range=(<NUM_LIT:0>, None), tuple_to_uniform=True,<EOL>list_to_choice=True)<EOL>def create_matrices(image, nb_channels, random_state_func):<EOL><INDENT>alpha_sample = alpha_param.draw_sample(random_state=random_state_func)<EOL>ia.do_assert(<NUM_LIT:0> <= alpha_sample <= <NUM_LIT:1.0>)<EOL>lightness_sample = lightness_param.draw_sample(random_state=random_state_func)<EOL>matrix_nochange = np.array([<EOL>[<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>],<EOL>[<NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:0>],<EOL>[<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>]<EOL>], dtype=np.float32)<EOL>matrix_effect = np.array([<EOL>[-<NUM_LIT:1>, -<NUM_LIT:1>, -<NUM_LIT:1>],<EOL>[-<NUM_LIT:1>, <NUM_LIT:8>+lightness_sample, -<NUM_LIT:1>],<EOL>[-<NUM_LIT:1>, -<NUM_LIT:1>, -<NUM_LIT:1>]<EOL>], dtype=np.float32)<EOL>matrix = (<NUM_LIT:1>-alpha_sample) * matrix_nochange + alpha_sample * matrix_effect<EOL>return [matrix] * nb_channels<EOL><DEDENT>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return Convolve(create_matrices, name=name, deterministic=deterministic, random_state=random_state)<EOL>

Augmenter that sharpens images and overlays the result with the original image.

dtype support::

    See ``imgaug.augmenters.convolutional.Convolve``.

Parameters
----------
alpha : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
    Visibility of the sharpened image. At 0, only the original image is
    visible, at 1.0 only its sharpened version is visible.

        * If an int or float, exactly that value will be used.
        * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will
          be sampled per image.
        * If a list, then a random value will be sampled from that list
          per image.
        * If a StochasticParameter, a value will be sampled from the
          parameter per image.

lightness : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
    Parameter that controls the lightness/brightness of the sharped image.
    Sane values are somewhere in the range ``(0.5, 2)``.
    The value 0 results in an edge map. Values higher than 1 create bright
    images. Default value is 1.

        * If an int or float, exactly that value will be used.
        * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will
          be sampled per image.
        * If a list, then a random value will be sampled from that list
          per image.
        * If a StochasticParameter, a value will be sampled from the
          parameter per image.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = Sharpen(alpha=(0.0, 1.0))

sharpens input images and overlays the sharpened image by a variable
amount over the old image.

>>> aug = Sharpen(alpha=(0.0, 1.0), lightness=(0.75, 2.0))

sharpens input images with a variable lightness in the range
``0.75 <= x <= 2.0`` and with a variable alpha.


return Flipud(*args, **kwargs)<EOL>


def Pepper(p=<NUM_LIT:0>, per_channel=False, name=None, deterministic=False, random_state=None):

replacement01 = iap.ForceSign(<EOL>iap.Beta(<NUM_LIT:0.5>, <NUM_LIT:0.5>) - <NUM_LIT:0.5>,<EOL>positive=False,<EOL>mode="<STR_LIT>"<EOL>) + <NUM_LIT:0.5><EOL>replacement = replacement01 * <NUM_LIT:255><EOL>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return ReplaceElementwise(<EOL>mask=p,<EOL>replacement=replacement,<EOL>per_channel=per_channel,<EOL>name=name,<EOL>deterministic=deterministic,<EOL>random_state=random_state<EOL>)<EOL>

Adds pepper noise to an image, i.e. black-ish pixels.

This is similar to dropout, but slower and the black pixels are not uniformly black.

dtype support::

    See ``imgaug.augmenters.arithmetic.ReplaceElementwise``.

Parameters
----------
p : float or tuple of float or list of float or imgaug.parameters.StochasticParameter, optional
    Probability of changing a pixel to pepper noise.

        * If a float, then that value will be used for all images as the
          probability.
        * If a tuple ``(a, b)``, then a probability will be sampled per image
          from the range ``a <= x <= b``.
        * If a list, then a random value will be sampled from that list
          per image.
        * If a StochasticParameter, then this parameter will be used as
          the *mask*, i.e. it is expected to contain values between
          0.0 and 1.0, where 1.0 means that pepper is to be added
          at that location.

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.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.Pepper(0.05)

Replaces 5 percent of all pixels with pepper.


def ImpulseNoise(p=<NUM_LIT:0>, name=None, deterministic=False, random_state=None):

return SaltAndPepper(p=p, per_channel=True, name=name, deterministic=deterministic, random_state=random_state)<EOL>

Creates an augmenter to apply impulse noise to an image.

This is identical to ``SaltAndPepper``, except that per_channel is always set to True.

dtype support::

    See ``imgaug.augmenters.arithmetic.SaltAndPepper``.


def Salt(p=<NUM_LIT:0>, per_channel=False, name=None, deterministic=False, random_state=None):

replacement01 = iap.ForceSign(<EOL>iap.Beta(<NUM_LIT:0.5>, <NUM_LIT:0.5>) - <NUM_LIT:0.5>,<EOL>positive=True,<EOL>mode="<STR_LIT>"<EOL>) + <NUM_LIT:0.5><EOL>replacement = replacement01 * <NUM_LIT:255>  <EOL>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return ReplaceElementwise(mask=p, replacement=replacement, per_channel=per_channel, name=name,<EOL>deterministic=deterministic, random_state=random_state)<EOL>

Adds salt noise to an image, i.e. white-ish pixels.

dtype support::

    See ``imgaug.augmenters.arithmetic.ReplaceElementwise``.

Parameters
----------
p : float or tuple of float or list of float or imgaug.parameters.StochasticParameter, optional
    Probability of changing a pixel to salt noise.

        * If a float, then that value will be used for all images as the
          probability.
        * If a tuple ``(a, b)``, then a probability will be sampled per image
          from the range ``a <= x <= b``.
        * If a list, then a random value will be sampled from that list
          per image.
        * If a StochasticParameter, then this parameter will be used as
          the *mask*, i.e. it is expected to contain values between
          0.0 and 1.0, where 1.0 means that salt is to be added
          at that location.

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.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.Salt(0.05)

Replaces 5 percent of all pixels with salt.


def CoarsePepper(p=<NUM_LIT:0>, size_px=None, size_percent=None, per_channel=False, min_size=<NUM_LIT:4>, name=None, deterministic=False,<EOL>random_state=None):

mask = iap.handle_probability_param(p, "<STR_LIT:p>", tuple_to_uniform=True, list_to_choice=True)<EOL>if size_px is not None:<EOL><INDENT>mask_low = iap.FromLowerResolution(other_param=mask, size_px=size_px, min_size=min_size)<EOL><DEDENT>elif size_percent is not None:<EOL><INDENT>mask_low = iap.FromLowerResolution(other_param=mask, size_percent=size_percent, min_size=min_size)<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>replacement01 = iap.ForceSign(<EOL>iap.Beta(<NUM_LIT:0.5>, <NUM_LIT:0.5>) - <NUM_LIT:0.5>,<EOL>positive=False,<EOL>mode="<STR_LIT>"<EOL>) + <NUM_LIT:0.5><EOL>replacement = replacement01 * <NUM_LIT:255><EOL>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return ReplaceElementwise(<EOL>mask=mask_low,<EOL>replacement=replacement,<EOL>per_channel=per_channel,<EOL>name=name,<EOL>deterministic=deterministic,<EOL>random_state=random_state<EOL>)<EOL>

Adds coarse pepper noise to an image, i.e. rectangles that contain noisy black-ish pixels.

dtype support::

    See ``imgaug.augmenters.arithmetic.ReplaceElementwise``.

Parameters
----------
p : float or tuple of float or list of float or imgaug.parameters.StochasticParameter, optional
    Probability of changing a pixel to pepper noise.

        * If a float, then that value will be used for all images as the
          probability.
        * If a tuple ``(a, b)``, then a probability will be sampled per image
          from the range ``a <= x <= b.``
        * If a list, then a random value will be sampled from that list
          per image.
        * If a StochasticParameter, then this parameter will be used as
          the *mask*, i.e. it is expected to contain values between
          0.0 and 1.0, where 1.0 means that pepper is to be added
          at that location.

size_px : int or tuple of int or imgaug.parameters.StochasticParameter, optional
    The size of the lower resolution image from which to sample the noise
    mask in absolute pixel dimensions.

        * If an integer, then that size will be used for both height and
          width. E.g. a value of 3 would lead to a ``3x3`` mask, which is then
          upsampled to ``HxW``, where ``H`` is the image size and W the image width.
        * If a tuple ``(a, b)``, then two values ``M``, ``N`` will be sampled from the
          range ``[a..b]`` and the mask will be generated at size ``MxN``, then
          upsampled to ``HxW``.
        * If a StochasticParameter, then this parameter will be used to
          determine the sizes. It is expected to be discrete.

size_percent : float or tuple of float or imgaug.parameters.StochasticParameter, optional
    The size of the lower resolution image from which to sample the noise
    mask *in percent* of the input image.

        * If a float, then that value will be used as the percentage of the
          height and width (relative to the original size). E.g. for value
          p, the mask will be sampled from ``(p*H)x(p*W)`` and later upsampled
          to ``HxW``.
        * If a tuple ``(a, b)``, then two values ``m``, ``n`` will be sampled from the
          interval ``(a, b)`` and used as the percentages, i.e the mask size
          will be ``(m*H)x(n*W)``.
        * If a StochasticParameter, then this parameter will be used to
          sample the percentage values. It is expected to be continuous.

per_channel : bool or float, optional
    Whether to use the same value (is dropped / is not dropped)
    for all channels of a pixel (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.

min_size : int, optional
    Minimum size of the low resolution mask, both width and height. If
    `size_percent` or `size_px` leads to a lower value than this, `min_size`
    will be used instead. This should never have a value of less than 2,
    otherwise one may end up with a 1x1 low resolution mask, leading easily
    to the whole image being replaced.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.CoarsePepper(0.05, size_percent=(0.01, 0.1))

Replaces 5 percent of all pixels with pepper in an image that has
1 to 10 percent of the input image size, then upscales the results
to the input image size, leading to large rectangular areas being replaced.


def CoarseSaltAndPepper(p=<NUM_LIT:0>, size_px=None, size_percent=None, per_channel=False, min_size=<NUM_LIT:4>, name=None,<EOL>deterministic=False, random_state=None):

mask = iap.handle_probability_param(p, "<STR_LIT:p>", tuple_to_uniform=True, list_to_choice=True)<EOL>if size_px is not None:<EOL><INDENT>mask_low = iap.FromLowerResolution(other_param=mask, size_px=size_px, min_size=min_size)<EOL><DEDENT>elif size_percent is not None:<EOL><INDENT>mask_low = iap.FromLowerResolution(other_param=mask, size_percent=size_percent, min_size=min_size)<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>replacement = iap.Beta(<NUM_LIT:0.5>, <NUM_LIT:0.5>) * <NUM_LIT:255><EOL>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return ReplaceElementwise(<EOL>mask=mask_low,<EOL>replacement=replacement,<EOL>per_channel=per_channel,<EOL>name=name,<EOL>deterministic=deterministic,<EOL>random_state=random_state<EOL>)<EOL>

Adds coarse salt and pepper noise to an image, i.e. rectangles that contain noisy white-ish and black-ish pixels.

TODO replace dtype support with uint8 only, because replacement is geared towards that value range

dtype support::

    See ``imgaug.augmenters.arithmetic.ReplaceElementwise``.

Parameters
----------
p : float or tuple of float or list of float or imgaug.parameters.StochasticParameter, optional
    Probability of changing a pixel to salt/pepper noise.

        * If a float, then that value will be used for all images as the
          probability.
        * If a tuple ``(a, b)``, then a probability will be sampled per image
          from the range ``a <= x <= b``.
        * If a list, then a random value will be sampled from that list
          per image.
        * If a StochasticParameter, then this parameter will be used as
          the *mask*, i.e. it is expected to contain values between
          0.0 and 1.0, where 1.0 means that salt/pepper is to be added
          at that location.

size_px : int or tuple of int or imgaug.parameters.StochasticParameter, optional
    The size of the lower resolution image from which to sample the noise
    mask in absolute pixel dimensions.

        * If an integer, then that size will be used for both height and
          width. E.g. a value of 3 would lead to a ``3x3`` mask, which is then
          upsampled to ``HxW``, where ``H`` is the image size and ``W`` the image width.
        * If a tuple ``(a, b)``, then two values ``M``, ``N`` will be sampled from the
          range ``[a..b]`` and the mask will be generated at size ``MxN``, then
          upsampled to ``HxW``.
        * If a StochasticParameter, then this parameter will be used to
          determine the sizes. It is expected to be discrete.

size_percent : float or tuple of float or imgaug.parameters.StochasticParameter, optional
    The size of the lower resolution image from which to sample the noise
    mask *in percent* of the input image.

        * If a float, then that value will be used as the percentage of the
          height and width (relative to the original size). E.g. for value
          p, the mask will be sampled from ``(p*H)x(p*W)`` and later upsampled
          to ``HxW.``
        * If a tuple ``(a, b)``, then two values ``m``, ``n`` will be sampled from the
          interval ``(a, b)`` and used as the percentages, i.e the mask size
          will be ``(m*H)x(n*W)``.
        * If a StochasticParameter, then this parameter will be used to
          sample the percentage values. It is expected to be continuous.

per_channel : bool or float, optional
    Whether to use the same value (is dropped / is not dropped)
    for all channels of a pixel (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.

min_size : int, optional
    Minimum size of the low resolution mask, both width and height. If
    `size_percent` or `size_px` leads to a lower value than this, `min_size`
    will be used instead. This should never have a value of less than 2,
    otherwise one may end up with a 1x1 low resolution mask, leading easily
    to the whole image being replaced.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.CoarseSaltAndPepper(0.05, size_percent=(0.01, 0.1))

Replaces 5 percent of all pixels with salt/pepper in an image that has
1 to 10 percent of the input image size, then upscales the results
to the input image size, leading to large rectangular areas being replaced.


def AdditiveLaplaceNoise(loc=<NUM_LIT:0>, scale=<NUM_LIT:0>, per_channel=False, name=None, deterministic=False, random_state=None):

loc2 = iap.handle_continuous_param(loc, "<STR_LIT>", value_range=None, tuple_to_uniform=True, list_to_choice=True)<EOL>scale2 = iap.handle_continuous_param(scale, "<STR_LIT>", value_range=(<NUM_LIT:0>, None), tuple_to_uniform=True,<EOL>list_to_choice=True)<EOL>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return AddElementwise(iap.Laplace(loc=loc2, scale=scale2), per_channel=per_channel, name=name,<EOL>deterministic=deterministic, random_state=random_state)<EOL>

Add laplace noise to images.

The laplace distribution is similar to the gaussian distribution, but has puts weight on the long tail.
Hence, this noise will add more outliers (very high/low values). It is somewhere between gaussian noise and
salt and pepper noise.

Values of around ``255 * 0.05`` for `scale` lead to visible noise (for uint8).
Values of around ``255 * 0.10`` for `scale` lead to very visible noise (for uint8).
It is recommended to usually set `per_channel` to True.

dtype support::

    See ``imgaug.augmenters.arithmetic.AddElementwise``.

Parameters
----------
loc : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
    Mean of the laplace distribution that generates the noise.

        * If a number, exactly that value will be used.
        * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will
          be sampled per image.
        * If a list, then a random value will be sampled from that list per
          image.
        * If a StochasticParameter, a value will be sampled from the
          parameter per image.

scale : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
    Standard deviation of the laplace distribution that generates the noise.
    Must be ``>= 0``. If 0 then only `loc` will be used.
    Recommended to be around ``255 * 0.05``.

        * If an int or float, exactly that value will be used.
        * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will
          be sampled per image.
        * If a list, then a random value will be sampled from that list per
          image.
        * If a StochasticParameter, a value will be sampled from the
          parameter per image.

per_channel : bool or float, optional
    Whether to use the same noise value per pixel 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.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.AdditiveLaplaceNoise(scale=0.1*255)

Adds laplace noise from the distribution ``Laplace(0, 0.1*255)`` to images.

>>> aug = iaa.AdditiveLaplaceNoise(scale=(0, 0.1*255))

Adds laplace noise from the distribution ``Laplace(0, s)`` to images,
where s is sampled per image from the range ``0 <= s <= 0.1*255``.

>>> aug = iaa.AdditiveLaplaceNoise(scale=0.1*255, per_channel=True)

Adds laplace noise from the distribution ``Laplace(0, 0.1*255)`` to images,
where the noise value is different per pixel *and* channel (e.g. a
different one for red, green and blue channels for the same pixel).

>>> aug = iaa.AdditiveLaplaceNoise(scale=0.1*255, per_channel=0.5)

Adds laplace noise from the distribution ``Laplace(0, 0.1*255)`` to images,
where the noise value is sometimes (50 percent of all cases) the same
per pixel for all channels and sometimes different (other 50 percent).


def CoarseDropout(p=<NUM_LIT:0>, size_px=None, size_percent=None, per_channel=False, min_size=<NUM_LIT:4>, name=None, deterministic=False,<EOL>random_state=None):

if ia.is_single_number(p):<EOL><INDENT>p2 = iap.Binomial(<NUM_LIT:1> - p)<EOL><DEDENT>elif ia.is_iterable(p):<EOL><INDENT>ia.do_assert(len(p) == <NUM_LIT:2>)<EOL>ia.do_assert(p[<NUM_LIT:0>] < p[<NUM_LIT:1>])<EOL>ia.do_assert(<NUM_LIT:0> <= p[<NUM_LIT:0>] <= <NUM_LIT:1.0>)<EOL>ia.do_assert(<NUM_LIT:0> <= p[<NUM_LIT:1>] <= <NUM_LIT:1.0>)<EOL>p2 = iap.Binomial(iap.Uniform(<NUM_LIT:1> - p[<NUM_LIT:1>], <NUM_LIT:1> - p[<NUM_LIT:0>]))<EOL><DEDENT>elif isinstance(p, iap.StochasticParameter):<EOL><INDENT>p2 = p<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>" % (type(p),))<EOL><DEDENT>if size_px is not None:<EOL><INDENT>p3 = iap.FromLowerResolution(other_param=p2, size_px=size_px, min_size=min_size)<EOL><DEDENT>elif size_percent is not None:<EOL><INDENT>p3 = iap.FromLowerResolution(other_param=p2, size_percent=size_percent, min_size=min_size)<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return MultiplyElementwise(p3, per_channel=per_channel, name=name, deterministic=deterministic,<EOL>random_state=random_state)<EOL>

Augmenter that sets rectangular areas within images to zero.

In contrast to Dropout, these areas can have larger sizes.
(E.g. you might end up with three large black rectangles in an image.)
Note that the current implementation leads to correlated sizes,
so when there is one large area that is dropped, there is a high likelihood
that all other dropped areas are also large.

This method is implemented by generating the dropout mask at a
lower resolution (than the image has) and then upsampling the mask
before dropping the pixels.

dtype support::

    See ``imgaug.augmenters.arithmetic.MultiplyElementwise``.

Parameters
----------
p : float or tuple of float or imgaug.parameters.StochasticParameter, optional
    The probability of any pixel being dropped (i.e. set to zero).

        * If a float, then that value will be used for all pixels. A value
          of 1.0 would mean, that all pixels will be dropped. A value of
          0.0 would lead to no pixels being dropped.
        * If a tuple ``(a, b)``, then a value p will be sampled from the
          range ``a <= p <= b`` per image and be used as the pixel's dropout
          probability.
        * If a StochasticParameter, then this parameter will be used to
          determine per pixel whether it should be dropped (sampled value
          of 0) or shouldn't (sampled value of 1).

size_px : int or tuple of int or imgaug.parameters.StochasticParameter, optional
    The size of the lower resolution image from which to sample the dropout
    mask in absolute pixel dimensions.

        * If an integer, then that size will be used for both height and
          width. E.g. a value of 3 would lead to a ``3x3`` mask, which is then
          upsampled to ``HxW``, where ``H`` is the image size and W the image width.
        * If a tuple ``(a, b)``, then two values ``M``, ``N`` will be sampled from the
          range ``[a..b]`` and the mask will be generated at size ``MxN``, then
          upsampled to ``HxW``.
        * If a StochasticParameter, then this parameter will be used to
          determine the sizes. It is expected to be discrete.

size_percent : float or tuple of float or imgaug.parameters.StochasticParameter, optional
    The size of the lower resolution image from which to sample the dropout
    mask *in percent* of the input image.

        * If a float, then that value will be used as the percentage of the
          height and width (relative to the original size). E.g. for value
          p, the mask will be sampled from ``(p*H)x(p*W)`` and later upsampled
          to ``HxW``.
        * If a tuple ``(a, b)``, then two values ``m``, ``n`` will be sampled from the
          interval ``(a, b)`` and used as the percentages, i.e the mask size
          will be ``(m*H)x(n*W)``.
        * If a StochasticParameter, then this parameter will be used to
          sample the percentage values. It is expected to be continuous.

per_channel : bool or float, optional
    Whether to use the same value (is dropped / is not dropped)
    for all channels of a pixel (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.

min_size : int, optional
    Minimum size of the low resolution mask, both width and height. If
    `size_percent` or `size_px` leads to a lower value than this, `min_size`
    will be used instead. This should never have a value of less than 2,
    otherwise one may end up with a ``1x1`` low resolution mask, leading easily
    to the whole image being dropped.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.CoarseDropout(0.02, size_percent=0.5)

drops 2 percent of all pixels on an lower-resolution image that has
50 percent of the original image's size, leading to dropped areas that
have roughly 2x2 pixels size.

>>> aug = iaa.CoarseDropout((0.0, 0.05), size_percent=(0.05, 0.5))

generates a dropout mask at 5 to 50 percent of image's size. In that mask,
0 to 5 percent of all pixels are dropped (random per image).

>>> aug = iaa.CoarseDropout((0.0, 0.05), size_px=(2, 16))

same as previous example, but the lower resolution image has 2 to 16 pixels
size.

>>> aug = iaa.CoarseDropout(0.02, size_percent=0.5, per_channel=True)

drops 2 percent of all pixels at 50 percent resolution (2x2 sizes)
in a channel-wise fashion, i.e. it is unlikely
for any pixel to have all channels set to zero (black pixels).

>>> aug = iaa.CoarseDropout(0.02, size_percent=0.5, per_channel=0.5)

same as previous example, but the `per_channel` feature is only active
for 50 percent of all images.


def blend_alpha(image_fg, image_bg, alpha, eps=<NUM_LIT>):

assert image_fg.shape == image_bg.shape<EOL>assert image_fg.dtype.kind == image_bg.dtype.kind<EOL>assert image_fg.dtype.name not in ["<STR_LIT>"]<EOL>assert image_bg.dtype.name not in ["<STR_LIT>"]<EOL>input_was_2d = (len(image_fg.shape) == <NUM_LIT:2>)<EOL>if input_was_2d:<EOL><INDENT>image_fg = np.atleast_3d(image_fg)<EOL>image_bg = np.atleast_3d(image_bg)<EOL><DEDENT>input_was_bool = False<EOL>if image_fg.dtype.kind == "<STR_LIT:b>":<EOL><INDENT>input_was_bool = True<EOL>image_fg = image_fg.astype(np.float32)<EOL>image_bg = image_bg.astype(np.float32)<EOL><DEDENT>alpha = np.array(alpha, dtype=np.float64)<EOL>if alpha.size == <NUM_LIT:1>:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>if alpha.ndim == <NUM_LIT:2>:<EOL><INDENT>assert alpha.shape == image_fg.shape[<NUM_LIT:0>:<NUM_LIT:2>]<EOL>alpha = alpha.reshape((alpha.shape[<NUM_LIT:0>], alpha.shape[<NUM_LIT:1>], <NUM_LIT:1>))<EOL><DEDENT>elif alpha.ndim == <NUM_LIT:3>:<EOL><INDENT>assert alpha.shape == image_fg.shape or alpha.shape == image_fg.shape[<NUM_LIT:0>:<NUM_LIT:2>] + (<NUM_LIT:1>,)<EOL><DEDENT>else:<EOL><INDENT>alpha = alpha.reshape((<NUM_LIT:1>, <NUM_LIT:1>, -<NUM_LIT:1>))<EOL><DEDENT>if alpha.shape[<NUM_LIT:2>] != image_fg.shape[<NUM_LIT:2>]:<EOL><INDENT>alpha = np.tile(alpha, (<NUM_LIT:1>, <NUM_LIT:1>, image_fg.shape[<NUM_LIT:2>]))<EOL><DEDENT><DEDENT>if not input_was_bool:<EOL><INDENT>if np.all(alpha >= <NUM_LIT:1.0> - eps):<EOL><INDENT>return np.copy(image_fg)<EOL><DEDENT>elif np.all(alpha <= eps):<EOL><INDENT>return np.copy(image_bg)<EOL><DEDENT><DEDENT>assert <NUM_LIT:0> <= alpha.item(<NUM_LIT:0>) <= <NUM_LIT:1.0><EOL>dt_images = iadt.get_minimal_dtype([image_fg, image_bg])<EOL>isize = dt_images.itemsize * <NUM_LIT:2><EOL>isize = max(isize, <NUM_LIT:4>)  <EOL>dt_blend = np.dtype("<STR_LIT>" % (isize,))<EOL>if alpha.dtype != dt_blend:<EOL><INDENT>alpha = alpha.astype(dt_blend)<EOL><DEDENT>if image_fg.dtype != dt_blend:<EOL><INDENT>image_fg = image_fg.astype(dt_blend)<EOL><DEDENT>if image_bg.dtype != dt_blend:<EOL><INDENT>image_bg = image_bg.astype(dt_blend)<EOL><DEDENT>image_blend = image_bg + alpha * (image_fg - image_bg)<EOL>if input_was_bool:<EOL><INDENT>image_blend = image_blend > <NUM_LIT:0.5><EOL><DEDENT>else:<EOL><INDENT>image_blend = iadt.restore_dtypes_(image_blend, dt_images, clip=False, round=True)<EOL><DEDENT>if input_was_2d:<EOL><INDENT>return image_blend[:, :, <NUM_LIT:0>]<EOL><DEDENT>return image_blend<EOL>

Blend two images using an alpha blending.

In an alpha blending, the two images are naively mixed. Let ``A`` be the foreground image
and ``B`` the background image and ``a`` is the alpha value. Each pixel intensity is then
computed as ``a * A_ij + (1-a) * B_ij``.

dtype support::

    * ``uint8``: yes; fully tested
    * ``uint16``: yes; fully tested
    * ``uint32``: yes; fully tested
    * ``uint64``: yes; fully tested (1)
    * ``int8``: yes; fully tested
    * ``int16``: yes; fully tested
    * ``int32``: yes; fully tested
    * ``int64``: yes; fully tested (1)
    * ``float16``: yes; fully tested
    * ``float32``: yes; fully tested
    * ``float64``: yes; fully tested (1)
    * ``float128``: no (2)
    * ``bool``: yes; fully tested (2)

    - (1) Tests show that these dtypes work, but a conversion to float128 happens, which only
          has 96 bits of size instead of true 128 bits and hence not twice as much resolution.
          It is possible that these dtypes result in inaccuracies, though the tests did not
          indicate that.
    - (2) Not available due to the input dtype having to be increased to an equivalent float
          dtype with two times the input resolution.
    - (3) Mapped internally to ``float16``.

Parameters
----------
image_fg : (H,W,[C]) ndarray
    Foreground image. Shape and dtype kind must match the one of the
    background image.

image_bg : (H,W,[C]) ndarray
    Background image. Shape and dtype kind must match the one of the
    foreground image.

alpha : number or iterable of number or ndarray
    The blending factor, between 0.0 and 1.0. Can be interpreted as the opacity of the
    foreground image. Values around 1.0 result in only the foreground image being visible.
    Values around 0.0 result in only the background image being visible.
    Multiple alphas may be provided. In these cases, there must be exactly one alpha per
    channel in the foreground/background image. Alternatively, for ``(H,W,C)`` images,
    either one ``(H,W)`` array or an ``(H,W,C)`` array of alphas may be provided,
    denoting the elementwise alpha value.

eps : number, optional
    Controls when an alpha is to be interpreted as exactly 1.0 or exactly 0.0, resulting
    in only the foreground/background being visible and skipping the actual computation.

Returns
-------
image_blend : (H,W,C) ndarray
    Blend of foreground and background image.


def FrequencyNoiseAlpha(exponent=(-<NUM_LIT:4>, <NUM_LIT:4>), first=None, second=None, per_channel=False,<EOL>size_px_max=(<NUM_LIT:4>, <NUM_LIT:16>), upscale_method=None,<EOL>iterations=(<NUM_LIT:1>, <NUM_LIT:3>), aggregation_method=["<STR_LIT>", "<STR_LIT>"],<EOL>sigmoid=<NUM_LIT:0.5>, sigmoid_thresh=None,<EOL>name=None, deterministic=False, random_state=None):

<EOL>upscale_method_default = iap.Choice(["<STR_LIT>", "<STR_LIT>", "<STR_LIT>"], p=[<NUM_LIT>, <NUM_LIT>, <NUM_LIT>])<EOL>sigmoid_thresh_default = iap.Normal(<NUM_LIT:0.0>, <NUM_LIT>)<EOL>noise = iap.FrequencyNoise(<EOL>exponent=exponent,<EOL>size_px_max=size_px_max,<EOL>upscale_method=upscale_method if upscale_method is not None else upscale_method_default<EOL>)<EOL>if iterations != <NUM_LIT:1>:<EOL><INDENT>noise = iap.IterativeNoiseAggregator(<EOL>noise,<EOL>iterations=iterations,<EOL>aggregation_method=aggregation_method<EOL>)<EOL><DEDENT>if sigmoid is False or (ia.is_single_number(sigmoid) and sigmoid <= <NUM_LIT>):<EOL><INDENT>noise = iap.Sigmoid.create_for_noise(<EOL>noise,<EOL>threshold=sigmoid_thresh if sigmoid_thresh is not None else sigmoid_thresh_default,<EOL>activated=sigmoid<EOL>)<EOL><DEDENT>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return AlphaElementwise(<EOL>factor=noise, first=first, second=second, per_channel=per_channel,<EOL>name=name, deterministic=deterministic, random_state=random_state<EOL>)<EOL>

Augmenter to alpha-blend two image sources using frequency noise masks.

The alpha masks are sampled using frequency noise of varying scales,
which can sometimes create large connected blobs of 1s surrounded by 0s
and other times results in smaller patterns. If nearest neighbour
upsampling is used, these blobs can be rectangular with sharp edges.

dtype support::

    See ``imgaug.augmenters.blend.AlphaElementwise``.

Parameters
----------
exponent : number or tuple of number of list of number or imgaug.parameters.StochasticParameter, optional
    Exponent to use when scaling in the frequency domain.
    Sane values are in the range -4 (large blobs) to 4 (small patterns).
    To generate cloud-like structures, use roughly -2.

        * If number, then that number will be used as the exponent for all
          iterations.
        * If tuple of two numbers ``(a, b)``, then a value will be sampled
          per iteration from the range ``[a, b]``.
        * If a list of numbers, then a value will be picked per iteration
          at random from that list.
        * If a StochasticParameter, then a value will be sampled from
          that parameter per iteration.

first : None or imgaug.augmenters.meta.Augmenter or iterable of imgaug.augmenters.meta.Augmenter, optional
    Augmenter(s) that make up the first of the two branches.

        * If None, then the input images will be reused as the output
          of the first branch.
        * If Augmenter, then that augmenter will be used as the branch.
        * If iterable of Augmenter, then that iterable will be converted
          into a Sequential and used as the augmenter.

second : None or imgaug.augmenters.meta.Augmenter or iterable of imgaug.augmenters.meta.Augmenter, optional
    Augmenter(s) that make up the second of the two branches.

        * If None, then the input images will be reused as the output
          of the second branch.
        * If Augmenter, then that augmenter will be used as the branch.
        * If iterable of Augmenter, then that iterable will be converted
          into a Sequential and used as the augmenter.

per_channel : bool or float, optional
    Whether to use the same factor 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.

size_px_max : int or tuple of int or list of int or imgaug.parameters.StochasticParameter, optional
    The noise is generated in a low resolution environment.
    This parameter defines the maximum size of that environment (in
    pixels). The environment is initialized at the same size as the input
    image and then downscaled, so that no side exceeds `size_px_max`
    (aspect ratio is kept).

        * If int, then that number will be used as the size for all
          iterations.
        * If tuple of two ints ``(a, b)``, then a value will be sampled
          per iteration from the discrete range ``[a..b]``.
        * If a list of ints, then a value will be picked per iteration at
          random from that list.
        * If a StochasticParameter, then a value will be sampled from
          that parameter per iteration.

upscale_method : None or imgaug.ALL or str or list of str or imgaug.parameters.StochasticParameter, optional
    After generating the noise maps in low resolution environments, they
    have to be upscaled to the input image size. This parameter controls
    the upscaling method.

        * If None, then either ``nearest`` or ``linear`` or ``cubic`` is picked.
          Most weight is put on linear, followed by cubic.
        * If imgaug.ALL, then either ``nearest`` or ``linear`` or ``area`` or ``cubic``
          is picked per iteration (all same probability).
        * If string, then that value will be used as the method (must be
          ``nearest`` or ``linear`` or ``area`` or ``cubic``).
        * If list of string, then a random value will be picked from that
          list per iteration.
        * If StochasticParameter, then a random value will be sampled
          from that parameter per iteration.

iterations : int or tuple of int or list of int or imgaug.parameters.StochasticParameter, optional
    How often to repeat the simplex noise generation process per
    image.

        * If int, then that number will be used as the iterations for all
          images.
        * If tuple of two ints ``(a, b)``, then a value will be sampled
          per image from the discrete range ``[a..b]``.
        * If a list of ints, then a value will be picked per image at
          random from that list.
        * If a StochasticParameter, then a value will be sampled from
          that parameter per image.

aggregation_method : imgaug.ALL or str or list of str or imgaug.parameters.StochasticParameter, optional
    The noise maps (from each iteration) are combined to one noise map
    using an aggregation process. This parameter defines the method used
    for that process. Valid methods are ``min``, ``max`` or ``avg``,
    where 'min' combines the noise maps by taking the (elementwise) minimum
    over all iteration's results, ``max`` the (elementwise) maximum and
    ``avg`` the (elementwise) average.

        * If imgaug.ALL, then a random value will be picked per image from the
          valid ones.
        * If a string, then that value will always be used as the method.
        * If a list of string, then a random value will be picked from
          that list per image.
        * If a StochasticParameter, then a random value will be sampled
          from that parameter per image.

sigmoid : bool or number, optional
    Whether to apply a sigmoid function to the final noise maps, resulting
    in maps that have more extreme values (close to 0.0 or 1.0).

        * If bool, then a sigmoid will always (True) or never (False) be
          applied.
        * If a number ``p`` with ``0<=p<=1``, then a sigmoid will be applied to
          ``p`` percent of all final noise maps.

sigmoid_thresh : None or number or tuple of number or imgaug.parameters.StochasticParameter, optional
    Threshold of the sigmoid, when applied. Thresholds above zero
    (e.g. 5.0) will move the saddle point towards the right, leading to
    more values close to 0.0.

        * If None, then ``Normal(0, 5.0)`` will be used.
        * If number, then that threshold will be used for all images.
        * If tuple of two numbers ``(a, b)``, then a random value will
          be sampled per image from the range ``[a, b]``.
        * If StochasticParameter, then a random value will be sampled from
          that parameter per image.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.FrequencyNoiseAlpha(first=iaa.EdgeDetect(1.0))

Detects per image all edges, marks them in a black and white image and
then alpha-blends the result with the original image using frequency noise
masks.

>>> aug = iaa.FrequencyNoiseAlpha(first=iaa.EdgeDetect(1.0), upscale_method="linear")

Same as the first example, but uses only (smooth) linear upscaling to
scale the frequency noise masks to the final image sizes, i.e. no nearest
neighbour upsampling is used, which would result in rectangles with hard
edges.

>>> aug = iaa.FrequencyNoiseAlpha(first=iaa.EdgeDetect(1.0), upscale_method="linear", exponent=-2, sigmoid=False)

Same as the previous example, but also limits the exponent to -2 and
deactivates the sigmoid, resulting in cloud-like patterns without sharp
edges.

>>> aug = iaa.FrequencyNoiseAlpha(first=iaa.EdgeDetect(1.0), sigmoid_thresh=iap.Normal(10.0, 5.0))

Same as the first example, but uses a threshold for the sigmoid function
that is further to the right. This is more conservative, i.e. the generated
noise masks will be mostly black (values around 0.0), which means that
most of the original images (parameter/branch `second`) will be kept,
rather than using the results of the augmentation (parameter/branch
`first`).


def SimplexNoiseAlpha(first=None, second=None, per_channel=False, size_px_max=(<NUM_LIT:2>, <NUM_LIT:16>), upscale_method=None,<EOL>iterations=(<NUM_LIT:1>, <NUM_LIT:3>), aggregation_method="<STR_LIT>", sigmoid=True, sigmoid_thresh=None,<EOL>name=None, deterministic=False, random_state=None):

upscale_method_default = iap.Choice(["<STR_LIT>", "<STR_LIT>", "<STR_LIT>"], p=[<NUM_LIT>, <NUM_LIT>, <NUM_LIT>])<EOL>sigmoid_thresh_default = iap.Normal(<NUM_LIT:0.0>, <NUM_LIT>)<EOL>noise = iap.SimplexNoise(<EOL>size_px_max=size_px_max,<EOL>upscale_method=upscale_method if upscale_method is not None else upscale_method_default<EOL>)<EOL>if iterations != <NUM_LIT:1>:<EOL><INDENT>noise = iap.IterativeNoiseAggregator(<EOL>noise,<EOL>iterations=iterations,<EOL>aggregation_method=aggregation_method<EOL>)<EOL><DEDENT>if sigmoid is False or (ia.is_single_number(sigmoid) and sigmoid <= <NUM_LIT>):<EOL><INDENT>noise = iap.Sigmoid.create_for_noise(<EOL>noise,<EOL>threshold=sigmoid_thresh if sigmoid_thresh is not None else sigmoid_thresh_default,<EOL>activated=sigmoid<EOL>)<EOL><DEDENT>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return AlphaElementwise(<EOL>factor=noise, first=first, second=second, per_channel=per_channel,<EOL>name=name, deterministic=deterministic, random_state=random_state<EOL>)<EOL>

Augmenter to alpha-blend two image sources using simplex noise alpha masks.

The alpha masks are sampled using a simplex noise method, roughly creating
connected blobs of 1s surrounded by 0s. If nearest neighbour upsampling
is used, these blobs can be rectangular with sharp edges.

dtype support::

    See ``imgaug.augmenters.blend.AlphaElementwise``.

Parameters
----------
first : None or imgaug.augmenters.meta.Augmenter or iterable of imgaug.augmenters.meta.Augmenter, optional
    Augmenter(s) that make up the first of the two branches.

        * If None, then the input images will be reused as the output
          of the first branch.
        * If Augmenter, then that augmenter will be used as the branch.
        * If iterable of Augmenter, then that iterable will be converted
          into a Sequential and used as the augmenter.

second : None or imgaug.augmenters.meta.Augmenter or iterable of imgaug.augmenters.meta.Augmenter, optional
    Augmenter(s) that make up the second of the two branches.

        * If None, then the input images will be reused as the output
          of the second branch.
        * If Augmenter, then that augmenter will be used as the branch.
        * If iterable of Augmenter, then that iterable will be converted
          into a Sequential and used as the augmenter.

per_channel : bool or float, optional
    Whether to use the same factor 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.

size_px_max : int or tuple of int or list of int or imgaug.parameters.StochasticParameter, optional
    The simplex noise is always generated in a low resolution environment.
    This parameter defines the maximum size of that environment (in
    pixels). The environment is initialized at the same size as the input
    image and then downscaled, so that no side exceeds `size_px_max`
    (aspect ratio is kept).

        * If int, then that number will be used as the size for all
          iterations.
        * If tuple of two ints ``(a, b)``, then a value will be sampled
          per iteration from the discrete range ``[a..b]``.
        * If a list of ints, then a value will be picked per iteration at
          random from that list.
        * If a StochasticParameter, then a value will be sampled from
          that parameter per iteration.

upscale_method : None or imgaug.ALL or str or list of str or imgaug.parameters.StochasticParameter, optional
    After generating the noise maps in low resolution environments, they
    have to be upscaled to the input image size. This parameter controls
    the upscaling method.

        * If None, then either ``nearest`` or ``linear`` or ``cubic`` is picked.
          Most weight is put on linear, followed by cubic.
        * If ia.ALL, then either ``nearest`` or ``linear`` or ``area`` or ``cubic``
          is picked per iteration (all same probability).
        * If string, then that value will be used as the method (must be
          'nearest' or ``linear`` or ``area`` or ``cubic``).
        * If list of string, then a random value will be picked from that
          list per iteration.
        * If StochasticParameter, then a random value will be sampled
          from that parameter per iteration.

iterations : int or tuple of int or list of int or imgaug.parameters.StochasticParameter, optional
    How often to repeat the simplex noise generation process per image.

        * If int, then that number will be used as the iterations for all
          images.
        * If tuple of two ints ``(a, b)``, then a value will be sampled
          per image from the discrete range ``[a..b]``.
        * If a list of ints, then a value will be picked per image at
          random from that list.
        * If a StochasticParameter, then a value will be sampled from
          that parameter per image.

aggregation_method : imgaug.ALL or str or list of str or imgaug.parameters.StochasticParameter, optional
    The noise maps (from each iteration) are combined to one noise map
    using an aggregation process. This parameter defines the method used
    for that process. Valid methods are ``min``, ``max`` or ``avg``,
    where ``min`` combines the noise maps by taking the (elementwise) minimum
    over all iteration's results, ``max`` the (elementwise) maximum and
    ``avg`` the (elementwise) average.

        * If imgaug.ALL, then a random value will be picked per image from the
          valid ones.
        * If a string, then that value will always be used as the method.
        * If a list of string, then a random value will be picked from
          that list per image.
        * If a StochasticParameter, then a random value will be sampled
          from that paramter per image.

sigmoid : bool or number, optional
    Whether to apply a sigmoid function to the final noise maps, resulting
    in maps that have more extreme values (close to 0.0 or 1.0).

        * If bool, then a sigmoid will always (True) or never (False) be
          applied.
        * If a number ``p`` with ``0<=p<=1``, then a sigmoid will be applied to
          ``p`` percent of all final noise maps.

sigmoid_thresh : None or number or tuple of number or imgaug.parameters.StochasticParameter, optional
    Threshold of the sigmoid, when applied. Thresholds above zero
    (e.g. 5.0) will move the saddle point towards the right, leading to
    more values close to 0.0.

        * If None, then ``Normal(0, 5.0)`` will be used.
        * If number, then that threshold will be used for all images.
        * If tuple of two numbers ``(a, b)``, then a random value will
          be sampled per image from the range ``[a, b]``.
        * If StochasticParameter, then a random value will be sampled from
          that parameter per image.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.SimplexNoiseAlpha(iaa.EdgeDetect(1.0))

Detects per image all edges, marks them in a black and white image and
then alpha-blends the result with the original image using simplex noise
masks.

>>> aug = iaa.SimplexNoiseAlpha(iaa.EdgeDetect(1.0), upscale_method="linear")

Same as the first example, but uses only (smooth) linear upscaling to
scale the simplex noise masks to the final image sizes, i.e. no nearest
neighbour upsampling is used, which would result in rectangles with hard
edges.

>>> aug = iaa.SimplexNoiseAlpha(iaa.EdgeDetect(1.0), sigmoid_thresh=iap.Normal(10.0, 5.0))

Same as the first example, but uses a threshold for the sigmoid function
that is further to the right. This is more conservative, i.e. the generated
noise masks will be mostly black (values around 0.0), which means that
most of the original images (parameter/branch `second`) will be kept,
rather than using the results of the augmentation (parameter/branch
`first`).


@ia.deprecated(alt_func="<STR_LIT>")<EOL>def InColorspace(to_colorspace, from_colorspace="<STR_LIT>", children=None, name=None, deterministic=False,<EOL>random_state=None):

return WithColorspace(to_colorspace, from_colorspace, children, name, deterministic, random_state)<EOL>