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