added NORM_HAMMING* support to cv::norm (ticket #1840)

This commit is contained in:
Vadim Pisarevsky
2012-04-23 12:19:02 +00:00
parent 8dae3431c7
commit 40f2c716af
3 changed files with 225 additions and 40 deletions

View File

@@ -1226,7 +1226,14 @@ struct NormOp : public BaseElemWiseOp
};
int getRandomType(RNG& rng)
{
return cvtest::randomType(rng, DEPTH_MASK_ALL_BUT_8S, 1, 4);
int type = cvtest::randomType(rng, DEPTH_MASK_ALL_BUT_8S, 1, 4);
normType = 1 << rng.uniform(0, 3);
if( CV_MAT_DEPTH(type) == CV_8U && (rng.next() & 8) != 0 )
{
normType = cv::NORM_HAMMING + rng.uniform(0, 2);
type = CV_MAT_DEPTH(type);
}
return type;
}
void op(const vector<Mat>& src, Mat& dst, const Mat& mask)
{
@@ -1242,7 +1249,6 @@ struct NormOp : public BaseElemWiseOp
}
void generateScalars(int, RNG& rng)
{
normType = 1 << rng.uniform(0, 3);
}
double getMaxErr(int)
{