For automatic oversegmentation, start with skimage.segmentation.felzenszwalb. To group or split already-labeled regions, build a region adjacency graph (RAG) and use a graph operation such as normalized cut or threshold merging. If you can supply seed labels, watershed and random walker are marker-guided alternatives. These approaches work at different levels, so the right choice depends on whether you need initial regions, region-level grouping, or labels guided by markers.
What graph-based segmentation means in practice
Image segmentation assigns a label to each pixel so that pixels in the same label form a region. In graph-based workflows, the graph may represent the image grid itself or a smaller set of regions created by an initial segmentation.
- Image-grid segmentation: an algorithm groups pixels directly. Felzenszwalb’s method produces labels this way.
- Region-level graph: an initial segmentation supplies labeled regions, which become nodes in a region adjacency graph. Edges encode relationships such as color similarity or boundary evidence; a later operation merges or partitions those regions.
- Marker-guided labeling: user- or algorithm-supplied seeds guide the assignment of pixels, as in random walker and watershed.
These are related tools, not interchangeable implementations of one task. The scikit-image 0.26.0 graph API documents RAG construction and operations, while its segmentation API documents Felzenszwalb, random walker, and watershed: skimage.graph API and skimage.segmentation API.
Choose the method that matches the job
| Method | Input and graph level | Useful when | Main controls and cautions |
|---|---|---|---|
| Felzenszwalb | Image-grid graph; no user markers required | You need automatic, often fine-grained initial regions. | scale sets the observation level; higher values generally produce fewer, larger regions. sigma smooths the image, and min_size affects small components. Resulting segment sizes can vary with local contrast. |
| Normalized cut | Similarity RAG built from existing labels | You want to recursively divide an oversegmentation into larger groups. | Edge meaning and scale affect the result. thresh controls when recursive splitting stops; num_cuts controls candidate cut attempts. |
| RAG threshold or hierarchical merge | RAG built from labels, with color or boundary weights | You want to combine neighboring regions after an initial segmentation. | Threshold meaning depends on how the edge weights were constructed. Hierarchical merging allows custom merge and weight functions. |
| Random walker | Marker-labeled graph over grayscale or multichannel data | You have meaningful seed labels to guide the segmentation. | Requires useful markers. Controls include beta, solver mode, and spacing. The API describes it as generally slower than watershed, with good results on noisy data and boundaries with holes. |
| Watershed | Marker basins flooded over an image or elevation surface | You need to separate objects or basins and can generate markers. | Explicit markers are encouraged. connectivity, mask, and compactness shape the output. An optional watershed line may fail to mark the boundary when marker regions touch. |
For automatic initial labels, choose Felzenszwalb or another superpixel method such as SLIC. For grouping existing labels, use a RAG. For segmentation guided by seeds, compare random walker and watershed. The official segmentation examples show these methods and related workflows: scikit-image segmentation examples.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Create initial regions with Felzenszwalb
skimage.segmentation.felzenszwalb performs graph-based oversegmentation on an image grid using minimum-spanning-tree-based clustering. Its controls influence the scale and cleanup of the regions rather than specifying a desired semantic class for each one.
- Increase
scaleto encourage fewer, larger regions; this is a general tendency, not a fixed region-count guarantee. - Use
sigmato smooth before segmentation when small image variations are producing distracting regions. - Use
min_sizeto affect small components.
Because segment sizes may vary with local contrast, inspect the labels on representative images rather than assuming a single scale produces uniform regions. Exact function signatures can vary by installed scikit-image version; consult that version’s API reference before running code.
Build a region adjacency graph
A RAG represents each labeled region as a node. Edges connect adjacent regions and carry weights that describe a chosen relationship. With mean-color similarity, the weights express color-based similarity; with a boundary map, they can express evidence at the boundary between regions. That edge meaning determines how a later cut or merge should be interpreted.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Use mean-color similarity
skimage.graph.rag_mean_color(image, labels, mode='similarity') constructs a graph using region mean colors and similarity-mode weights. This is a natural starting point when color similarity should help determine which neighboring regions belong together.
Recommended Free Tools
Use boundary evidence
skimage.graph.rag_boundary(labels, edge_map) builds a RAG using an edge or boundary map. Choose this path when the boundary or elevation signal, rather than average region color, should inform the graph operation.
Before choosing a cut threshold or interpreting results, confirm the installed API’s mode, sigma, and edge-weight direction. A threshold has no useful universal meaning independent of how its weights were constructed.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Partition or merge the graph
Split groups with normalized cut
skimage.graph.cut_normalized(labels, rag) applies normalized cut to a similarity RAG. The typical workflow starts with labels, builds the RAG, and then partitions the labeled regions. The thresh parameter controls when recursive splitting stops, while num_cuts controls candidate cut attempts. The outcome depends on the initial segmentation and on what the graph’s edge weights represent.
from skimage import graph, segmentation
# image is a NumPy array with channels interpreted as expected by scikit-image.
labels = segmentation.slic(
image, n_segments=250, compactness=10, start_label=1
)
rag = graph.rag_mean_color(image, labels, mode="similarity")
regions = graph.cut_normalized(labels, rag)
This illustrates the documented SLIC → mean-color similarity RAG → normalized-cut API shape; the parameter values are examples, not tested recommendations. See the official graph API example for the documented workflow: skimage.graph API.
Merge by a threshold
skimage.graph.cut_threshold(labels, rag, thresh) merges adjacent regions according to the edge-weight threshold. Select thresh only after understanding the scale and direction of the weights produced by the RAG construction. A numeric threshold that makes sense for one edge definition may not make sense for another.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Customize hierarchical merging
skimage.graph.merge_hierarchical supports a customizable hierarchical RAG merge workflow, including merge and weight functions. Use it when a simple threshold rule is insufficient and you need to define how regions combine. Check the installed version’s API for its exact arguments and defaults.
Some graph calls may mutate a RAG in place depending on arguments or defaults. If you need to reuse the original graph for another operation, preserve a copy or verify the behavior in the installed version’s documentation.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Use markers when seeds are available
Random walker
Random walker uses marker labels to guide segmentation over grayscale or multichannel image data. It is useful when seeds are meaningful and the image is noisy or boundaries contain holes. Its documented controls include beta, solver mode, and spacing; the scikit-image API describes it as generally slower than watershed.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsBest Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Watershed
Watershed floods basins over an image or elevation surface from markers. It is often a practical choice for separating objects when markers can be generated or placed. The connectivity, mask, and compactness settings shape the result. If requesting a separating watershed line, be aware that it may fail to mark the boundary when marker regions touch.
Both methods depend on marker quality: a marker layout that does not reflect the intended regions can guide the result in the wrong direction. Compare them on representative images with the markers, connectivity, noise, and expected boundaries in mind. The current controls and cautions are described in the scikit-image segmentation API.
Practical workflow and checks
- Load and interpret the image. Work with a NumPy array and establish its channel layout and color interpretation before choosing a method. The scikit-image project paper describes its basic image representation as a standard NumPy array: scikit-image: Image processing in Python.
- Choose the graph level. Use Felzenszwalb for direct automatic labels, or use SLIC when you want superpixels as the starting labels for a later RAG operation.
- Build the graph for the signal you care about. Choose mean-color similarity for color relationships or a boundary map when boundaries should guide edge weights.
- Pick a graph operation. Use normalized cut to recursively partition a similarity RAG, threshold cut to merge by edge weight, or hierarchical merging when you need custom merge logic.
- Inspect the labels. Overlay labels on the image and check region counts and boundaries on representative examples. Tune parameters empirically; the API documentation does not establish a universally optimal setting or benchmark for a particular dataset.
- Try marker-driven alternatives when appropriate. If seed labels are available, compare random walker and watershed, paying attention to marker placement, connectivity, and noise.
How to evaluate whether the result is useful
Segmentation is not automatically semantic understanding: a region boundary does not by itself say what object or class the region represents. Judge the output against the task’s intended regions and downstream use. Inspect overlays for under- or over-segmentation, check whether graph merges cross meaningful boundaries, and repeat the check across images with different contrast and noise. No single parameter recipe or performance figure is established for an unspecified dataset, so task-specific validation is necessary.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

