Enumerations | Functions

Arithmetic Operations
[Image Processing]

Collaboration diagram for Arithmetic Operations:

Enumerations

enum  imUnaryOp {
  IM_UN_EQL, IM_UN_ABS, IM_UN_LESS, 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,
  IM_UN_POSITIVES, IM_UN_NEGATIVES
}
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 imProcessBlendConst (const imImage *src_image1, const imImage *src_image2, imImage *dst_image, float alpha)
void imProcessBlend (const imImage *src_image1, const imImage *src_image2, const imImage *alpha_image, imImage *dst_image)
void imProcessCompose (const imImage *src_image1, const imImage *src_image2, imImage *dst_image)
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 imProcessMultipleMedian (const imImage **src_image_list, int src_image_count, 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)

Detailed Description

Simple math operations for images.
See im_process_pnt.h

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 

absolute = |a|

IM_UN_LESS 

less = -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)

IM_UN_POSITIVES 

positives = if a<0 then a=0

IM_UN_NEGATIVES 

negatives = if a>0 then a=0

enum imBinaryOp

Binary Arithmetic Operations.
Divide 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


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 color space and size.
Target image can be several types depending on source:

  • any integer -> any integer or real
  • real -> real
  • complex -> complex If source is complex, target complex must be the same data type (imcfloat-imcfloat or imcdouble-imcdouble only).
    If target is byte, then the result is cropped to 0-255.
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 color space and size.
Source images must match, target image can be several types depending on source:

  • any integer -> any integer+ or real
  • real -> real
  • complex -> complex One exception is that you can use src1=complex src2=real resulting dst=complex.
    If source is complex, target complex must be the same data type (imcfloat-imcfloat or imcdouble-imcdouble only).
    If target is integer then it must have equal or more precision than the source.
    If target is byte, then the result is cropped to 0-255. Alpha channel is not included.
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 color space and size.
Target image can be several types depending on source:

  • any integer -> any integer or real
  • real -> real
  • complex -> complex The constant value is type casted to an appropriate type before the operation.
    If source is complex, target complex must be the same data type (imcfloat-imcfloat or imcdouble-imcdouble only).
    If target is byte, then the result is cropped to 0-255.
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 imProcessBlendConst ( const imImage src_image1,
const 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.
alpha value must be in the interval [0.0 - 1.0].

im.ProcessBlendConst(src_image1: imImage, src_image2: imImage, dst_image: imImage, alpha: number) [in Lua 5] 
im.ProcessBlendConstNew(image1: imImage, image2: imImage, alpha: number) -> new_image: imImage [in Lua 5] 
void imProcessBlend ( const imImage src_image1,
const imImage src_image2,
const imImage alpha_image,
imImage dst_image 
)

Blend two images using an alpha channel = [a * alpha + b * (1 - alpha)].
Can be done in-place, images must match.
alpha_image must have the same data type except for complex images that must be real, and color_space must be IM_GRAY. Maximum alpha values are based in imColorMax. Minimum is always 0.

im.ProcessBlend(src_image1: imImage, src_image2: imImage, alpha_image: imImage, dst_image: imImage) [in Lua 5] 
im.ProcessBlendNew(image1: imImage, image2: imImage, alpha_image: imImage) -> new_image: imImage [in Lua 5] 
void imProcessCompose ( const imImage src_image1,
const imImage src_image2,
imImage dst_image 
)

Compose two images that have an alpha channel using the OVER operator.
Can be done in-place, images must match.
Maximum alpha values are baed in imColorMax. Minimum is always 0.

im.ProcessCompose(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] 
im.ProcessComposeNew(image1: imImage, image2: imImage) -> new_image: imImage [in Lua 5] 
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).
Source image must be complex, target images must be real.

im.ProcessSplitComplex(src_image: imImage, dst_image1: imImage, dst_image2: imImage, polar: boolean) [in Lua 5] 
im.ProcessSplitComplexNew(image: imImage, 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 real, target image must be complex.

im.ProcessMergeComplex(src_image1: imImage, src_image2: imImage, dst_image: imImage, polar: boolean) [in Lua 5] 
im.ProcessMergeComplexNew(image1: imImage, image2: imImage, polar: boolean) -> 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 imProcessMultipleMedian ( const imImage **  src_image_list,
int  src_image_count,
imImage dst_image 
)

Calculates the median of multiple images.
Images must match size and type. Complex is not supported.
Uses imProcessMultiPointOp internally.

im.ProcessMultipleMedian(src_image_list: table of imImage, dst_image: imImage) -> counter: boolean [in Lua 5] 
im.ProcessMultipleMedianNew(src_image_list: table of imImage) -> counter: boolean, 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. Returns zero if the counter aborted.
Target is IM_FLOAT, except if source is IM_DOUBLE. 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]