[][src]Function opencv::core::compare

pub fn compare(
    src1: &dyn ToInputArray,
    src2: &dyn ToInputArray,
    dst: &mut dyn ToOutputArray,
    cmpop: i32
) -> Result<()>

Performs the per-element comparison of two arrays or an array and scalar value.

The function compares: Elements of two arrays when src1 and src2 have the same size: block formula Elements of src1 with a scalar src2 when src2 is constructed from Scalar or has a single element: block formula src1 with elements of src2 when src1 is constructed from Scalar or has a single element: block formula When the comparison result is true, the corresponding element of output array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:

This example is not tested
Mat dst1 = src1 >= src2;
Mat dst2 = src1 < 8;
...

Parameters

  • src1: first input array or a scalar; when it is an array, it must have a single channel.
  • src2: second input array or a scalar; when it is an array, it must have a single channel.
  • dst: output array of type ref CV_8U that has the same size and the same number of channels as the input arrays.
  • cmpop: a flag, that specifies correspondence between the arrays (cv::CmpTypes)

See also

checkRange, min, max, threshold