00001 // ---------------------------------------------------------------------------- 00002 // 00003 // $Id$ 00004 // 00005 // Copyright 2008, 2009, 2010, 2011, 2012 Antonio Franchi and Paolo Stegagno 00006 // 00007 // This file is part of MIP. 00008 // 00009 // MIP is free software: you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation, either version 3 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // MIP is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>. 00021 // 00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it 00023 // 00024 // ---------------------------------------------------------------------------- 00025 00026 00030 00031 00032 #ifndef __EDGE_EXTR_H__ 00033 #define __EDGE_EXTR_H__ 00034 00035 #include <math.h> 00036 #include <baselib.h> 00037 00038 using namespace std; 00039 00040 using namespace MipBaselib; 00041 00042 namespace MipAlgorithms{ 00043 00045 /* @{ */ 00046 00050 class PosiEdgeExtrPar{ 00051 private: 00052 Decimal _discThreshold; 00053 Decimal _minRobWidth; 00054 Decimal _maxRobWidth; 00055 Decimal _offset; 00056 Decimal _sameEdgeThreshold; 00057 protected: 00058 00060 void setDiscThreshold(Decimal value){ 00061 assert(value>=0.0); 00062 _discThreshold=value; 00063 } 00067 void setMinRobWidth(Decimal value){ 00068 assert(value>=0.0); 00069 _minRobWidth=value; 00070 } 00075 void setMaxRobWidth(Decimal value){ 00076 assert(value>=_minRobWidth); 00077 _maxRobWidth=value; 00078 } 00082 void setOffset(Decimal value){ 00083 // assert(value>=0.0); 00084 _offset=value; 00085 } 00089 void setSameEdgeThreshold(Decimal value){ 00090 assert(value>=0.0); 00091 _sameEdgeThreshold=value; 00092 } 00093 public: 00095 PosiEdgeExtrPar (){ 00096 _discThreshold = 0.0; 00097 _minRobWidth = 0.0; 00098 _maxRobWidth = 0.0; 00099 _offset = 0.0; 00100 _sameEdgeThreshold = 0.0; 00101 } 00102 00109 PosiEdgeExtrPar (Decimal discThreshold, Decimal minRobWidth, Decimal maxRobWidth, Decimal offset, Decimal sameEdgeThreshold){ 00110 _discThreshold = discThreshold; 00111 _minRobWidth = minRobWidth; 00112 _maxRobWidth = maxRobWidth; 00113 _offset = offset; 00114 _sameEdgeThreshold = sameEdgeThreshold; 00115 } 00116 00118 PosiEdgeExtrPar(const PosiEdgeExtrPar &s){ 00119 _discThreshold = s._discThreshold; 00120 _minRobWidth = s._minRobWidth; 00121 _maxRobWidth = s._maxRobWidth; 00122 _offset = s._offset; 00123 _sameEdgeThreshold=s._sameEdgeThreshold; 00124 } 00126 PosiEdgeExtrPar& operator=(const PosiEdgeExtrPar& s){ 00127 if (this != &s){ 00128 _discThreshold=s._discThreshold; 00129 _minRobWidth=s._minRobWidth; 00130 _maxRobWidth=s._maxRobWidth; 00131 _offset =s._offset; 00132 _sameEdgeThreshold=s._sameEdgeThreshold; 00133 } 00134 return *this; 00135 } 00136 00138 Decimal discThreshold(){ 00139 return _discThreshold; 00140 } 00142 Decimal minRobWidth(){ 00143 return _minRobWidth; 00144 } 00146 Decimal maxRobWidth(){ 00147 return _maxRobWidth; 00148 } 00150 Decimal offset(){ 00151 return _offset; 00152 } 00154 Decimal sameEdgeThreshold(){ 00155 return _sameEdgeThreshold; 00156 } 00158 inline string print(); 00159 }; 00160 00161 class PosiEdgeExtrVar{ 00162 public: 00163 bool _prevIsCorner; 00164 Decimal _prevReading; 00165 PosiEdgeExtrVar(){ 00166 _prevIsCorner = false; 00167 _prevReading = 1.0; 00168 } 00169 }; 00170 00179 class PosiEdgeExtr{ 00180 private: 00182 // bool _prevIsCorner; 00183 // Decimal _prevReading; 00184 // PosiEdgeExtrPar params; 00185 PosiEdgeExtrVar* _var; 00186 00187 public: 00189 // PosiEdgeExtr(){ 00190 // } 00192 PosiEdgeExtr(const PosiEdgeExtrPar& par){ 00193 // params = par; 00194 // _prevIsCorner = false; 00195 _var = new PosiEdgeExtrVar; 00196 00197 } 00199 ~PosiEdgeExtr(){ 00200 delete _var; 00201 } 00205 00206 PosiFeatures extract(Scan scan, Decimal rangeMax); 00207 00208 }; 00209 00210 }; // end namespace MipAlgorithms 00211 00212 #endif 00213 00214 00215 /* @} */ 00216 00217 00218