IM: Arithmetic Operations

IM - Imaging Libray

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 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.

Enumeration values:
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.

Enumeration values:
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
00053                 {
00054   IM_BIN_ADD,    /**< add         =    a+b            */
00055   IM_BIN_SUB,    /**< subtract    =    a-b            */
00056   IM_BIN_MUL,    /**< multiply    =    a*b            */
00057   IM_BIN_DIV,    /**< divide      =    a/b            (#) */
00058   IM_BIN_DIFF,   /**< difference  =    |a-b|          */
00059   IM_BIN_POW,    /**< power       =    a^b            */
00060   IM_BIN_MIN,    /**< minimum     =    (a < b)? a: b  */
00061   IM_BIN_MAX     /**< maximum     =    (a > b)? a: b  */
00062 };


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.

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.

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.

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.

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

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

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_COMPLEX.

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.

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.

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.

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.