L_SRADAnisotropicDiffusion

#include "Ltimgcor.h"

L_LTIMGCOR_API L_INT L_TADAnisotropicDiffusion ( pBitmap, nIter, nLambda, pRect)

pBITMAPHANDLE pBitmap;

pointer to the bitmap handle

L_INT nIter;

number of iterations the filter will perform

L_INT nLambda;

smoothing time step value

LPRECT pRect;

the homgeneous region of uniform speckles

Applies a 2-Dimensional Anisotropic Diffusion filter on an image in order to reduce noise and speckling, while preserving the edges.

Parameter

Description

pBitmap

Pointer to the bitmap handle.

nIter

Number of iterations the filter will perform. The default value is 10.

nLambda

The smoothing time step value. Valid values range from 0 to 100. A value of 0 means nothing will be done to the image. The default value is 50.

pRect

Pointer to a rectangle representing the homogeneous region of uniform speckles.     

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The Speckle Reducing Anisotropic Diffusion (SRAD) function  is similar to the L_AverageFilterBitmap function, but is used to reduce noise and speckling in images while preserving the edges instead of blurring.

LEADTOOLS offers three functions that implement anisotropic diffusion:

All three reduce noise and preserve edges and perform better than the L_MedianFilterBitmap or L_GaussianFilterBitmap functions. With the anisotropic functions, areas within regions are smoothed, but the edges are not affected.

The number of iterations controls the number of times the filter will be applied to an image. The lower the number of iterations, the faster the filter will perform. Higher iterations typically mean clearer results.

This function can only process the entire image. It does not support regions.

This function supports 8- and 16-bit grayscale images and 24- and 32-bit colored images.

This function supports signed/unsigned images.

Required DLLs and Libraries

LTIMGCOR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

L_AnisotropicDiffusionBitmap, L_MedianFilterBitmap, L_GaussianFilterBitmap, L_TADAnisotropicDiffusion, L_AverageFilterBitmap

Topics:

Raster Image Functions: Filtering Images 

 

Removing Noise 

Detecting and Enhancing Edges and Lines

Example

This example loads a bitmap and applies SRADAnisotropicDiffusion.

L_INT SRADAnisotropicDiffusionExample(L_VOID) 
{ 
    L_INT nRet; 
    BITMAPHANDLE LeadBitmap;   /* Bitmap handle to hold the loaded image. */ 
    /* Load the bitmap, keeping the bits per pixel of the file */ 
    nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE3.dcm")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
    if(nRet != SUCCESS) 
        return nRet ; 
 
    /* Apply SRADAnisotropicDiffusion filter */ 
    RECT rc ; 
    rc.left   = 150; 
    rc.right  = 180; 
    rc.top    = 300; 
    rc.bottom = 330; 
    nRet = L_SRADAnisotropicDiffusion(&LeadBitmap, 10, 50, &rc); 
 
    if(nRet == SUCCESS) 
        nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL); 
 
    //free bitmap 
    if(LeadBitmap.Flags.Allocated) 
        L_FreeBitmap(&LeadBitmap) ; 
 
    return nRet ; 
} 

Help Version 20.0.2018.7.30
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help