tune_tolerance {pliman} | R Documentation |
Provides options for tunning tolerance
parameter utilized in
[analyze_objects()]
in two ways:
Declaring the actual
argument, an iterative algorithm will compute the
first analysis and sequentially increase the parameter tolerance
if the
computed number of objects is greater than actual
or reduce the parameter
tolerance
if the computed number of objects is less than actual
. If the
algorithm did not converge up to maxiter
is reached, users can change the
default extension
value.
The second way is to create a grid
with tolerance
and extension
values. When grid
is informed, all combinations (made by
base::expand.grid()
) are tested and the residual from actual
value is
plotted. Users can than find a better combination of parameters to use in
analyze_objects()
.
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
)
img |
The image to be analyzed. |
actual |
The actual number of objects. |
start_tol |
An starting value for tolerance. Defaults to |
extension |
The extension value. Defaults to |
grid |
A list with a numeric sequence for |
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 |
plot |
Logical. If |
fill_hull |
Fill holes in the binary image? Defaults to |
filter |
Performs median filtering after image processing? defaults to
|
invert |
Inverts the binary image, if desired. This is useful to process
images with black background. Defaults to |
workers |
The number of multiple sections to be used in the computation. |
verbose |
If |
Tiago Olivoto tiagoolivoto@gmail.com
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)
}