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 __LINDILATEDIMAGE_H_INCLUDED__ 00029 #define __LINDILATEDIMAGE_H_INCLUDED__ 00030 00031 00032 /** 00033 * @file LinDilatedImage.H 00034 * @brief Header file of class qgar::LinDilatedImage. 00035 * 00036 * @author <a href="mailto:qgar-develop@loria.fr?subject=Qgar fwd Mathieu Baeumler">Mathieu Baeumler</a> 00037 * @date August 5, 2002 16:52 00038 * @since Qgar 2.0 00039 */ 00040 00041 00042 00043 // For RCS/CVS use: Do not delete 00044 /* $Id: LinDilatedImage.H,v 1.15 2005/10/14 17:05:47 masini Exp $ */ 00045 00046 00047 00048 // QGAR 00049 #include <qgarlib/GenImage.H> 00050 namespace qgar 00051 { 00052 // Avoid #include's when not necessary 00053 class QgarErrorDomain; 00054 } 00055 00056 00057 00058 namespace qgar 00059 { 00060 00061 /** 00062 * @ingroup IMGPROC_MORPH 00063 * 00064 * @class LinDilatedImage LinDilatedImage.H "qgarlib/LinDilatedImage.H" 00065 * 00066 * @brief Grey-level image dilated using a segment. 00067 * 00068 * The length of the segment is <b>2 * aDilSize + 1</b>. 00069 * The algorithm is derived from 00070 * [<a href="Bibliography.html#van-Herk-1992">van Herk, 1992</a>]. 00071 * 00072 * @author <a href="mailto:qgar-develop@loria.fr?subject=Qgar fwd Mathieu Baeumler">Mathieu Baeumler</a> 00073 * @date August 5, 2002 16:52 00074 * @since Qgar 2.0 00075 */ 00076 class LinDilatedImage 00077 00078 : public GreyLevelImage 00079 00080 { 00081 // ------------------------------------------------------------------- 00082 // T Y P E D E F I N I T I O N S 00083 // ------------------------------------------------------------------- 00084 public: 00085 00086 /** @name Types */ 00087 // ===== 00088 //@{ 00089 00090 /** 00091 * @brief Type of the elements stored in the pixel map. 00092 */ 00093 typedef GreyLevelImage::value_type value_type; 00094 00095 /** 00096 * @brief Reference to qgar::LinDilatedImage::value_type. 00097 */ 00098 typedef value_type& reference; 00099 00100 /** 00101 * @brief Constant reference to qgar::LinDilatedImage::value_type. 00102 */ 00103 typedef const value_type& const_reference; 00104 00105 /** 00106 * @brief Pointer to qgar::LinDilatedImage::value_type. 00107 */ 00108 typedef value_type* pointer; 00109 00110 /** 00111 * @brief Constant pointer to qgar::LinDilatedImage::value_type. 00112 */ 00113 typedef const value_type* const_pointer; 00114 00115 //@} 00116 00117 // ------------------------------------------------------------------- 00118 // P U B L I C M E M B E R S 00119 // ------------------------------------------------------------------- 00120 public: 00121 00122 00123 /** @name Constructors */ 00124 // ============ 00125 //@{ 00126 00127 /** 00128 * @brief Construct from a binary image. 00129 * 00130 * 00131 * Orientation qgar::QGE_ORIENTATION_ALL corresponds to the 00132 * maximum of the 4 possible dilations. 00133 * 00134 * @param anImg image to be dilated 00135 * @param anOrient dilation orientation 00136 * (default qgar::QGE_ORIENTATION_HOR) 00137 * @param aDilSize dilation size 00138 * 00139 * @exception qgar::QgarErrorDomain 00140 * (dilation size too large for image) 00141 */ 00142 LinDilatedImage(GreyLevelImage& anImg, 00143 QGEorientation anOrient = QGE_ORIENTATION_HOR, 00144 unsigned int aDilSize = 1) 00145 throw(QgarErrorDomain); 00146 00147 //@} 00148 00149 00150 /** @name Linear dilation */ 00151 // =============== 00152 //@{ 00153 00154 /** 00155 * @brief Perform a linear dilation on the given grey-level image. 00156 * 00157 * <b>To be used to perform a linear dilation without preserving 00158 * the initial image.</b> 00159 * 00160 * Orientation qgar::QGE_ORIENTATION_ALL corresponds to the 00161 * maximum of the 4 possible dilations. 00162 * 00163 * @param anImg image to be dilated 00164 * @param anOrient dilation orientation 00165 * @param aDilSize dilation size 00166 */ 00167 static void perform(GreyLevelImage* anImg, 00168 QGEorientation anOrient, 00169 unsigned int aDilSize = 1); 00170 00171 //@} 00172 00173 // ------------------------------------------------------------------- 00174 // P R I V A T E M E M B E R S 00175 // ------------------------------------------------------------------- 00176 private: 00177 00178 /** @name Oriented dilations */ 00179 // ================== 00180 //@{ 00181 00182 /** 00183 * @brief Horizontal dilation. 00184 * 00185 * @param anImg image to be dilated 00186 * @param aDilSize dilation size 00187 * 00188 * @exception qgar::QgarErrorDomain 00189 * (dilation size too large for image) 00190 */ 00191 static void dilateHor(GreyLevelImage* anImg, unsigned int aDilSize) 00192 throw(QgarErrorDomain); 00193 00194 /** 00195 * @brief Vertical dilation. 00196 * 00197 * @param anImg image to be dilated 00198 * @param aDilSize dilation size 00199 * 00200 * @exception qgar::QgarErrorDomain 00201 * (dilation size too large for image) 00202 */ 00203 static void dilateVer(GreyLevelImage* anImg, unsigned int aDilSize) 00204 throw(QgarErrorDomain); 00205 00206 /** 00207 * @brief NE-SW dilation. 00208 * 00209 * @param anImg image to be dilated 00210 * @param aDilSize dilation size 00211 * 00212 * @exception qgar::QgarErrorDomain 00213 * (dilation size too large for image) 00214 */ 00215 static void dilatePdiag(GreyLevelImage* anImg, unsigned int aDilSize) 00216 throw(QgarErrorDomain); 00217 00218 /** 00219 * @brief NW-SE dilation. 00220 * 00221 * @param anImg image to be dilated 00222 * @param aDilSize dilation size 00223 * 00224 * @exception qgar::QgarErrorDomain 00225 * (dilation size too large for image) 00226 */ 00227 static void dilateNdiag(GreyLevelImage* anImg, unsigned int aDilSize) 00228 throw(QgarErrorDomain); 00229 00230 /** 00231 * @brief Maximum of the 4 possible dilations. 00232 * 00233 * @param anImg image to be dilated 00234 * @param aDilSize dilation size 00235 * 00236 * @exception qgar::QgarErrorDomain 00237 *(dilation size too large for image) 00238 */ 00239 static void dilateAll(GreyLevelImage* anImg, unsigned int aDilSize) 00240 throw(QgarErrorDomain); 00241 00242 //@} 00243 00244 // ------------------------------------------------------------------- 00245 }; // class LinDilatedImage 00246 00247 00248 } // namespace qgar 00249 00250 00251 #endif /* __LINDILATEDIMAGE_H_INCLUDED__ */ 00252