image_segment {pliman}R Documentation

Image segmentation

Description

Usage

image_segment(
  image,
  index = NULL,
  my_index = NULL,
  threshold = "Otsu",
  fill_hull = FALSE,
  re = NULL,
  nir = NULL,
  invert = FALSE,
  show_image = TRUE,
  nrow = NULL,
  ncol = NULL,
  parallel = FALSE,
  workers = NULL,
  verbose = TRUE
)

image_segment_iter(
  image,
  nseg = 1,
  index = NULL,
  invert = NULL,
  threshold = NULL,
  show_image = TRUE,
  verbose = TRUE,
  nrow = NULL,
  ncol = NULL,
  parallel = FALSE,
  workers = NULL,
  ...
)

Arguments

image

An image object or a list of image objects.

index
  • For image_segment(), a character value (or a vector of characters) specifying the target mode for conversion to binary image. See the available indexes with pliman_indexes(). See image_index() for more details.

  • For image_segment_iter() a character or a vector of characters with the same length of nseg. It can be either an available index (described above) or any operation involving the RGB values (e.g., "B/R+G").

my_index

User can calculate a different index using the bands names, e.g. my_index = "R+B/G".

threshold

By default (threshold = "Otsu"), a threshold value based on Otsu's method is used to reduce the grayscale image to a binary image. If a numeric value is informed, this value will be used as a threshold. Inform any non-numeric value different than "Otsu" to iteratively chosen the threshold based on a raster plot showing pixel intensity of the index. For image_segmentation_iter(), use a vector (allows a mixed (numeric and character) type) with the same length of nseg.

fill_hull

Fill holes in the objects? Defaults to FALSE.

re

Respective position of the red-edge band at the original image file.

nir

Respective position of the near-infrared band at the original image file.

invert

Inverts the binary image, if desired. For image_segmentation_iter() use a vector with the same length of nseg.

show_image

Show image after processing?

nrow, ncol

The number of rows or columns in the plot grid. Defaults to NULL, i.e., a square grid is produced.

parallel

Processes the images asynchronously (in parallel) in separate R sessions running in the background on the same machine. It may speed up the processing time when image is a list. The number of sections is set up to 70% of available cores.

workers

A positive numeric scalar or a function specifying the maximum number of parallel processes that can be active at the same time.

verbose

If TRUE (default) a summary is shown in the console.

nseg

The number of iterative segmentation steps to be performed.

...

Additional arguments passed on to image_segment().

Value

Author(s)

Tiago Olivoto tiagoolivoto@gmail.com

References

Nobuyuki Otsu, "A threshold selection method from gray-level histograms". IEEE Trans. Sys., Man., Cyber. 9 (1): 62-66. 1979. doi: 10.1109/TSMC.1979.4310076

Examples

library(pliman)
img <- image_pliman("soybean_touch.jpg", plot = TRUE)
image_segment(img, index = c("R, G, B"))


[Package pliman version 1.1.0 Index]