L_LevelsetBitmapRgn

#include "Ltimgcor.h"

L_LTIMGCOR_API L_INT L_LevelsetBitmapRgn(pBitmap, LambdaIn, LambdaOut)

pBITMAPHANDLE pBitmap;

pointer to the bitmap handle

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

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

Parameter

Description

pBitmap

Pointer to the bitmap handle to be segmented.

LambdaIn

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

LambdaOut

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

Returns

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

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, Linux.

See Also

Functions:

L_LambdaConnectedness, L_ShrinkWrapTool, L_WatershedBitmap, L_KMeansBitmapSegmentation, L_GWireGetMinPath

Topics:

               

Raster Image Functions: Image Analysis

Processing an Image

Example

This example loads a bitmap and applies Levelset 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.2018.2.25
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help