FastCompute.ImageProcessing
0.8.1
dotnet add package FastCompute.ImageProcessing --version 0.8.1
NuGet\Install-Package FastCompute.ImageProcessing -Version 0.8.1
<PackageReference Include="FastCompute.ImageProcessing" Version="0.8.1" />
<PackageVersion Include="FastCompute.ImageProcessing" Version="0.8.1" />
<PackageReference Include="FastCompute.ImageProcessing" />
paket add FastCompute.ImageProcessing --version 0.8.1
#r "nuget: FastCompute.ImageProcessing, 0.8.1"
#:package FastCompute.ImageProcessing@0.8.1
#addin nuget:?package=FastCompute.ImageProcessing&version=0.8.1
#tool nuget:?package=FastCompute.ImageProcessing&version=0.8.1
FastCompute.ImageProcessing
FastCompute.ImageProcessing is a strongly named .NET 8 library for
backend-neutral native image processing. It depends on the
FastCompute core package and
shares its Scalar CPU, Parallel CPU, SIMD, and GPU execution model.
Install
dotnet add package FastCompute.ImageProcessing --version 0.8.1
The package depends on FastCompute 0.8.1, so the core is restored
automatically. Both assemblies are strongly named with the public key token
c76a60c96d65300c.
Pixel formats
The package provides Rgb24 (tightly packed 24-bit RGB), floating-point
Rgb, Gray8, and GrayF32, together with separate Srgb/Linear encoding
metadata.
using FastCompute;
using FastCompute.ImageProcessing;
Image<Rgb24> decoded = Image<Rgb24>.Load(pixels, width, height);
Image<Rgb24> view = Image<Rgb24>.Wrap(memory, width, height); // zero-copy
Image<TPixel> owns an array or wraps contiguous Memory<TPixel> without
copying. It provides row spans, CopyRow, Clone, and Crop.
Conversions
Image<GrayF32> linear = decoded.ToGrayscaleF32(ColorEncoding.Linear);
Image<Gray8> compact = decoded.ToGrayscale8();
Image<Rgb> wide = decoded.ToRgbF32(ColorEncoding.Linear);
Image<Rgb24> roundTrip = linear.ToRgb24(ColorEncoding.Srgb);
ToLinear and ToSrgb convert nonlinear/linear light in place of the
supported value types.
Filters and spatial operations
All filters accept the same ComputeOptions contract as the array API:
Image<GrayF32> lowPass = linear.BoxBlur(radius: 1);
Image<GrayF32> gaussian = linear.GaussianBlur(radius: 2, sigma: 1.5f);
Image<GrayF32> edges = linear.Sobel();
Image<GrayF32> laplacian = linear.Laplacian();
Image<GrayF32> residual = linear.Subtract(lowPass);
Image<GrayF32> resized = linear.Resize(width: 1024, height: 768);
Image<GrayF32> downsampled = linear.Downsample(width: 256, height: 256);
CPU area downsampling vectorizes accumulation across each source interval. GPU box blur uses parallel per-pixel kernels for small radii and switches to a linear-time sliding-window pass for radii greater than four. Local contrast, local window entropy, spectrum preparation, and radial spectra are available for analysis-style pipelines.
Bayer CFA and camera simulation
float[] mosaic = rgb.ToBayer(BayerPattern.Rggb);
Image<Rgb> demosaiced = mosaicImage.DemosaicBilinear();
Image<Rgb> reconstructed = mosaicImage.Demosaic();
rgb.SimulateCamera(new CameraSimulationOptions
{
ShotNoise = 0.002f,
ReadNoise = 0.0005f,
OpticalBlur = 0.5f,
Sharpening = 0.15f,
RandomSeed = 1
});
Camera simulation is intended for robustness testing. It implements optical blur, signal-dependent/read noise, Bayer sampling, basic demosaicing, and sharpening.
GPU execution
Explicit GPU execution is available for conversions, transfer functions, convolution, box blur, subtraction, resize/downsampling, gradients, local contrast/entropy, radial spectra, Bayer/demosaicing, and noise application:
var gpuOptions = new ComputeOptions
{
Backend = ComputeBackendKind.Gpu,
GpuContext = gpu
};
Image<GrayF32> linearGpu = decoded.ToGrayscaleF32(
ColorEncoding.Linear,
gpuOptions);
Image<GrayF32> lowPassGpu = linearGpu.BoxBlur(
radius: 1,
options: gpuOptions);
Auto follows the normal FastCompute thresholds. Host-backed image operations
use GpuSimpleThreshold, which is disabled by default because host/device
transfer often costs more than CPU SIMD. Explicit
Backend = ComputeBackendKind.Gpu always requests the GPU path.
For multi-stage GPU processing, upload once and keep intermediate images on the accelerator:
using ImageBuffer<Rgb24> resident = decoded.UploadToGpu(gpu);
using ImageBuffer<GrayF32> luminance = resident.ToGrayscaleF32(
ColorEncoding.Linear);
using ImageBuffer<GrayF32> blur = luminance.BoxBlur(radius: 1);
using ImageBuffer<GrayF32> residual = luminance.Subtract(blur);
Image<GrayF32> result = residual.Download();
ImageBuffer<TPixel> owns its device allocation and must be disposed.
Conversion, blur, subtraction, resize, and downsampling operate
device-to-device; only UploadToGpu and Download cross the host/device
boundary.
Limitations
- Explicit SIMD requests for local window entropy and phase spectrum are rejected rather than executed by a hidden scalar loop; both operations have Scalar, Parallel CPU, and native GPU paths.
- Nonlinear
Srgb/Lineartransfer conversion must currently use Scalar, Parallel CPU, or GPU. - Percentile/quantile use the runtime in-place sort because FastCompute does not yet expose a backend-native ordering primitive.
- Chromatic aberration and vignetting camera simulation options are reserved for a future implementation.
Further documentation
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. |
-
net8.0
- FastCompute (>= 0.8.1)
- ILGPU (>= 1.5.3)
- ILGPU.Algorithms (>= 1.5.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
# FastCompute.NET Release Notes
## 0.8.1 - 2026-08-14
Documentation-only repack. Each NuGet package now ships its own README:
`FastCompute` carries the core guide and `FastCompute.ImageProcessing` carries
the image processing guide, while the repository root README remains the
project overview. No API or behavior changes.
## 0.8.0 - 2026-08-14
Native signal, statistics, and image processing primitives. The image and
forensics capabilities now live in their own assembly, and the generic numeric
primitives behind them moved into the core package.
### Added
- One- and two-dimensional radix-2 FFT for `Complex32[]` with allocating and
in-place APIs (`Fft`, `FftInPlace`, `Fft2D`, `Fft2DInPlace`, inverse
variants) on Scalar, Parallel CPU, AVX SIMD, and GPU backends.
- `Complex32` native composite value with `PowerSpectrum`,
`MagnitudeSpectrum`, and `PhaseSpectrum` helpers; `FindPeaks`,
`PeakToMedianRatio`, `MeanAbsoluteDifference`, `Percentile`, `Quantile`,
`Median`, and Hann/Hamming/Blackman window functions in
`Compute.Signal`.
- 1D and 2D convolution (`Convolve1D`, `Convolve2D`) with the same
`ComputeOptions` contract.
- Statistics: `CalculateStatistics`, `Mean`, `Variance`, `StandardDeviation`,
`Skewness`, `Kurtosis`, `SumOfSquares`, `Covariance`, `Correlation`,
`AutoCorrelation`, `LinearRegression`, and `ShannonEntropy`.
- Threshold, `MinMax`, `Normalize`, and `SafeDivide` utilities.
- Homogeneous `byte`-component packed values with native SIMD layout
load/store kernels and byte-composite GPU execution for one through four
components.
### Changed
- Image and forensics functionality was moved into the new
`FastCompute.ImageProcessing` assembly and NuGet package. The core
`FastCompute` package has no image dependency; it ships with the generic
primitives above.
- The negative image forensics pipeline now runs on the generic primitives
instead of its own copies of FFT, statistics, convolution, Bayer handling,
and camera simulation. See
`docs/ai-image-forensics-algorithm-migration.md` for the ownership table.
- `Image<TPixel>` gained convolution-backed Gaussian/Sobel/Laplacian filters,
residuals, local contrast and entropy, spectrum preparation, deterministic
area resize, Bayer CFA sampling, and demosaicing on Scalar, Parallel CPU,
SIMD, and GPU.
### Compatibility
- `FastCompute.ImageProcessing` 0.8.0 depends on `FastCompute` 0.8.0 and is
strongly named with the same public key token `c76a60c96d65300c`.
- The original lazy pipeline, reduction fusion, `ComputeMath` (and the
`GpuMath` alias), resident buffers, and chunked/streaming GPU execution
remain unchanged.
- Explicit SIMD requests for local window entropy and phase spectrum are
rejected instead of falling back to a hidden scalar loop; both operations
have Scalar, Parallel CPU, and native GPU paths.