readPNGBinary: readPNGBinary

Description Usage Arguments Value Examples

View source: R/ThinText.R

Description

This function reads in and binarizes PNG images from the specified file path.

Usage

1
2
3
4
5
6
7
readPNGBinary(
  path,
  cutoffAdjust = 0,
  clean = TRUE,
  crop = TRUE,
  inversion = FALSE
)

Arguments

path

File path for image.

cutoffAdjust

Multiplicative adjustment to the K-means estimated binarization cutoff.

clean

Whether to fill in white pixels with 7 or 8 neighbors. This will help a lot when thinning – keeps from getting little white bubbles in text.

crop

Logical value dictating whether or not to crop the white out around the image. TRUE by default.

inversion

Logical value dictating whether or not to flip each pixel of binarized image. Flipping happens after binarization. FALSE by default.

Value

Returns image from path. 0 represents black, and 1 represents white by default.

Examples

1
2
3
4
5
6
7
## Not run: 
csafe_document = list()
csafe_document$image = readPNGBinary("examples/Writing_csafe_single.png")
csafe_document$thin = thinImage(csafe_document$image)
csafe_processList = processHandwriting(csafe_document$thin, dim(csafe_document$image))

## End(Not run)

handwriter documentation built on Aug. 16, 2021, 5:07 p.m.