tune_tolerance {pliman}R Documentation

Tune tolerance parameter

Description

Provides options for tunning tolerance parameter utilized in ⁠[analyze_objects()]⁠ in two ways:

Usage

tune_tolerance(
  img,
  actual,
  start_tol = NULL,
  extension = NULL,
  grid = NULL,
  maxiter = 200,
  index = "NB",
  my_index = NULL,
  plot = TRUE,
  fill_hull = FALSE,
  filter = FALSE,
  invert = FALSE,
  workers = NULL,
  verbose = TRUE
)

Arguments

img

The image to be analyzed.

actual

The actual number of objects.

start_tol

An starting value for tolerance. Defaults to 1.

extension

The extension value. Defaults to 1.

grid

A list with a numeric sequence for tolerance and extension values. When grid is informed, all combinations are tested and the residual from actual value is plotted.

maxiter

The maximum number of iterations. Default to 200.

index, my_index

A character value specifying the target mode for conversion to binary image when foreground and background are not declared. Defaults to "NB" (normalized blue). See image_index() for more details.

plot

Logical. If TRUE (default) generates a plot showing the results.

fill_hull

Fill holes in the binary image? Defaults to FALSE. This is useful to fill holes in objects that have portions with a color similar to the background. IMPORTANT: Objects touching each other can be combined into one single object, which may underestimate the number of objects in an image.

filter

Performs median filtering after image processing? defaults to FALSE. See more at image_filter().

invert

Inverts the binary image, if desired. This is useful to process images with black background. Defaults to FALSE.

workers

The number of multiple sections to be used in the computation.

verbose

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

Author(s)

Tiago Olivoto tiagoolivoto@gmail.com

Examples

library(pliman)
if(FALSE){
 img <- image_pliman("soybean_touch.jpg")

 # starts with tolerance = 1
 tune_tolerance(img, actual = 30)

 # Using a grid of tolerance and extension values
 tune2 <-
   tune_tolerance(img,
                  actual = 30,
                  grid = list(tolerance = seq(0, 5, by = 0.1),
                              extension = 1:4), plot = TRUE)
}

[Package pliman version 1.1.0 Index]