deblend_segments
- petrofit.segmentation.deblend_segments(image, segm, npixels=None, nlevels=30, contrast=0.001)[source]
Deblend overlapping sources labeled in a segmentation image.
- Parameters:
- imagearray like
Input image.
- segm
SegmentationImageorNone A 2D segmentation image, with the same shape as
data, where sources are marked by different positive integer values. A value of zero is reserved for the background. If no sources are found thenNoneis returned.- npixelsint
The number of connected pixels, each greater than
threshold, that an object must have to be detected.npixelsmust be a positive integer.- nlevelsint, optional
The number of multi-thresholding levels to use. Each source will be re-thresholded at
nlevelslevels spaced exponentially or linearly (see themodekeyword) between its minimum and maximum values within the source segment.- contrastfloat, optional
The fraction of the total (blended) source flux that a local peak must have (at any one of the multi-thresholds) to be considered as a separate object.
contrastmust be between 0 and 1, inclusive. Ifcontrast = 0then every local peak will be made a separate object (maximum deblending). Ifcontrast = 1then no deblending will occur. The default is 0.001, which will deblend sources with a 7.5 magnitude difference.
- Returns:
- segment_image
SegmentationImage A segmentation image, with the same shape as
data, where sources are marked by different positive integer values. A value of zero is reserved for the background.
- segment_image