Local Adaptive Thresholding


Local adaptive thresholding technique shows a good performance in extracting objects from inhomogeneous background.

I implemented local adaptive thresholding (ThresholdAdaptive).

You can use it as show below.

library(devtools)
install_github("ShotaOchi/imagerExtra")
library(imagerExtra)
layout(matrix(1:4, 2, 2, byrow=TRUE))
plot(papers, main = "Original")
threshold(papers) %>% plot(main = "A Variant of Otsu")
ThresholdAdaptive(papers, 0, range = c(0,1)) %>% plot(main = "Local Adaptive (k=0)")
ThresholdAdaptive(papers, 0.2, range = c(0,1)) %>% plot(main = "Local Adaptive (k=0.2)")