LBitmap::GetFeretsDiameter

#include "ltwrappr.h"

static L_INT LBitmap::GetFeretsDiameter (pPoints, uSize, puFeretsDiameter, puFirstIndex, puSecondIndex, uFlags = 0)

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

Parameters

POINT * pPoints

Pointer to an array of object contour coordinate points.

L_UINT uSize

Array size.

L_UINT * 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.

L_UINT * puFirstIndex

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

L_UINT * puSecondIndex

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

L_UINT32 uFlags

Reserved for future use. Must be 0.

Returns

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

Comments

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

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LBitmap__GetFeretsDiameterExample(LBitmap *pLeadBitmap)  
{ 
   L_INT nRet; 
   RECT rcRect;  
   POINT  * pPoints;  
   L_UINT  uSize, uFeretsDiam, uFstIndex, uSndIndex;  
   RGNXFORM MyXForm;  
 
   rcRect.top = pLeadBitmap->GetHeight ()/4;  
   rcRect.bottom = pLeadBitmap->GetHeight ()*3/4;  
   rcRect.left = pLeadBitmap->GetWidth ()/4;  
   rcRect.right = pLeadBitmap->GetWidth ()*3/4;  
    
   nRet =pLeadBitmap->Region()->SetRgnEllipse (&rcRect); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =pLeadBitmap->Region()->GetRgnXForm (&MyXForm); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =pLeadBitmap->GetRgnContourPoints(&MyXForm,&pPoints, &uSize,0); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =LBitmap::GetFeretsDiameter (pPoints, uSize, &uFeretsDiam, &uFstIndex, &uSndIndex); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 21.0.2021.4.8
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help