IM: Arithmetic Operations

IM - An Imaging Tool

Arithmetic Operations
[Image Processing]


Detailed Description

Simple math operations for images.
See im_process_pon.h


Enumerations

enum  imUnaryOp {
  IM_UN_EQL, IM_UN_ABS, IM_UN_LESS, IM_UN_INC,
  IM_UN_INV, IM_UN_SQR, IM_UN_SQRT, IM_UN_LOG,
  IM_UN_EXP, IM_UN_SIN, IM_UN_COS, IM_UN_CONJ,
  IM_UN_CPXNORM
}
enum  imBinaryOp {
  IM_BIN_ADD, IM_BIN_SUB, IM_BIN_MUL, IM_BIN_DIV,
  IM_BIN_DIFF, IM_BIN_POW, IM_BIN_MIN, IM_BIN_MAX
}

Functions

void imProcessUnArithmeticOp (const imImage *src_image, imImage *dst_image, int op)
void imProcessArithmeticOp (const imImage *src_image1, const imImage *src_image2, imImage *dst_image, int op)
void imProcessArithmeticConstOp (const imImage *src_image, float src_const, imImage *dst_image, int op)
void imProcessBlend (const imImage *src_image1, imImage *src_image2, imImage *dst_image, float alpha)
void imProcessSplitComplex (const imImage *src_image, imImage *dst_image1, imImage *dst_image2, int do_polar)
void imProcessMergeComplex (const imImage *src_image1, const imImage *src_image2, imImage *dst_image, int polar)
void imProcessMultipleMean (const imImage **src_image_list, int src_image_count, imImage *dst_image)
void imProcessMultipleStdDev (const imImage **src_image_list, int src_image_count, const imImage *mean_image, imImage *dst_image)
int imProcessAutoCovariance (const imImage *src_image, const imImage *mean_image, imImage *dst_image)
void imProcessMultiplyConj (const imImage *src_image1, const imImage *src_image2, imImage *dst_image)

Enumeration Type Documentation

enum imUnaryOp
 

Unary Arithmetic Operations. Inverse and log may lead to math exceptions.

