Skip to main content

Multiclass Minimum Barrier Distance segmentation algorithm

Project description

mc_mbd: Multiclass Minimum Barrier Distance Segmentation

PyPI version License Python 3.9+

Strand, R., Malmberg, F., Saha, P. K., & Linnér, E. (2014). The Minimum Barrier Distance – Stability to Seed Point Position. In Advanced Information Systems Engineering (pp. 111–121). Springer Berlin Heidelberg. https://doi.org/10.1007/978-3-319-09955-2_10

mc-mbd is a fast, cross-platform implementation of the Multiclass Minimum Barrier Distance (MBD) algorithm for seeded image segmentation. It supports multi-label propagation and is accelerated by a C++ core with Python fallback. The package is installable via PyPI and works out-of-the-box for research and practical segmentation tasks.

Installation (pip)

Install from PyPI (package name uses an underscore so it's importable):

pip install mc-mbd

After installing via pip you can import the library in Python (package name stays mbd):

from mc_mbd import segment_image

For Development (build from source)

To build and develop locally:

# Create and activate a virtual environment
python -m venv .mc_mbd
# On Windows (PowerShell):
.\.mc_mbd\Scripts\Activate.ps1
# On Windows (cmd):
.\.mc_mbd\Scripts\activate.bat
# On macOS/Linux:
source .mc_mbd/bin/activate

# Install dependencies
pip install -r requirements.txt

# Build the C++ core extension in-place
python setup.py build_ext --inplace

Performance

Segmentation accuracy: mc-mbd achieves a mean intersection-over-union (mIoU) of 55.5% on the PASCAL VOC 2012 dataset using the ScribblesForAll dataset for initial seeds, without iterative refinement (one-shot segmentation).

Speed: On standard 480×480 pixel images, mc-mbd segments each image in about 0.16 seconds on average, enabling fast and efficient large-scale image processing.

Quick Usage Example

# If installed from PyPI:
from mc_mbd import segment_image
import numpy as np
# image: 2D numpy array, seeds: integer mask (0=unlabeled, 1=background, 2+=foreground)
labels = segment_image(image, seeds)

License

This project is licensed under the MIT License - see the LICENSE file for details.


Copyright © 2025 Mvzvrt. All rights reserved.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mc_mbd-0.1.4.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mc_mbd-0.1.4-cp313-cp313-win_amd64.whl (76.5 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file mc_mbd-0.1.4.tar.gz.

File metadata

  • Download URL: mc_mbd-0.1.4.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for mc_mbd-0.1.4.tar.gz
Algorithm Hash digest
SHA256 32b83aeecb00e408e6ea54fa1af8e34b076f25a0603d1d290dff8cac3a89b83a
MD5 981cc69191c0b32c09ba34ea90b145cc
BLAKE2b-256 d60a7b9f92e7d69b6ef40717ed7db373da859236c40884f3efb94dd58ae9ce38

See more details on using hashes here.

File details

Details for the file mc_mbd-0.1.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: mc_mbd-0.1.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 76.5 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for mc_mbd-0.1.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 59d503a61f74f99bdefa2719ab818842fc3e20fcbff14131b06d6387b27fb248
MD5 557a2bab15e8b3333ba5e759d4c64ea7
BLAKE2b-256 e4c07985f94c673708286657338bba5f3d34789e8045edec6ebfdd846e5eb031

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page