L_LevelsetBitmapRgn

#include "Ltimgcor.h"

L_LTIMGCOR_API L_INT L_LevelsetBitmapRgn(pBitmap, LambdaIn, LambdaOut)

Performs semi-automatic segmentation (using the Levelset algorithm) by shrinking or expanding a contour represented by a region to the objects in the image.

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle to be segmented.

L_INT LambdaIn

Represents the weight of moving the contour inside. The default value is 1.

L_INT LambdaOut

Represents the weight of moving the contour outside. The default value is 1.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

If the image has no region this function assumes a rectangular region that covers the entire image.

The Levelset algorithm finds the best-fitting contour that encapsulates the object.

Equal values for LambdaIn and LambdaOut allow the algorithm to decide whether to shrink or expand the selected region.

This function supports 12- and 16-bit grayscale and 48- and 64-bit color images.

This function supports signed/unsigned images.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example loads a bitmap and applies Levelest segmentation.

L_INT LevelsetBitmapRgnExample(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 ; 
 
    RECT MainRect ; 
    MainRect.left   = 200 ; 
    MainRect.right  = 300; 
    MainRect.top    = 200 ; 
    MainRect.bottom = 250; 
 
    // set region 
    L_SetBitmapRgnRect(&LeadBitmap, NULL, &MainRect, L_RGN_SET); 
 
    // found level set region 
    nRet = L_LevelsetBitmapRgn(&LeadBitmap, 1, 1) ; 
    if( nRet !=SUCCESS ) 
        return nRet ; 
 
    nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL); 
    if( nRet != SUCCESS ) 
        return nRet ; 
 
    //free bitmap  
    if(LeadBitmap.Flags.Allocated) 
        L_FreeBitmap(&LeadBitmap); 
 
    return SUCCESS; 
} 

Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help