public class RemoveWatersheds extends Object
Examines a segmented image created by
WatershedVincentSoille1991and merged watershed pixels into neighboring regions. Since there is no good rule for which region the pixel should be merged into, it is merged into the first valid one.
removepublic void remove
(GrayS32 segmented)Removes watersheds from the segmented image. The input image must be the entire original segmented image and assumes the outside border is filled with values < 0. To access this image call
WatershedVincentSoille1991.getOutputBorder(). Each watershed is assigned the value of an arbitrary neighbor. 4-connect rule is used for neighbors. Doesn't matter if initial segmented was done using another connectivity rule. The value of each region i s reduced by one at the very end.
segmented- Entire segmented image (including border of -1 values) with watersheds