Visualizes the character region enclosed by the convex polygon computed using cog_contour.
Optionally overlays crosshair lines at the computed center of gravity (COG) to aid interpretation.
Arguments
- lst
A list returned by
cog_contour, containing a data frame of polygon points and computed statistics.- show_cog
Logical. If
TRUE(default), draws horizontal and vertical red lines through the COG to indicate its location.- plot_image
Logical. If
TRUE(default), plots the reconstructed image. IfFALSE, returns the image object without displaying it.- cimg
Logical. If
TRUE(default) and imager is available, returns acimgobject. IfFALSE, always returns a raster object.
Value
If cimg = TRUE and imager is installed, returns a cimg
object. Otherwise, returns a raster object (class "raster").
Details
By default (cimg = TRUE), the function returns a cimg object if the
imager package is available. If imager is not installed or if
cimg = FALSE, a base R raster object created by as.raster() is returned.
Examples
data(img_A) # load example image from the package
result <- cog_contour(img_A)
draw_contour(result, show_cog = TRUE, cimg = FALSE)