L_AutoSegmentBitmap

#include "l_bitmap.h"

L_LTIMGCOR_API L_INT EXT_FUNCTION L_AutoSegmentBitmap(pBitmap, pRect, uFlags)

pBITMAPHANDLE pBitmap;

pointer to the bitmap

L_RECT* pRect;

pointer to rectangle specifying area to perform segmentation on

L_UINT32 uFlags;

flags

Performs automated segmentation of a rectangular area in the image specified by the user. The result is applied to the image as a region.

Parameter

Description

pBitmap

Pointer to the bitmap handle referencing the bitmap to be changed.

pRect

Pointer to a Windows RECT structure that specifies the part of the bitmap to perform the segmentation on.

uFlags

Reserved for future use. Must be 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function was designed specifically for CT/MRI images, to segment regions of cancer clusters.

Point pRect to a rectangle that includes all of the objects that need to be selected, since the function segments only what is inside the specified rectangle.

Do not select more than the objects you need to isolate and segment.

The rectangle must not exceed the borders of the image; otherwise the function will return an ERROR_INVALID_PARAMETER error and will not execute.

When the resulting region is no longer needed, it should be freed by calling L_FreeBitmapRgn.

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_SetBitmapRgnColor, L_HolesRemovalBitmapRgn, L_FreeBitmapRgn, L_ShrinkWrapTool 

Topics:

Raster Image Functions: Creating and Using a Region

 

Creating a Bitmap Region

Example

This example loads a bitmap and applies the L_AutoSegmentBitmap function to it

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT AutoSegmentExample(L_VOID) 
{ 
   L_INT nRet; 
   BITMAPHANDLE LeadBitmap; /*Bitmap handle to hold the loaded image*/ 
   L_RECT rcRect;             /*Rectangle to specify area on Bitmap*/ 
   /* Load the bitmap, keeping the bits per pixel of the file */ 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), 
   &LeadBitmap, sizeof(BITMAPHANDLE), 0, 
   ORDER_BGR, NULL, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   //Specify rectangle parameters 
   rcRect.left = 50; 
   rcRect.top = 100; 
   rcRect.right = 100; 
   rcRect.bottom = 150; 
   //Apply the AutoSegmentBitmap Function 
   nRet = L_AutoSegmentBitmap (&LeadBitmap, &rcRect, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Lighten the region so that we will see it */ 
   nRet = L_ChangeBitmapIntensity(&LeadBitmap,500, 0); 
   /* Free the region */ 
   L_FreeBitmapRgn(&LeadBitmap); 
   L_FreeBitmap(&LeadBitmap); 
   return nRet; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help