Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you know that the foreground has 2 separate areas/regions, then why aren't you just segment it once more? eg: you have subtracted the background, so you have the mask for the foreground that has 2 pats, like light and dark, then create the foreground image:

image.clone(foreground, foregroundMask);

Then segment it with threshold, so you are goinf to have 2 regions.

If your problem is a more complex, then you should think of how to define the 2 markers for the foreground, so watershed will segment it correctly.