Description Usage Arguments Value References See Also Examples
A function provides automatic clustering-based thresholding proposed by Ohtsu, and a gray scale image is converted to binary image. Initial histogram and discriminant level of binning are displayed by his=TRUE, dis=TRUE options. A threshold value can be also set manually.
1 |
x |
A raster image or a matrix |
auto |
set threshold automatically (Ohtsu method) or manually |
th |
a threshold value used when auto=FALSE |
his |
A histogram of initial gray scale image |
dis |
A plot of variation between classes divided by variation within classes |
A requested binary image. Black is zero.
N. Otsu (1979) A threshold selection method from gray-level histograms, IEEE Trans. Sys., Man., Cyber., 9(1), 62-66.
rgb2gray
1 2 3 4 5 6 7 8 9 10 | data(camphora)
par(mfrow=c(2,3))
image(rot90c(camphora), col= gray((0:255)/255), main="camphora", asp=1, useRaster=TRUE, axes=FALSE)
out <- gray2bin(camphora, his=TRUE, dis=TRUE)
image(rot90c(out), col= gray((0:255)/255), main="binary image, auto", asp=1,
useRaster=TRUE, axes=FALSE)
image(rot90c(gray2bin(camphora,auto=FALSE,th=100)), col= gray((0:255)/255), main="binary image,
thresh=100", asp=1, useRaster=TRUE, axes=FALSE)
image(rot90c(gray2bin(camphora,auto=FALSE,th=180)), col= gray((0:255)/255), main="binary image,
thresh=180", asp=1, useRaster=TRUE, axes=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.