ImageEn, unit ievision

TIEVisionImage.smooth

TIEVisionImage.smooth


Declaration

procedure smooth(dst: TIEVisionImage; smoothType: TIEVisionSmoothType = ievGAUSSIAN; param1: int32_t = 3; param2: int32_t = 0; param3: double = 0.0; param4: double = 0.0); overload; safecall;
procedure smooth(smoothType: TIEVisionSmoothType = ievGAUSSIAN; param1: int32_t = 3; param2: int32_t = 0; param3: double = 0.0; param4: double = 0.0); overload; safecall;


Description

Smooths the image.
First overload places the result into destination object.
Second overload updates the current image.

Parameter Description
dst Container for the destination image
smoothType Type of the smoothing
param1 Parameter 1. See description for each smoothType below
param2 Parameter 2. See description for each smoothType below
param3 Parameter 3. See description for each smoothType below
param4 Parameter 4. See description for each smoothType below

smoothType can be:
Parameter Description
ievBLUR_NO_SCALE Linear convolution with param1 x param2 box kernel (all 1's). To smooth different pixels with different-size box kernels, you can use the integral image that is computed using integral.
ievBLUR Linear convolution with param1 x param2 box kernel (all 1's) with subsequent scaling by 1 / (param1 * param2).
ievGAUSSIAN Linear convolution with a param1 x param2 Gaussian kernel (values should be odd).
ievMEDIAN Median filter with a param1 x param2 square aperture (values should be odd).
ievBILATERAL Bilateral filter with a param1 x param2 square aperture, color sigma= param3 and spatial sigma= param4. If param1=0, the aperture square side is set to round(param4*1.5)*2+1.

Note: For ievGAUSSIAN and ievMEDIAN param1 must be an ODD value

Also see: Comparison of smoothing, blurring and noise reduction methods


Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Examples

// Load test image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

  

// Smooth image using Blur
ImageEnView1.IEBitmap.GetIEVisionImage().smooth( ImageEnView1.IEBitmap.GetIEVisionImage(), ievBLUR );
ImageEnView1.Update();

  

// Smooth image using Gaussian
ImageEnView1.IEBitmap.GetIEVisionImage().smooth( ImageEnView1.IEBitmap.GetIEVisionImage(), ievGAUSSIAN );
ImageEnView1.Update();

  

// Smooth image using Median
ImageEnView1.IEBitmap.GetIEVisionImage().smooth( ImageEnView1.IEBitmap.GetIEVisionImage(), ievMEDIAN );
ImageEnView1.Update();

  

// Smooth image using Bilateral
// For Param3 and Param4, values in the range 30-100 are best
bmp.Assign( ienOriginal.IEBitmap );
ImageEnView1.IEBitmap.GetIEVisionImage().smooth( bmp.GetIEVisionImage(), ievBILATERAL, 5, 5, 30, 30 );
ImageEnView1.Update();