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

Generated on Thu Oct 1 11:40:01 2009 for IM by  doxygen 1.6.1