extractor: Image rotation, de-skewing, and cropping

View source: R/extractor.R

extractorR Documentation

Image rotation, de-skewing, and cropping

Description

This is a helper function to extract the game board images from an arbitrary photograph.

Usage

extractor(
  image,
  locations,
  histogram_balancing = FALSE,
  direction = "backward"
)

Arguments

image

The image, stored in "imager" format, to be processed. Supplied via the pre-processing code.

locations

Locations of the corners of the game boards in the image file. Supplied via the pre-processing code.

histogram_balancing

Should histogram balancing be used to correct grey-out images? This sometimes helps, but sometimes hurts, classification accuracy. This will cause token hue to shift as well, so hue thresholds will need to be revised if this is used.

direction

How image skew is corrected. The "forward" algorithm is fast but lower quality. The "backward" algorithm is slow but higher quality. See imwarp function in imager package for technical details.

Value

A square, cropped, and unskewed image.


ctross/DieTryin documentation built on Sept. 8, 2024, 8:07 p.m.