Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ConvolutionKernel.h
Go to the documentation of this file.
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.GPL  **
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/Size.h>
00034 #include <ICLUtils/Exception.h>
00035 
00036 
00037 namespace icl{
00038   namespace filter{
00040 
00046     struct ConvolutionKernel{
00047   
00049 
00117       enum fixedType { 
00118         gauss3x3=0,   
00119         gauss5x5=10,  
00120         sobelX3x3=1,  
00121         sobelX5x5=11, 
00122         sobelY3x3=2,  
00123         sobelY5x5=12, 
00124         laplace3x3=3, 
00125         laplace5x5=13,
00126         custom,
00127       };
00128       
00130       ConvolutionKernel();
00131       
00133 
00134       ConvolutionKernel(const ConvolutionKernel &other);  
00135       
00137 
00143       ConvolutionKernel(int *data, const utils::Size &size,int factor=1, bool deepCopy=true) throw (utils::InvalidSizeException);
00144       
00146       ConvolutionKernel(float *data, const utils::Size &size, bool deepCopy=true) throw (utils::InvalidSizeException);
00147       
00149       ConvolutionKernel(fixedType t, bool useFloats=false);
00150       
00152       ~ConvolutionKernel();
00153       
00155 
00156       ConvolutionKernel &operator=(const ConvolutionKernel &other);
00157   
00159       void toFloat();
00160       
00162 
00163       void toInt(bool force=false);
00164       
00166       inline int getDim() const { return size.getDim(); }
00167       
00169       inline const utils::Size &getSize() const { return size; }
00170       
00172       inline int getWidth() const { return size.width; }
00173       
00175       inline int getHeight() const { return size.height; }
00176       
00178       inline bool isFloat() const { return !!fdata; }
00179       
00181       inline const float *getFloatData() const { return fdata; }
00182   
00184       inline float *getFloatData() { return fdata; }
00185   
00187       inline const int *getIntData() const { return idata; }
00188   
00190       inline int *getIntData() { return idata; }
00191       
00193       inline int getFactor() const { return factor; }
00194       
00196       inline bool isNull() const { return isnull; }
00197       
00199       inline fixedType getFixedType() const { return ft; }
00200       
00202       void detach();
00203       
00204     private:
00205       utils::Size size;    
00206       float *fdata; 
00207       int *idata;   
00208       int factor;   
00209       bool isnull;  
00210       bool owned;   
00211       fixedType ft; 
00212     };
00213   } // namespace filter
00214 }
00215 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines