Array API

Statistics

cv::Scalar wtcv::median(
cv::InputArray array,
cv::InputArray mask = cv::noArray(),
)

Computes the channel-wise median.

Parameters:
  • array[in]

  • mask[in] A single channel matrix of type CV_8UC1 or CV_8SC1 where nonzero entries indicate which array elements are used.

cv::Scalar wtcv::mad(
cv::InputArray array,
cv::InputArray mask = cv::noArray(),
)

Masked mean absolute deviation.

The standard deviation of the \(k^{th}\) channel of \(x\) is estimated by

\[\begin{equation} \mad(x_k) = \median(|x_k| - \median(x_k)) \end{equation}\]
where the median is taken over locations where the mask is nonzero.

Parameters:
  • array[in] The multichannel array.

  • mask[in] A single channel matrix of type CV_8UC1 or CV_8SC1 where nonzero entries indicate which array elements are used.

cv::Scalar wtcv::mad_stdev(
cv::InputArray array,
)

Robust estimation of the standard deviation.

This function estimates the standard deviation of each channel separately using the mean absolute deviation (i.e. mad()). The elements in a each channel are assumed to be i.i.d from a normal distribution.

Specifically, the standard deviation of the \(k^{th}\) channel of \(x\) is estimated by

\[\begin{equation} \hat{\sigma_k} = \frac{\mad(x_k)}{0.675} \end{equation}\]

Parameters:

array[in] The data samples. This can a multichannel with up to 4 channels.

double wtcv::maximum_abs_value(
cv::InputArray array,
cv::InputArray mask = cv::noArray(),
)

Returns the maximum absolute value over all channels.

Parameters:
  • array[in]

  • mask[in]

Comparison

template<typename T>
requires std::floating_point<std::remove_cvref_t<T>>
bool wtcv::is_approx_zero(
T x,
double absolute_tolerance,
)

Returns true if the floating point value is approximately zero.

Parameters:
  • x[in]

  • absolute_tolerance[in]

