Image Component Library (ICL)
CannyOp.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLFilter/src/ICLFilter/CannyOp.h **
10 ** Module : ICLFilter **
11 ** Authors: Christof Elbrechter, Andre Justus, Sergius Gaulik **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLUtils/Uncopyable.h>
35 #include <ICLCore/Img.h>
36 #include <ICLFilter/UnaryOp.h>
37 
38 namespace icl {
39  namespace filter{
40 
42 
75  public:
77 
84  CannyOp(icl32f lowThresh=0, icl32f highThresh=255, int preBlurRadius=0);
86 
94  CannyOp(UnaryOp *dxOp, UnaryOp *dyOp, icl32f lowThresh=0, icl32f highThresh=255, bool deleteOps=true, int preBlurRadius=0);
95 
97  virtual ~CannyOp();
98 
100 
104  void setThresholds(icl32f lowThresh, icl32f highThresh);
105 
107 
110  icl32f getLowThreshold() const;
111 
113 
116  icl32f getHighThreshold() const;
117 
119 
123  virtual void apply(const core::ImgBase *src, core::ImgBase **dst);
124 
126 
130  virtual void apply(const core::ImgBase *src_x, const core::ImgBase *src_y, core::ImgBase **dst);
131 
133  using UnaryOp::apply;
134 
136 
137  void setPreBlurRadius(int preBlurRadius){
138  m_preBlurRadius = preBlurRadius;
139  ICL_DELETE(m_preBlurOp);
140  setUpPreBlurOp();
141  }
142 
143  void setUseDerivativesInfo(bool use_derivatives) {
144  m_use_derivatives_info = use_derivatives;
145  }
146 
148  bool getPreBlurRadius() const {
149  return m_preBlurRadius;
150  }
151 
152  private:
153 
154  void property_callback(const Property &p);
155 
156  void setUpPreBlurOp();
157 
159  void applyCanny32f(const core::ImgBase *dx, const core::ImgBase *dy, core::ImgBase *dst, int c);
160  void applyCanny16s(const core::ImgBase *dx, const core::ImgBase *dy, core::ImgBase *dst, int c);
161 
163  std::vector<icl8u> m_cannyBuf;
164  core::ImgBase *m_derivatives[2];
165  UnaryOp *m_ops[2];
167  icl32f m_lowT,m_highT;
168  bool m_ownOps;
172  };
173  } // namespace filter
174 } // namespace icl
undocument this line if you encounter any issues!
Definition: Any.h:37
Class interface for un-copyable classes.
Definition: Uncopyable.h:64
std::vector< icl8u > m_cannyBuf
buffer for ippiCanny
Definition: CannyOp.h:163
icl32f m_lowT
Definition: CannyOp.h:167
Ipp32f icl32f
32Bit floating point type for the ICL
Definition: BasicTypes.h:55
core::Img32f m_buffer
Definition: CannyOp.h:170
Abstract Base class for Unary Operators.
Definition: UnaryOp.h:51
bool m_use_derivatives_info
Definition: CannyOp.h:169
UnaryOp * m_preBlurOp
Definition: CannyOp.h:166
int m_preBlurRadius
Definition: CannyOp.h:171
void setPreBlurRadius(int preBlurRadius)
sets the pre-blur-radius
Definition: CannyOp.h:137
ICLQt_API core::Img< T > filter(const core::Img< T > &image, const std::string &filter)
applies a filter operation on the source image (affinity for float)
#define ICL_DELETE(X)
Definition: Macros.h:242
Class for the canny edge detector.
Definition: CannyOp.h:74
#define ICLFilter_API
Definition: CompatMacros.h:175
virtual void apply(const core::ImgBase *operand1, core::ImgBase **dst)=0
pure virtual apply function, that must be implemented in all derived classes
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
bool m_ownOps
Definition: CannyOp.h:168
bool getPreBlurRadius() const
returns current pre-blur feature state
Definition: CannyOp.h:148
void setUseDerivativesInfo(bool use_derivatives)
Definition: CannyOp.h:143