compress: Compress square to circle

Description Usage Arguments Value Author(s) References Examples

View source: R/cnvIM.R

Description

Compress data from square image to circular in binary matrix

Usage

1
compress(imagematrix, method = "radial", background = NA)

Arguments

imagematrix

The matrix to be compressed.

method

Compress algorithm. Four algorithms (radial, shirley, squircle, and elliptical) are available to stretch the image. The algorithms were adapted from Lambers 2016.

background

Code for background cell value. When compressing a squared matrix, corners of the transformed matrix will no have corresponding pixel from original matrix. Thus, the background value will be the value of transformed matrix corners.

Value

A matrix of 0, 1 and NA representing white, black and transparent pixels, respectively.

Author(s)

Carlos Biagolini-Jr.

References

Lambers 2016 Mappings between Sphere, Disc, and Square. Journal of Computer Graphics Techniques, 5(2): 1-21.

Examples

1
2
3
img_location <- system.file("extdata/chesstable.png",package ="bwimage")
image_matrix<- threshold_color(img_location,"png", "frame_fixed",target_width = 50,target_height=50)
compress(image_matrix,method="radial")

bwimage documentation built on April 23, 2020, 1:06 a.m.