PaperFactory#

class augraphy.base.paperfactory.PaperFactory(texture_path='./paper_textures', blend_texture=1, blend_method='random', p=1)[source]#

Bases: Augmentation

Replaces the starting paper image with a texture randomly chosen from a directory and resized to fit or cropped and tiled to fit.

Parameters:
  • texture_path (string, optional) – Directory location to pull paper textures from.

  • blend_texture (int, optional) – Flag to blend multiple textures.

  • blend_method (string, optional) – The method to blend multiple textures.

  • p (float, optional) – The probability that this Augmentation will be applied.

check_paper_edges(texture)[source]#

Crop image section with better texture.

Parameters:

texture (numpy array) – Texture image.

resize(texture, shape)[source]#

Scales and zooms a given texture to fit a given shape.

Parameters:
  • texture (numpy array.3.) – Texture image.

  • shape (list or tuple) – x and y shape of scaled image.

retrieve_texture(image)[source]#