/// <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 other) { if (this.IsEmpty) { if (!other.IsEmpty) { return(false); } } else if (other.IsEmpty) { return(false); } if (NumberOfChannels != other.NumberOfChannels || Size != other.Size || Type != other.Type) { return(false); } Size s = Size; using (GpuMat xor = new GpuMat()) { CudaInvoke.BitwiseXor(this, other, xor, null, null); if (xor.NumberOfChannels == 1) { return(CudaInvoke.CountNonZero(xor) == 0); } else { using (GpuMat singleChannel = xor.Reshape(1, 0)) { return(CudaInvoke.CountNonZero(singleChannel) == 0); } } } }