Learn R Programming

Rvision (version 0.4.2)

changeBitDepth: Convert image bit depth

Description

This function takes an Image object and modifies its bit depth (e.g. from 16 bits to 8 bits).

Usage

changeBitDepth(image, bitdepth, scale = 1, in_place = FALSE)

Arguments

image

An Image object.

bitdepth

A string corresponding to the bitdepth the image should be converted to. Options are "8U", "8S", "16U", "16S", "32S", and "32F".

scale

A scaling factor (default: 1).

in_place

A logical indicating whether the change should be applied to the image itself (TRUE, faster but destructive) or to a copy of it (FALSE, the default, slower but non destructive).

Value

An Image object if in_place=FALSE. Otherwise, it returns nothing and modifies image in place.

See Also

Image

Examples

Run this code
# NOT RUN {
balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
balloon_16 <- changeBitDepth(balloon, "16U")

# }

Run the code above in your browser using DataLab