Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In the end I solved this issue using contrast gradients to delimit the areas to apply watershed. It doesn't work perfectly but it gives a rough estimate for the number of colour regions in the image. I use this estimate to give a range in which to calculate using k-means to give an accurate result. Even just doing watershed give a good estimate with the right parameters.

Thank you for all the help @holger and @Kitnos. The contour idea was not an option since to apply it I would need to make masks for each of the colours which would mean that I actually know the colours before-hand.