autoThr: Binarize images with an automatic threshold.

Description Usage Arguments Details Value Methods (by class) References See Also Examples

Description

Given a single layer image, a global threshold value is automatically obtained and a binarized image is returned. All pixels above the auto-threshold are replaced by 1 and the rest by 0. On the other hand, only a threshold value is returned for numeric vector input.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
autoThr(x, ...)

## S4 method for signature 'numeric'
autoThr(x)

## S4 method for signature 'CanopyPhoto'
autoThr(x, subset = 3)

## S4 method for signature 'RasterLayer'
autoThr(x)

Arguments

x

numeric, CanopyPhoto or RasterLayer.

...

Additional arguments (none implemented).

subset

numeric or character. It indicates the channel to process (represented as integer or by their name).

Details

Threshold value is obtained with the Ridler and Calvard (1978) method. The implementation is based on the IsoData method of Auto Threshold ImageJ plugin by Gabriel Landini.

Value

numeric or BinImage.

Methods (by class)

References

Ridler, T., Calvard, S., 1978. Picture thresholding using an iterative selection method. IEEE Trans. Syst. Man Cybern. 8, 260-263.

See Also

presetThr.

Examples

1
2
3
4
5
6
7
8
9
x <- loadPhoto()
bin <- autoThr(x, 3)
bin
plot(bin)

path <- system.file("external/Black_caiman_Macrofotografie_2.jpg",
                                                              package="caiman")
bin <- autoThr(raster(path))
plot(bin)

GastonMauroDiaz/caiman documentation built on Jan. 22, 2022, 4:43 a.m.