00001 /* 00002 This file is part of the BIAS library (Basic ImageAlgorithmS). 00003 00004 Copyright (C) 2003, 2004 (see file CONTACTS for details) 00005 Multimediale Systeme der Informationsverarbeitung 00006 Institut fuer Informatik 00007 Christian-Albrechts-Universitaet Kiel 00008 00009 00010 BIAS is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU Lesser General Public License as published by 00012 the Free Software Foundation; either version 2.1 of the License, or 00013 (at your option) any later version. 00014 00015 BIAS is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public License 00021 along with BIAS; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 #ifndef _BIAS_MOPRH_DILATION_HH_ 00025 #define _BIAS_MOPRH_DILATION_HH_ 00026 #include "./Morphology.hh" 00027 00028 namespace BIAS { 00029 00030 /** @class Dilation 00031 @ingroup g_filter 00032 @brief Dilation operator for binary images (black and white) 00033 00034 Dilation sets all pixel to 255, which have a neighboring pixel !=0 00035 It is also possible to dilate the image with a real grey-value image with 00036 Dilate3Fast(). 00037 Fastest ist TBH_valid and kernelsize=3 00038 or call Dilate3Fast() directly. 00039 @author grest, Oct. 2004 00040 */ 00041 00042 template <class InputStorageType, class OutputStorageType> 00043 class BIASFilter_EXPORT Dilation : public Morphology<InputStorageType, OutputStorageType> 00044 { 00045 public: 00046 Dilation() {} 00047 Dilation(const Dilation<InputStorageType, OutputStorageType>& other); 00048 virtual ~Dilation() {} 00049 00050 /** Does the dilation. ROI ignored, but set if TBH_valid 00051 */ 00052 virtual int Filter(const Image<InputStorageType>& src, 00053 Image<OutputStorageType>& dst); 00054 00055 /** dilate with square kernel filled with 255 00056 @author Felix Woelk (22/04/2002) 00057 @status alpha */ 00058 int Dilate(const Image<InputStorageType>& Source, 00059 Image<OutputStorageType>& Destination, 00060 int KernelSize = 3); 00061 00062 /** Very fast dilate with 3x3 mask, all values, which are not 00063 not zero, are treated as foreground. 00064 The src img is dilated with pixels from orig. 00065 Therefore src and orig MUST NOT be the same, 00066 set orig to a 255 image if u have no original grey image. 00067 The border of one pixel is always deleted (set to zero). 00068 default is 8-neighborhood. 00069 src and dest must NOT be the same! 00070 @author Daniel Grest, Sept. 2002 00071 @status tested */ 00072 int Dilate3Fast(const Image<InputStorageType>& src, 00073 const Image<InputStorageType>& orig, 00074 Image<OutputStorageType>& dest, 00075 bool Neighbor4=false); 00076 00077 /** Very fast dilate with 3x3 mask, all values, which are not 00078 not zero, are treated as foreground. 00079 src and dest must NOT be the same! 00080 @author woelk, grest 04/2006 */ 00081 int Dilate3Fast(const Image<InputStorageType>& src, 00082 Image<OutputStorageType>& dest, 00083 bool Neighbor4 = false); 00084 00085 /** @brief If DilateLower=true then the lower value (except 0) overwrites 00086 * the higher otherwise the standard algorithm (higher value 00087 * overrides lower) is done. 00088 * @ author streckel 10/06 */ 00089 void SetDilateLower(bool dl) { 00090 DilateLower_ = dl; } 00091 00092 protected: 00093 virtual void GetBordersValid_(int& border_x, int& border_y) const; 00094 00095 using Morphology<InputStorageType, OutputStorageType>::_FilterBorderHandling; 00096 using Morphology<InputStorageType, OutputStorageType>::TBH_valid; 00097 using Morphology<InputStorageType, OutputStorageType>::TBH_same; 00098 using Morphology<InputStorageType, OutputStorageType>::TBH_full; 00099 using Morphology<InputStorageType, OutputStorageType>::kernelSize_; 00100 00101 bool DilateLower_; 00102 }; 00103 00104 } // namespace 00105 #endif 00106
1.5.7.1