コード例 #1
0
 public static TemplateFootprint Of(SampleFingerprint fp)
 {
     return(PersistentCache.Get("footprints", fp.Path, () =>
     {
         var footprint = new TemplateFootprint();
         var serialized = NativeTemplate.Serialized(fp);
         footprint.Count = 1;
         footprint.Serialized = serialized.Length;
         footprint.Hash = DataHash.Of(SerializationUtils.Normalize(serialized));
         return footprint;
     }));
 }
コード例 #2
0
 public static double[][] Of(SampleDataset dataset)
 {
     return(PersistentCache.Get("scores", dataset.Path, () =>
     {
         var fingerprints = dataset.Fingerprints;
         var templates = fingerprints.Select(fp => NativeTemplate.Of(fp)).ToList();
         var scores = new double[fingerprints.Count][];
         foreach (var probe in fingerprints)
         {
             var matcher = new FingerprintMatcher(templates[probe.Id]);
             scores[probe.Id] = new double[fingerprints.Count];
             foreach (var candidate in fingerprints)
             {
                 scores[probe.Id][candidate.Id] = matcher.Match(templates[candidate.Id]);
             }
         }
         return scores;
     }));
 }