派生自 Algorithm/baseDetector

孙天宇
2022-07-12 6eb847801e6d1d66105a8ec2fe8c449c9e24da4c
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;
}