L_GetFeretsDiameter

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_GetFeretsDiameter (pPoints, uSize, puFeretsDiameter, puFirstIndex, puSecondIndex)

POINT L_FAR * pPoints;

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

L_UINT uSize;

/* number of points in the array */

L_UINT L_FAR * puFeretsDiameter;

/* pointer to a variable to be updated */

L_UINT L_FAR * puFirstIndex;

/* pointer to a variable to be updated */

L_UINT L_FAR * puSecondIndex;

/* pointer to a variable to be updated */

Computes the Feret’s diameter of an object (the maximum distance between the points of the perimeter of the region), and finds its end points. This function is available in the Raster Pro and above toolkits.

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 Feret’s 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 Feret’s diameter.

puSecondIndex

Pointer to a variable to be updated with index of the second end point of the Feret’s diameter.

Returns

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

LTIMG

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

Windows 95 / 98 / Me, Windows 2000 / XP.

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

BITMAPHANDLE LeadBitmap;   /* Bitmap handle for the image */
RECT rcRect; 
POINT L_FAR * pPoints; 
L_UINT uSize, uFeretsDiam, uFstIndex, uSndIndex; 

/* Load a bitmap at its own bits per pixel */
L_LoadBitmap
 (TEXT("image3.cmp"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 

rcRect.top = LeadBitmap.Height/4; 
rcRect.bottom = LeadBitmap.Height*3/4; 
rcRect.left = LeadBitmap.Width/4; 
rcRect.right = LeadBitmap.Width*3/4; 
L_SetBitmapRgnEllipse
 (&LeadBitmap, NULL, &rcRect, L_RGN_SET); 
L_GetRgnContourPoints
 (&LeadBitmap, NULL, &pPoints, &uSize); 
L_GetFeretsDiameter 
(pPoints, uSize, &uFeretsDiam, &uFstIndex, &uSndIndex);