Function opencv::core::convert_scale_abs

source ·
pub fn convert_scale_abs(
    src: &impl ToInputArray,
    dst: &mut impl ToOutputArray,
    alpha: f64,
    beta: f64
) -> Result<()>
Expand description

Scales, calculates absolute values, and converts the result to 8-bit.

On each element of the input array, the function convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type: block formula In case of multi-channel arrays, the function processes each channel independently. When the output is not 8-bit, the operation can be emulated by calling the Mat::convertTo method (or by using matrix expressions) and then by calculating an absolute value of the result. For example:

   Mat_<float> A(30,30);
   randu(A, Scalar(-100), Scalar(100));
   Mat_<float> B = A*5 + 3;
   B = abs(B);
   // Mat_<float> B = abs(A*5+3) will also do the job,
   // but it will allocate a temporary matrix

§Parameters

  • src: input array.
  • dst: output array.
  • alpha: optional scale factor.
  • beta: optional delta added to the scaled values.

§See also

Mat::convertTo, cv::abs(const Mat&)

§C++ default parameters

  • alpha: 1
  • beta: 0