OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
local_sigma_threshold.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 #ifndef IMG_ALG_COMMON_LOCAL_SIGMA_THRES
21 #define IMG_ALG_COMMON_LOCAL_SIGMA_THRES
22 
23 #include <ost/img/image_state.hh>
26 
27 namespace ost { namespace img { namespace alg {
28 
29 /*
30  Binary threshold based on local standard deviation; for each point,
31  the standard deviation in a window of size*2+1 is checked against the
32  given level, and if it surpasses that, the value in the resulting image
33  is set to one, otherwise zero
34 
35  The output image is slightly smaller due to the edge being removed
36 */
37 
39 public:
41  LocalSigmaThresholdBase(int size,Real level);
42 
43  template <typename T, class D>
44  ImageStateBasePtr VisitState(const ImageStateImpl<T,D>& s) const;
45 
46  static String GetAlgorithmName() {return "LocalSigmaThreshold";}
47 private:
48  int size_;
49  Real level_;
50 };
51 
52 typedef ImageStateConstModOPAlgorithm<LocalSigmaThresholdBase> LocalSigmaThreshold;
53 
54 
55 }
56 
57 OST_IMG_ALG_EXPLICIT_INST_DECL(class,ImageStateConstModOPAlgorithm<alg::LocalSigmaThresholdBase>)
58 
59  }} // ns
60 
61 
62 #endif
ImageStateConstModOPAlgorithm< LocalSigmaThresholdBase > LocalSigmaThreshold
std::string String
Definition: base.hh:54
float Real
Definition: base.hh:44
#define DLLEXPORT_IMG_ALG
boost::shared_ptr< ImageStateBase > ImageStateBasePtr
#define OST_IMG_ALG_EXPLICIT_INST_DECL(c, t)