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