Skip to contents

pow raises every element of an Image object to a power.

Usage

pow(x, y = 2, target = "new")

Arguments

x

A 32- or 64-bit (32F or 64F) Image object.

y

A numeric value representing the exponent of power. Note that for a non-integer power exponent, the absolute values of the Image object are used.

target

The location where the results should be stored when passing a sum of images to the function. 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 x (faster but destructive).

An Image object:

the results are stored in another existing Image object. This is fast but will replace the content of target. Note that target should have the same dimensions, bitdepth, and number of channels as x, 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 x in place. If target is an Image object, the function returns nothing and modifies that Image object in place.

See also

Author

Simon Garnier, garnier@njit.edu

Examples

balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
changeBitDepth(balloon, "32F", 1 , "self")
#> NULL
pow(balloon, 2)
#> Class: image. 
#> Dimensions: 640x360.
#> Type: BGR, 3-channel, 32F.
#> GPU: FALSE.