Reputation: 5566
I know that watershed and grabcut algorithms are both common tools for image segmentation. They both seem to rely on predefined markers to form something like a source-sink system and then uses the gradient of the image to find the boundaries.
The largest difference I observe is that grabcut uses a graph structure where the gradient translates to edge weights, while watershed intuitively works by slowly adding water to the gradient image. But to me, it seems like they would yield similar results?
My question is what are the relative strengths and weaknesses between these two algorithms? When should I use one over another?
Upvotes: 2
Views: 1418
Reputation: 5566
For future reference,
In the specific case of opencv and what I experienced,
Grabcut only separates foreground from background (i.e. only supports 2 labels) while watershed supports segmenting with multiple labels
Grabcut is much slower than watershed, I don't have hard stats, but watershed was able to process in near real time on an image that grabcut requires around 5 secs to process
Upvotes: 1
Reputation: 5888
I don't know for the GraphCut, but for the Watershed the main weakness is "leaking". Indeed, if your markers are not perfectly defined, the watershed will leak as soon as it finds a pixel that allows to propagate. So it has to be highly constrained by the markers.
The watershed (well developed, see SMIL library) seems to be faster than the graph cut.
Upvotes: 1