コード例 #1
0
ファイル: Program.cs プロジェクト: fallk/HSNXT.Extensions
        /// <summary>
        /// Method to compare 2 image hashes
        /// </summary>
        /// <returns>% of similarity</returns>
        public double CompareWith(ImgHash compareWith)
        {
            if (HashData.Length != compareWith.HashData.Length)
            {
                throw new Exception("Cannot compare hashes with different sizes");
            }

            var differenceCounter = HashData.Where((t, i) => t != compareWith.HashData[i]).Count();

            return(100 - differenceCounter / 100.0 * HashData.Length / 2.0);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: fallk/HSNXT.Extensions
 private static void Main(string[] args)
 {
     Console.WriteLine("Hello World!");
     foreach (var f in Directory.EnumerateFiles("../Cheaturu/poke_out/poke"))
     {
         Console.WriteLine(f);
         var hash = new ImgHash();
         hash.GenerateFromPath(f);
         File.WriteAllText("./data/" + Path.GetFileNameWithoutExtension(f) + ".txt", string.Join(",", hash.HashData));
     }
 }