Skip to content

Commit

Permalink
Docs changes
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Apr 8, 2024
1 parent aba6e19 commit 698ec0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This project implements the following algorithms:
### Calculate image hash

<!-- snippet: CalculateImageHash -->
<a id='snippet-calculateimagehash'></a>
<a id='snippet-CalculateImageHash'></a>
```cs
var hashAlgorithm = new AverageHash();
// or one of the other available algorithms:
Expand All @@ -54,22 +54,22 @@ using var stream = File.OpenRead(filename);

ulong imageHash = hashAlgorithm.Hash(stream);
```
<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>
<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>
<!-- endSnippet -->

### Calculate image similarity
Note that to calculate the image similarity, both image hashes should have been calculated using the same hash algorihm.

<!-- snippet: CalculateSimilarity -->
<a id='snippet-calculatesimilarity'></a>
<a id='snippet-CalculateSimilarity'></a>
```cs
// calculate the two image hashes
ulong hash1 = hashAlgorithm.Hash(imageStream1);
ulong hash2 = hashAlgorithm.Hash(imageStream2);

double percentageImageSimilarity = CompareHash.Similarity(hash1, hash2);
```
<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>
<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>
<!-- endSnippet -->

You can also take a look at [DotNet APIs](http://dotnetapis.com/pkg/CoenM.ImageSharp.ImageHash).
Expand Down
8 changes: 4 additions & 4 deletions src/ImageHash/PackageDescription.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ See [github](https://www.github.com/coenm/ImageHash/) for more information.
## Calculate image hash

<!-- snippet: CalculateImageHash -->
<a id='snippet-calculateimagehash'></a>
<a id='snippet-CalculateImageHash'></a>
```cs
var hashAlgorithm = new AverageHash();
// or one of the other available algorithms:
Expand All @@ -18,20 +18,20 @@ using var stream = File.OpenRead(filename);

ulong imageHash = hashAlgorithm.Hash(stream);
```
<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>
<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>
<!-- endSnippet -->

## Calculate image similarity
Note that to calculate the image similarity, both image hashes should have been calculated using the same hash algorihm.

<!-- snippet: CalculateSimilarity -->
<a id='snippet-calculatesimilarity'></a>
<a id='snippet-CalculateSimilarity'></a>
```cs
// calculate the two image hashes
ulong hash1 = hashAlgorithm.Hash(imageStream1);
ulong hash2 = hashAlgorithm.Hash(imageStream2);

double percentageImageSimilarity = CompareHash.Similarity(hash1, hash2);
```
<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>
<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>
<!-- endSnippet -->

0 comments on commit 698ec0e

Please sign in to comment.