Thresholds an image using a moving rectangular window.
Usage
thresh(x, w=5, h=5, offset=0.01)
Arguments
x
An Image object or an array.
w, h
Width and height of the moving rectangular window.
offset
Thresholding offset from the averaged value.
Details
This function returns the binary image resulting from the comparison
between an image and its filtered version with a rectangular window.
It is equivalent of doing {f = matrix(1, nc=2*w+1, nr=2*h+1) ; f=f/sum(f) ; x>(filter2(x, f)+offset)}
but slightly faster. The function filter2 provides hence more
flexibility than thresh.
Value
An Image object or an array, containing the transformed version
of x.
x = readImage(system.file('images', 'nuclei.tif', package='EBImage'))
display(x)
y = thresh(x, 10, 10, 0.05)
display(y)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(EBImage)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/EBImage/thresh.Rd_%03d_medium.png", width=480, height=480)
> ### Name: thresh
> ### Title: Adaptive thresholding
> ### Aliases: thresh
> ### Keywords: manip
>
> ### ** Examples
>
> x = readImage(system.file('images', 'nuclei.tif', package='EBImage'))
> display(x)
Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
> y = thresh(x, 10, 10, 0.05)
> display(y)
Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
>
>
>
>
>
> dev.off()
null device
1
>