Zefirrat.ImageComparer.AspNet.Di
1.0.0
See the version list below for details.
dotnet add package Zefirrat.ImageComparer.AspNet.Di --version 1.0.0
NuGet\Install-Package Zefirrat.ImageComparer.AspNet.Di -Version 1.0.0
<PackageReference Include="Zefirrat.ImageComparer.AspNet.Di" Version="1.0.0" />
paket add Zefirrat.ImageComparer.AspNet.Di --version 1.0.0
#r "nuget: Zefirrat.ImageComparer.AspNet.Di, 1.0.0"
// Install Zefirrat.ImageComparer.AspNet.Di as a Cake Addin #addin nuget:?package=Zefirrat.ImageComparer.AspNet.Di&version=1.0.0 // Install Zefirrat.ImageComparer.AspNet.Di as a Cake Tool #tool nuget:?package=Zefirrat.ImageComparer.AspNet.Di&version=1.0.0
Zefirrat.ImageComparer
Recognition of similar or same images, with varying degrees of accuracy.
For example, for images with noise, the similarity of compressed images and the original ones, to search for the original image by its compressed copy, to search for images with small changes or distortions.
Test demonstrations
First image for compare (source):
Comparing with compressed:
Result:
Accuracy: VeryLow
Similar: True ✔
Equal: True ✔
-------------------------
Accuracy: Low
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: Medium
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: High
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: VeryHigh
Similar: False ✖
Equal: False ✖
-------------------------
Added transparent drawing at right bottom corner:
Result:
Accuracy: VeryLow
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: Low
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: Medium
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: High
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: VeryHigh
Similar: False ✖
Equal: False ✖
-------------------------
Added few red curves:
Result:
Accuracy: VeryLow
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: Low
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: Medium
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: High
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: VeryHigh
Similar: False ✖
Equal: False ✖
-------------------------
Added more red curves:
Result:
Accuracy: VeryLow
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: Low
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: Medium
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: High
Similar: False ✖
Equal: False ✖
-------------------------
Accuracy: VeryHigh
Similar: False ✖
Equal: False ✖
-------------------------
Added mush more red curves:
Result:
Accuracy: VeryLow
Similar: True ✔
Equal: False ✖
-------------------------
Accuracy: Low
Similar: False ✖
Equal: False ✖
-------------------------
Accuracy: Medium
Similar: False ✖
Equal: False ✖
-------------------------
Accuracy: High
Similar: False ✖
Equal: False ✖
-------------------------
Accuracy: VeryHigh
Similar: False ✖
Equal: False ✖
-------------------------
Installation
PM > Install-Package Zefirrat.ImageComparer
Usage
Base
var imageComparer = new ImageComparer();
using var image1 = Image.Load("../../../../Test_Images/test_image_source.png");
using var image2 = Image.Load("../../../../Test_Images/test_image_source_compressed.jpg");
var similar = imageComparer.AreSimilar(image1, image2);
var equal = imageComparer.AreEqual(image1, image2);
Accuracy options
Выше значение - выше допускаемый разброс.
public cllass ImageComparer
{
// ...
public static class AccuracyValues
{
public const byte VeryHigh = 1;
public const byte High = 20;
public const byte Medium = 50;
public const byte Low = 90;
public const byte VeryLow = byte.MaxValue;
}
}
var imageComparer = new ImageComparer(ImageComparerOptions.AccuracyValues.VeryHigh);
Dependency Injection
In Configure
:
serviceCollection.AddImageComparer
And then request as interface:
public YourControllerConstructor(IImageComparer imageComparer)
{
_imageComparer = imageComparer;
}
Explanation:
Inspired by the work on the "Manhattan distance" algorithm, which was based on calculating the distance between similar pixels, and based on this value, the probability of similarity of images was compared by the mean square deviation (standard deviation).
I took from this approach, the work with the mean square deviation (standard deviation).
Prepare:
- To begin with, all images are resized to 16x16.
- Then we take the rgba pixel values as coordinate values
- Convert pixels to vectors
- We take the lengths of the vectors
- We get an array of vector lengths for each image being compared
For equality:
- Comparison of the vector difference of each pixel with an acceptable discrepancy
For similarity:
- Getting the quadratic deviation (standard deviation) between the vectors for each image, and the sum of all vectors
- The difference between the total deviation and the deviation for each image should not exceed the allowable discrepancy
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Zefirrat.ImageComparer (>= 1.0.0)
- Zefirrat.ImageComparer.Abstractions (>= 1.0.0)
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Zefirrat.ImageComparer (>= 1.0.0)
- Zefirrat.ImageComparer.Abstractions (>= 1.0.0)
-
.NETStandard 2.1
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Zefirrat.ImageComparer (>= 1.0.0)
- Zefirrat.ImageComparer.Abstractions (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.0 | 142 | 12/14/2023 |
1.1.0.1 | 137 | 12/13/2023 |
1.1.0.1-pre1 | 110 | 12/13/2023 |
1.1.0 | 135 | 12/12/2023 |
1.1.0-pre9 | 118 | 12/12/2023 |
1.1.0-pre2 | 122 | 12/11/2023 |
1.1.0-pre16 | 106 | 12/12/2023 |
1.1.0-pre15 | 105 | 12/12/2023 |
1.1.0-pre14 | 101 | 12/12/2023 |
1.1.0-pre13 | 95 | 12/12/2023 |
1.1.0-pre12 | 111 | 12/12/2023 |
1.1.0-pre11 | 100 | 12/12/2023 |
1.1.0-pre10 | 119 | 12/12/2023 |
1.0.0.4 | 133 | 12/6/2023 |
1.0.0.3 | 126 | 12/6/2023 |
1.0.0.2 | 114 | 12/6/2023 |
1.0.0.1 | 134 | 12/6/2023 |
1.0.0 | 126 | 12/6/2023 |