00001 /** \file
00002 * \brief Image Processing - Global Operations
00003 *
00004 * See Copyright Notice in im_lib.h
00005 * $Id: im_process_glo.h,v 1.4 2005/12/12 20:29:00 scuri Exp $
00006 */
00007
00008 #ifndef __IM_PROCESS_GLO_H
00009 #define __IM_PROCESS_GLO_H
00010
00011 #include "im_image.h"
00012
00013 #if defined(__cplusplus)
00014 extern "C" {
00015 #endif
00016
00017
00018
00019 /** \defgroup transform Other Domain Transform Operations
00020 * \par
00021 * Hough, Distance.
00022 *
00023 * See \ref im_process_glo.h
00024 * \ingroup process */
00025
00026 /** Hough Lines Transform. \n
00027 * It will detect white lines in a black background. So the source image must be a IM_BINARY image
00028 * with the white lines of interest enhanced. The better the threshold with the white lines the better
00029 * the line detection. \n
00030 * The destiny image must have IM_GRAY, IM_INT, width=180, height=2*rmax+1, where rmax is the image diagonal/2. \n
00031 * The houfh transform defines "cos(theta) * X + sin(theta) * Y = rho" and the parameters are in the interval: \n
00032 * theta = "0 .. 179", rho = "-height/2 .. height/2" .\n
00033 * Returns zero if the counter aborted. \n
00034 * Inspired from ideas in XITE, Copyright 1991, Blab, UiO \n
00035 * http://www.ifi.uio.no/~blab/Software/Xite/
00036 *
00037 * \verbatim im.ProcessHoughLines(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] \endverbatim
00038 * \verbatim im.ProcessHoughLinesNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
00039 * \ingroup transform */
00040 int imProcessHoughLines(const imImage* src_image, imImage* dst_image);
00041
00042 /** Draw detected hough lines. \n
00043 * The source image must be IM_GRAY and IM_BYTE. The destiny image can be a clone of the source image or
00044 * it can be the source image for in place processing. \n
00045 * The hough points image is a hough transform image that was thresholded to a IM_BINARY image,
00046 * usually using a Local Max threshold operation. Again the better the threshold the better the results. \n
00047 * The destiny image will be set to IM_MAP, and the detected lines will be drawn using a red color. \n
00048 * Returns the number of detected lines.
00049 *
00050 * \verbatim im.ProcessHoughLinesDraw(src_image: imImage, hough_points: imImage, dst_image: imImage) -> lines: number [in Lua 5] \endverbatim
00051 * \verbatim im.ProcessHoughLinesDrawNew(image: imImage, hough_points: imImage) -> lines: number, new_image: imImage [in Lua 5] \endverbatim
00052 * \ingroup transform */
00053 int imProcessHoughLinesDraw(const imImage* src_image, const imImage* hough_points, imImage* dst_image);
00054
00055 /** Calculates the Cross Correlation in the frequency domain. \n
00056 * CrossCorr(a,b) = IFFT(Conj(FFT(a))*FFT(b)) \n
00057 * Images must be of the same size and only destiny image must be of type complex.
00058 *
00059 * \verbatim im.ProcessCrossCorrelation(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00060 * \verbatim im.ProcessCrossCorrelationNew(image1: imImage, image2: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00061 * \ingroup transform */
00062 void imProcessCrossCorrelation(const imImage* src_image1, const imImage* src_image2, imImage* dst_image);
00063
00064 /** Calculates the Auto Correlation in the frequency domain. \n
00065 * Uses the cross correlation.
00066 * Images must be of the same size and only destiny image must be of type complex.
00067 *
00068 * \verbatim im.ProcessAutoCorrelation(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00069 * \verbatim im.ProcessAutoCorrelationNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00070 * \ingroup transform */
00071 void imProcessAutoCorrelation(const imImage* src_image, imImage* dst_image);
00072
00073 /** Calculates the Distance Transform of a binary image
00074 * using an aproximation of the euclidian distance.\n
00075 * Each white pixel in the binary image is
00076 * assigned a value equal to its distance from the nearest
00077 * black pixel. \n
00078 * Uses a two-pass algorithm incrementally calculating the distance. \n
00079 * Source image must be IM_BINARY, destiny must be IM_FLOAT.
00080 *
00081 * \verbatim im.ProcessDistanceTransform(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00082 * \verbatim im.ProcessDistanceTransformNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00083 * \ingroup transform */
00084 void imProcessDistanceTransform(const imImage* src_image, imImage* dst_image);
00085
00086 /** Marks all the regional maximum of the distance transform. \n
00087 * source is IMGRAY/IM_FLOAT destiny in IM_BINARY. \n
00088 * We consider maximum all connected pixel values that have smaller pixel values around it.
00089 *
00090 * \verbatim im.ProcessRegionalMaximum(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00091 * \verbatim im.ProcessRegionalMaximumNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00092 * \ingroup transform */
00093 void imProcessRegionalMaximum(const imImage* src_image, imImage* dst_image);
00094
00095
00096
00097 /** \defgroup fourier Fourier Transform Operations
00098 * \par
00099 * All Fourier transforms use FFTW library version 2.1.5. \n
00100 * Although there are newer versions, we build binaries only to version 2
00101 * because it is small and as fast as newer versions.
00102 * Source code to use FFTW version 3 is available.
00103 * \par
00104 * FFTW Copyright Matteo Frigo, Steven G. Johnson and the MIT. \n
00105 * http://www.fftw.org \n
00106 * See "fftw.h"
00107 * \par
00108 * Must link with "im_fftw" library. \n
00109 * \par
00110 * The FFTW lib has a GPL license. The license of the "im_fftw" library is automatically the GPL.
00111 * So you cannot use it for commercial applications without contacting the authors.
00112 * \par
00113 * See \ref im_process_glo.h
00114 * \ingroup process */
00115
00116 /** Forward FFT. \n
00117 * The result has its lowest frequency at the center of the image. \n
00118 * This is an unnormalized fft. \n
00119 * Images must be of the same size. Destiny image must be of type complex.
00120 *
00121 * \verbatim im.ProcessFFT(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00122 * \verbatim im.ProcessFFTNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00123 * \ingroup fourier */
00124 void imProcessFFT(const imImage* src_image, imImage* dst_image);
00125
00126 /** Inverse FFT. \n
00127 * The image has its lowest frequency restored to the origin before the transform. \n
00128 * The result is normalized by (width*height). \n
00129 * Images must be of the same size and both must be of type complex.
00130 *
00131 * \verbatim im.ProcessIFFT(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
00132 * \verbatim im.ProcessIFFTNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
00133 * \ingroup fourier */
00134 void imProcessIFFT(const imImage* src_image, imImage* dst_image);
00135
00136 /** Raw in-place FFT (forward or inverse). \n
00137 * The lowest frequency can be centered after forward, or
00138 * can be restored to the origin before inverse. \n
00139 * The result can be normalized after the transform by sqrt(w*h) [1] or by (w*h) [2],
00140 * or left unnormalized [0]. \n
00141 * Images must be of the same size and both must be of type complex.
00142 *
00143 * \verbatim im.ProcessFFTraw(image: imImage, inverse: number, center: number, normalize: number) [in Lua 5] \endverbatim
00144 * \ingroup fourier */
00145 void imProcessFFTraw(imImage* image, int inverse, int center, int normalize);
00146
00147 /** Auxiliary function for the raw FFT. \n
00148 * This is the function used internally to change the lowest frequency position in the image. \n
00149 * If the image size has even dimensions the flag "center2origin" is useless. But if it is odd,
00150 * you must specify if its from center to origin (usually used before inverse) or
00151 * from origin to center (usually used after forward). \n
00152 * Notice that this function is used for images in the the frequency domain. \n
00153 * Image type must be complex.
00154 *
00155 * \verbatim im.ProcessSwapQuadrants(image: imImage, center2origin: number) [in Lua 5] \endverbatim
00156 * \ingroup fourier */
00157 void imProcessSwapQuadrants(imImage* image, int center2origin);
00158
00159
00160 #if defined(__cplusplus)
00161 }
00162 #endif
00163
00164 #endif