Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

LinDilatedBinaryImage.H

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