Image Component Library (ICL)
|
00001 /******************************************************************** 00002 ** Image Component Library (ICL) ** 00003 ** ** 00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld ** 00005 ** Neuroinformatics Group ** 00006 ** Website: www.iclcv.org and ** 00007 ** http://opensource.cit-ec.de/projects/icl ** 00008 ** ** 00009 ** File : ICLFilter/src/ICLFilter/ConvolutionKernel.h ** 00010 ** Module : ICLFilter ** 00011 ** Authors: Christof Elbrechter ** 00012 ** ** 00013 ** ** 00014 ** GNU LESSER GENERAL PUBLIC LICENSE ** 00015 ** This file may be used under the terms of the GNU Lesser General ** 00016 ** Public License version 3.0 as published by the ** 00017 ** ** 00018 ** Free Software Foundation and appearing in the file LICENSE.LGPL ** 00019 ** included in the packaging of this file. Please review the ** 00020 ** following information to ensure the license requirements will ** 00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt ** 00022 ** ** 00023 ** The development of this software was supported by the ** 00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** 00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** 00026 ** Forschungsgemeinschaft (DFG) in the context of the German ** 00027 ** Excellence Initiative. ** 00028 ** ** 00029 ********************************************************************/ 00030 00031 #pragma once 00032 00033 #include <ICLUtils/CompatMacros.h> 00034 #include <ICLUtils/Size.h> 00035 #include <ICLUtils/Exception.h> 00036 00037 00038 namespace icl{ 00039 namespace filter{ 00041 00047 struct ICLFilter_API ConvolutionKernel{ 00048 00050 00118 enum fixedType { 00119 gauss3x3=0, 00120 gauss5x5=10, 00121 sobelX3x3=1, 00122 sobelX5x5=11, 00123 sobelY3x3=2, 00124 sobelY5x5=12, 00125 laplace3x3=3, 00126 laplace5x5=13, 00127 custom, 00128 }; 00129 00131 ConvolutionKernel(); 00132 00134 00135 ConvolutionKernel(const ConvolutionKernel &other); 00136 00138 00144 ConvolutionKernel(int *data, const utils::Size &size,int factor=1, bool deepCopy=true) throw (utils::InvalidSizeException); 00145 00147 ConvolutionKernel(float *data, const utils::Size &size, bool deepCopy=true) throw (utils::InvalidSizeException); 00148 00150 ConvolutionKernel(fixedType t, bool useFloats=false); 00151 00153 ~ConvolutionKernel(); 00154 00156 00157 ConvolutionKernel &operator=(const ConvolutionKernel &other); 00158 00160 void toFloat(); 00161 00163 00164 void toInt(bool force=false); 00165 00167 inline int getDim() const { return size.getDim(); } 00168 00170 inline const utils::Size &getSize() const { return size; } 00171 00173 inline int getWidth() const { return size.width; } 00174 00176 inline int getHeight() const { return size.height; } 00177 00179 inline bool isFloat() const { return !!fdata; } 00180 00182 inline const float *getFloatData() const { return fdata; } 00183 00185 inline float *getFloatData() { return fdata; } 00186 00188 inline const int *getIntData() const { return idata; } 00189 00191 inline int *getIntData() { return idata; } 00192 00194 inline int getFactor() const { return factor; } 00195 00197 inline bool isNull() const { return isnull; } 00198 00200 inline fixedType getFixedType() const { return ft; } 00201 00203 void detach(); 00204 00205 private: 00206 utils::Size size; 00207 float *fdata; 00208 int *idata; 00209 int factor; 00210 bool isnull; 00211 bool owned; 00212 fixedType ft; 00213 }; 00214 } // namespace filter 00215 } 00216