_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q251900 | CoarseDropout | validation | def CoarseDropout(p=0, size_px=None, size_percent=None, per_channel=False, min_size=4, name=None, deterministic=False,
random_state=None):
"""
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... | python | {
"resource": ""
} |
q251901 | ImpulseNoise | validation | def ImpulseNoise(p=0, name=None, deterministic=False, random_state=None):
"""
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::
| python | {
"resource": ""
} |
q251902 | SaltAndPepper | validation | def SaltAndPepper(p=0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Adds salt and pepper noise to an image, i.e. some white-ish and black-ish pixels.
dtype support::
See ``imgaug.augmenters.arithmetic.ReplaceElementwise``.
Parameters
----------
p : float ... | python | {
"resource": ""
} |
q251903 | Pepper | validation | def Pepper(p=0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
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.ReplaceEleme... | python | {
"resource": ""
} |
q251904 | CoarsePepper | validation | def CoarsePepper(p=0, size_px=None, size_percent=None, per_channel=False, min_size=4, name=None, deterministic=False,
random_state=None):
"""
Adds coarse pepper noise to an image, i.e. rectangles that contain noisy black-ish pixels.
dtype support::
See ``imgaug.augmenters.arithmet... | python | {
"resource": ""
} |
q251905 | ContrastNormalization | validation | def ContrastNormalization(alpha=1.0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Augmenter that changes the contrast of images.
dtype support:
See ``imgaug.augmenters.contrast.LinearContrast``.
Parameters
----------
alpha : number or tuple of number or l... | python | {
"resource": ""
} |
q251906 | is_single_float | validation | def is_single_float(val):
"""
Checks whether a variable is a float.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a float. Otherwise False.
| python | {
"resource": ""
} |
q251907 | is_integer_array | validation | def is_integer_array(val):
"""
Checks whether a variable is a numpy integer array.
Parameters
----------
val
The variable to | python | {
"resource": ""
} |
q251908 | is_float_array | validation | def is_float_array(val):
"""
Checks whether a variable is a numpy float array.
Parameters
----------
val
The variable to | python | {
"resource": ""
} |
q251909 | new_random_state | validation | def new_random_state(seed=None, fully_random=False):
"""
Returns a new random state.
Parameters
----------
seed : None or int, optional
Optional seed value to use.
The same datatypes are allowed as for ``numpy.random.RandomState(seed)``.
fully_random : bool, optional
Wh... | python | {
"resource": ""
} |
q251910 | copy_random_state | validation | def copy_random_state(random_state, force_copy=False):
"""
Creates a copy of a random state.
Parameters
----------
random_state : numpy.random.RandomState
The random state to copy.
force_copy : bool, optional
If True, this function will always create a copy of every random
... | python | {
"resource": ""
} |
q251911 | derive_random_states | validation | def derive_random_states(random_state, n=1):
"""
Create N new random states based on an existing random state or seed.
Parameters
----------
random_state : numpy.random.RandomState
Random state or seed from which to derive new random states.
n : int, optional
Number of random s... | python | {
"resource": ""
} |
q251912 | _quokka_normalize_extract | validation | def _quokka_normalize_extract(extract):
"""
Generate a normalized rectangle to be extract from the standard quokka image.
Parameters
----------
extract : 'square' or tuple of number or imgaug.BoundingBox or imgaug.BoundingBoxesOnImage
Unnormalized representation of the image subarea to be e... | python | {
"resource": ""
} |
q251913 | _compute_resized_shape | validation | def _compute_resized_shape(from_shape, to_shape):
"""
Computes the intended new shape of an image-like array after resizing.
Parameters
----------
from_shape : tuple or ndarray
Old shape of the array. Usually expected to be a tuple of form ``(H, W)`` or ``(H, W, C)`` or
alternativel... | python | {
"resource": ""
} |
q251914 | quokka | validation | def quokka(size=None, extract=None):
"""
Returns an image of a quokka as a numpy array.
Parameters
----------
size : None or float or tuple of int, optional
Size of the output image. Input into :func:`imgaug.imgaug.imresize_single_image`.
Usually expected to be a tuple ``(H, W)``, w... | python | {
"resource": ""
} |
q251915 | quokka_segmentation_map | validation | def quokka_segmentation_map(size=None, extract=None):
"""
Returns a segmentation map for the standard example quokka image.
Parameters
----------
size : None or float or tuple of int, optional
See :func:`imgaug.quokka`.
extract : None or 'square' or tuple of number or imgaug.BoundingBo... | python | {
"resource": ""
} |
q251916 | quokka_keypoints | validation | def quokka_keypoints(size=None, extract=None):
"""
Returns example keypoints on the standard example quokke image.
The keypoints cover the eyes, ears, nose and paws.
Parameters
----------
size : None or float or tuple of int or tuple of float, optional
Size of the output image on which... | python | {
"resource": ""
} |
q251917 | quokka_bounding_boxes | validation | def quokka_bounding_boxes(size=None, extract=None):
"""
Returns example bounding boxes on the standard example quokke image.
Currently only a single bounding box is returned that covers the quokka.
Parameters
----------
size : None or float or tuple of int or tuple of float, optional
S... | python | {
"resource": ""
} |
q251918 | quokka_polygons | validation | def quokka_polygons(size=None, extract=None):
"""
Returns example polygons on the standard example quokke image.
The result contains one polygon, covering the quokka's outline.
Parameters
----------
size : None or float or tuple of int or tuple of float, optional
Size of the output ima... | python | {
"resource": ""
} |
q251919 | angle_between_vectors | validation | def angle_between_vectors(v1, v2):
"""
Returns the angle in radians between vectors `v1` and `v2`.
From http://stackoverflow.com/questions/2827393/angles-between-two-n-dimensional-vectors-in-python
Parameters
----------
v1 : (N,) ndarray
First vector.
v2 : (N,) ndarray
Sec... | python | {
"resource": ""
} |
q251920 | compute_line_intersection_point | validation | def compute_line_intersection_point(x1, y1, x2, y2, x3, y3, x4, y4):
"""
Compute the intersection point of two lines.
Taken from https://stackoverflow.com/a/20679579 .
Parameters
----------
x1 : number
x coordinate of the first point on line 1. (The lines extends beyond this point.)
... | python | {
"resource": ""
} |
q251921 | draw_text | validation | def draw_text(img, y, x, text, color=(0, 255, 0), size=25):
"""
Draw text on an image.
This uses by default DejaVuSans as its font, which is included in this library.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: no
* ``uint32``: no
* ``uint64``: no
... | python | {
"resource": ""
} |
q251922 | imresize_single_image | validation | def imresize_single_image(image, sizes, interpolation=None):
"""
Resizes a single image.
dtype support::
See :func:`imgaug.imgaug.imresize_many_images`.
Parameters
----------
image : (H,W,C) ndarray or (H,W) ndarray
Array of the image to resize.
Usually recommended to... | python | {
"resource": ""
} |
q251923 | compute_paddings_for_aspect_ratio | validation | def compute_paddings_for_aspect_ratio(arr, aspect_ratio):
"""
Compute the amount of pixels by which an array has to be padded to fulfill an aspect ratio.
The aspect ratio is given as width/height.
Depending on which dimension is smaller (height or width), only the corresponding
sides (left/right or... | python | {
"resource": ""
} |
q251924 | pad_to_aspect_ratio | validation | def pad_to_aspect_ratio(arr, aspect_ratio, mode="constant", cval=0, return_pad_amounts=False):
"""
Pad an image-like array on its sides so that it matches a target aspect ratio.
Depending on which dimension is smaller (height or width), only the corresponding
sides (left/right or top/bottom) will be pa... | python | {
"resource": ""
} |
q251925 | pool | validation | def pool(arr, block_size, func, cval=0, preserve_dtype=True):
"""
Resize an array by pooling values within blocks.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: yes; tested
* ``uint32``: yes; tested (2)
* ``uint64``: no (1)
* ``int8``: yes; tested
... | python | {
"resource": ""
} |
q251926 | avg_pool | validation | def avg_pool(arr, block_size, cval=0, preserve_dtype=True):
"""
Resize an array using average pooling.
dtype support::
See :func:`imgaug.imgaug.pool`.
Parameters
----------
arr : (H,W) ndarray or (H,W,C) ndarray
Image-like array to pool. See :func:`imgaug.pool` for details.
... | python | {
"resource": ""
} |
q251927 | max_pool | validation | def max_pool(arr, block_size, cval=0, preserve_dtype=True):
"""
Resize an array using max-pooling.
dtype support::
See :func:`imgaug.imgaug.pool`.
Parameters
----------
arr : (H,W) ndarray or (H,W,C) ndarray
Image-like array to pool. See :func:`imgaug.pool` for details.
b... | python | {
"resource": ""
} |
q251928 | draw_grid | validation | def draw_grid(images, rows=None, cols=None):
"""
Converts multiple input images into a single image showing them in a grid.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: yes; fully tested
* ``uint32``: yes; fully tested
* ``uint64``: yes; fully tested
... | python | {
"resource": ""
} |
q251929 | show_grid | validation | def show_grid(images, rows=None, cols=None):
"""
Converts the input images to a grid image and shows it in a new window.
dtype support::
minimum of (
:func:`imgaug.imgaug.draw_grid`,
:func:`imgaug.imgaug.imshow`
)
Parameters
----------
images : (N,H,W,3... | python | {
"resource": ""
} |
q251930 | imshow | validation | def imshow(image, backend=IMSHOW_BACKEND_DEFAULT):
"""
Shows an image in a window.
dtype support::
* ``uint8``: yes; not tested
* ``uint16``: ?
* ``uint32``: ?
* ``uint64``: ?
* ``int8``: ?
* ``int16``: ?
* ``int32``: ?
* ``int64``: ?
... | python | {
"resource": ""
} |
q251931 | warn_deprecated | validation | def warn_deprecated(msg, stacklevel=2):
"""Generate a non-silent deprecation warning with stacktrace.
The used warning is ``imgaug.imgaug.DeprecationWarning``.
Parameters
----------
msg : str
The message of the warning.
stacklevel : int, optional
How many steps above this func... | python | {
"resource": ""
} |
q251932 | HooksImages.is_activated | validation | def is_activated(self, images, augmenter, parents, default):
"""
Returns whether an augmenter may be executed.
Returns
-------
bool
If True, the augmenter may be executed. If False, it may not be executed.
| python | {
"resource": ""
} |
q251933 | HooksImages.postprocess | validation | def postprocess(self, images, augmenter, parents):
"""
A function to be called after the augmentation of images was
performed.
Returns
-------
(N,H,W,C) ndarray or (N,H,W) ndarray or list of (H,W,C) ndarray or list of (H,W) ndarray
The input images, optionall... | python | {
"resource": ""
} |
q251934 | Pool.pool | validation | def pool(self):
"""Return the multiprocessing.Pool instance or create it if not done yet.
Returns
-------
multiprocessing.Pool
The multiprocessing.Pool used internally by this imgaug.multicore.Pool.
"""
if self._pool is None:
processes = self.pro... | python | {
"resource": ""
} |
q251935 | Pool.map_batches | validation | def map_batches(self, batches, chunksize=None):
"""
Augment batches.
Parameters
----------
batches : list of imgaug.augmentables.batches.Batch
The batches to augment.
chunksize : None or int, optional
Rough indicator of how many tasks should be s... | python | {
"resource": ""
} |
q251936 | Pool.map_batches_async | validation | def map_batches_async(self, batches, chunksize=None, callback=None, error_callback=None):
"""
Augment batches asynchonously.
Parameters
----------
batches : list of imgaug.augmentables.batches.Batch
The batches to augment.
chunksize : None or int, optional
... | python | {
"resource": ""
} |
q251937 | Pool.imap_batches | validation | def imap_batches(self, batches, chunksize=1):
"""
Augment batches from a generator.
Parameters
----------
batches : generator of imgaug.augmentables.batches.Batch
The batches to augment, provided as a generator. Each call to the generator should yield exactly one
... | python | {
"resource": ""
} |
q251938 | Pool.imap_batches_unordered | validation | def imap_batches_unordered(self, batches, chunksize=1):
"""
Augment batches from a generator in a way that does not guarantee to preserve order.
Parameters
----------
batches : generator of imgaug.augmentables.batches.Batch
The batches to augment, provided as a gener... | python | {
"resource": ""
} |
q251939 | Pool.terminate | validation | def terminate(self):
"""Terminate the pool immediately."""
if self._pool is | python | {
"resource": ""
} |
q251940 | BatchLoader.terminate | validation | def terminate(self):
"""Stop all workers."""
if not self.join_signal.is_set():
self.join_signal.set()
# give minimal time to put generated batches in queue and gracefully shut down
time.sleep(0.01)
if self.main_worker_thread.is_alive():
self.main_worker_t... | python | {
"resource": ""
} |
q251941 | BackgroundAugmenter.get_batch | validation | def get_batch(self):
"""
Returns a batch from the queue of augmented batches.
If workers are still running and there are no batches in the queue,
it will automatically wait for the next batch.
Returns
-------
out : None or imgaug.Batch
One batch or N... | python | {
"resource": ""
} |
q251942 | BackgroundAugmenter._augment_images_worker | validation | def _augment_images_worker(self, augseq, queue_source, queue_result, seedval):
"""
Augment endlessly images in the source queue.
This is a worker function for that endlessly queries the source queue (input batches),
augments batches in it and sends the result to the output queue.
... | python | {
"resource": ""
} |
q251943 | BackgroundAugmenter.terminate | validation | def terminate(self):
"""
Terminates all background processes immediately.
This will also free their RAM.
"""
for worker in self.workers:
if worker.is_alive():
worker.terminate()
| python | {
"resource": ""
} |
q251944 | UnnormalizedBatch.to_normalized_batch | validation | def to_normalized_batch(self):
"""Convert this unnormalized batch to an instance of Batch.
As this method is intended to be called before augmentation, it
assumes that none of the ``*_aug`` attributes is yet set.
It will produce an AssertionError otherwise.
The newly created Ba... | python | {
"resource": ""
} |
q251945 | Positive | validation | def Positive(other_param, mode="invert", reroll_count_max=2):
"""
Converts another parameter's results to positive values.
Parameters
----------
other_param : imgaug.parameters.StochasticParameter
Other parameter which's sampled values are to be
modified.
mode : {'invert', 'rer... | python | {
"resource": ""
} |
q251946 | Negative | validation | def Negative(other_param, mode="invert", reroll_count_max=2):
"""
Converts another parameter's results to negative values.
Parameters
----------
other_param : imgaug.parameters.StochasticParameter
Other parameter which's sampled values are to be
modified.
mode : {'invert', 'rer... | python | {
"resource": ""
} |
q251947 | Polygon.area | validation | def area(self):
"""
Estimate the area of the polygon.
Returns
-------
number
Area of the polygon.
"""
if len(self.exterior) < 3:
raise Exception("Cannot | python | {
"resource": ""
} |
q251948 | Polygon.project | validation | def project(self, from_shape, to_shape):
"""
Project the polygon onto an image with different shape.
The relative coordinates of all points remain the same.
E.g. a point at (x=20, y=20) on an image (width=100, height=200) will be
projected on a new image (width=200, height=100) ... | python | {
"resource": ""
} |
q251949 | Polygon.find_closest_point_index | validation | def find_closest_point_index(self, x, y, return_distance=False):
"""
Find the index of the point within the exterior that is closest to the given coordinates.
"Closeness" is here defined based on euclidean distance.
This method will raise an AssertionError if the exterior contains no po... | python | {
"resource": ""
} |
q251950 | Polygon.is_fully_within_image | validation | def is_fully_within_image(self, image):
"""
Estimate whether the polygon is fully inside the image area.
Parameters
----------
image : (H,W,...) ndarray or tuple of int
Image dimensions to use.
| python | {
"resource": ""
} |
q251951 | Polygon.is_partly_within_image | validation | def is_partly_within_image(self, image):
"""
Estimate whether the polygon is at least partially inside the image area.
Parameters
----------
image : (H,W,...) ndarray or tuple of int
Image dimensions to use.
If an ndarray, its shape will be used.
... | python | {
"resource": ""
} |
q251952 | Polygon.is_out_of_image | validation | def is_out_of_image(self, image, fully=True, partly=False):
"""
Estimate whether the polygon is partially or fully outside of the image area.
Parameters
----------
image : (H,W,...) ndarray or tuple of int
Image dimensions to use.
If an ndarray, its shape... | python | {
"resource": ""
} |
q251953 | Polygon.clip_out_of_image | validation | def clip_out_of_image(self, image):
"""
Cut off all parts of the polygon that are outside of the image.
This operation may lead to new points being created.
As a single polygon may be split into multiple new polygons, the result
is always a list, which may contain more than one ... | python | {
"resource": ""
} |
q251954 | Polygon.extract_from_image | validation | def extract_from_image(self, image):
"""
Extract the image pixels within the polygon.
This function will zero-pad the image if the polygon is partially/fully outside of
the image.
Parameters
----------
image : (H,W) ndarray or (H,W,C) ndarray
The ima... | python | {
"resource": ""
} |
q251955 | Polygon.change_first_point_by_coords | validation | def change_first_point_by_coords(self, x, y, max_distance=1e-4,
raise_if_too_far_away=True):
"""
Set the first point of the exterior to the given point based on its coordinates.
If multiple points are found, the closest one will be picked.
If no matc... | python | {
"resource": ""
} |
q251956 | Polygon.change_first_point_by_index | validation | def change_first_point_by_index(self, point_idx):
"""
Set the first point of the exterior to the given point based on its index.
Note: This method does *not* work in-place.
Parameters
----------
point_idx : int
Index of the desired starting point.
R... | python | {
"resource": ""
} |
q251957 | Polygon.to_shapely_polygon | validation | def to_shapely_polygon(self):
"""
Convert this polygon to a Shapely polygon.
Returns
-------
shapely.geometry.Polygon
The Shapely polygon | python | {
"resource": ""
} |
q251958 | Polygon.to_shapely_line_string | validation | def to_shapely_line_string(self, closed=False, interpolate=0):
"""
Convert this polygon to a Shapely LineString object.
Parameters
----------
closed : bool, optional
Whether to return the line string with the last point being identical to the first point.
in... | python | {
"resource": ""
} |
q251959 | Polygon.to_bounding_box | validation | def to_bounding_box(self):
"""
Convert this polygon to a bounding box tightly containing the whole polygon.
Returns
-------
imgaug.BoundingBox
Tight bounding box around the polygon.
"""
# TODO get rid of this deferred import
| python | {
"resource": ""
} |
q251960 | Polygon.to_keypoints | validation | def to_keypoints(self):
"""
Convert this polygon's `exterior` to ``Keypoint`` instances.
Returns
-------
list of imgaug.Keypoint
Exterior vertices as ``Keypoint`` instances.
"""
# | python | {
"resource": ""
} |
q251961 | Polygon.to_line_string | validation | def to_line_string(self, closed=True):
"""
Convert this polygon's `exterior` to a ``LineString`` instance.
Parameters
----------
closed : bool, optional
Whether to close the line string, i.e. to add the first point of
the `exterior` also as the last point... | python | {
"resource": ""
} |
q251962 | Polygon.from_shapely | validation | def from_shapely(polygon_shapely, label=None):
"""
Create a polygon from a Shapely polygon.
Note: This will remove any holes in the Shapely polygon.
Parameters
----------
polygon_shapely : shapely.geometry.Polygon
The shapely polygon.
label : None ... | python | {
"resource": ""
} |
q251963 | Polygon.exterior_almost_equals | validation | def exterior_almost_equals(self, other, max_distance=1e-6, points_per_edge=8):
"""
Estimate if this and other polygon's exterior are almost identical.
The two exteriors can have different numbers of points, but any point
randomly sampled on the exterior of one polygon should be close to... | python | {
"resource": ""
} |
q251964 | Polygon.copy | validation | def copy(self, exterior=None, label=None):
"""
Create a shallow copy of the Polygon object.
Parameters
----------
exterior : list of imgaug.Keypoint or list of tuple or (N,2) ndarray, optional
List of points defining the polygon. See :func:`imgaug.Polygon.__init__` f... | python | {
"resource": ""
} |
q251965 | Polygon.deepcopy | validation | def deepcopy(self, exterior=None, label=None):
"""
Create a deep copy of the Polygon object.
Parameters
----------
exterior : list of Keypoint or list of tuple or (N,2) ndarray, optional
List of points defining the polygon. See `imgaug.Polygon.__init__` for details.
| python | {
"resource": ""
} |
q251966 | PolygonsOnImage.on | validation | def on(self, image):
"""
Project polygons from one image to a new one.
Parameters
----------
image : ndarray or tuple of int
New image onto which the polygons are to be projected.
May also simply be that new image's shape tuple.
Returns
-... | python | {
"resource": ""
} |
q251967 | PolygonsOnImage.draw_on_image | validation | def draw_on_image(self,
image,
color=(0, 255, 0), color_face=None,
color_lines=None, color_points=None,
alpha=1.0, alpha_face=None,
alpha_lines=None, alpha_points=None,
size=1, size_lines=... | python | {
"resource": ""
} |
q251968 | PolygonsOnImage.remove_out_of_image | validation | def remove_out_of_image(self, fully=True, partly=False):
"""
Remove all polygons that are fully or partially outside of the image.
Parameters
----------
fully : bool, optional
Whether to remove polygons that are fully outside of the image.
partly : bool, opt... | python | {
"resource": ""
} |
q251969 | PolygonsOnImage.clip_out_of_image | validation | def clip_out_of_image(self):
"""
Clip off all parts from all polygons that are outside of the image.
NOTE: The result can contain less polygons than the input did. That
happens when a polygon is fully outside of the image plane.
NOTE: The result can also contain *more* polygons... | python | {
"resource": ""
} |
q251970 | PolygonsOnImage.deepcopy | validation | def deepcopy(self):
"""
Create a deep copy of the PolygonsOnImage object.
Returns
-------
imgaug.PolygonsOnImage
Deep copy.
"""
# Manual copy is far faster than deepcopy for PolygonsOnImage,
| python | {
"resource": ""
} |
q251971 | MultiPolygon.from_shapely | validation | def from_shapely(geometry, label=None):
"""
Create a MultiPolygon from a Shapely MultiPolygon, a Shapely Polygon or a Shapely GeometryCollection.
This also creates all necessary Polygons contained by this MultiPolygon.
Parameters
----------
geometry : shapely.geometry.M... | python | {
"resource": ""
} |
q251972 | SweepLine.get_intersections | validation | def get_intersections(self):
"""
Return a list of unordered intersection points.
"""
if Real is float:
| python | {
"resource": ""
} |
q251973 | _ABCTree.min_item | validation | def min_item(self):
"""Get item with min key of tree, raises ValueError if tree is empty."""
if self.is_empty():
| python | {
"resource": ""
} |
q251974 | _ABCTree.max_item | validation | def max_item(self):
"""Get item with max key of tree, raises ValueError if tree is empty."""
if self.is_empty():
| python | {
"resource": ""
} |
q251975 | _ABCTree.prev_key | validation | def prev_key(self, key, default=_sentinel):
"""Get predecessor to key, raises KeyError if key is min | python | {
"resource": ""
} |
q251976 | _ABCTree.succ_key | validation | def succ_key(self, key, default=_sentinel):
"""Get successor to key, raises KeyError if key is max key | python | {
"resource": ""
} |
q251977 | OpenSimplex.noise2d | validation | def noise2d(self, x, y):
"""
Generate 2D OpenSimplex noise from X,Y coordinates.
"""
# Place input coordinates onto grid.
stretch_offset = (x + y) * STRETCH_CONSTANT_2D
xs = x + stretch_offset
ys = y + stretch_offset
# Floor to get grid coordinates of rho... | python | {
"resource": ""
} |
q251978 | InColorspace | validation | def InColorspace(to_colorspace, from_colorspace="RGB", children=None, name=None, deterministic=False,
random_state=None):
"""Convert images to another colorspace."""
return | python | {
"resource": ""
} |
q251979 | Grayscale | validation | def Grayscale(alpha=0, from_colorspace="RGB", name=None, deterministic=False, random_state=None):
"""
Augmenter to convert images to their grayscale versions.
NOTE: Number of output channels is still 3, i.e. this augmenter just "removes" color.
TODO check dtype support
dtype support::
* ... | python | {
"resource": ""
} |
q251980 | LineString.height | validation | def height(self):
"""Get the height of a bounding box encapsulating the line."""
if len(self.coords) <= 1:
| python | {
"resource": ""
} |
q251981 | LineString.width | validation | def width(self):
"""Get the width of a bounding box encapsulating the line."""
if len(self.coords) <= 1:
| python | {
"resource": ""
} |
q251982 | LineString.get_pointwise_inside_image_mask | validation | def get_pointwise_inside_image_mask(self, image):
"""
Get for each point whether it is inside of the given image plane.
Parameters
----------
image : ndarray or tuple of int
Either an image with shape ``(H,W,[C])`` or a tuple denoting
such an image shape.... | python | {
"resource": ""
} |
q251983 | LineString.compute_neighbour_distances | validation | def compute_neighbour_distances(self):
"""
Get the euclidean distance between each two consecutive points.
Returns
-------
ndarray
Euclidean distances between point pairs.
| python | {
"resource": ""
} |
q251984 | LineString.compute_pointwise_distances | validation | def compute_pointwise_distances(self, other, default=None):
"""
Compute the minimal distance between each point on self and other.
Parameters
----------
other : tuple of number \
or imgaug.augmentables.kps.Keypoint \
or imgaug.augmentables.LineStr... | python | {
"resource": ""
} |
q251985 | LineString.compute_distance | validation | def compute_distance(self, other, default=None):
"""
Compute the minimal distance between the line string and `other`.
Parameters
----------
other : tuple of number \
or imgaug.augmentables.kps.Keypoint \
or imgaug.augmentables.LineString
... | python | {
"resource": ""
} |
q251986 | LineString.project | validation | def project(self, from_shape, to_shape):
"""
Project the line string onto a differently shaped image.
E.g. if a point of the line string is on its original image at
``x=(10 of 100 pixels)`` and ``y=(20 of 100 pixels)`` and is projected
onto a new image with size ``(width=200, he... | python | {
"resource": ""
} |
q251987 | LineString.is_fully_within_image | validation | def is_fully_within_image(self, image, default=False):
"""
Estimate whether the line string is fully inside the image area.
Parameters
----------
image : ndarray or tuple of int
Either an image with shape ``(H,W,[C])`` or a tuple denoting
such an image sh... | python | {
"resource": ""
} |
q251988 | LineString.is_partly_within_image | validation | def is_partly_within_image(self, image, default=False):
"""
Estimate whether the line string is at least partially inside the image.
Parameters
----------
image : ndarray or tuple of int
Either an image with shape ``(H,W,[C])`` or a tuple denoting
such an... | python | {
"resource": ""
} |
q251989 | LineString.find_intersections_with | validation | def find_intersections_with(self, other):
"""
Find all intersection points between the line string and `other`.
Parameters
----------
other : tuple of number or list of tuple of number or \
list of LineString or LineString
The other geometry to use du... | python | {
"resource": ""
} |
q251990 | LineString.draw_mask | validation | def draw_mask(self, image_shape, size_lines=1, size_points=0,
raise_if_out_of_image=False):
"""
Draw this line segment as a binary image mask.
Parameters
----------
image_shape : tuple of int
The shape of the image onto which to draw the line mask.
... | python | {
"resource": ""
} |
q251991 | LineString.draw_lines_heatmap_array | validation | def draw_lines_heatmap_array(self, image_shape, alpha=1.0,
size=1, antialiased=True,
raise_if_out_of_image=False):
"""
Draw the line segments of the line string as a heatmap array.
Parameters
----------
image_shap... | python | {
"resource": ""
} |
q251992 | LineString.draw_points_heatmap_array | validation | def draw_points_heatmap_array(self, image_shape, alpha=1.0,
size=1, raise_if_out_of_image=False):
"""
Draw the points of the line string as a heatmap array.
Parameters
----------
image_shape : tuple of int
The shape of the image onto... | python | {
"resource": ""
} |
q251993 | LineString.draw_heatmap_array | validation | def draw_heatmap_array(self, image_shape, alpha_lines=1.0, alpha_points=1.0,
size_lines=1, size_points=0, antialiased=True,
raise_if_out_of_image=False):
"""
Draw the line segments and points of the line string as a heatmap array.
Parameters... | python | {
"resource": ""
} |
q251994 | LineString.draw_points_on_image | validation | def draw_points_on_image(self, image, color=(0, 128, 0),
alpha=1.0, size=3,
copy=True, raise_if_out_of_image=False):
"""
Draw the points of the line string on a given image.
Parameters
----------
image : ndarray or tuple ... | python | {
"resource": ""
} |
q251995 | LineString.draw_on_image | validation | def draw_on_image(self, image,
color=(0, 255, 0), color_lines=None, color_points=None,
alpha=1.0, alpha_lines=None, alpha_points=None,
size=1, size_lines=None, size_points=None,
antialiased=True,
raise_if_out_o... | python | {
"resource": ""
} |
q251996 | LineString.extract_from_image | validation | def extract_from_image(self, image, size=1, pad=True, pad_max=None,
antialiased=True, prevent_zero_size=True):
"""
Extract the image pixels covered by the line string.
It will only extract pixels overlapped by the line string.
This function will by default ze... | python | {
"resource": ""
} |
q251997 | LineString.concatenate | validation | def concatenate(self, other):
"""
Concatenate this line string with another one.
This will add a line segment between the end point of this line string
and the start point of `other`.
Parameters
----------
other : imgaug.augmentables.lines.LineString or ndarray ... | python | {
"resource": ""
} |
q251998 | LineString.subdivide | validation | def subdivide(self, points_per_edge):
"""
Adds ``N`` interpolated points with uniform spacing to each edge.
For each edge between points ``A`` and ``B`` this adds points
at ``A + (i/(1+N)) * (B - A)``, where ``i`` is the index of the added
point and ``N`` is the number of points... | python | {
"resource": ""
} |
q251999 | LineString.to_keypoints | validation | def to_keypoints(self):
"""
Convert the line string points to keypoints.
Returns
-------
list of imgaug.augmentables.kps.Keypoint
Points of the line string as keypoints.
"""
| python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.