R/compress.R
compress.Rd
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.
compress(img, b)
img | array, the image to be processed |
---|---|
b | integer, the desired number of bits |
array, returns the compressed image
#> , , 1 #> #> [,1] [,2] [,3] [,4] #> [1,] 1.5 3.5 7.0 9.5 #> [2,] 1.5 5.0 8.0 11.5 #> [3,] 3.5 6.0 9.5 11.5 #> #> , , 2 #> #> [,1] [,2] [,3] [,4] #> [1,] 13.5 15.5 19.0 21.5 #> [2,] 13.5 17.0 20.0 23.5 #> [3,] 15.5 18.0 21.5 23.5 #>