Segmentation#

segment() partitions an image into labelled regions – typically the sand layers (“facies”) of a multi-layered rig. It runs a watershed on a gradient or monochromatic signal; you supply markers and edge parameters through a config dict.

import darsia

image = darsia.imread("baseline.jpg", dim=2)

config = {
    "median disk radius": 20,
    "rescaling factor": 0.3,
    "markers disk radius": 10,
    "threshold": 20,
    "gradient disk radius": 2,
}
labels = darsia.segment(
    image,
    markers_method="gradient_based",   # or "supervised" with marker_points
    edges_method="gradient_based",     # or "scharr"
    **config,
)
labels.show()

Working with the label field#

The workflow presets turn a hand-segmented reference image into named facies via [labeling] and [facies] – see 4. Configuration Reference.

See also#