Enumerator:
IM_UN_EQL  equal = a
IM_UN_ABS  abssolute = |a|
IM_UN_LESS  less = -a
IM_UN_INC  increment += a
IM_UN_INV  invert = 1/a (#)
IM_UN_SQR  square = a*a
IM_UN_SQRT  square root = a^(1/2)
IM_UN_LOG  natural logarithm = ln(a) (#)
IM_UN_EXP  exponential = exp(a)
IM_UN_SIN  sine = sin(a)
IM_UN_COS  cosine = cos(a)
IM_UN_CONJ  complex conjugate = ar - ai*i
IM_UN_CPXNORM  complex normalization by magnitude = a / cpxmag(a)
00029                {
00030   IM_UN_EQL,    /**< equal             =     a        */
00031   IM_UN_ABS,    /**< abssolute         =    |a|       */
00032   IM_UN_LESS,   /**< less              =    -a        */
00033   IM_UN_INC,    /**< increment        +=     a        */
00034   IM_UN_INV,    /**< invert            =   1/a       (#) */
00035   IM_UN_SQR,    /**< square            =     a*a      */
00036   IM_UN_SQRT,   /**< square root       =     a^(1/2)  */
00037   IM_UN_LOG,    /**< natural logarithm =  ln(a)      (#) */
00038   IM_UN_EXP,    /**< exponential       = exp(a)       */
00039   IM_UN_SIN,    /**< sine              = sin(a)       */
00040   IM_UN_COS,    /**< cosine            = cos(a)       */
00041   IM_UN_CONJ,   /**< complex conjugate =     ar - ai*i                   */
00042   IM_UN_CPXNORM /**< complex normalization by magnitude = a / cpxmag(a)  */
00043 };

enum imBinaryOp
 

Binary Arithmetic Operations. Inverse and log may lead to math exceptions.

Enumerator:
IM_BIN_ADD  add = a+b
IM_BIN_SUB  subtract = a-b
IM_BIN_MUL  multiply = a*b
IM_BIN_DIV  divide = a/b (#)
IM_BIN_DIFF  difference = |a-b|
IM_BIN_POW  power = a^b
IM_BIN_MIN  minimum = (a < b)? a: b
IM_BIN_MAX  maximum = (a > b)? a: b
00056                 {
00057   IM_BIN_ADD,    /**< add         =    a+b            */
00058   IM_BIN_SUB,    /**< subtract    =    a-b            */
00059   IM_BIN_MUL,    /**< multiply    =    a*b            */
00060   IM_BIN_DIV,    /**< divide      =    a/b            (#) */
00061   IM_BIN_DIFF,   /**< difference  =    |a-b|          */
00062   IM_BIN_POW,    /**< power       =    a^b            */
00063   IM_BIN_MIN,    /**< minimum     =    (a < b)? a: b  */
00064   IM_BIN_MAX     /**< maximum     =    (a > b)? a: b  */
00065 };


Function Documentation

void imProcessUnArithmeticOp const imImage src_image,
imImage dst_image,
int  op
 

Apply an arithmetic unary operation.
Can be done in place, images must match size, does not need to match type.

im.ProcessUnArithmeticOp(src_image: imImage, dst_image: imImage, op: number) [in Lua 5] 
im.ProcessUnArithmeticOpNew(image: imImage, op: number) -> new_image: imImage [in Lua 5] 

void imProcessArithmeticOp const imImage src_image1,
const imImage src_image2,
imImage dst_image,
int  op
 

Apply a binary arithmetic operation.
Can be done in place, images must match size.
Source images must match type, destiny image can be several types depending on source:

  • byte -> byte, ushort, int, float
  • ushort -> ushort, int, float
  • int -> int, float
  • float -> float
  • complex -> complex One exception is that you can combine complex with float resulting complex.
im.ProcessArithmeticOp(src_image1: imImage, src_image2: imImage, dst_image: imImage, op: number) [in Lua 5] 
im.ProcessArithmeticOpNew(image1: imImage, image2: imImage, op: number) -> new_image: imImage [in Lua 5] 
The New function will create a new image of the same type of the source images.

void imProcessArithmeticConstOp const imImage src_image,
float  src_const,
imImage dst_image,
int  op
 

Apply a binary arithmetic operation with a constant value.
Can be done in place, images must match size.
Destiny image can be several types depending on source:

  • byte -> byte, ushort, int, float
  • ushort -> byte, ushort, int, float
  • int -> byte, ushort, int, float
  • float -> float
  • complex -> complex The constant value is type casted to an apropriate type before the operation.
im.ProcessArithmeticConstOp(src_image: imImage, src_const: number, dst_image: imImage, op: number) [in Lua 5] 
im.ProcessArithmeticConstOpNew(image: imImage, src_const: number, op: number) -> new_image: imImage [in Lua 5] 

void imProcessBlend const imImage src_image1,
imImage src_image2,
imImage dst_image,
float  alpha
 

Blend two images using an alpha value = [a * alpha + b * (1 - alpha)].
Can be done in place, images must match size and type.

im.ProcessBlend(src_image1: imImage, src_image2: imImage, dst_image: imImage, alpha: number) [in Lua 5] 
im.ProcessBlendNew(image1: imImage, image2: imImage, alpha: number) -> new_image: imImage [in Lua 5] 

void imProcessSplitComplex const imImage src_image,
imImage dst_image1,
imImage dst_image2,
int  do_polar
 

Split a complex image into two images with real and imaginary parts
or magnitude and phase parts (polar).
Source image must be IM_CFLOAT, destiny images must be IM_FLOAT.

im.ProcessSplitComplex(src_image: imImage, dst_image1: imImage, dst_image2: imImage, do_polar: boolean) [in Lua 5] 
im.ProcessSplitComplexNew(image: imImage, do_polar: boolean) -> dst_image1: imImage, dst_image2: imImage [in Lua 5] 

void imProcessMergeComplex const imImage src_image1,
const imImage src_image2,
imImage dst_image,
int  polar
 

Merges two images as the real and imaginary parts of a complex image,
or as magnitude and phase parts (polar = 1).
Source images must be IM_FLOAT, destiny image must be IM_CFLOAT.

im.ProcessMergeComplex(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] 
im.ProcessMergeComplexNew(image1: imImage, image2: imImage) -> new_image: imImage [in Lua 5] 

void imProcessMultipleMean const imImage **  src_image_list,
int  src_image_count,
imImage dst_image
 

Calculates the mean of multiple images.
Images must match size and type.

im.ProcessMultipleMean(src_image_list: table of imImage, dst_image: imImage) [in Lua 5] 
im.ProcessMultipleMeanNew(src_image_list: table of imImage) -> new_image: imImage [in Lua 5] 

void imProcessMultipleStdDev const imImage **  src_image_list,
int  src_image_count,
const imImage mean_image,
imImage dst_image
 

Calculates the standard deviation of multiple images.
Images must match size and type. Use imProcessMultipleMean to calculate the mean_image.

im.ProcessMultipleStdDev(src_image_list: table of imImage, mean_image: imImage, dst_image: imImage) [in Lua 5] 
im.ProcessMultipleStdDevNew(src_image_list: table of imImage, mean_image: imImage) -> new_image: imImage [in Lua 5] 

int imProcessAutoCovariance const imImage src_image,
const imImage mean_image,
imImage dst_image
 

Calculates the auto-covariance of an image with the mean of a set of images.
Images must match size and type. Returns zero if the counter aborted.

im.ProcessAutoCovariance(src_image: imImage, mean_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] 
im.ProcessAutoCovarianceNew(src_image: imImage, mean_image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] 

void imProcessMultiplyConj const imImage src_image1,
const imImage src_image2,
imImage dst_image
 

Multiplies the conjugate of one complex image with another complex image.
Images must match size. Conj(img1) * img2
Can be done in-place.

im.ProcessMultiplyConj(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] 
im.ProcessMultiplyConjNew(src_image1: imImage, src_image2: imImage) -> new_image: imImage [in Lua 5]