Skip to content

Commit

Permalink
Fix an issue that occurred when processing the folder with only one i…
Browse files Browse the repository at this point in the history
…mage.
  • Loading branch information
Zixu_Wang authored and Zixu_Wang committed Jun 9, 2020
1 parent b90dbca commit db25cd8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions SimilarImages/SimilarImages/ImageHash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public static List<Tuple<string, string, double>> GetSimilarity(
{
throw new DirectoryNotFoundException("Directory not found.");
}
Debug.WriteLine($"Hash Algorithm: {hashEnum} Precision: {precision}\n" +
$"Interpolation Mode: {interpolationMode} Threshold: {threshold}");
Debug.WriteLine($"Hash Algorithm: {hashEnum}\nPrecision: {precision}\n" +
$"Interpolation Mode: {interpolationMode}\nThreshold: {threshold}");

watch.Restart();

Expand All @@ -45,7 +45,7 @@ public static List<Tuple<string, string, double>> GetSimilarity(
// Get hashes
var imageHashPairs = GetImageHashes(folderPath, hashEnum).ToArray();
validImageCount = imageHashPairs.Length;
if (validImageCount == 0) { return null; }
if (validImageCount < 2) { return null; }
watch.Stop();
long hashTime = watch.ElapsedMilliseconds;

Expand Down

0 comments on commit db25cd8

Please sign in to comment.