Visualize Potential-Based Center of Gravity (COG) and Potential Field
Source:R/draw_potential.r
draw_potential.Rd
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.
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. IfFALSE
, returns the image object without displaying it.
Value
An object of class cimg
representing the potential field image,
optionally overlaid with COG crosshair lines.
Examples
# \donttest{
data(img_A) # load example image from the package
result <- cog_potential(img_A)
draw_potential(result, show_cog = TRUE)
#> Image. Width: 500 pix Height: 500 pix Depth: 1 Colour channels: 3
# }