OpenCV  3.4.4
Open Source Computer Vision
samples/cpp/watershed.cpp

An example using the watershed algorithm