Learn R Programming

coglyphr (version 1.0.4)

draw_potential: Visualize Potential-Based Center of Gravity (COG) and Potential Field

Description

Visualizes the normalized potential field and center of gravity (COG) computed by cog_potential. Each pixel's potential is shown as grayscale intensity, where darker pixels indicate higher potential. Optionally overlays crosshair lines at the computed COG to indicate its position.

Usage

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

Value

An object of class cimg representing the potential field image, optionally overlaid with COG crosshair lines.

Arguments

lst

A list returned by cog_potential, containing a data frame of normalized potentials and computed statistics.

show_cog

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

plot_image

Logical. If TRUE (default), plots the generated image. If FALSE, returns the image object without displaying it.

See Also

cog_potential

Examples

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

Run the code above in your browser using DataLab