L_MathFunctionBitmap

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_MathFunctionBitmap (pBitmap, uMType, uFactor)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_UINT uMType;

/* determines the manipulation function */

L_UINT uFactor;

/* amplitude or frequency Factor */

Re-maps the image colors according to a mathematical function such as: square, log, square root, sine and cosine.

Parameter

Description

pBitmap

Pointer to the bitmap handle referencing the bitmap to be modified.

uMType

Value that represents the function to be applied. Possible values are:

 

Value

Meaning

 

MF_SQR

[0] Square the values.

 

MF_LOG

[1] Take the log of the values.

 

MF_SQRT

[2] Take the square root of the values.

 

MF_SIN

[3] Take the sine of the values.

 

MF_COS

[4] Take the cosine of the values.

uFactor

Factor used as an Amplitude factor when squaring, taking the log of or taking the square root of the color values and as a Frequency factor when taking the sine or cosine of the color values. The value of uFactor is divided internally by different amounts, according to the type of the function being used. These amounts are as follows:

 

If uMType is set to:

then the uFactor will be divided by:

 

MF_SQR

10000 internally

 

MF_LOG

10 internally

 

MF_SQRT

10 internally

 

MF_SIN

100 internally

 

MF_COS

100 internally

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function uses the RGB color space.

This function makes it possible to apply one of five mathematical functions to a bitmap’s pixel values: square, square root, log, sine and cosine.

Select the mathematical operation to be performed on each pixel’s values with the uMType parameter. The resulting values are multiplied by the factor uFactor. The uFactor parameter can be any value greater than 0. It is divided internally by different amounts, according to the type of the function being used.

If the bitmap has a region, the effect will be applied on the region only.

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.

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

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_AddBitmaps, L_CombineBitmap, 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_GetFeretsDiameter, L_GetObjectInfo, L_GetRgnContourPoints, L_GetRgnPerimeterLength, L_RevEffectBitmap, L_SegmentBitmap, L_SubtractBackgroundBitmap, L_UserFilterBitmap

Topics:

Raster Image Functions: Modifying Intensity Values

 

Changing Brightness and Contrast

 

Raster Image Functions: Changing Brightness and Contrast

Example

/* This example loads a bitmap and applies a Log Function over the loaded image. */
BITMAPHANDLE  LeadBitmap;   /* Bitmap handle to hold the loaded image. */
/* Load the bitmap, keeping the bits per pixel of the file */
L_LoadBitmap
 (TEXT("IMAGE1.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
/* Apply Log Function to this bitmap */
L_MathFunctionBitmap
 (&LeadBitmap, MF_LOG, 100);