Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ObjectEdgeDetectorCPU.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   : ICLGeom/src/ICLGeom/ObjectEdgeDetectorCPU.h            **
00010 ** Module : ICLGeom                                                **
00011 ** Authors: Andre Ueckermann                                       **
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 
00032 //Please use the ObjectEdgeDetector Class.
00033 //This is the CPU implementation of the interface.
00034 
00035 #pragma once
00036 
00037 #include <ICLGeom/ObjectEdgeDetectorPlugin.h>
00038 
00039 namespace icl{
00040   namespace geom{
00041   
00042     struct Vec4 {
00043             inline Vec4() {
00044             }
00045             inline Vec4(float x, float y, float z, float w) :
00046                             x(x), y(y), z(z), w(w) {
00047             }
00048             float x, y, z, w;
00049     };
00050   
00051      class ICLGeom_API ObjectEdgeDetectorCPU : public ObjectEdgeDetectorPlugin{
00052     
00053      struct Data;  
00054       Data *m_data; 
00055 
00056      public:
00057   
00059 
00061       ObjectEdgeDetectorCPU(); 
00062         
00064       virtual ~ObjectEdgeDetectorCPU();
00065     
00067 
00073       const core::Img8u &calculate(const core::Img32f &depthImage, bool filter, bool average, bool gauss);
00074         
00076 
00077       void setDepthImage(const core::Img32f &depthImg);
00078         
00080 
00081       void applyMedianFilter();
00082         
00084 
00085       const core::Img32f &getFilteredDepthImage();
00086         
00088 
00090       void setFilteredDepthImage(const core::Img32f &filteredImg); 
00091         
00093 
00095       void applyNormalCalculation();
00096         
00098 
00102       void applyLinearNormalAveraging();
00103   
00105 
00111       void applyGaussianNormalSmoothing();
00112   
00114 
00115       const core::DataSegment<float,4> getNormals();
00116       
00118 
00119       void applyWorldNormalCalculation(const Camera &cam);
00120           
00122 
00123       const core::DataSegment<float,4> getWorldNormals();
00124           
00126 
00127       const core::Img8u &getRGBNormalImage();
00128       
00130 
00132       void setNormals(core::DataSegment<float,4> pNormals);
00133         
00135 
00137       void applyAngleImageCalculation();
00138         
00140 
00141       const core::Img32f &getAngleImage();
00142         
00144 
00146       void setAngleImage(const core::Img32f &angleImg);
00147         
00149 
00150       void applyImageBinarization();
00151         
00153 
00154       const core::Img8u &getBinarizedAngleImage();      
00155         
00157 
00159       void setMedianFilterSize(int size);
00160         
00162 
00164       void setNormalCalculationRange(int range);
00165         
00167 
00168       void setNormalAveragingRange(int range);
00169         
00171 
00173       void setAngleNeighborhoodMode(int mode);
00174         
00176 
00178       void setAngleNeighborhoodRange(int range);
00179         
00181 
00184       void setBinarizationThreshold(float threshold);
00185         
00187 
00189       void setUseNormalAveraging(bool use);
00190       
00192 
00194       void setUseGaussSmoothing(bool use);
00195       
00197 
00199       bool isCLReady();         
00200         
00201           void initialize(utils::Size size);
00202         
00203         
00204          private:
00205       
00206           float scalar(math::FixedColVector<float,4> &a, math::FixedColVector<float,4> &b);
00207           float flipAngle(float angle);
00208           float scalarAndFlip(math::FixedColVector<float,4> &a, math::FixedColVector<float,4> &b);
00209           float maxAngle(float snr, float snl, float snt, float snb,
00210                      float snbl, float snbr, float sntl, float sntr);
00211         
00212     };
00213   }
00214 }
00215 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines