OriginLab Corporation - Scientific Graphing and Data Analysis Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis

imgMathfun

Contents

Menu Information

Math Function

Brief Information

Perform math function on image pixel values with a factor

Additional Information

This feature is for OriginPro only.

Command Line Usage

1. imgMathfun mf:=sqrt fact:=1.5;

2. imgMathfun mf:=sin fact:=2 oimg:=mat(2);

3. imgMathfun oimg:=<new>;

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input Matrix img

Input

Image

<active>

Specifies the input image. The default input is the active image.

Function mf

Input

int

sqr

Specifies the math function to apply.
Option list:

  • sqr:Square
    Square the pixel values.
  • log:Log
    Take the log of the pixel values
  • sqrt:Squarel Root
    Take the square root of the pixel values.
  • sin:Sin
    Take the sine of the pixel values.
  • cos:Cos
    Take the cosine of the pixel values.
Factor fact

Input

double

0.01

Specifies the factor, by which the input image will be multiplied before the math function is applied.

Output Image oimg

Output

Image

<input>

Specifies the output image. By default, the output image is the same as the input image.

See the syntax here.

Description

This function multiplies the pixel values of the input image by a factor and then applies the specified mathematic function on the products. It allows you to remap the pixel values of the images according to the factor and function you choose.

Examples

In this example, we use the imgMathfun function to apply cosine function on the input image:

  1. When the input image is active, select Image: Arithmetic Transform: Math Function. This opens the dialog of the X-Function.
  2. In the X-Function dialog, change the settings as the screenshot below and click OK to close the dialog.
    Image:imgMathfun_help_English_files_image002.jpg
    A new image is created as a result.
Image:imgMathfun_help_English_files_image004.jpg
Image:imgMathfun_help_English_files_image006.jpg
Input image
Output image


Algorithm

The computation mainly uses L_MathFunctionBitmap() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_MathFunctionBitmap topic.

References

LEADTOOLS Main API Help file, Version 14

Related X-Functions

imgPixlog