L_RemoveRedeyeBitmap

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_RemoveRedeyeBitmap(pBitmap, rcNewColor, uThreshold, nLightness)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

COLORREF rcNewColor;

/* new eye color */

L_UINT uThreshold;

/* threshold value */

L_INT nLightness;

/* lightening or darkening value */

Removes the "red eye" effect in color images by converting the red color in the eye to the new specified color.

Parameter

Description

pBitmap

Pointer to the bitmap handle that references the bitmap to be modified.

rcNewColor

COLORREF variable that contains the new color value used to replace the red color in the eyes.

uThreshold

Threshold value that indicates which pixels will be changed by this function. All pixels with a red component value greater than this value will be changed. Pixels with a red component value less than this value will not be changed. This value is between 0 and 255.

nLightness

"Percentage" value that indicates whether the pixels that are replaced are lightened or darkened. If this value is greater than 100, the replaced pixels will be lightened. If this value is less than 100, the replaced pixels will be darkened. This function preserves the lightness of the original pixels and substitutes the red color with the new color.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function has no effect on grayscale images, since there is no "red eye" problem in grayscale images.

To use this function the user should select a small region around the eye. Otherwise, the function will change all the red color in the image. This function also allows the user to replace the red color with a new color for the eyes that is nearest to the original color.

To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.

This function supports 48 and 64-bit color images.

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.

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_SetStatusCallback, L_BumpMapBitmap, L_CubismBitmap, L_DrawStarBitmap, L_DryBitmap, L_FreePlaneBendBitmap, L_FreeRadBendBitmap, L_GlassEffectBitmap, L_GlowFilterBitmap, L_LensFlareBitmap, L_LightBitmap, L_OceanBitmap, L_PlaneBendBitmap, L_PlaneBitmap, L_SampleTargetBitmap, L_TunnelBitmap, L_BendingBitmap, L_CylindricalBitmap, L_FreeHandShearBitmap, L_FreeHandWaveBitmap, L_ImpressionistBitmap, L_PixelateBitmap, L_PolarBitmap, L_PunchBitmap, L_RadialBlurBitmap, L_RadWaveBitmap, L_RippleBitmap, L_SpherizeBitmap, L_SwirlBitmap, L_WaveBitmap, L_WindBitmap, L_ZoomBlurBitmap, L_ZoomWaveBitmap, L_AddShadowBitmap, L_RevEffectBitmap, L_AgingBitmap, L_DiceEffectBitmap, L_FunctionalLightBitmap, L_PuzzleEffectBitmap, L_RingEffectBitmap, L_TextureAlphaBlendBitmap, L_BricksTextureBitmap, L_CanvasBitmap, L_CloudsBitmap, L_ColoredBallsBitmap, L_DiffuseGlowBitmap, L_DisplaceMapBitmap, L_FragmentBitmap, L_HalfTonePatternBitmap, L_MaskConvolutionBitmap, L_MosaicTilesBitmap, L_OffsetBitmap, L_PerspectiveBitmap, L_PlasmaFilterBitmap, L_PointillistBitmap, L_RomanMosaicBitmap, L_VignetteBitmap, L_ZigZagBitmap, L_AdjustBitmapTint, L_ColorHalfToneBitmap

Topics:

Applying Artistic Effects

 

Correcting Colors

 

Raster Image Functions: Modifying Intensity Values

 

Raster Image Functions: Getting and Setting Pixel Values

 

Using Color Values in LEADTOOLS

 

Raster Image Functions: Correcting Colors

Example

/* This example loads a bitmap that has a red eye problem, creates an elliptical region, and applies the redeye removal function on it. */
BITMAPHANDLE LeadBitmap;   /* Bitmap handle to hold the loaded image. */
void TestFunction(HWND hWnd)
{
   RECT rRgnRect;               /* Rectangle that defines the region */
   COLORREF  rcNewColor;  /* the new color of the eyes */
/* Load a bitmap */
L_LoadBitmap
 (TEXT("REDEYE.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
/* Specify a rectangle to define the region rounded the eye. This region is specified by the mouse on the IMGFEATR demo*/
SetRect(&rRgnRect, 80, 20, 100, 40);
/* Create an elliptical region */
L_SetBitmapRgnEllipse
(&LeadBitmap, NULL, &rRgnRect, L_RGN_SET);
   /* Specify the new color for eyes */
   rcNewColor  = RGB(5, 20, 10);
   /* Apply the redeye removal function */
   L_RemoveRedeyeBitmap(&LeadBitmap, rcNewColor, 125, 100);
   /* Free the region */
   L_FreeBitmapRgn(&LeadBitmap);