IM: im_process_pon.h Source File

IM - An Imaging Tool

im_process_pon.h

Go to the documentation of this file.
00001 /** \file
00002  * \brief Image Processing - Pontual Operations
00003  *
00004  * See Copyright Notice in im_lib.h
00005  */
00006 
00007 #ifndef __IM_PROCESS_PON_H
00008 #define __IM_PROCESS_PON_H
00009 
00010 #include "im_image.h"
00011 
00012 #if defined(__cplusplus)
00013 extern "C" {
00014 #endif
00015 
00016 
00017 
00018 /** \defgroup arithm Arithmetic Operations 
00019  * \par
00020  * Simple math operations for images.
00021  * \par
00022  * See \ref im_process_pon.h
00023  * \ingroup process */
00024 
00025 /** Unary Arithmetic Operations.
00026  * Inverse and log may lead to math exceptions.
00027  * \ingroup arithm */
00028 enum imUnaryOp {
00029   IM_UN_EQL,    /**< equal             =     a        */
00030   IM_UN_ABS,    /**< abssolute         =    |a|       */
00031   IM_UN_LESS,   /**< less              =    -a        */
00032   IM_UN_INC,    /**< increment        +=     a        */
00033   IM_UN_INV,    /**< invert            =   1/a       (#) */
00034   IM_UN_SQR,    /**< square            =     a*a      */
00035   IM_UN_SQRT,   /**< square root       =     a^(1/2)  */
00036   IM_UN_LOG,    /**< natural logarithm =  ln(a)      (#) */
00037   IM_UN_EXP,    /**< exponential       = exp(a)       */
00038   IM_UN_SIN,    /**< sine              = sin(a)       */
00039   IM_UN_COS,    /**< cosine            = cos(a)       */
00040   IM_UN_CONJ,   /**< complex conjugate =     ar - ai*i                   */
00041   IM_UN_CPXNORM /**< complex normalization by magnitude = a / cpxmag(a)  */
00042 };
00043 
00044 /** Apply an arithmetic unary operation. \n
00045  * Can be done in place, images must match size, does not need to match type.
00046  *
00047  * \verbatim im.ProcessUnArithmeticOp(src_image: imImage, dst_image: imImage, op: number) [in Lua 5] \endverbatim
00048  * \verbatim im.ProcessUnArithmeticOpNew(image: imImage, op: number) -> new_image: imImage [in Lua 5] \endverbatim
00049  * \ingroup arithm */
00050 void imProcessUnArithmeticOp(const imImage* src_image, imImage* dst_image, int op);
00051 
00052 /** Binary Arithmetic Operations.
00053  * Inverse and log may lead to math exceptions.
00054  * \ingroup arithm */
00055 enum imBinaryOp {
00056   IM_BIN_ADD,    /**< add         =    a+b            */
00057   IM_BIN_SUB,    /**< subtract    =    a-b            */
00058   IM_BIN_MUL,    /**< multiply    =    a*b            */
00059   IM_BIN_DIV,    /**< divide      =    a/b            (#) */
00060   IM_BIN_DIFF,   /**< difference  =    |a-b|          */
00061   IM_BIN_POW,    /**< power       =    a^b            */
00062   IM_BIN_MIN,    /**< minimum     =    (a < b)? a: b  */
00063   IM_BIN_MAX     /**< maximum     =    (a > b)? a: b  */
00064 };
00065 
00066 /** Apply a binary arithmetic operation. \n
00067  * Can be done in place, images must match size. \n
00068  * Source images must match type, destiny image can be several types depending on source: \n
00069  * \li byte -> byte, ushort, int, float
00070  * \li ushort -> ushort, int, float
00071  * \li int -> int, float
00072  * \li float -> float
00073  * \li complex -> complex
00074  * One exception is that you can combine complex with float resulting complex.
00075  *
00076  * \verbatim im.ProcessArithmeticOp(src_image1: imImage, src_image2: imImage, dst_image: imImage, op: number) [in Lua 5] \endverbatim
00077  * \verbatim im.ProcessArithmeticOpNew(image1: imImage, image2: imImage, op: number) -> new_image: imImage [in Lua 5] \endverbatim
00078  * The New function will create a new image of the same type of the source images.
00079  * \ingroup arithm */
00080 void imProcessArithmeticOp(const imImage* src_image1, const imImage* src_image2, imImage* dst_image, int op);
00081 
00082 /** Apply a binary arithmetic operation with a constant value. \n
00083  * Can be done in place, images must match size. \n
00084  * Destiny image can be several types depending on source: \n
00085  * \li byte -> byte, ushort, int, float
00086  * \li ushort -> byte, ushort, int, float
00087  * \li int -> byte, ushort, int, float
00088  * \li float -> float
00089  * \li complex -> complex
00090  * The constant value is type casted to an apropriate type before the operation.
00091  *
00092  * \verbatim im.ProcessArithmeticConstOp(src_image: imImage, src_const: number, dst_image: imImage, op: number) [in Lua 5] \endverbatim
00093  * \verbatim im.ProcessArithmeticConstOpNew(image: imImage, src_const: number, op: number) -> new_image: imImage [in Lua 5] \endverbatim
00094  * \ingroup arithm */
00095 void imProcessArithmeticConstOp(const imImage* src_image, float src_const, imImage* dst_image, int op);
00096 
00097 /** Blend two images using an alpha value = [a * alpha + b * (1 - alpha)]. \n
00098  * Can be done in place, images must match size and type. \n
00099  * alpha value must be in the interval [0.0 - 1.0].
00100  *
00101  * \verbatim im.ProcessBlend(src_image1: imImage, src_image2: imImage, dst_image: imImage, alpha: number) [in Lua 5] \endverbatim
00102  * \verbatim im.ProcessBlendNew(image1: imImage, image2: imImage, alpha: number) -> new_image: imImage [in Lua 5] \endverbatim
00103  * \ingroup arithm */
00104 void imProcessBlendConst(const imImage* src_image1, const imImage* src_image2, imImage* dst_image, float alpha);
00105 
00106 /** Blend two images using an alpha channel = [a * alpha + b * (1 - alpha)]. \n
00107  * Can be done in place, images must match size and type. \n
00108  * alpha_image must have the same data type except for complex images that must be float, and color_space must be IM_GRAY.
00109  * integer alpha values must be:
00110 \verbatim 
00111 0 - 255        IM_BYTE  
00112 0 - 65535      IM_USHORT
00113 0 - 2147483647 IM_INT
00114 \endverbatim
00115  * that will be normalized to 0 - 1.
00116  * \verbatim im.ProcessBlend(src_image1: imImage, src_image2: imImage, alpha_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00117  * \verbatim im.ProcessBlendNew(image1: imImage, image2: imImage, alpha_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00118  * \ingroup arithm */
00119 void imProcessBlend(const imImage* src_image1, const imImage* src_image2, const imImage* alpha_image, imImage* dst_image);
00120 
00121 /** Split a complex image into two images with real and imaginary parts \n
00122  * or magnitude and phase parts (polar). \n
00123  * Source image must be IM_CFLOAT, destiny images must be IM_FLOAT.
00124  *
00125  * \verbatim im.ProcessSplitComplex(src_image: imImage, dst_image1: imImage, dst_image2: imImage, do_polar: boolean) [in Lua 5] \endverbatim
00126  * \verbatim im.ProcessSplitComplexNew(image: imImage, do_polar: boolean) -> dst_image1: imImage, dst_image2: imImage [in Lua 5] \endverbatim
00127  * \ingroup arithm */
00128 void imProcessSplitComplex(const imImage* src_image, imImage* dst_image1, imImage* dst_image2, int do_polar);
00129 
00130 /** Merges two images as the real and imaginary parts of a complex image, \n
00131  * or as magnitude and phase parts (polar = 1). \n
00132  * Source images must be IM_FLOAT, destiny image must be IM_CFLOAT.
00133  *
00134  * \verbatim im.ProcessMergeComplex(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00135  * \verbatim im.ProcessMergeComplexNew(image1: imImage, image2: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00136  * \ingroup arithm */
00137 void imProcessMergeComplex(const imImage* src_image1, const imImage* src_image2, imImage* dst_image, int polar);
00138 
00139 /** Calculates the mean of multiple images. \n
00140  * Images must match size and type.
00141  *
00142  * \verbatim im.ProcessMultipleMean(src_image_list: table of imImage, dst_image: imImage) [in Lua 5] \endverbatim
00143  * \verbatim im.ProcessMultipleMeanNew(src_image_list: table of imImage) -> new_image: imImage [in Lua 5] \endverbatim
00144  * \ingroup arithm */
00145 void imProcessMultipleMean(const imImage** src_image_list, int src_image_count, imImage* dst_image);
00146 
00147 /** Calculates the standard deviation of multiple images. \n
00148  * Images must match size and type. Use \ref imProcessMultipleMean to calculate the mean_image.
00149  *
00150  * \verbatim im.ProcessMultipleStdDev(src_image_list: table of imImage, mean_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00151  * \verbatim im.ProcessMultipleStdDevNew(src_image_list: table of imImage, mean_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00152  * \ingroup arithm */
00153 void imProcessMultipleStdDev(const imImage** src_image_list, int src_image_count, const imImage *mean_image, imImage* dst_image);
00154 
00155 /** Calculates the auto-covariance of an image with the mean of a set of images. \n
00156  * Images must match size and type. Returns zero if the counter aborted.
00157  *
00158  * \verbatim im.ProcessAutoCovariance(src_image: imImage, mean_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] \endverbatim
00159  * \verbatim im.ProcessAutoCovarianceNew(src_image: imImage, mean_image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00160  * \ingroup arithm */
00161 int imProcessAutoCovariance(const imImage* src_image, const imImage* mean_image, imImage* dst_image);
00162 
00163 /** Multiplies the conjugate of one complex image with another complex image. \n
00164  * Images must match size. Conj(img1) * img2 \n
00165  * Can be done in-place.
00166  *
00167  * \verbatim im.ProcessMultiplyConj(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00168  * \verbatim im.ProcessMultiplyConjNew(src_image1: imImage, src_image2: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00169  * \ingroup arithm */
00170 void imProcessMultiplyConj(const imImage* src_image1, const imImage* src_image2, imImage* dst_image);
00171 
00172 
00173 
00174 /** \defgroup quantize Additional Image Quantization Operations
00175  * \par
00176  * Additionally operations to the \ref imConvertColorSpace function.
00177  * \par
00178  * See \ref im_process_pon.h
00179  * \ingroup process */
00180 
00181 /** Converts a RGB image to a MAP image using uniform quantization 
00182  * with an optional 8x8 ordered dither. The RGB image must have data type IM_BYTE.
00183  *
00184  * \verbatim im.ProcessQuantizeRGBUniform(src_image: imImage, dst_image: imImage, do_dither: boolean) [in Lua 5] \endverbatim
00185  * \verbatim im.ProcessQuantizeRGBUniformNew(src_image: imImage, do_dither: boolean) -> new_image: imImage [in Lua 5] \endverbatim
00186  * \ingroup quantize */
00187 void imProcessQuantizeRGBUniform(const imImage* src_image, imImage* dst_image, int do_dither);
00188 
00189 /** Quantizes a gray scale image in less that 256 grays using uniform quantization. \n
00190  * Both images must be IM_BYTE/IM_GRAY. Can be done in place. 
00191  *
00192  * \verbatim im.ProcessQuantizeGrayUniform(src_image: imImage, dst_image: imImage, grays: number) [in Lua 5] \endverbatim
00193  * \verbatim im.ProcessQuantizeGrayUniformNew(src_image: imImage, grays: number) -> new_image: imImage [in Lua 5] \endverbatim
00194  * \ingroup quantize */
00195 void imProcessQuantizeGrayUniform(const imImage* src_image, imImage* dst_image, int grays);
00196 
00197 
00198 
00199 /** \defgroup histo Histogram Based Operations
00200  * \par
00201  * See \ref im_process_pon.h
00202  * \ingroup process */
00203 
00204 /** Performs an histogram expansion based on a percentage of the number of pixels. \n
00205  * Percentage defines an amount of pixels to include at the lowest level and at the highest level.
00206  * If its is zero only empty counts of the histogram will be considered. \n
00207  * Images must be IM_BYTE/(IM_RGB or IM_GRAY). Can be done in place. \n
00208  * To expand the gammut without using the histogram, by just specifing the lowest and highest levels
00209  * use the \ref IM_GAMUT_EXPAND tone gammut operation (\ref imProcessToneGamut).
00210  *
00211  * \verbatim im.ProcessExpandHistogram(src_image: imImage, dst_image: imImage, percent: number) [in Lua 5] \endverbatim
00212  * \verbatim im.ProcessExpandHistogramNew(src_image: imImage, percent: number) -> new_image: imImage [in Lua 5] \endverbatim
00213  * \ingroup histo */
00214 void imProcessExpandHistogram(const imImage* src_image, imImage* dst_image, float percent);
00215 
00216 /** Performs an histogram equalization. \n
00217  * Images must be IM_BYTE/(IM_RGB or IM_GRAY). Can be done in place. 
00218  *
00219  * \verbatim im.ProcessEqualizeHistogram(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00220  * \verbatim im.ProcessEqualizeHistogramNew(src_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00221  * \ingroup histo */
00222 void imProcessEqualizeHistogram(const imImage* src_image, imImage* dst_image);
00223 
00224 
00225 
00226 /** \defgroup colorproc Color Processing Operations
00227  * \par
00228  * Operations to change the color components configuration.
00229  * \par
00230  * See \ref im_process_pon.h
00231  * \ingroup process */
00232 
00233 /** Split a RGB image into luma and chroma. \n
00234  * Chroma is calculated as R-Y,G-Y,B-Y. Source image must be IM_RGB/IM_BYTE. \n
00235  * luma image is IM_GRAY/IM_BYTE and chroma is IM_RGB/IM_BYTE. \n
00236  * Source and destiny must have the same size. 
00237  *
00238  * \verbatim im.ProcessSplitYChroma(src_image: imImage, y_image: imImage, chroma_image: imImage) [in Lua 5] \endverbatim
00239  * \verbatim im.ProcessSplitYChromaNew(src_image: imImage) -> y_image: imImage, chroma_image: imImage [in Lua 5] \endverbatim
00240  * \ingroup colorproc */
00241 void imProcessSplitYChroma(const imImage* src_image, imImage* y_image, imImage* chroma_image);
00242 
00243 /** Split a RGB image into HSI planes. \n
00244  * Source image must be IM_RGB/IM_BYTE,IM_FLOAT. Destiny images are all IM_GRAY/IM_FLOAT. \n
00245  * Source images must normalized to 0-1 if type is IM_FLOAT (\ref imProcessToneGamut can be used). See \ref hsi for a definition of the color conversion.\n
00246  * Source and destiny must have the same size. 
00247  *
00248  * \verbatim im.ProcessSplitHSI(src_image: imImage, h_image: imImage, s_image: imImage, i_image: imImage) [in Lua 5] \endverbatim
00249  * \verbatim im.ProcessSplitHSINew(src_image: imImage) -> h_image: imImage, s_image: imImage, i_image: imImage [in Lua 5] \endverbatim
00250  * \ingroup colorproc */
00251 void imProcessSplitHSI(const imImage* src_image, imImage* h_image, imImage* s_image, imImage* i_image);
00252 
00253 /** Merge HSI planes into a RGB image. \n
00254  * Source images must be IM_GRAY/IM_FLOAT. Destiny image can be IM_RGB/IM_BYTE,IM_FLOAT. \n
00255  * Source and destiny must have the same size. See \ref hsi for a definition of the color conversion.
00256  *
00257  * \verbatim im.ProcessMergeHSI(h_image: imImage, s_image: imImage, i_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00258  * \verbatim im.ProcessMergeHSINew(h_image: imImage, s_image: imImage, i_image: imImage) -> dst_image: imImage [in Lua 5] \endverbatim
00259  * \ingroup colorproc */
00260 void imProcessMergeHSI(const imImage* h_image, const imImage* s_image, const imImage* i_image, imImage* dst_image);
00261 
00262 /** Split a multicomponent image into separate components.\n
00263  * Destiny images must be IM_GRAY. Size and data types must be all the same.\n
00264  * The number of destiny images must match the depth of the source image.
00265  *
00266  * \verbatim im.ProcessSplitComponents(src_image: imImage, dst_image_list: table of imImage) [in Lua 5] \endverbatim
00267  * \verbatim im.ProcessSplitComponentsNew(src_image: imImage) -> dst_image_list: table of imImage [in Lua 5] \endverbatim
00268  * \ingroup colorproc */
00269 void imProcessSplitComponents(const imImage* src_image, imImage** dst_image_list);
00270 
00271 /** Merges separate components into a multicomponent image.\n
00272  * Source images must be IM_GRAY. Size and data types must be all the same.\n
00273  * The number of source images must match the depth of the destiny image.
00274  *
00275  * \verbatim im.ProcessMergeComponents(src_image_list: table of imImage, dst_image: imImage) [in Lua 5] \endverbatim
00276  * \verbatim im.ProcessMergeComponentsNew(src_image_list: table of imImage) -> dst_image: imImage [in Lua 5] \endverbatim
00277  * \ingroup colorproc */
00278 void imProcessMergeComponents(const imImage** src_image_list, imImage* dst_image);
00279 
00280 /** Normalize the color components by their sum. Example: c1 = c1/(c1+c2+c3). \n
00281  * Destiny image must be IM_FLOAT. 
00282  *
00283  * \verbatim im.ProcessNormalizeComponents(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00284  * \verbatim im.ProcessNormalizeComponentsNew(src_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00285  * \ingroup colorproc */
00286 void imProcessNormalizeComponents(const imImage* src_image, imImage* dst_image);
00287 
00288 /** Replaces the source color by the destiny color. \n
00289  * The color will be type casted to the image data type. \n
00290  * The colors must have the same number of components of the images. \n
00291  * Supports all color spaces and all data types except IM_CFLOAT.
00292  *
00293  * \verbatim im.ProcessReplaceColor(src_image: imImage, dst_image: imImage, src_color: table of numbers, dst_color: table of numbers) [in Lua 5] \endverbatim
00294  * \verbatim im.ProcessReplaceColorNew(src_image: imImage, src_color: table of numbers, dst_color: table of numbers) -> new_image: imImage [in Lua 5] \endverbatim
00295  * \ingroup colorproc */
00296 void imProcessReplaceColor(const imImage* src_image, imImage* dst_image, float* src_color, float* dst_color);
00297 
00298 
00299 
00300 /** \defgroup logic Logical Arithmetic Operations 
00301  * \par
00302  * Logical binary math operations for images.
00303  * \par
00304  * See \ref im_process_pon.h
00305  * \ingroup process */
00306 
00307 /** Logical Operations.
00308  * \ingroup logic */
00309 enum imLogicOp {
00310   IM_BIT_AND,   /**< and  =   a & b   */
00311   IM_BIT_OR,    /**< or   =   a | b   */
00312   IM_BIT_XOR    /**< xor  = ~(a | b)  */
00313 };
00314 
00315 /** Apply a logical operation.\n
00316  * Images must have data type IM_BYTE, IM_USHORT or IM_INT. Can be done in place. 
00317  *
00318  * \verbatim im.ProcessBitwiseOp(src_image1: imImage, src_image2: imImage, dst_image: imImage, op: number) [in Lua 5] \endverbatim
00319  * \verbatim im.ProcessBitwiseOpNew(src_image1: imImage, src_image2: imImage, op: number) -> new_image: imImage [in Lua 5] \endverbatim
00320  * \ingroup logic */
00321 void imProcessBitwiseOp(const imImage* src_image1, const imImage* src_image2, imImage* dst_image, int op);
00322 
00323 /** Apply a logical NOT operation.\n
00324  * Images must have data type IM_BYTE, IM_USHORT or IM_INT. Can be done in place. 
00325  *
00326  * \verbatim im.ProcessBitwiseNot(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00327  * \verbatim im.ProcessBitwiseNotNew(src_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00328  * \ingroup logic */
00329 void imProcessBitwiseNot(const imImage* src_image, imImage* dst_image);
00330 
00331 /** Apply a bit mask. \n
00332  * The same as imProcessBitwiseOp but the second image is replaced by a fixed mask. \n
00333  * Images must have data type IM_BYTE. It is valid only for AND, OR and XOR. Can be done in place.
00334  *
00335  * \verbatim im.ProcessBitMask(src_image: imImage, dst_image: imImage, mask: string, op: number) [in Lua 5] \endverbatim
00336  * \verbatim im.ProcessBitMaskNew(src_image: imImage, mask: string, op: number) -> new_image: imImage [in Lua 5] \endverbatim
00337  * In Lua, mask is a string with 0s and 1s, for example: "11001111".
00338  * \ingroup logic */
00339 void imProcessBitMask(const imImage* src_image, imImage* dst_image, unsigned char mask, int op);
00340 
00341 /** Extract or Reset a bit plane. For ex: 000X0000 or XXX0XXXX (plane=3).\n
00342  * Images must have data type IM_BYTE. Can be done in place. 
00343  *
00344  * \verbatim im.ProcessBitPlane(src_image: imImage, dst_image: imImage, plane: number, do_reset: boolean) [in Lua 5] \endverbatim
00345  * \verbatim im.ProcessBitPlaneNew(src_image: imImage, plane: number, do_reset: boolean) -> new_image: imImage [in Lua 5] \endverbatim
00346  * \ingroup logic */
00347 void imProcessBitPlane(const imImage* src_image, imImage* dst_image, int plane, int do_reset);
00348 
00349 
00350 
00351 /** \defgroup render Synthetic Image Render
00352  * \par
00353  * Renders some 2D mathematical functions as images. All the functions operates in place 
00354  * and supports all data types except IM_CFLOAT.
00355  * \par
00356  * See \ref im_process_pon.h
00357  * \ingroup process */
00358 
00359 /** Render Funtion.
00360  * \verbatim render_func(x: number, y: number, d: number, param: table of number) -> value: number [in Lua 5] \endverbatim
00361  * \ingroup render */
00362 typedef float (*imRenderFunc)(int x, int y, int d, float* param);
00363 
00364 /** Render Conditional Funtion.
00365  * \verbatim render_cond_func(x: number, y: number, d: number, param: table of number) -> value: number, cond: boolean [in Lua 5] \endverbatim
00366  * \ingroup render */
00367 typedef float (*imRenderCondFunc)(int x, int y, int d, int *cond, float* param);
00368 
00369 /** Render a synthetic image using a render function. \n
00370  * plus will make the render be added to the current image data, 
00371  * or else all data will be replaced. All the render functions use this or the conditional function. \n
00372  * Returns zero if the counter aborted.
00373  *
00374  * \verbatim im.ProcessRenderOp(image: imImage, render_func: function, render_name: string, param: table of number, plus: boolean) -> counter: boolean [in Lua 5] \endverbatim
00375  * \ingroup render */
00376 int imProcessRenderOp(imImage* image, imRenderFunc render_func, char* render_name, float* param, int plus);
00377 
00378 /** Render a synthetic image using a conditional render function. \n
00379  * Data will be rendered only if the condional param is true. \n
00380  * Returns zero if the counter aborted.
00381  *
00382  * \verbatim im.ProcessRenderCondOp(image: imImage, render_cond_func: function, render_name: string, param: table of number) -> counter: boolean [in Lua 5] \endverbatim
00383  * \ingroup render */
00384 int imProcessRenderCondOp(imImage* image, imRenderCondFunc render_cond_func, char* render_name, float* param);
00385 
00386 /** Render speckle noise on existing data. Can be done in place.
00387  *
00388  * \verbatim im.ProcessRenderAddSpeckleNoise(src_image: imImage, dst_image: imImage, percent: number) -> counter: boolean [in Lua 5] \endverbatim
00389  * \verbatim im.ProcessRenderAddSpeckleNoiseNew(src_image: imImage, percent: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00390  * \ingroup render */
00391 int imProcessRenderAddSpeckleNoise(const imImage* src_image, imImage* dst_image, float percent);
00392 
00393 /** Render gaussian noise on existing data. Can be done in place.
00394  *
00395  * \verbatim im.ProcessRenderAddGaussianNoise(src_image: imImage, dst_image: imImage, mean: number, stddev: number) -> counter: boolean [in Lua 5] \endverbatim
00396  * \verbatim im.ProcessRenderAddGaussianNoiseNew(src_image: imImage, mean: number, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00397  * \ingroup render */
00398 int imProcessRenderAddGaussianNoise(const imImage* src_image, imImage* dst_image, float mean, float stddev);
00399 
00400 /** Render uniform noise on existing data. Can be done in place.
00401  *
00402  * \verbatim im.ProcessRenderAddUniformNoise(src_image: imImage, dst_image: imImage, mean: number, stddev: number) -> counter: boolean [in Lua 5] \endverbatim
00403  * \verbatim im.ProcessRenderAddUniformNoiseNew(src_image: imImage, mean: number, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00404  * \ingroup render */
00405 int imProcessRenderAddUniformNoise(const imImage* src_image, imImage* dst_image, float mean, float stddev);
00406 
00407 /** Render random noise.
00408  *
00409  * \verbatim im.ProcessRenderRandomNoise(image: imImage) -> counter: boolean [in Lua 5] \endverbatim
00410  * \ingroup render */
00411 int imProcessRenderRandomNoise(imImage* image);
00412 
00413 /** Render a constant. The number of values must match the depth of the image.
00414  *
00415  * \verbatim im.ProcessRenderConstant(image: imImage, value: table of number) -> counter: boolean [in Lua 5] \endverbatim
00416  * \ingroup render */
00417 int imProcessRenderConstant(imImage* image, float* value);
00418 
00419 /** Render a centered wheel.
00420  *
00421  * \verbatim im.ProcessRenderWheel(image: imImage, internal_radius: number, external_radius: number) -> counter: boolean [in Lua 5] \endverbatim
00422  * \ingroup render */
00423 int imProcessRenderWheel(imImage* image, int internal_radius, int external_radius);
00424 
00425 /** Render a centered cone.
00426  *
00427  * \verbatim im.ProcessRenderCone(image: imImage, radius: number) -> counter: boolean [in Lua 5] \endverbatim
00428  * \ingroup render */
00429 int imProcessRenderCone(imImage* image, int radius);
00430 
00431 /** Render a centered tent.
00432  *
00433  * \verbatim im.ProcessRenderTent(image: imImage, tent_width: number, tent_height: number) -> counter: boolean [in Lua 5] \endverbatim
00434  * \ingroup render */
00435 int imProcessRenderTent(imImage* image, int tent_width, int tent_height);
00436 
00437 /** Render a ramp. Direction can be vertical (1) or horizontal (0).
00438  *
00439  * \verbatim im.ProcessRenderRamp(image: imImage, start: number, end: number, vert_dir: boolean) -> counter: boolean [in Lua 5] \endverbatim
00440  * \ingroup render */
00441 int imProcessRenderRamp(imImage* image, int start, int end, int vert_dir);
00442 
00443 /** Render a centered box.
00444  *
00445  * \verbatim im.ProcessRenderBox(image: imImage, box_width: number, box_height: number) -> counter: boolean [in Lua 5] \endverbatim
00446  * \ingroup render */
00447 int imProcessRenderBox(imImage* image, int box_width, int box_height);
00448 
00449 /** Render a centered sinc.
00450  *
00451  * \verbatim im.ProcessRenderSinc(image: imImage, x_period: number, y_period: number) -> counter: boolean [in Lua 5] \endverbatim
00452  * \ingroup render */
00453 int imProcessRenderSinc(imImage* image, float x_period, float y_period);
00454 
00455 /** Render a centered gaussian.
00456  *
00457  * \verbatim im.ProcessRenderGaussian(image: imImage, stddev: number) -> counter: boolean [in Lua 5] \endverbatim
00458  * \ingroup render */
00459 int imProcessRenderGaussian(imImage* image, float stddev);
00460 
00461 /** Render the laplacian of a centered gaussian.
00462  *
00463  * \verbatim im.ProcessRenderLapOfGaussian(image: imImage, stddev: number) -> counter: boolean [in Lua 5] \endverbatim
00464  * \ingroup render */
00465 int imProcessRenderLapOfGaussian(imImage* image, float stddev);
00466 
00467 /** Render a centered cosine.
00468  *
00469  * \verbatim im.ProcessRenderCosine(image: imImage, x_period: number, y_period: number) -> counter: boolean [in Lua 5] \endverbatim
00470  * \ingroup render */
00471 int imProcessRenderCosine(imImage* image, float x_period, float y_period);
00472 
00473 /** Render a centered grid.
00474  *
00475  * \verbatim im.ProcessRenderGrid(image: imImage, x_space: number, y_space: number) -> counter: boolean [in Lua 5] \endverbatim
00476  * \ingroup render */
00477 int imProcessRenderGrid(imImage* image, int x_space, int y_space);
00478 
00479 /** Render a centered chessboard.
00480  *
00481  * \verbatim im.ProcessRenderChessboard(image: imImage, x_space: number, y_space: number) -> counter: boolean [in Lua 5] \endverbatim
00482  * \ingroup render */
00483 int imProcessRenderChessboard(imImage* image, int x_space, int y_space);
00484 
00485 
00486 
00487 /** \defgroup tonegamut Tone Gamut Operations
00488  * \par
00489  * Operations that try to preserve the min-max interval in the output (the dynamic range).
00490  * \par
00491  * See \ref im_process_pon.h
00492  * \ingroup process */
00493 
00494 
00495 /** Tone Gamut Operations.
00496  * \ingroup tonegamut */
00497 enum imToneGamut {
00498   IM_GAMUT_NORMALIZE, /**< normalize = (a-min) / (max-min)     (destiny image must be IM_FLOAT)   */
00499   IM_GAMUT_POW,       /**< pow       = ((a-min) / (max-min))^gamma * (max-min) + min                  \n
00500                                        param[0]=gamma                                             */
00501   IM_GAMUT_LOG,       /**< log       = log(K * (a-min) / (max-min) + 1))*(max-min)/log(K+1) + min     \n
00502                                        param[0]=K     (K>0)                                       */
00503   IM_GAMUT_EXP,       /**< exp       = (exp(K * (a-min) / (max-min)) - 1))*(max-min)/(exp(K)-1) + min \n
00504                                        param[0]=K                                                 */
00505   IM_GAMUT_INVERT,    /**< invert    = max - (a-min)                                              */
00506   IM_GAMUT_ZEROSTART, /**< zerostart = a - min                                                    */
00507   IM_GAMUT_SOLARIZE,  /**< solarize  = a < level ?  a:  (level * (max-min) - a * (level-min)) / (max-level) \n
00508                                        param[0]=level percentage (0-100) relative to min-max      \n
00509                                        photography solarization effect. */
00510   IM_GAMUT_SLICE,     /**< slice     = start < a || a > end ?  min:  binarize?  max: a                     \n
00511                                        param[0]=start,  param[1]=end,  param[2]=binarize          */
00512   IM_GAMUT_EXPAND,    /**< expand    = a < start ?  min: a > end ? max :  (a-start)*(max-min)/(end-start) + min  \n
00513                                        param[0]=start,  param[1]=end                              */
00514   IM_GAMUT_CROP,      /**< crop      = a < start ?  start: a > end ? end : a                                        \n
00515                                        param[0]=start,  param[1]=end                              */
00516   IM_GAMUT_BRIGHTCONT /**< brightcont = a < min ?  min:  a > max ?  max:  a * tan(c_a) + b_s + (max-min)*(1 - tan(c_a))/2  \n
00517                                         param[0]=bright_shift (-100%..+100%),  param[1]=contrast_factor (-100%..+100%)     \n
00518                                         change brightness and contrast simultaneously. */
00519 };
00520 
00521 /** Apply a gamut operation with arguments. \n
00522  * Supports all data types except IM_CFLOAT. \n
00523  * The linear operation do a special convertion when min > 0 and max < 1, it forces min=0 and max=1. \n
00524  * IM_BYTE images have min=0 and max=255 always. \n
00525  * Can be done in place. When there is no extra params use NULL.
00526  *
00527  * \verbatim im.ProcessToneGamut(src_image: imImage, dst_image: imImage, op: number, param: table of number) [in Lua 5] \endverbatim
00528  * \verbatim im.ProcessToneGamutNew(src_image: imImage, op: number, param: table of number) -> new_image: imImage [in Lua 5] \endverbatim
00529  * \ingroup tonegamut */
00530 void imProcessToneGamut(const imImage* src_image, imImage* dst_image, int op, float* param);
00531 
00532 /** Converts from (0-1) to (0-255), crop out of bounds values. \n
00533  * Source image must be IM_FLOAT, and destiny image must be IM_BYTE.
00534  *
00535  * \verbatim im.ProcessUnNormalize(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00536  * \verbatim im.ProcessUnNormalizeNew(src_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00537  * \ingroup tonegamut */
00538 void imProcessUnNormalize(const imImage* src_image, imImage* dst_image);
00539 
00540 /** Directly converts IM_USHORT, IM_INT and IM_FLOAT into IM_BYTE images. \n
00541  * This can also be done using \ref imConvertDataType with IM_CAST_DIRECT.
00542  *
00543  * \verbatim im.ProcessDirectConv(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00544  * \verbatim im.ProcessDirectConvNew(src_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00545  * \ingroup tonegamut */
00546 void imProcessDirectConv(const imImage* src_image, imImage* dst_image);
00547 
00548 /** A negative effect. Uses \ref imProcessToneGamut with IM_GAMUT_INVERT for non MAP images. \n
00549  * Supports all color spaces and all data types except IM_CFLOAT. \n
00550  * Can be done in place. 
00551  *
00552  * \verbatim im.ProcessNegative(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00553  * \verbatim im.ProcessNegativeNew(src_image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00554  * \ingroup tonegamut */
00555 void imProcessNegative(const imImage* src_image, imImage* dst_image);
00556 
00557 
00558 
00559 /** \defgroup threshold Threshold Operations
00560  * \par
00561  * Operations that converts a usually IM_GRAY/IM_BYTE image into a IM_BINARY image using several threshold techniques.
00562  * \par
00563  * See \ref im_process_pon.h
00564  * \ingroup process */
00565 
00566 /** Apply a manual threshold. \n
00567  * threshold = a <= level ? 0: value \n
00568  * Normal value is 1 but another common value is 255. Can be done in place for IM_BYTE source. \n
00569  * Supports all integer IM_GRAY images as source, and IM_BINARY as destiny.
00570  *
00571  * \verbatim im.ProcessThreshold(src_image: imImage, dst_image: imImage, level: number, value: number) [in Lua 5] \endverbatim
00572  * \verbatim im.ProcessThresholdNew(src_image: imImage, level: number, value: number) -> new_image: imImage [in Lua 5] \endverbatim
00573  * \ingroup threshold */
00574 void imProcessThreshold(const imImage* src_image, imImage* dst_image, int level, int value);
00575 
00576 /** Apply a threshold by the difference of two images. \n
00577  * threshold = a1 <= a2 ? 0: 1   \n
00578  * Can be done in place. 
00579  *
00580  * \verbatim im.ProcessThresholdByDiff(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00581  * \verbatim im.ProcessThresholdByDiffNew(src_image1: imImage, src_image2: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00582  * \ingroup threshold */
00583 void imProcessThresholdByDiff(const imImage* src_image1, const imImage* src_image2, imImage* dst_image);
00584 
00585 /** Apply a threshold by the Hysteresis method. \n
00586  * Hysteresis thersholding of edge pixels. Starting at pixels with a
00587  * value greater than the HIGH threshold, trace a connected sequence
00588  * of pixels that have a value greater than the LOW threhsold. \n
00589  * Note: could not find the original source code author name.
00590  *
00591  * \verbatim im.ProcessHysteresisThreshold(src_image: imImage, dst_image: imImage, low_thres: number, high_thres: number) [in Lua 5] \endverbatim
00592  * \verbatim im.ProcessHysteresisThresholdNew(src_image: imImage, low_thres: number, high_thres: number) -> new_image: imImage [in Lua 5] \endverbatim
00593  * \ingroup threshold */
00594 void imProcessHysteresisThreshold(const imImage* src_image, imImage* dst_image, int low_thres, int high_thres);
00595 
00596 /** Estimates hysteresis low and high threshold levels. \n
00597  * Usefull for \ref imProcessHysteresisThreshold.
00598  *
00599  * \verbatim im.ProcessHysteresisThresEstimate(image: imImage) -> low_level: number, high_level: number [in Lua 5] \endverbatim
00600  * \ingroup threshold */
00601 void imProcessHysteresisThresEstimate(const imImage* image, int *low_level, int *high_level);
00602 
00603 /** Calculates the threshold level for manual threshold using an uniform error approach. \n
00604  * Extracted from XITE, Copyright 1991, Blab, UiO \n
00605  * http://www.ifi.uio.no/~blab/Software/Xite/
00606 \verbatim
00607   Reference:
00608     S. M. Dunn & D. Harwood & L. S. Davis:
00609     "Local Estimation of the Uniform Error Threshold"
00610     IEEE Trans. on PAMI, Vol PAMI-6, No 6, Nov 1984.
00611   Comments: It only works well on images whith large objects.
00612   Author: Olav Borgli, BLAB, ifi, UiO
00613   Image processing lab, Department of Informatics, University of Oslo
00614 \endverbatim
00615  * Returns the used level.
00616  *
00617  * \verbatim im.ProcessUniformErrThreshold(src_image: imImage, dst_image: imImage) -> level: number [in Lua 5] \endverbatim
00618  * \verbatim im.ProcessUniformErrThresholdNew(src_image: imImage)  -> level: number, new_image: imImage [in Lua 5] \endverbatim
00619  * \ingroup threshold */
00620 int imProcessUniformErrThreshold(const imImage* src_image, imImage* dst_image);
00621 
00622 /** Apply a dithering on each image channel by using a difusion error method. \n
00623  * It can be applied on any IM_BYTE images. It will "threshold" each channel indivudually, so
00624  * source and destiny must be of the same depth.
00625  *
00626  * \verbatim im.ProcessDifusionErrThreshold(src_image: imImage, dst_image: imImage, level: number) [in Lua 5] \endverbatim
00627  * \verbatim im.ProcessDifusionErrThresholdNew(src_image: imImage, level: number) -> new_image: imImage [in Lua 5] \endverbatim
00628  * \ingroup threshold */
00629 void imProcessDifusionErrThreshold(const imImage* src_image, imImage* dst_image, int level);
00630 
00631 /** Calculates the threshold level for manual threshold using a percentage of pixels
00632  * that should stay bellow the threshold. \n
00633  * Returns the used level.
00634  *
00635  * \verbatim im.ProcessPercentThreshold(src_image: imImage, dst_image: imImage, percent: number) -> level: number [in Lua 5] \endverbatim
00636  * \verbatim im.ProcessPercentThresholdNew(src_image: imImage, percent: number) -> level: number, new_image: imImage [in Lua 5] \endverbatim
00637  * \ingroup threshold */
00638 int imProcessPercentThreshold(const imImage* src_image, imImage* dst_image, float percent);
00639 
00640 /** Calculates the threshold level for manual threshold using the Otsu approach. \n
00641  * Returns the used level. \n
00642  * Original implementation by Flavio Szenberg.
00643  *
00644  * \verbatim im.ProcessOtsuThreshold(src_image: imImage, dst_image: imImage) -> level: number [in Lua 5] \endverbatim
00645  * \verbatim im.ProcessOtsuThresholdNew(src_image: imImage) -> level: number, new_image: imImage [in Lua 5] \endverbatim
00646  * \ingroup threshold */
00647 int imProcessOtsuThreshold(const imImage* src_image, imImage* dst_image);
00648 
00649 /** Calculates the threshold level for manual threshold using (max-min)/2. \n
00650  * Returns the used level. \n
00651  * Supports all integer IM_GRAY images as source, and IM_BINARY as destiny.
00652  *
00653  * \verbatim im.ProcessMinMaxThreshold(src_image: imImage, dst_image: imImage) -> level: number [in Lua 5] \endverbatim
00654  * \verbatim im.ProcessMinMaxThresholdNew(src_image: imImage) -> level: number, new_image: imImage [in Lua 5] \endverbatim
00655  * \ingroup threshold */
00656 int imProcessMinMaxThreshold(const imImage* src_image, imImage* dst_image);
00657 
00658 /** Estimates Local Max threshold level for IM_BYTE images.
00659  *
00660  * \verbatim im.ProcessLocalMaxThresEstimate(image: imImage) -> level: number [in Lua 5] \endverbatim
00661  * \ingroup threshold */
00662 void imProcessLocalMaxThresEstimate(const imImage* image, int *level);
00663 
00664 /** Apply a manual threshold using an interval. \n
00665  * threshold = start_level <= a <= end_level ? 1: 0 \n
00666  * Normal value is 1 but another common value is 255. Can be done in place for IM_BYTE source. \n
00667  * Supports all integer IM_GRAY images as source, and IM_BINARY as destiny.
00668  *
00669  * \verbatim im.ProcessSliceThreshold(src_image: imImage, dst_image: imImage, start_level: number, end_level: number) [in Lua 5] \endverbatim
00670  * \verbatim im.ProcessSliceThresholdNew(src_image: imImage, start_level: number, end_level: number) -> new_image: imImage [in Lua 5] \endverbatim
00671  * \ingroup threshold */
00672 void imProcessSliceThreshold(const imImage* src_image, imImage* dst_image, int start_level, int end_level);
00673 
00674 
00675 /** \defgroup effects Special Effects
00676  * \par
00677  * Operations to change image appearance.
00678  * \par
00679  * See \ref im_process_pon.h
00680  * \ingroup process */
00681 
00682 
00683 /** Generates a zoom in effect averaging colors inside a square region. \n
00684  * Operates only on IM_BYTE images.
00685  *
00686  * \verbatim im.ProcessPixelate(src_image: imImage, dst_image: imImage, box_size: number) [in Lua 5] \endverbatim
00687  * \verbatim im.ProcessPixelateNew(src_image: imImage, box_size: number) -> new_image: imImage [in Lua 5] \endverbatim
00688  * \ingroup effects */
00689 void imProcessPixelate(const imImage* src_image, imImage* dst_image, int box_size);
00690 
00691 /** A simple Posterize effect. It reduces the number of colors in the image eliminating 
00692  * less significant bit planes. Can have 1 to 7 levels. See \ref imProcessBitMask. \n
00693  * Image data type must be integer.
00694  *
00695  * \verbatim im.ProcessPosterize(src_image: imImage, dst_image: imImage, level: number) [in Lua 5] \endverbatim
00696  * \verbatim im.ProcessPosterizeNew(src_image: imImage, level: number) -> new_image: imImage [in Lua 5] \endverbatim
00697  * \ingroup effects */
00698 void imProcessPosterize(const imImage* src_image, imImage* dst_image, int level);
00699 
00700 
00701 
00702 #if defined(__cplusplus)
00703 }
00704 #endif
00705 
00706 #endif