IM: im_process_glo.h Source File
From IM - An Imaging Tool
im_process_glo.h
Go to the documentation of this file.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.1 2005/04/02 22:07: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 Domain Transform Operations 00020 * \par 00021 * FFT, Wavelts, Hough, Distance. 00022 * \par 00023 * FFTW Copyright Matteo Frigo, Steven G. Johnson and the MIT. \n 00024 * http://www.fftw.org \n 00025 * See fftw.h or fftw3.h 00026 * \par 00027 * Must link with "im_fftw.lib" for FFTW version 2.1.5, and "im_fftw3.lib" for version 3.0.1. \n 00028 * Both libraries are available because version 3 was not that fast from version 2, 00029 * and its file size is 3x bigger than version 2. But version 3 was not compiled using hardware 00030 * otimizations. 00031 * \par 00032 * The FFTW lib has a GPL license. The license of the "im_fftw.lib" library is automatically the GPL. 00033 * So you cannot use it for commercial applications without contacting the authors. 00034 * \par 00035 * See \ref im_process_glo.h 00036 * \ingroup process */ 00037 00038 /** Forward FFT. \n 00039 * The result has its lowest frequency at the center of the image. \n 00040 * This is an unnormalized fft. \n 00041 * Images must be of the same size. Destiny image must be of type complex. 00042 * \ingroup transform */ 00043 void imProcessFFT(const imImage* src_image, imImage* dst_image); 00044 00045 /** Inverse FFT. \n 00046 * The image has its lowest frequency restored to the origin before the transform. \n 00047 * The result is normalized by (width*height). \n 00048 * Images must be of the same size and both must be of type complex. 00049 * \ingroup transform */ 00050 void imProcessIFFT(const imImage* src_image, imImage* dst_image); 00051 00052 /** Raw in-place FFT (forward or inverse). \n 00053 * The lowest frequency can be centered after forward, or 00054 * can be restored to the origin before inverse. \n 00055 * The result can be normalized after the transform by sqrt(w*h) [1] or by (w*h) [2], 00056 * or left unnormalized [0]. \n 00057 * Images must be of the same size and both must be of type complex. 00058 * \ingroup transform */ 00059 void imProcessFFTraw(imImage* src_image, int inverse, int center, int normalize); 00060 00061 /** Auxiliary function for the raw FFT. \n 00062 * This is the function used internally to change the lowest frequency position in the image. \n 00063 * If the image size has even dimensions the flag "center2origin" is useless. But if it is odd, 00064 * you must specify if its from center to origin (usually used before inverse) or 00065 * from origin to center (usually used after forward). \n 00066 * Notice that this function is used for images in the the frequency domain. \n 00067 * Image type must be complex. 00068 * \ingroup transform */ 00069 void imProcessSwapQuadrants(imImage* src_image, int center2origin); 00070 00071 /** Hough Lines Transform. \n 00072 * It will detect white lines in a black background. So the source image must be a IM_BINARY image 00073 * with the white lines of interest enhanced. The better the threshold with the white lines the better 00074 * the line detection. \n 00075 * The destiny image must have IM_GRAY, IM_INT, width=180, height=2*rmax+1, where rmax is the image diagonal/2. \n 00076 * The houfh transform defines "cos(theta) * X + sin(theta) * Y = rho" and the parameters are in the interval: \n 00077 * theta = "0 .. 179", rho = "-height/2 .. height/2" .\n 00078 * Returns zero if the counter aborted. \n 00079 * Inspired from ideas in XITE, Copyright 1991, Blab, UiO \n 00080 * http://www.ifi.uio.no/~blab/Software/Xite/ 00081 * \ingroup transform */ 00082 int imProcessHoughLines(const imImage* src_image, imImage* dst_image); 00083 00084 /** Draw detected hough lines. \n 00085 * The source image must be IM_GRAY and IM_BYTE. The destiny image can be a clone of the source image or 00086 * it can be the source image for in place processing. \n 00087 * The hough points image is a hough transform image that was thresholded to a IM_BINARY image, 00088 * usually using a Local Max threshold operation. Again the better the threshold the better the results. \n 00089 * The destiny image will be set to IM_MAP, and the detected lines will be drawn using a red color. \n 00090 * Returns the number of detected lines. 00091 * \ingroup transform */ 00092 int imProcessHoughLinesDraw(const imImage* src_image, const imImage* hough_points, imImage* dst_image); 00093 00094 /** Calculates the Cross Correlation in the frequency domain. \n 00095 * CrossCorr(a,b) = IFFT(Conj(FFT(a))*FFT(b)) \n 00096 * Images must be of the same size and only destiny image must be of type complex. 00097 * \ingroup transform */ 00098 void imProcessCrossCorrelation(const imImage* src_image1, const imImage* src_image2, imImage* dst_image); 00099 00100 /** Calculates the Auto Correlation in the frequency domain. \n 00101 * Uses the cross correlation. 00102 * Images must be of the same size and only destiny image must be of type complex. 00103 * \ingroup transform */ 00104 void imProcessAutoCorrelation(const imImage* src_image, imImage* dst_image); 00105 /** Calculates the Distance Transform of a binary image 00106 * using an aproximation of the euclidian distance.\n 00107 * Each white pixel in the binary image is 00108 * assigned a value equal to its distance from the nearest 00109 * black pixel. \n 00110 * Uses a two-pass algorithm incrementally calculating the distance. \n 00111 * Source image must be IM_BINARY, destiny must be IM_FLOAT. 00112 * \ingroup transform */ 00113 void imProcessDistanceTransform(const imImage* src_image, imImage* dst_image); 00114 00115 /** Marks all the regional maximum of the distance transform. \n 00116 * source is IMGRAY/IM_FLOAT destiny in IM_BINARY. \n 00117 * We consider maximum all connected pixel values that have smaller pixel values around it. 00118 * \ingroup transform */ 00119 void imProcessRegionalMaximum(const imImage* src_image, imImage* dst_image); 00120 00121 00122 #if defined(__cplusplus) 00123 } 00124 #endif 00125 00126 #endif