CountNonZero() 개인적인 메소드

private CountNonZero ( IntPtr src ) : int
src System.IntPtr
리턴 int
예제 #1
0
        /// <summary>
        /// Returns true if the two GpuMat equals
        /// </summary>
        /// <param name="other">The other GpuMat to be compares with</param>
        /// <returns>True if the two GpuMat equals</returns>
        public bool Equals(GpuMat <TDepth> other)
        {
            if (NumberOfChannels != other.NumberOfChannels || Size != other.Size)
            {
                return(false);
            }

            using (GpuMat <TDepth> xor = new GpuMat <TDepth>(Size, NumberOfChannels))
            {
                GpuInvoke.BitwiseXor(_ptr, other, xor, IntPtr.Zero, IntPtr.Zero);

                if (xor.NumberOfChannels == 1)
                {
                    return(GpuInvoke.CountNonZero(xor) == 0);
                }
                else
                {
                    using (GpuMat <TDepth> singleChannel = xor.Reshape(1, 0))
                    {
                        return(GpuInvoke.CountNonZero(singleChannel) == 0);
                    }
                }
            }
        }