Create a "Paint by Numbers" script

Here an idea like I used for mosaic using K-Mean Clustering, has color are transformed to points (in [-1, 1] space).
I then use mesh IsoSplitting but you could use Mesh Contour, Mesh Plane Intersection …
K-Mean Clustering is very sensitive to initial condition, so change seed value. There is surely a better approach but I don’t know it.
I also did it a bit fast, so there could be some glitches

split (24.1 KB)


And smoothing the contours, filtering by area … A bit long so some Dams could be useful

split image (22.4 KB)