Learn R Programming

coglyphr (version 1.0.4)

draw_contour: Visualize Contour-Based Region and Center of Gravity (COG)

Description

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.

Usage

draw_contour(lst, show_cog = TRUE, plot_image = TRUE)

Value

An object of class cimg representing the polygon-filled image (with or without COG lines), which can be further used or saved.

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. If FALSE, returns the image object without displaying it.

See Also

cog_contour

Examples

Run this code
if (FALSE) { # (identical(Sys.getenv("IN_PKGDOWN"), "true") || interactive())
data(img_A) # load example image from the package
result <- cog_contour(img_A)
draw_contour(result, show_cog = TRUE)
}

Run the code above in your browser using DataLab