GaussianFit.Core 1.0.3

There is a newer version of this package available.
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
                    
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="GaussianFit.Core" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GaussianFit.Core" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="GaussianFit.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GaussianFit.Core --version 1.0.3
                    
#r "nuget: GaussianFit.Core, 1.0.3"
                    
#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.
#:package GaussianFit.Core@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GaussianFit.Core&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=GaussianFit.Core&version=1.0.3
                    
Install as a Cake Tool

GaussianFit.Core

NuGet License .NET

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

  1. Laser beam profiling
  2. Optical spot measurement
  3. Image-based Gaussian fitting for microscopy or sensors

📜 License

MIT License © 2025 Napat Sutikant

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.1.0 191 1/12/2026
1.0.3 255 11/3/2025
1.0.1 263 10/28/2025