pixel_category {pixelclasser} | R Documentation |
Creates a category object
Description
Creates an object of class "pixel_category"
, which contains a list of
objects of class "pixel_subcategory"
.
Usage
pixel_category(cat_name, cat_colour, ...)
is.category(x)
## S3 method for class 'pixel_category'
summary(object, ...)
Arguments
cat_name |
a character string containing the name of the category. |
cat_colour |
a character string defining the colour to paint the pixels with when creating a classified picture. |
... |
in |
x |
the R object being tested |
object |
an object of class |
Details
The function receives a list of objects of class
"pixel_subcategory"
and creates an object of class
"pixel_category"
with them. However, subcategories are not always
needed (see pixel_subcategory
). In these cases
"pixel_rule"
objects can be passed to this function, which creates
an internal subcategory object (named "S0") to contain them. See the
examples below.
Note that it is an error to pass a mixture of "pixel_rule"
and
"pixel_subcategory"
objects.
colour
can be specified in any form understood by
grDevices::col2grb
.
Value
An object of class "pixel_category"
which is a list with the
following elements:
-
name
: the character string with the name of the pixel category. -
colour
: a character string describing the colour of the pixels of the category in the classified images. -
subcats
: a list of"pixel_subcategory"
objects.
See Also
pixel_rule
, pixel_subcategory
,
col2rgb
Examples
# This set of rules is not consistent, they are only useful as examples
rule01 <- pixel_rule("R01", "g", "b",
list(c(0.35, 0.30), c(0.45, 0.10)), ">=")
rule02 <- pixel_rule("R02", "g", "b",
list(c(0.35, 0.253), c(0.45, 0.253)), ">=")
rule03 <- pixel_rule("R03", "g", "b",
list(c(0.35, 0.29), c(0.49, 0.178)), ">=")
rule04 <- pixel_rule("R04", "g", "b",
list(c(0.35, 0.253), c(0.45, 0.253)), "<")
subcat01 <- pixel_subcategory("Subcat01", rule01, rule02)
subcat02 <- pixel_subcategory("Subcat02", rule03, rule04)
cat01 <- pixel_category("Cat01", "#ffae2a", subcat01, subcat02)
# A single category defined by a set of rules, not subcategories
cat02 <- pixel_category("Cat02", "#00ae2a", rule01, rule02, rule03)