Skip to content

Commit db25cd8

Browse files
Zixu_WangZixu_Wang
authored andcommitted
Fix an issue that occurred when processing the folder with only one image.
1 parent b90dbca commit db25cd8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

SimilarImages/SimilarImages/ImageHash.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public static List<Tuple<string, string, double>> GetSimilarity(
3333
{
3434
throw new DirectoryNotFoundException("Directory not found.");
3535
}
36-
Debug.WriteLine($"Hash Algorithm: {hashEnum} Precision: {precision}\n" +
37-
$"Interpolation Mode: {interpolationMode} Threshold: {threshold}");
36+
Debug.WriteLine($"Hash Algorithm: {hashEnum}\nPrecision: {precision}\n" +
37+
$"Interpolation Mode: {interpolationMode}\nThreshold: {threshold}");
3838

3939
watch.Restart();
4040

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

0 commit comments

Comments
 (0)