ImageOverlay#
- class augraphy.utilities.imageoverlay.ImageOverlay(foreground, position=(None, None), p=1)[source]#
Bases:
Augmentation
Takes a background and foreground image and overlays foreground somewhere on background. Not all of foreground will necessarily be visible; some may be cut off by the edge of the background image.
- Parameters:
foreground (np.array) – the image to overlay on the background document
position (pair of ints, optional) – a pair of x and y coordinates to place the foreground image If not given, the foreground will be randomly placed.
p (float, optional) – the probability this augmentation will be applied
- layerForeground(ambient, xloc, yloc)[source]#
Put self.foreground at (xloc,yloc) on ambient
- Parameters:
ambient (np.array) – The initial ambient image.
xloc (int) – Coordinate of x start location.
yloc (int) – Coordinate of y start location.
- overlay(background, foreground)[source]#
Centers the background image over workspace, then places foreground somewhere on the workspace, and finally crops to the background dimension
- Parameters:
background (np.array) – Background image of overlaying process.
foreground (np.array) – Foreground image of overlaying process.
Overview#
ImageOverlay is the base class to overlay 2 images. It is obsolete and replaced by OverlayBuilder now.