派生自 Algorithm/baseDetector

sunty
2022-03-21 d0a24896f95b4e060011852f80048ebfb0bf5f55
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//
// Created by Scheaven on 2020/9/3.
//
#include "feature_util.h"
 
double feature_distance(FEATURE feat1, FEATURE feat2)
{
    double FeatA=0.0, FeatB=0.0, score=0.0;
    for (int i = 0; i < 128; i++)
    {
        FeatA += double(feat1[i])*double(feat1[i]);
        FeatB += double(feat2[i])*double(feat2[i]);
        score += double(feat1[i])*double(feat2[i]);
    }
 
 
 
    FeatA = sqrt(FeatA);
    FeatB = sqrt(FeatB);
 
    score = score / (FeatA * FeatB);
 
    if (score < 0) {
        score = 0;
    }
    printf("--评分---%f--",score);
    return score;
}