NORM_L2SQR added too (ticket #1840)

This commit is contained in:
Vadim Pisarevsky
2012-04-23 12:29:23 +00:00
parent 40f2c716af
commit b8e70ea6c9
3 changed files with 32 additions and 10 deletions

View File

@@ -1257,6 +1257,8 @@ double norm(const Mat& src, int normType, const Mat& mask)
result += normHamming(planes[0].data, total, cellSize);
return result;
}
int normType0 = normType;
normType = normType == NORM_L2SQR ? NORM_L2 : normType;
CV_Assert( mask.empty() || (src.size == mask.size && mask.type() == CV_8U) );
CV_Assert( normType == NORM_INF || normType == NORM_L1 || normType == NORM_L2 );
@@ -1302,7 +1304,7 @@ double norm(const Mat& src, int normType, const Mat& mask)
CV_Error(CV_StsUnsupportedFormat, "");
};
}
if( normType == NORM_L2 )
if( normType0 == NORM_L2 )
result = sqrt(result);
return result;
}
@@ -1332,6 +1334,8 @@ double norm(const Mat& src1, const Mat& src2, int normType, const Mat& mask)
result += normHamming(planes[0].data, total, cellSize);
return result;
}
int normType0 = normType;
normType = normType == NORM_L2SQR ? NORM_L2 : normType;
CV_Assert( src1.type() == src2.type() && src1.size == src2.size );
CV_Assert( mask.empty() || (src1.size == mask.size && mask.type() == CV_8U) );
@@ -1378,7 +1382,7 @@ double norm(const Mat& src1, const Mat& src2, int normType, const Mat& mask)
CV_Error(CV_StsUnsupportedFormat, "");
};
}
if( normType == NORM_L2 )
if( normType0 == NORM_L2 )
result = sqrt(result);
return result;
}