LBitmap::ContourFilter

#include "l_bitmap.h"

virtual L_INT LBitmap::ContourFilter (nThreshold, nDeltaDirection, nMaximumError, nOption)

L_INT16 nThreshold;

/* threshold value */

L_INT16 nDeltaDirection;

/* maximum angle */

L_INT16 nMaximumError;

/* maximum error */

L_INT nOption;

/* flag that controls the resulting image */

Performs a contour segment filter on the source bitmap. This function is available in the Medical toolkits.

Parameter

Description

nThreshold

Threshold of the gradient magnitude. Values below this will be considered as background, and will be set to 0. Values can be from 1 to 254. A lower threshold provides a better quality image. Default is 15.

nDeltaDirection

Maximum angle for the thinning algorithm. Values can be from 1 to 64. Default is 35.

nMaximumError

Maximum error for approximation algorithm. Values can be from 0 to 255. Default is 5. This parameter is only valid if nOption is CONTOUR_APPROX_COLOR.

nOption

Flag that controls the resulting image. This value tells the method what process to complete before returning. Possible values are:

 

Value

Meaning

 

CONTOUR_THIN

[0] return after the thinning algorithm

 

CONTOUR_LINK_BLACKWHITE

[1] return after contour linking, using only black and white

 

CONTOUR_LINK_GRAY

[2] return after contour linking, using 256 grayscale

 

CONTOUR_LINK_COLOR

[3] return after contour linking, using colors

 

CONTOUR_APPROX_COLOR

[4] return after line segment approximation, using colors

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

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.

See Also

Functions:

LBitmap::BricksTexture, LBitmap::Deskew, LBitmap::DeskewExt, LBitmap::DiffuseGlow, LBitmap::GlowFilter, LBitmap::HalfTonePattern, LBitmap::HighPassFilter, LBitmap::MaskConvolution, LBitmap::Perspective, LBitmap::PlasmaFilter, LBitmap::Pointillist, LDialogImageEffect::DoModalContourFilter, LBitmap::DeskewCheck

Example

//ContourFilter

L_INT LBitmap__ContourFilterExample()
{
   L_INT nRet;
   LBitmap m_Bitmap;
   nRet =m_Bitmap.Load(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\image1.cmp"), 0,ORDER_BGR);
   if(nRet !=SUCCESS)
      return nRet;
   // Increase the Saturation
   nRet =m_Bitmap.ContourFilter(5, 5, 5, CONTOUR_LINK_COLOR);
   if(nRet !=SUCCESS)
      return nRet;
   return SUCCESS;
}