Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

L_GetFeretsDiameter

Show in webframe

#include "l_bitmap.h"

L_LTIMGEFX_API L_INT L_GetFeretsDiameter (pPoints, uSize, puFeretsDiameter, puFirstIndex, puSecondIndex, uFlags)

POINT *pPoints;

/* pointer to an array of object contour coordinate points */

L_UINT uSize;

/* number of points in the array */

L_UINT *puFeretsDiameter;

/* pointer to a variable to be updated */

L_UINT *puFirstIndex;

/* pointer to a variable to be updated */

L_UINT *puSecondIndex;

/* pointer to a variable to be updated */

L_UINT32 uFlags;

/* flags */

Computes the Ferets diameter of an object (the maximum distance between the points of the perimeter of the region), and finds its end points.

Parameter

Description

pPoints

Pointer to an array of object contour coordinate points.

uSize

Array size.

puFeretsDiameter

Pointer to a variable to be updated with the length of the Ferets diameter. The length is measured in pixels and is internally multiplied by 1000. Divide this value by 1000 to obtain the real length.

puFirstIndex

Pointer to a variable to be updated with index of the first end point of the Ferets diameter.

puSecondIndex

Pointer to a variable to be updated with index of the second end point of the Ferets diameter.

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 does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

This function calculates the Feret's Diameter (caliper length), the longest distance between any two points along the boundary. This is equivalent to the minimum diameter of a tube through which this object can pass.

This function does not call the status callback.

Required DLLs and Libraries

LTIMGEFX

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_AddShadowBitmap, L_AllocFTArray, L_ChangeHueSatIntBitmap, L_ColorReplaceBitmap, L_ColorThresholdBitmap, L_DFTBitmap, L_DirectionEdgeStatisticalBitmap, L_FFTBitmap, L_FreeFTArray, L_FrqFilterBitmap, L_FrqFilterMaskBitmap, L_FTDisplayBitmap, L_GetBitmapStatisticsInfo, L_GetObjectInfo, L_GetRgnContourPoints, L_GetRgnPerimeterLength, L_MathFunctionBitmap, L_RevEffectBitmap, L_SegmentBitmap, L_SubtractBackgroundBitmap, L_UserFilterBitmap

Topics:

Raster Image Functions: Analysis Image Object or Region Analysis

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName


#if defined (LEADTOOLS_V16_OR_LATER)
 L_INT GetFeretsDiameterExample(L_VOID)
{
   L_INT nRet;
   BITMAPHANDLE LeadBitmap;   /* Bitmap handle for the image */
   RECT rcRect; 
   POINT       * pPoints; 
   L_UINT uSize, uFeretsDiam, uFstIndex, uSndIndex; 

   /* Load a bitmap at its own bits per pixel */
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet !=SUCCESS)
      return nRet;

   rcRect.top = LeadBitmap.Height/4; 
   rcRect.bottom = LeadBitmap.Height*3/4; 
   rcRect.left = LeadBitmap.Width/4; 
   rcRect.right = LeadBitmap.Width*3/4; 
   nRet = L_SetBitmapRgnEllipse (&LeadBitmap, NULL, &rcRect, L_RGN_SET); 
   if(nRet !=SUCCESS)
      return nRet;
   nRet = L_GetRgnContourPoints (&LeadBitmap, NULL, &pPoints, &uSize, RGNCONTOUR_ALL); 
   if(nRet !=SUCCESS)
      return nRet;
   nRet = L_GetFeretsDiameter (pPoints, uSize, &uFeretsDiam, &uFstIndex, &uSndIndex, 0);
   if(nRet !=SUCCESS)
      return nRet;
   //free Bitmap
   if(LeadBitmap.Flags.Allocated)  
      L_FreeBitmap(&LeadBitmap);
   return SUCCESS;
}
#else
 L_INT GetFeretsDiameterExample(L_VOID)
{
   L_INT nRet;
   BITMAPHANDLE LeadBitmap;   /* Bitmap handle for the image */
   RECT rcRect; 
   POINT       * pPoints; 
   L_UINT uSize, uFeretsDiam, uFstIndex, uSndIndex; 

   /* Load a bitmap at its own bits per pixel */
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet !=SUCCESS)
      return nRet;

   rcRect.top = LeadBitmap.Height/4; 
   rcRect.bottom = LeadBitmap.Height*3/4; 
   rcRect.left = LeadBitmap.Width/4; 
   rcRect.right = LeadBitmap.Width*3/4; 
   nRet = L_SetBitmapRgnEllipse (&LeadBitmap, NULL, &rcRect, L_RGN_SET); 
   if(nRet !=SUCCESS)
      return nRet;
   nRet = L_GetRgnContourPoints (&LeadBitmap, NULL, &pPoints, &uSize, RGNCONTOUR_ALL); 
   if(nRet !=SUCCESS)
      return nRet;
   nRet = L_GetFeretsDiameter (pPoints, uSize, &uFeretsDiam, &uFstIndex, &uSndIndex);
   if(nRet !=SUCCESS)
      return nRet;
   //free Bitmap
   if(LeadBitmap.Flags.Allocated)  
      L_FreeBitmap(&LeadBitmap);
   return SUCCESS;
}
#endif // LEADTOOLS_V16_OR_LATER
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.