template<typename T>
requires std::floating_point<std::remove_cvref_t<T>>
bool wtcv::is_approx_zero(
T x,
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool wtcv::is_approx_zero(
cv::InputArray a,
double absolute_tolerance,
)

Returns true if all values are approximately zero.

Parameters:
  • a[in]

  • absolute_tolerance[in]

bool wtcv::is_approx_zero(
cv::InputArray a,
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Warning

doxygenfunction: Unable to resolve function “wtcv::is_approx_equal” with arguments “(cv::InputArray, cv::InputArray, double, double)”. Candidate function could not be parsed. Parsing error is Invalid C++ declaration: Expected identifier in nested name, got keyword: constexpr [error at 104] template<typename T1, typename T2> requires std::floating_point< std::remove_cvref_t< T1 > > &&constexpr std::floating_point< std::remove_cvref_t< T2 > > bool is_approx_equal (T1 x, T2 y, double relative_tolerance, double zero_absolute_tolerance) ——————————————————————————————————–^

Warning

doxygenfunction: Unable to resolve function “wtcv::is_approx_equal” with arguments “(cv::InputArray, cv::InputArray, double)”. Candidate function could not be parsed. Parsing error is Invalid C++ declaration: Expected identifier in nested name, got keyword: constexpr [error at 104] template<typename T1, typename T2> requires std::floating_point< std::remove_cvref_t< T1 > > &&constexpr std::floating_point< std::remove_cvref_t< T2 > > bool is_approx_equal (T1 x, T2 y, double relative_tolerance, double zero_absolute_tolerance) ——————————————————————————————————–^

Warning

doxygenfunction: Unable to resolve function “wtcv::is_approx_equal” with arguments “(cv::InputArray, cv::InputArray)”. Candidate function could not be parsed. Parsing error is Invalid C++ declaration: Expected identifier in nested name, got keyword: constexpr [error at 104] template<typename T1, typename T2> requires std::floating_point< std::remove_cvref_t< T1 > > &&constexpr std::floating_point< std::remove_cvref_t< T2 > > bool is_approx_equal (T1 x, T2 y, double relative_tolerance, double zero_absolute_tolerance) ——————————————————————————————————–^

bool wtcv::is_equal(
cv::InputArray a,
cv::InputArray b,
)

Returns true if all values two matrices are equal.

Parameters:
  • a[in]

  • b[in]

bool wtcv::is_identical(
cv::InputArray a,
cv::InputArray b,
)

Returns true if two matrices refer to the same data and are equal.

Parameters:
  • a[in]

  • b[in]

void wtcv::less_than(
cv::InputArray a,
cv::InputArray b,
cv::OutputArray result,
cv::InputArray mask = cv::noArray(),
)

Returns a multichannel mask indicating which elements of a matrix are less than the elements of another matrix.

Parameters:
  • a[in]

  • b[in]

  • result[out]

  • mask[in]

void wtcv::less_than_or_equal(
cv::InputArray a,
cv::InputArray b,
cv::OutputArray result,
cv::InputArray mask = cv::noArray(),
)

Returns a multichannel mask indicating which elements of a matrix are less than or equal to the elements of another matrix.

Parameters:
  • a[in]

  • b[in]

  • result[out]

  • mask[in]

void wtcv::greater_than(
cv::InputArray a,
cv::InputArray b,
cv::OutputArray result,
cv::InputArray mask = cv::noArray(),
)

Returns a multichannel mask indicating which elements of a matrix are greater than the elements of another matrix.

Parameters:
  • a[in]

  • b[in]

  • result[out]

  • mask[in]

void wtcv::greater_than_or_equal(
cv::InputArray a,
cv::InputArray b,
cv::OutputArray result,
cv::InputArray mask = cv::noArray(),
)

Returns a multichannel mask indicating which elements of a matrix are greater than or equal to the elements of another matrix.

Parameters:
  • a[in]

  • b[in]

  • result[out]

  • mask[in]

void wtcv::compare(
cv::InputArray a,
cv::InputArray b,
cv::OutputArray result,
cv::CmpTypes compare_type,
cv::InputArray mask = cv::noArray(),
)

Returns a multichannel mask indicating how the elements of a matrix compare to the elements of another matrix.

Parameters:
  • a[in]

  • b[in]

  • result[out]

  • compare_type[in]

  • mask[in]

Utilities

void wtcv::collect_masked(
cv::InputArray array,
cv::OutputArray collected,
cv::InputArray mask,
)

Collect values indicated by the given mask.

Parameters:
  • array[in]

  • collected[out]

  • mask[in]

bool wtcv::is_data_shared(
cv::InputArray a,
cv::InputArray b,
)

Returns true if the two matrices refer to the same data.

Parameters:
  • a[in]

  • b[in]

void wtcv::negate_even_indices(
cv::InputArray vector,
cv::OutputArray result,
)

Negates all even indexed values.

Parameters:
  • vector[in] A row or column vector.

  • result[out] The input vector with the even indexed values negated.

void wtcv::negate_odd_indices(
cv::InputArray vector,
cv::OutputArray result,
)

Negates all odd indexed values.

Parameters:
  • vector[in] A row or column vector.

  • result[out] The input vector with the odd indexed values negated.

bool wtcv::is_not_array(
cv::InputArray array,
)

Returns true if array is cv::noArray().

Parameters:

array[in]

void wtcv::patch_nans(
cv::InputOutputArray array,
double value = 0.0,
)

Replace all NaN values.

This is a version of cv::patch_nans() that accepts arrays of any depth, not just CV_32F.

Parameters:
  • array[inout] The array containing NaN values.

  • value[in] The value used to replace NaN.

bool wtcv::is_scalar_for_array(
cv::InputArray scalar,
cv::InputArray array,
)

Returns true if the given value can be used as a scalar for the given array.

Scalars can be added to or subtracted from the array, be assigned to all or some array elements, or be used with comparison functions (e.g. compare(), less_than(), etc.).

A scalar is defined to be one of the following:

  • A fundamental type (e.g. float, double, etc.)

  • A vector containing array.channels() elements (e.g. cv::Vec, std::vector, array, etc.)

  • A cv::Scalar if array.channels() is less than or equal to 4

Parameters:
  • scalar[in]

  • array[in]

bool wtcv::is_vector(
cv::InputArray array,
)

Returns true if the array is a row vector or column vector.

The array is a vector if it has a single row or column and is continuous.

Parameters:

array – The potential vector.

bool wtcv::is_vector(
cv::InputArray array,
int channels,
)

Returns true if the array is a row vector or column vector.

The array is a vector if it has a single row or column, is continuous, and has channels number of channels.

Parameters:
  • array – The potential vector.

  • channels – The required number of channels.

bool wtcv::is_column_vector(
cv::InputArray array,
)

Returns true if the array is a row vector or column vector.

The array is a vector if it has a single column and is continuous.

Parameters:

array – The potential vector.

bool wtcv::is_column_vector(
cv::InputArray array,
int channels,
)

Returns true if the array is a column vector.

The array is a vector if it has a single column, is continuous, and has channels number of channels.

Parameters:
  • array – The potential vector.

  • channels – The required number of channels.

bool wtcv::is_row_vector(
cv::InputArray array,
)

Returns true if the array is a row vector or column vector.

The array is a vector if it has a single row and is continuous.

Parameters:

array – The potential vector.

bool wtcv::is_row_vector(
cv::InputArray array,
int channels,
)

Returns true if the array is a row vector.

The array is a vector if it has a single row, is continuous, and has channels number of channels.

Parameters:
  • array – The potential vector.

  • channels – The required number of channels.