YubinXie / watershed

A Python implementation of the watershed image segmentation algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Watershed

A simple (but not very fast) Python implementation of Determining watersheds in digital pictures via flooding simulations.

source image labelled image

In contrast to skimage.morphology.watershed and cv2.watershed this implementation does not use marker seeds.

Usage

import numpy as np
from Watershed import Watershed
from PIL import Image
import matplotlib.pyplot as plt

w = Watershed()
image = np.array(Image.open('ex.png'))
labels = w.apply(image)
plt.imshow(labels, cmap='Paired', interpolation='nearest')
plt.show()

About

A Python implementation of the watershed image segmentation algorithm

License:MIT License


Languages

Language:Python 100.0%