compress: Return a compressed image Quantizes an image into 2^b...

Description Usage Arguments Value Examples

View source: R/compress.R

Description

Return a compressed image Quantizes an image into 2^b clusters and return a version of the image (the same size as the original) where each pixel's original colour is replaced with the nearest prototype colour.

Usage

1
compress(img, b)

Arguments

img

array, the image to be processed

b

integer, the desired number of bits

Value

array, returns the compressed image

Examples

1
2
old_img <- array(1:24, dim = c(3, 4, 2))
(compressed_img <- compress(old_img, 3L))

UBC-MDS/Rgroup12 documentation built on April 1, 2020, 4:36 a.m.