virtual L_INT LBitmap::MathFunction (uMType, uFactor, uFlags = 0)
Re-maps the image colors according to a mathematical function such as: square, log, square root, sine and cosine.
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. |
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 |
Reserved for future use. Must be 0.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function uses the RGB color space.
This function makes it possible to apply one of five mathematical functions to a bitmaps pixel values: square, square root, log, sine and cosine.
Select the mathematical operation to be performed on each pixels 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.
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 LBase::EnableStatusCallback.
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.
Win32, x64.
L_INT LBitmap__MathFunctionExample(LBitmap *pLeadBitmap)
{
/* This example applies a Log Function over the loaded image. */
/* Apply Log Function to this bitmap */
return pLeadBitmap->MathFunction(MF_LOG, 100);
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document