LBitmap::ApplyTransformationParameters

#include "ltwrappr.h"

virtual L_INT LBitmap::ApplyTransformationParameters (nXTranslation, nYTranslation, nAngle, uXScale, uYScale, uFlags)

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.

Parameter

Description

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 LBitmap::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 LBitmap::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 is rotated in a counter-clockwise rotation. This value must be equal to the one returned from LBitmap::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 LBitmap::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 LBitmap::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 LBitmap::GetTransformationParameters.

You can get the translation, rotation, and scaling parameters by using LBitmap::GetTransformationParameters function; the returned values must be passed as they are to LBitmap::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 LBitmap::Deskew function.

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

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

LTIMGCOR

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:

LBitmapBase::Combine, LBitmapBase::Rotate, LBitmapBase::Size, LBitmapBase::Resize, LBitmap::Deskew, LBitmap::GetTransformationParameters, LBitmap::IsRegMark, LBitmap::SearchRegMarks, LBitmap::GetMarksCenterMass, LBitmapBase::SizeInterpolate, LBitmap::DeskewCheck

Topics:

Raster Image Functions: Document Imaging

 

Detecting Registration Marks

Example

For an example, refer to LBitmap::GetTransformationParameters.