pixelclasser {pixelclasser} | R Documentation |
pixelclasser: Functions to classify pixels by colour
Description
pixelclasser
contains functions to classify the pixels of a digital
image file (in format jpeg or tiff) by its colour. It uses a simple form of
the technique known as Support Vector Machine, adapted to this particular
problem. The original colour variables (R, G, B
) are transformed into
colour proportions (r, g, b
), and the resulting two dimensional plane,
defined by any convenient pair of the transformed variables is divided in
several subsets (categories) by one or more straight lines (rules) manually
selected by the user. Finally, the pixels belonging to each category are
identified using the rules, and a classified image can be created and saved.
Details
To classify the pixels of an image, a series of steps must be done in the following order, using the functions shown in parenthesis:
import the image into an R array of transformed (
rgb
) data (usingread_image()
).plot the pixels of the image on the plane of two transformed variables that shows the categories of pixels most clearly (
plot_rgb_plane()
,plot_pixels
).trace lines between the pixel clusters and use them to create classification rules (
place_rule()
,pixel_rule
,plot_rule()
). The user places the lines manually.combine the rules to define categories. Sometimes the rules are combined into subcategories and these into categories (
pixel_category()
,pixel_subcategory()
).use the categories to classify the pixels (
classify_pixels()
).save the results of the classification as an image, if needed (
save_clasif_image()
).
These steps are explained in depth in the vignette included in the package.
Author(s)
Carlos Real (carlos.real@usc.es)