[][src]Function opencv::core::pow

pub fn pow(
    src: &dyn ToInputArray,
    power: f64,
    dst: &mut dyn ToOutputArray
) -> Result<()>

Raises every array element to a power.

The function cv::pow raises every element of the input array to power : block formula

So, for a non-integer power exponent, the absolute values of input array elements are used. However, it is possible to get true values for negative values using some extra operations. In the example below, computing the 5th root of array src shows:

This example is not tested
Mat mask = src < 0;
pow(src, 1./5, dst);
subtract(Scalar::all(0), dst, dst, mask);

For some values of power, such as integer values, 0.5 and -0.5, specialized faster algorithms are used.

Special values (NaN, Inf) are not handled.

Parameters

  • src: input array.
  • power: exponent of power.
  • dst: output array of the same size and type as src.

See also

sqrt, exp, log, cartToPolar, polarToCart