Skip to contents

This is a basic watershed algorithm that can be used as a faster alternative to EBImage::watershed(). I strongly suggest using this only with round objects, since it doesn't consider both 'extension' and 'tolerance' arguments of EBImage::watershed().

Usage

watershed2(binary, dist_thresh = 0.75, plot = TRUE)

Arguments

binary

A binary image

dist_thresh

The distance threshold to create the

plot

If TRUE (default) plots the labeled objects

Value

The labelled version of binary.

Examples

if (interactive() && requireNamespace("EBImage")) {
library(pliman)
img <- image_pliman("soybean_touch.jpg")
binary <- image_binary(img, "B")[[1]]
wts <- watershed2(binary)
range(wts)
}


#> [1]  0 30