coglyphr: Compute Glyph Centers of Gravity from Image Data

Overview

coglyphr is an R package for computing the center of gravity (COG) of character-like binary images using three different methods. This package provides functions for estimating stroke-based, contour-based, and potential energy-based COG. It is useful for analyzing glyph structure in areas such as visual cognition research and font development.

The current version supports the following COG computation methods:

For details on each function, refer to the function references.

Installation

You can install coglyphr from GitHub using devtools:

# Install devtools if not already installed
if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools")

# Install coglyphr
devtools::install_github("mutopsy/coglyphr")

Dependencies

This package requires:
* R (>= 4.4.0)
* dplyr
* imager
* sp

Usage

After installation, you can load this package using the library function.

library(coglyphr)

Citation

A paper describing this package has been submitted to the Journal of Open Source Software (JOSS).
Until it is formally published, please cite the following preprint:

Muto, H. (2025). coglyphr: An R package to compute glyph centers of gravity from image data. Jxiv. https://doi.org/10.51094/jxiv.1531

Version History

See the Changelog on pkgdown site for the full changelog.

References