Skip to contents

These functions calculates the per-element minimum or maximum of 2 Image objects or of 1 Image object and 1 numeric value/vector.

Usage

bitMin(e1, e2, target)

bitMax(e1, e2, target)

Arguments

e1, e2

Either 2 Image objects or 1 Image object and 1 numeric value/vector. If a vector and its length is less than the number of channels of the image, then it is recycled to match it.

target

The location where the results should be stored. It can take 3 values:

"new":

a new Image object is created and the results are stored inside (the default).

"self":

the results are stored back into e1 if it is an Image object, otherwise into e2 (faster but destructive).

An Image object:

the results are stored in another existing Image object. This is fast and will not replace the content of e1 or e2 but will replace that of target. Note that if target does not have the same dimensions, number of channels, and bit depth as e1 (if e1 is an Image object, e2 otherwise), an error will be thrown.

Value

If target="new", the function returns an Image object. If target="self", the function returns nothing and modifies e1 in place if it is an Image object, otherwise it modifies e2 in place. If target is an Image object, the function returns nothing and modifies that Image object in place.

Author

Simon Garnier, garnier@njit.edu

Examples

balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
bitMax(balloon, c(0, 0, 127), "self")
#> NULL
bitMin(balloon, c(127, 255, 255), "self")
#> NULL