Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

imho, you're calculating something different, than compare() / countNonzero().

try:

uchar s1 = mat1.at<uchar>(y,x);
uchar s2 = mat2.at<uchar>(y,x);
score += (s1 == s2);

imho, you're calculating something different, than compare() / countNonzero().

try:

uchar s1 = mat1.at<uchar>(y,x);
uchar s2 = mat2.at<uchar>(y,x);
score += (s1 == s2);

can you explain, how you arrived at:

score += (s1.val[0]/255)*(s2.val[0]/255);

?