utils_measures | R Documentation |
get_measures()
computes object measures (area, perimeter, radius) by using
either a known resolution (dpi) or an object with known measurements.
plot_measures()
draws the object measures given in an object to the
current plot. The object identification ("id"
) is drawn by default.
get_measures(
object,
measure = NULL,
id = NULL,
dpi = NULL,
sep = "\\_|-",
verbose = TRUE,
digits = 5
)
plot_measures(
object,
measure = "id",
id = NULL,
hjust = NULL,
vjust = NULL,
digits = 2,
size = 0.9,
col = "white",
...
)
object |
An object computed with |
measure |
For
|
id |
An object in the image to indicate a known value. |
dpi |
A known resolution of the image in DPI (dots per inch). |
sep |
Regular expression to manage file names. The function combines in
the |
verbose |
If |
digits |
The number of significant figures. Defaults to |
hjust, vjust |
A numeric value to adjust the labels horizontally and vertically. Positive values will move labels to right (hjust) and top (vjust). Negative values will move the labels to left and bottom, respectively. |
size |
The size of the text. Defaults to |
col |
The color of the text. Defaults to |
... |
Further arguments passed on to |
For get_measures()
, if measure
is informed, the pixel values will be
corrected by the value of the known object, given in the unit of the
right-hand side of meae
. If dpi
is informed, then all the measures
will be adjusted to the knosurwn dpi
.
If applied to an object of class anal_obj
, returns a data frame with the
object id
and the (corrected) measures.
If applied to an object of class anal_obj_ls
, returns a list of class
measures_ls
, with two objects: (i) results
, a data frame containing
the identification of each image (img) and object within each image (id);
and (ii) summary
a data frame containing the values for each image. If
more than one object is detected in a given image, the number of objects
(n
), total area (area_sum
), mean area (area_mean
) and the standard
deviation of the area (area_sd
) will be computed. For the other measures
(perimeter and radius), the mean values are presented.
plot_measures()
returns a NULL
object, drawing the text according to
the x and y coordinates of the objects in object
.
Tiago Olivoto tiagoolivoto@gmail.com
library(pliman)
img <- image_pliman("objects_300dpi.jpg")
plot(img)
# Image with four objects with a known resolution of 300 dpi
# Higher square: 10 x 10 cm
# Lower square: 5 x 5 cm
# Rectangle: 4 x 2 cm
# Circle: 3 cm in diameter
# Count the objects using the blue band to segment the image
results <-
analyze_objects(img,
index = "B",
lower_noise = 0.1)
plot_measures(results, measure = "id")
# Get object measures by declaring the known resolution in dots per inch
(measures <- get_measures(results, dpi = 300))
# Calculated diagonal of the object 1
# 10 * sqrt(2) = 14.14
# Observed diagonal of the object 1
measures[1, "radius_max"] * 2
# Get object measures by declaring the known area of object 1
get_measures(results,
id = 1,
area ~ 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.