pierogis.ingredients.ingredient module

definition of ingredient base class

class pierogis.ingredients.ingredient.Ingredient(opacity: int = 100, mask: Optional[numpy.ndarray] = None, **kwargs)[source]

Bases: object

wrapper for a function to be applied to a grid of pixels.

this base class defines some basic methods to be inherited and built upon, as well as a container for media represented as a numpy array.

the two methods to be inherited and overridden are prep and cook.

prep defines and sets the parameters of this image manipulation, and cook performs the manipulation of the array.

in this base class, cook and prep do nothing

cook(pixels: numpy.ndarray) numpy.ndarray[source]

performs actions on a pixel array and returns a cooked array

mask

opacity when overlaying

mask_pixels(pixels)[source]

create a black and white mask from pixels and the seasonings attached to this ingredient

Parameters

pixels – pixels to create a mask from

opacity

opacity when overlaying on previous output

prep(**kwargs) None[source]

parameterize the cook function

season(seasoning: pierogis.ingredients.ingredient.Ingredient)[source]

add an ingredient whose cook function is used to produce this ingredients mask