Declaration ​
pascal
procedure SelectiveGaussianBlur32(ASource, ADest: TBitmap32; Radius: TFloat; Delta: Integer);Parameters ​
| Parameter | Type | Description |
|---|---|---|
ASource | TBitmap32 | Source 32-bit bitmap to read pixels from. |
ADest | TBitmap32 | Destination 32-bit bitmap to receive the edge-preserved blurred output. |
Radius | TFloat | Spatial blur radius in pixels. |
Delta | Integer | Maximum color channel difference threshold (0..255). |
Description ​
SelectiveGaussianBlur32 performs edge-preserving Gaussian blurring on 32-bit ARGB bitmaps.
Neighbor pixels within the spatial window (Radius) are accumulated into the weighted Gaussian sum only if their color channel difference from the center pixel is within the specified Delta threshold:
Behavior Summary ​
- Preserving Details: Setting a modest
Delta(e.g.) smooths noise, JPEG compression artifacts, and flat region variations while leaving sharp contrast edges completely intact. - Alpha Channel: The Alpha channel is preserved without being blurred.
Example ​
pascal
var
Src, Dst: TBitmap32;
begin
Src := TBitmap32.Create;
Dst := TBitmap32.Create;
try
Src.LoadFromFile('photo_noisy.png');
// Smooth surface noise (Radius=4.0) while preserving sharp edges (Delta=15)
SelectiveGaussianBlur32(Src, Dst, 4.0, 15);
Dst.SaveToFile('photo_denoised.png');
finally
Src.Free;
Dst.Free;
end;
end;