GaussianFit.Core
1.0.3
See the version list below for details.
dotnet add package GaussianFit.Core --version 1.0.3
NuGet\Install-Package GaussianFit.Core -Version 1.0.3
<PackageReference Include="GaussianFit.Core" Version="1.0.3" />
<PackageVersion Include="GaussianFit.Core" Version="1.0.3" />
<PackageReference Include="GaussianFit.Core" />
paket add GaussianFit.Core --version 1.0.3
#r "nuget: GaussianFit.Core, 1.0.3"
#:package GaussianFit.Core@1.0.3
#addin nuget:?package=GaussianFit.Core&version=1.0.3
#tool nuget:?package=GaussianFit.Core&version=1.0.3
GaussianFit.Core
A small .NET Standard 2.0 library for 2D Gaussian fitting from System.Drawing.Bitmap inputs.
Works on .NET Framework 4.6.1+ and modern .NET (6/7/8).
🚀 Install
dotnet add package GaussianFit.Core
💻 Quick Start
using GaussianFit.Core;
var result = GaussianFitter.Run("beam.png", new FitOptions {
Mode = PrepMode.EdgeMean_BorderPct,
BorderPercent = 10,
CutoffPercent = 30
});
Console.WriteLine(result.ReportText);
Example output:
A (amplitude) = 215.63
x0, y0 = 123.4, 98.5
σx, σy = 12.1, 11.9
RMSE = 0.024
nRMSE (RMSE/A) = 1.12 % [Excellent]
⚙️ Configuration Options
| Property | Description | Default |
|---|---|---|
Mode |
Preprocessing mode (EdgeMean_BorderPct or Percentile_GlobalP) |
EdgeMean_BorderPct |
BorderPercent |
Border area (%) used for background mean | 10.0 |
PercentileP |
Percentile threshold (0.1–50.0%) for Percentile_GlobalP mode |
10.0 |
CutoffPercent |
Minimum intensity (%) for fitting samples | 30.0 |
MaxIterations |
Maximum Levenberg–Marquardt iterations | 200 |
Epsilon |
Stop criterion ( ΔSSE / SSE) | 1e-9 |
📈 Algorithm Overview
The 2D Gaussian model is defined as:
f(x, y) = A · exp( -((x − x₀)² / (2σₓ²) + (y − y₀)² / (2σᵧ²)) ) + C
where:
| Symbol | Description |
|---|---|
| f(x, y) | Fitted Gaussian intensity value at coordinates (x, y) |
| A | Amplitude (peak value above background) |
| x₀, y₀ | Center position (mean) of the Gaussian distribution |
| σₓ, σᵧ | Standard deviations (spread) along x and y axes |
| C | Constant background offset |
| exp(·) | Exponential function, e raised to the given argument |
The library iteratively minimizes the Sum of Squared Errors (SSE) between the measured data and the model using the Levenberg–Marquardt optimizer.
🎯 Visualization Guide
When drawing overlays (as in the WinForms demo):
🟢 Green ellipse = 1σ boundary (~68% energy)
🟠 Orange ellipse = FWHM/2 radius (~1.177σ)
🔵 Blue ellipse = 1/e² boundary (radius = 2σ)
🧠 Example Use Cases
- Laser beam profiling
- Optical spot measurement
- Image-based Gaussian fitting for microscopy or sensors
📜 License
MIT License © 2025 Napat Sutikant
| 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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. |
-
.NETStandard 2.0
- System.Drawing.Common (>= 9.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.