Removing objects
scikit-image has several ways of removing objects from N-dimensional images. Here, “objects” (and “holes”) are defined as groups of samples with the same label value which distinct from the background and other objects.
This example shows how to remove objects based on their size, or their distances from other objects.

import matplotlib.pyplot as plt
import skimage as ski
# Extract foreground by thresholding an image taken by the Hubble Telescope
image =