L_ApplyTransformationParameters

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_ApplyTransformationParameters (pBitmap, nXTranslation, nYTranslation,nAngle, uXScale, uYScale, uFlags)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_INT nXTranslation;

/* x-axis translation */

L_INT nYTranslation;

/* y-axis translation */

L_INT nAngle;

/* bitmap rotation angle */

L_UINT uXScale;

/* bitmap x-axis (Width) scaling factor */

L_UINT uYScale;

/* bitmap y-axis (Height) scaling factor */

L_UINT uFlags;

/* flags that specify resize behavior */

Corrects the image by removing the translation, rotation, and scaling deformations that have been applied on the image. This function is available in the Document/Medical Toolkits.

Parameter

Description

pBitmap

Pointer to the bitmap handle referencing the transformed bitmap.

nXTranslation

The amount of bitmap translation along the x-axis (Width). This value is internally divided by 100. This value must be equal to the one returned from L_GetTransformationParameters function.

nYTranslation

The amount of bitmap translation (in pixels) along the y-axis (Height). This value is internally divided by 100. This value must be equal to the one returned from L_GetTransformationParameters function.

nAngle

Hundredths of degrees to rotate (+/-). This can be a number from 1 to 36,000. This value is internally divided by 100. A positive value means the image rotated in a clockwise rotation, while a negative value means the image rotated in a counter-clockwise rotation. This value must be equal to the one returned from L_GetTransformationParameters function.

uXScale

The amount of bitmap x-axis (Width) scaling. This is a percentage value (internally divided by 100). This value must be equal to the one returned from L_GetTransformationParameters function.

uYScale

The amount of bitmap y-axis (Height) scaling. This is a percentage value (internally divided by 100). This value must be equal to the one returned from L_GetTransformationParameters function.

uFlags

Flag that specifies the behavior when resizing the bitmap. Select one value. Possible values are:

 

Value

Meaning

 

RGS_SIZE_NORMAL

[0x0001] Resize normally.

 

RGS_SIZE_RESAMPLE

[0x0002] Use linear interpolation and averaging to produce a higher-quality image.

 

RGS_SIZE_BICUBIC

[0x0003] Use bicubic interpolation and averaging to produce a higher quality image. This is slower than SIZE_RESAMPLE.

 

RGS_SIZE_FAVORBLACK

[0x0010] (Document/Medical only) Preserve black objects when making the image smaller. This option affects only 1-bit, black-and-white images, where it prevents the disappearance of thin lines. You can use a bitwise OR ( | ) to combine this flag with another one. For example, RGS_SIZE_RESAMPLE | RGS_SIZE_FAVORBLACK causes color images to be resampled, but applies the favor-black option to 1-bit, black-and-white images.

 

RGS_SIZE_FAVORWHITE

[0x0020] (Document/Medical only) Preserve white objects when making the image smaller. This option affects only 1-bit, black-and-white images, where it prevents the disappearance of thin lines. You can use a bitwise OR ( | ) to combine this flag with another one. For example, RGS_SIZE_RESAMPLE | RGS_SIZE_FAVORWHITE causes color images to be resampled, but applies the favor-white option to 1-bit, black-and-white images.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function corrects the image by removing the translation, rotation, and scaling deformations that have been applied to the image. These transformations make this bitmap match a reference bitmap.

This function is designed to work with L_GetTransformationParameters.

You can get the translation, rotation, and scaling parameters by using L_GetTransformationParameters function; the returned values must be passed as they are to L_ApplyTransformationParameters function.

The shift operation is performed first, followed by the rotation and resize operations.

If you simply want to automatically straighten a bitmap, use the L_DeskewBitmap function.

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

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 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_CombineBitmap, L_RotateBitmap, L_SizeBitmap, L_ResizeBitmap L_DeskewBitmap, L_GetTransformationParameters, L_IsRegMarkBitmap, L_SearchRegMarksBitmap, L_GetMarksCenterMassBitmap

Topics:

Raster Image Functions: Document Imaging

 

Detecting Registration Marks

Example

For an example, refer to L_GetTransformationParameters.