Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

thresh

Adaptive thresholding


Description

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

Half 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, boundary="replicate") + offset) } but faster. The function filter2 provides hence more flexibility than thresh.

Value

An Image object or an array, containing the transformed version of x.

Author(s)

Oleg Sklyar, osklyar@ebi.ac.uk, 2005-2007

See Also

filter2

Examples

x = readImage(system.file('images', 'nuclei.tif', package='EBImage'))
  display(x)
  y = thresh(x, 10, 10, 0.05)
  display(y)

EBImage

Image processing and analysis toolbox for R

v4.32.0
LGPL
Authors
Andrzej Oleś, Gregoire Pau, Mike Smith, Oleg Sklyar, Wolfgang Huber, with contributions from Joseph Barry and Philip A. Marais
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.