ThresholdAdaptive: Local Adaptive Thresholding

Description Usage Arguments Value Author(s) References Examples

View source: R/local_adaptive_thresholding.R

Description

Local Adaptive Thresholding

Usage

1
ThresholdAdaptive(im, k, windowsize = 17, range = c(0, 255))

Arguments

im

a grayscale image of class cimg

k

a numeric in the range [0,1]. when k is high, local threshold values tend to be lower. when k is low, local threshold value tend to be higher.

windowsize

windowsize controls the number of local neighborhood

range

this function assumes that the range of pixel values of of input image is [0,255] by default. you may prefer [0,1]. Note that range determines the max standard deviation. The max standard deviation plays an important role in this function.

Value

a pixel set

Author(s)

Shota Ochi

References

Faisal Shafait, Daniel Keysers, Thomas M. Breuel, "Efficient implementation of local adaptive thresholding techniques using integral images", Proc. SPIE 6815, Document Recognition and Retrieval XV, 681510 (28 January 2008)

Examples

1
2
3
4
5
layout(matrix(1:4, 2, 2))
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)")

Example output

Loading required package: imager
Loading required package: magrittr

Attaching package:imagerThe following object is masked frompackage:magrittr:

    add

The following objects are masked frompackage:stats:

    convolve, spectrum

The following object is masked frompackage:graphics:

    frame

The following object is masked frompackage:base:

    save.image

imagerExtra documentation built on May 2, 2019, 1:44 p.m.