コード例 #1
0
ファイル: Matrix.cs プロジェクト: y2ket/EmguCVStandard
        /// <summary>
        /// This function compare the current matrix with <paramref name="mat2"/> and returns the comparison mask
        /// </summary>
        /// <param name="mat2">The other matrix to compare with</param>
        /// <param name="type">Comparison type</param>
        /// <returns>The comparison mask</returns>
        public Matrix <Byte> Cmp(Matrix <TDepth> mat2, Emgu.CV.CvEnum.CmpType type)
        {
            Matrix <Byte> res = new Matrix <Byte>(Rows, Cols);

            CvInvoke.Compare(this, mat2, res, type);
            return(res);
        }
コード例 #2
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.
        /// </returns>
        public bool Equals(UMat other)
        {
            if (!(Size.Equals(other.Size) && NumberOfChannels == other.NumberOfChannels && Depth == other.Depth))
            {
                return(false);
            }

            using (UMat cmpResult = new UMat())
            {
                CvInvoke.Compare(this, other, cmpResult, CmpType.NotEqual);
                using (UMat reshaped = cmpResult.Reshape(1))
                    return(CvInvoke.CountNonZero(reshaped) == 0);
            }
        }