GdPicture image identifier.
Level corresponding to number of pixels to include in the median operation, where Level = n, corresponds to (n*2+1)^2 pixels to be included. For Example, KernelSize = 1 includes 9 pixels in the median operation, KernelSize = 2 includes 25 pixels in the median operation. Range from 1 to 60. If value supplied is out of range the method will return GdPictureStatus.InvalidParameter.
Example





In This Topic

FxMedian Method (GdPictureImaging)

In This Topic
Performs a median filter of any size of kernel (amount of pixels included in operation) on a GdPicture image or on an area of a GdPicture image defined by SetROI() method. This method clears the image of Salt and Pepper noise, which is random dot like noise of white and black color.
Syntax
'Declaration
 
Public Function FxMedian( _
   ByVal ImageID As Integer, _
   ByVal KernelSize As Integer _
) As GdPictureStatus
public GdPictureStatus FxMedian( 
   int ImageID,
   int KernelSize
)
public function FxMedian( 
    ImageID: Integer;
    KernelSize: Integer
): GdPictureStatus; 
public function FxMedian( 
   ImageID : int,
   KernelSize : int
) : GdPictureStatus;
public: GdPictureStatus FxMedian( 
   int ImageID,
   int KernelSize
) 
public:
GdPictureStatus FxMedian( 
   int ImageID,
   int KernelSize
) 

Parameters

ImageID
GdPicture image identifier.
KernelSize
Level corresponding to number of pixels to include in the median operation, where Level = n, corresponds to (n*2+1)^2 pixels to be included. For Example, KernelSize = 1 includes 9 pixels in the median operation, KernelSize = 2 includes 25 pixels in the median operation. Range from 1 to 60. If value supplied is out of range the method will return GdPictureStatus.InvalidParameter.

Return Value

A member of the GdPictureStatus enumeration.
Remarks
This method is used in the "Image Processing" and the "Document Clean Up" C# Demo.
Example
Performing a median filter on a jpeg image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // LoadInMemory parameter is set to true in order to be able to update the input file.
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg", true);
 
    // Range from 1 to 60. The higher the value, the harsher it applies the filter.
    int kernel_size = 2;
 
    // Performing a median filter.
    gdpictureImaging.FxMedian(imageID, kernel_size);
    gdpictureImaging.SaveAsJPEG(imageID, "image.jpg");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also