Ask Your Question

Revision history [back]

Matrix expressions comparison result

I’m using the following matrix comparison to see if two 3 channel 8 bit color images are identical:

Mat result = image1 != image2;

Your documentation states: The result of comparison is an 8-bit single channel mask whose elements are set to 255 (if the particular element or pair of elements satisfy the condition) or 0.

So, I was expecting the result matrix to be a single channel binary image. However, I find that result is actually a three channel matrix. If I split the result into three planes and count non-zero for each plane, and if each of the counts is zero then I know that the two images are identical. Do I misunderstand your documentation? Can someone clarify this for me?

Thank you, WJS