@@ -42,7 +42,7 @@ This project implements the following algorithms:
42
42
### Calculate image hash
43
43
44
44
<!-- snippet: CalculateImageHash -->
45
- <a id =' snippet-calculateimagehash ' ></a >
45
+ <a id =' snippet-CalculateImageHash ' ></a >
46
46
``` cs
47
47
var hashAlgorithm = new AverageHash ();
48
48
// or one of the other available algorithms:
@@ -54,22 +54,22 @@ using var stream = File.OpenRead(filename);
54
54
55
55
ulong imageHash = hashAlgorithm .Hash (stream );
56
56
```
57
- <sup ><a href =' /tests/ImageHash.Test/Examples.cs#L14-L26 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-calculateimagehash ' title =' Start of snippet ' >anchor</a ></sup >
57
+ <sup ><a href =' /tests/ImageHash.Test/Examples.cs#L14-L26 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CalculateImageHash ' title =' Start of snippet ' >anchor</a ></sup >
58
58
<!-- endSnippet -->
59
59
60
60
### Calculate image similarity
61
61
Note that to calculate the image similarity, both image hashes should have been calculated using the same hash algorihm.
62
62
63
63
<!-- snippet: CalculateSimilarity -->
64
- <a id =' snippet-calculatesimilarity ' ></a >
64
+ <a id =' snippet-CalculateSimilarity ' ></a >
65
65
``` cs
66
66
// calculate the two image hashes
67
67
ulong hash1 = hashAlgorithm .Hash (imageStream1 );
68
68
ulong hash2 = hashAlgorithm .Hash (imageStream2 );
69
69
70
70
double percentageImageSimilarity = CompareHash .Similarity (hash1 , hash2 );
71
71
```
72
- <sup ><a href =' /tests/ImageHash.Test/Examples.cs#L35-L43 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-calculatesimilarity ' title =' Start of snippet ' >anchor</a ></sup >
72
+ <sup ><a href =' /tests/ImageHash.Test/Examples.cs#L35-L43 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CalculateSimilarity ' title =' Start of snippet ' >anchor</a ></sup >
73
73
<!-- endSnippet -->
74
74
75
75
You can also take a look at [ DotNet APIs] ( http://dotnetapis.com/pkg/CoenM.ImageSharp.ImageHash ) .
0 commit comments