Learn R Programming

coglyphr (version 1.0.4)

draw_stroke: Visualize Stroke Region and Center of Gravity (COG)

Description

Visualizes the stroke region of a character-like binary image using the result from cog_stroke(). Optionally overlays crosshair lines at the computed center of gravity (COG) position.

Usage

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

Value

An object of class cimg representing the stroke image (with or without COG lines), suitable for plotting or further manipulation.

Arguments

lst

A list returned by cog_stroke, containing stroke pixel data and computed statistics.

show_cog

Logical. If TRUE (default), draws horizontal and vertical red lines through the COG to visualize its position.

plot_image

Logical. If TRUE (default), plots the image. If FALSE, returns the image object without plotting.

See Also

cog_stroke

Examples

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

Run the code above in your browser using DataLab