compression_perrrfect: This function uses a lossy pooling algorithm to compress an...

Description Usage Arguments Value Examples

View source: R/compression_perrrfect.R

Description

The function can be applied to a greyscale or colour image. The user passes a cimg type object (from the imager package) which is to be compressed and the resulting compressed cimg object is returned. The user can also specify the pooling algorithm to be used and the size of the kernel to apply over the image.

Usage

1
compression_perrrfect(img, kernel_size = 2, pooling_function = "max")

Arguments

img

A cimg type object of 4 dimensions representing a greyscale or colour image.

kernel_size

The size of the length and width of the kernel to be passed over the image. Default: 2

pooling_function

The pooling algorithm to be used. Three options: "max", "min", and "mean". Default: "max"

Value

A cimg type image of 4 dimensions representing a greyscale or colour image.

Examples

1
2
img <- imager::as.cimg(imager::boats)
compression_perrrfect(img, kernel_size=2, pooling_function="max")

UBC-MDS/pictureperrrfect documentation built on March 28, 2021, 1:28 p.m.