/// <summary> /// Performs the per-element comparison of two arrays or an array and scalar value. /// </summary> /// <param name="src1">first input array or a scalar; when it is an array, it must have a single channel.</param> /// <param name="src2">second input array or a scalar; when it is an array, it must have a single channel.</param> /// <param name="dst">output array of type ref CV_8U that has the same size and the same number of channels as the input arrays.</param> /// <param name="cmpop">a flag, that specifies correspondence between the arrays (cv::CmpTypes)</param> public static void Compare(InputArray src1, InputArray src2, OutputArray dst, CmpTypes cmpop) { if (src1 == null) throw new ArgumentNullException("src1"); if (src2 == null) throw new ArgumentNullException("src2"); if (dst == null) throw new ArgumentNullException("dst"); src1.ThrowIfDisposed(); src2.ThrowIfDisposed(); dst.ThrowIfNotReady(); NativeMethods.core_compare(src1.CvPtr, src2.CvPtr, dst.CvPtr, (int)cmpop); GC.KeepAlive(src1); GC.KeepAlive(src2); dst.Fix(); }
/// <summary> /// Compares elements of two matrices (or of a matrix and scalar). /// </summary> /// <param name="src1">First source matrix or scalar.</param> /// <param name="src2">Second source matrix or scalar.</param> /// <param name="dst">Destination matrix that has the same size as the input array(s) and type CV_8U.</param> /// <param name="cmpop">Flag specifying the relation between the elements to be checked: /// - **CMP_EQ:** a(.) == b(.) /// - **CMP_GT:** a(.) \> b(.) /// - **CMP_GE:** a(.) \>= b(.) /// - **CMP_LT:** a(.) \< b(.)\ /// - **CMP_LE:** a(.) \<= b(.) /// - **CMP_NE:** a(.) != b(.)</param> /// <param name="stream">Stream for the asynchronous version.</param> public static void compare(InputArray src1, InputArray src2, OutputArray dst, CmpTypes cmpop, Stream stream = null) { if (src1 == null) { throw new ArgumentNullException(nameof(src1)); } if (src2 == null) { throw new ArgumentNullException(nameof(src2)); } if (dst == null) { throw new ArgumentNullException(nameof(dst)); } src1.ThrowIfDisposed(); src2.ThrowIfDisposed(); dst.ThrowIfNotReady(); NativeMethods.cuda_arithm_compare(src1.CvPtr, src2.CvPtr, dst.CvPtr, (int)cmpop, stream?.CvPtr ?? Stream.Null.CvPtr); GC.KeepAlive(src1); GC.KeepAlive(src2); GC.KeepAlive(dst); dst.Fix(); }