VintaSoft Twain .NET SDK 15.0: Documentation for .NET developer
Vintasoft.Twain Namespace / AcquiredImage Class / Despeckle(Int32,Int32,Int32,Int32) Method
Syntax Remarks Example Requirements SeeAlso
In This Topic
    Despeckle(Int32,Int32,Int32,Int32) Method (AcquiredImage)
    In This Topic
    Removes noise from image.
    Syntax
    'Declaration
    
    Public Sub Despeckle( _
    ByVal level1
    Maximal quantity of pixels in small noise. Possible values: 0 - 100. Default value is 8. What is "small noise" see below.
    As Integer, _
    ByVal level2
    Maximal quantity of pixels in medium noise. Possible values: 0 - 100. Default value is 25. What is "medium noise" see below.
    As Integer, _
    ByVal radius
    Radius of area around medium noise in which there are no "good objects". Possible values: 0 - 100. Default value is 30. What is "good objects" see below.
    As Integer, _
    ByVal level3
    Maximal quantity of pixels in "border" noise. Possible values: 0 - 3000. Default value is 400. What is "border noise" see below.
    As Integer _
    )
    public void Despeckle(
    int level1,
    int level2,
    int radius,
    int level3
    )
    public: void Despeckle(
    int level1,
    int level2,
    int radius,
    int level3
    )
    public:
    void Despeckle(
    int level1,
    int level2,
    int radius,
    int level3
    )

    Parameters

    level1
    Maximal quantity of pixels in small noise. Possible values: 0 - 100. Default value is 8. What is "small noise" see below.
    level2
    Maximal quantity of pixels in medium noise. Possible values: 0 - 100. Default value is 25. What is "medium noise" see below.
    radius
    Radius of area around medium noise in which there are no "good objects". Possible values: 0 - 100. Default value is 30. What is "good objects" see below.
    level3
    Maximal quantity of pixels in "border" noise. Possible values: 0 - 3000. Default value is 400. What is "border noise" see below.
    Remarks

    This method removes noise from image. Current algorithm removes three types of noise:

    1. Small noise - a set of pixels (non background pixels) with quantity of pixels less than value of level1 parameter. This set of pixels will be replaced to background pixels.

    2. Medium noise - a set of pixels (non background pixels) with quantity of pixels less than value of level2 parameter. This set of pixels will be replaced to background pixels if around this set of pixels in a region with radius of value of radius parameter there is no "good objects". "Good object" - not a noise.

    3. "Border" noise - a set of pixels (non background pixels) with quantity of pixels less than value of level3 parameter. This set of pixels will be replaced to background pixels if at least one pixel from this set of pixels is located on an image border.

    Here is a "good" sequence of operations for image processing:
    1. Despeckle an image (Despeckle(Int32,Int32,Int32,Int32) method)
    2. Deskew an image (Deskew(TwainBorderColor,Int32,Int32) method)
    3. Detect image border (DetectBorder(Int32) method)

    Example

    Please see example here: AcquiredImage.

    Requirements

    Target Platforms: .NET 8, .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also