HomographySharp 3.3.0
.NET 6.0
.NET Standard 2.0
dotnet add package HomographySharp --version 3.3.0
NuGet\Install-Package HomographySharp -Version 3.3.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HomographySharp" Version="3.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HomographySharp --version 3.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HomographySharp, 3.3.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HomographySharp as a Cake Addin
#addin nuget:?package=HomographySharp&version=3.3.0
// Install HomographySharp as a Cake Tool
#tool nuget:?package=HomographySharp&version=3.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
HomographySharp
HomographySharp is a C# class library for finding and using homography matrix.
Install
NuGet: HomographySharp
Package Manager
PM > Install-Package HomographySharp
.NET CLI
dotnet add package HomographySharp
Usage
Find homography matrix
//System.Numerics.Vector2
var srcList = new List<Vector2>(4);
var dstList = new List<Vector2>(4);
srcList.Add(new Vector2(-152, 394));
srcList.Add(new Vector2(218, 521));
srcList.Add(new Vector2(223, -331));
srcList.Add(new Vector2(-163, -219));
dstList.Add(new Vector2(-666, 431));
dstList.Add(new Vector2(500, 300));
dstList.Add(new Vector2(480, -308));
dstList.Add(new Vector2(-580, -280));
// args type: ReadOnlySpan, IReadOnlyList, T[]
HomographyMatrix<float> homo = Homography.Find(srcList, dstList);
Point2<float> result = homo.Translate(-152, 394);
Assert.IsTrue(Math.Abs(result.X - -666) < 0.001); //true
Assert.IsTrue(Math.Abs(result.Y - 431) < 0.001); //true
// System.Drawing.PointF
PointF pointf = result.ToPointF();
// System.Numerics.Vector2
Vector2 vector2 = result.ToVector2();
// MathNet.Numerics.LinearAlgebra.Matrix<T>
Matrix<float> mat = homo.ToMathNetMatrix();
or
//HomographySharp.Point2<T>
var srcArray = new Point2<double>[4]; // or Point2<float>
var dstArray = new Point2<double>[4];
srcArray[0] = new Point2<double>(10, 10);
srcArray[1] = new Point2<double>(100, 10);
srcArray[2] = new Point2<double>(100, 150);
srcArray[3] = new Point2<double>(10, 150);
dstArray[0] = new Point2<double>(11, 11);
dstArray[1] = new Point2<double>(500, 11);
dstArray[2] = new Point2<double>(500, 200);
dstArray[3] = new Point2<double>(11, 200);
HomographyMatrix<double> homo = Homography.Find(srcList.AsSpan(), dstList.AsSpan());
Point2<double> result = homo.Translate(100, 10);
Assert.IsTrue(Math.Abs(result.X - 500) < 0.001); //true
Assert.IsTrue(Math.Abs(result.Y - 11) < 0.001); //true
Json serialize support
using System.Text.Json;
var homoMat = Homography.Find(srcList, dstList);
string json = JsonSerializer.Serialize(homo);
var homoMat2 = JsonSerializer.Deserialize<HomographyMatrix<double>>(json);
Create homography matrix from raw array
HomographyMatrix<double> homoMat = ...;
var newMat = Homography.Create(homoMat.ElementsAsSpan());
Visualization App
Use visualization app if you want to see how points are transformed by a homography matrix.
Dependent Library
- Math.NET Numerics
- Copyright (c) 2002-2022 Math.NET
- Released under the MIT/X11 License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.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. |
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- MathNet.Numerics (>= 5.0.0)
- System.Memory (>= 4.5.5)
- System.Numerics.Vectors (>= 4.5.0)
- System.Text.Json (>= 7.0.1)
-
net6.0
- MathNet.Numerics (>= 5.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 |
---|---|---|
3.3.0 | 1,065 | 2/5/2023 |
3.2.1 | 2,623 | 6/4/2022 |
3.2.0 | 573 | 4/8/2022 |
3.1.1 | 3,138 | 11/14/2021 |
3.1.0 | 1,422 | 11/13/2021 |
3.0.1 | 704 | 5/20/2021 |
2.1.1 | 342 | 3/3/2021 |
2.0.1 | 322 | 1/14/2021 |
2.0.0 | 447 | 10/19/2020 |
1.5.0 | 1,101 | 11/6/2019 |
1.4.0 | 446 | 9/21/2019 |
1.3.6 | 478 | 9/7/2019 |
1.3.2 | 526 | 6/20/2019 |
1.3.0 | 544 | 6/19/2019 |
1.2.4 | 549 | 6/16/2019 |
1.2.0 | 549 | 6/11/2019 |
1.1.2 | 531 | 5/12/2019 |
1.1.1 | 618 | 2/3/2019 |
1.1.0 | 621 | 2/1/2019 |
1.0.3 | 685 | 1/12/2019 |
1.0.2 | 661 | 1/10/2019 |
1.0.0 | 722 | 1/9/2019 |