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.3.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.3-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.3.tar.gz.

File metadata

  • Download URL: mc_mbd-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 cbbaf56ffb200e6a672eb0f07ed04f4b733b8ac2b044a546ee1b7302373d61f4
MD5 84f29c8283b207743764b20fb828e572
BLAKE2b-256 992c704b49872d9d02a941ad75f668f76a444c3fbf74016aa1eaa3eed45e97d9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mc_mbd-0.1.3-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.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a65948780af50af63e2c7fb616a26b8d36322f686e570834b57722af49ef32dc
MD5 971d780a288dfc15c2137b3d68de1b0b
BLAKE2b-256 9050817e560b9ce94833059ea65d5e5bc097ac36a1406d85f356d7c000687ea5

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