Learn R Programming

bwimage (version 1.3)

stretch: stretch circle to square

Description

Stretch data from circular image to square in binary matrix

Usage

stretch(imagematrix, method = "radial")

Arguments

imagematrix

The matrix to be stretched.

method

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

Value

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

References

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

Examples

Run this code
# NOT RUN {
img_location <- system.file("extdata/chesstable.png",package ="bwimage")
image_matrix<- threshold_color(img_location,"png", "frame_fixed",target_width = 50,target_height=50)
stretch(image_matrix,method="radial")
# }

Run the code above in your browser using DataLab