Installation can be done with the devtools package.
library(devtools)
install_github("lochbika/Rwatershed",ref="main")
Alternatively, you can download/clone this repository and manually run the installation routines in RStudio.
This R package contains functions to compute the watershed segmentation of an input matrix. Call the respective implementation with the wrapper function watershed, for example
> watershed(x, method = "R")
where x is the input matrix.
The documentation is a good starting point. Then there is a small sample script (demonstration.R) that demonstrates the use with the sample data of this package. For a full tutorial and demonstration, check out the blog post on my personal website.