00001 /*---------------------------------------------------------------------+ 00002 | Library QgarLib, graphics analysis and recognition | 00003 | Copyright (C) 2002 Qgar Project, LORIA | 00004 | | 00005 | This library is free software; you can redistribute it and/or | 00006 | modify it under the terms of the GNU Lesser General Public | 00007 | License version 2.1, as published by the Free Software Foundation. | 00008 | | 00009 | This library is distributed in the hope that it will be useful, | 00010 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00011 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 00012 | See the GNU Lesser General Public License for more details. | 00013 | | 00014 | The GNU Lesser General Public License is included in the file | 00015 | LICENSE.LGPL, in the root directory of the Qgar packaging. See | 00016 | http://www.gnu.org/licenses/lgpl.html for the terms of the licence. | 00017 | To receive a paper copy, write to the Free Software Foundation, | 00018 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. | 00019 | | 00020 | Contact Project Qgar for any information: | 00021 | LORIA - équipe Qgar | 00022 | B.P. 239, 54506 Vandoeuvre-lès-Nancy Cedex, France | 00023 | email: qgar-contact@loria.fr | 00024 | http://www.qgar.org/ | 00025 *---------------------------------------------------------------------*/ 00026 00027 00028 #ifndef __DERICHEGRADIENTIMAGE_H_INCLUDED__ 00029 #define __DERICHEGRADIENTIMAGE_H_INCLUDED__ 00030 00031 00032 /** 00033 * @file DericheGradientImage.H 00034 * @brief Header file of class qgar::DericheGradientImage. 00035 * 00036 * @author <a href="mailto:qgar-develop@loria.fr?subject=Qgar fwd Karl Tombre">Karl Tombre</a> 00037 * @date July 3, 2001 11:15 00038 * @since Qgar 1.0 00039 */ 00040 00041 // For RCS/CVS use: Do not delete 00042 /* $Id: DericheGradientImage.H,v 1.13 2005/10/14 17:05:45 masini Exp $ */ 00043 00044 00045 // QGAR 00046 #include <qgarlib/AbstractGradientImage.H> 00047 #include <qgarlib/GenImage.H> 00048 00049 00050 namespace qgar 00051 { 00052 00053 00054 /** 00055 * @class DericheGradientImage DericheGradientImage.H "qgarlib/DericheGradientImage.H" 00056 * @ingroup IMGPROC_GRAD 00057 * @brief Deriche's optimal edge detector. 00058 * 00059 * The code is based on a previous implementation by Djemel Ziou 00060 * and Salvatore Tabbone, as described in 00061 * [<a href="Bibliography.html#Deriche-1987">Deriche, 1987</a>]. 00062 * 00063 * @author <a href="mailto:qgar-develop@loria.fr?subject=Qgar fwd Karl Tombre">Karl Tombre</a> 00064 * @date July 3, 2001 11:15 00065 * @since Qgar 1.0 00066 */ 00067 class DericheGradientImage 00068 00069 : public AbstractGradientImage 00070 00071 { 00072 // ------------------------------------------------------------------- 00073 // P U B L I C M E M B E R S 00074 // ------------------------------------------------------------------- 00075 public: 00076 00077 /** @name Constructors */ 00078 // ============ 00079 //@{ 00080 /** 00081 * @brief Construct from given grey-level image. 00082 * @param img grey-level image to derive 00083 * @param alpha parameter of the Deriche filter (default <b>1.0</b>) 00084 * @param w parameter of the Deriche filter (default <b>0.01</b>) 00085 * @param normalized = <b>1</b> if filter is normalized to have a 00086 * surface of 1. Default is <b>0</b>: In this case, the filter 00087 * preserves the height of the step edge. 00088 */ 00089 DericheGradientImage(const GreyLevelImage& img, 00090 float alpha = 1.0, 00091 float w = .01, 00092 int normalized = 0); 00093 00094 /** 00095 * @brief Construct from a float image. 00096 * 00097 * @param img float image to derive 00098 * @param alpha parameter of the Deriche filter (default <b>1.0</b>) 00099 * @param w parameter of the Deriche filter (default <b>0.01</b>) 00100 * @param normalized = <b>1</b> if filter is normalized to have a 00101 * surface of 1. Default is <b>0</b>: In this case, the filter 00102 * preserves the height of the step edge. 00103 */ 00104 DericheGradientImage(const FloatImage& img, 00105 float alpha = 1.0, 00106 float w = .01, 00107 int normalized = 0); 00108 00109 //@} 00110 00111 // ------------------------------------------------------------------- 00112 // P R O T E C T E D M E M B E R S 00113 // ------------------------------------------------------------------- 00114 protected: 00115 00116 /** @name Parameters (see Deriche's paper) */ 00117 // ================================ 00118 //@{ 00119 /** 00120 * @brief The alpha parameter. 00121 */ 00122 float _alpha; 00123 00124 /** 00125 * @brief The w parameter. 00126 */ 00127 float _w; 00128 //@} 00129 00130 // ------------------------------------------------------------------- 00131 // P R I V A T E M E M B E R S 00132 // ------------------------------------------------------------------- 00133 private: 00134 00135 /** @name Parameters to implement the IIR filter */ 00136 // ====================================== 00137 //@{ 00138 /// 00139 float a; 00140 /// 00141 float a0; 00142 /// 00143 float a1; 00144 /// 00145 float a2; 00146 /// 00147 float a3; 00148 /// 00149 float b1; 00150 /// 00151 float b2; 00152 //@} 00153 00154 00155 /** @name Filtering */ 00156 // ========= 00157 //@{ 00158 /** 00159 * @brief X filter. 00160 */ 00161 void dfilterX(); 00162 00163 /** 00164 * Y filter. 00165 */ 00166 void dfilterY(); 00167 //@} 00168 00169 00170 /** @name Auxiliaries */ 00171 // =========== 00172 //@{ 00173 /** 00174 * @brief The effective computation of the contour image. 00175 */ 00176 void PRIVATEbuildDericheImage(int normalized); 00177 //@} 00178 00179 // ------------------------------------------------------------------- 00180 }; // class DericheGradientImage 00181 00182 00183 } // namespace qgar 00184 00185 00186 #endif /* __DERICHEGRADIENTIMAGE_H_INCLUDED__ */