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()