darsia.extract_characteristic_data#
- extract_characteristic_data(signal, mask=None, samples=None, filter=<function <lambda>>, num_clusters=5, num_attempts=100, num_iterations=200, eps=0.1, mode='most_common', show_plot=False)[source]#
Extract representative colours from an image for given patches.
- Parameters:
- signal
numpy.ndarrayordarsia.Image Input signal, assumed to be a 2d colour image.
- mask
numpy.ndarrayordarsia.Image,optional Boolean array flagging pixels of interest; by default all pixels.
- samples
listofslices,optional 2d regions of interest; None means the full region.
- filter
callable(),optional Preprocessing applied to the signal before analysis (e.g. a Gaussian filter). Default: identity.
- num_clusters
int,optional Number of clusters to extract. Default 5.
- num_attempts
int,optional Number of attempts to find the best clusters. Default 100.
- num_iterations
int,optional Maximum iterations of the iterative procedure. Default 200.
- eps
float,optional Stopping tolerance for the iterative procedure. Default 0.1.
- mode{“most_common”, “least_common”, “all”},
optional What to return. Default
"most_common".- show_plotbool,
optional Display plots. Default False.
- signal
- Returns:
numpy.ndarrayortupleofnumpy.ndarrayCharacteristic colours for the chosen samples when
modeis"most_common"/"least_common"; a(labels, palettes)tuple whenmodeis"all".