pyiron_contrib.image.custom_filters module
- pyiron_contrib.image.custom_filters.brightness_filter(image, sigma=10, bins=100, deg=10, plot=False)[source]
Automatically detect a threshold between ‘dark’ and ‘light’ pixel values by looking for a minima in the pixel value histogram, fitting a polynomial, and finding the trough between the two highest peaks.
Just exists as a near-trivial example
- Parameters
image (image.Image) – The image to filter.
sigma (float) – The amount of gaussian smearing to apply to the image data before binning brightness. (Default is 10.)
bins (int) – How many bins to put the pixel brightness into. (Default is 100)
deg (int) – Degree of polynomial to fit to the binned brightness data. (Default is 10.)
plot (bool) – Whether to plot a summary of the filtering process. (Default is False.)
- Returns
The fraction of pixels darker than the threshold. (float): The threshold used. (numpy.ndarray): The mask of values from the smoothed image below the threshold.
- Return type
(float)