getBGcol: Finds 'background' value in a matrix.

View source: R/textCanvas.R

getBGcolR Documentation

Finds 'background' value in a matrix.

Description

Finds the most common value in a matrix and returns it.

Usage

getBGcol(cnvs)

Arguments

cnvs

A matrix representing a text canvas.

Details

Finds the 'background' value in a matrix, defined as the most common value in a matrix.

Not necessarily intended to be called by the end user.

Value

A numeric value corresponding to the the most common value in cnvs.

Author(s)

Dave Braze <davebraze@gmail.com>

Examples

cnvs <- system.file("extdata/story01.png", package="FDBeye")
cnvs <- png::readPNG(cnvs)
fcnvs <- apply(cnvs, c(1,2), sum) # flatten to a single plane for convenience
getBGcol(fcnvs)

davebraze/FDBeye documentation built on April 28, 2022, 1:20 a.m.