Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SegmenterUtils.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/SegmenterUtils.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 
00031 #pragma once
00032 
00033 #include <ICLGeom/GeomDefs.h>
00034 #include <ICLCore/DataSegment.h>
00035 #include <ICLCore/Channel.h>
00036 
00037 namespace icl{
00038   namespace geom{
00039 
00041 
00043     class SegmenterUtils{
00044         
00045           public:
00046             enum Mode {BEST, GPU, CPU};
00047           
00049 
00051         SegmenterUtils(Mode mode=BEST); 
00052             
00053             
00055         ~SegmenterUtils();
00056    
00057           
00059 
00062         core::Img8u createColorImage(core::Img32s &labelImage);
00063         
00065 
00075         core::Img8u createROIMask(core::DataSegment<float,4> &xyzh, core::Img32f &depthImage,
00076                     float xMin, float xMax, float yMin, float yMax, float zMin=-10000, float zMax=10000);
00077         
00079 
00082         core::Img8u createMask(core::Img32f &depthImage);
00083         
00085 
00088         core::Img32s stabelizeSegmentation(core::Img32s &labelImage);
00089         
00091 
00099         math::DynMatrix<bool> calculateAdjacencyMatrix(core::DataSegment<float,4> &xyzh, core::Img32s &labelImage, 
00100                               core::Img8u &maskImage, int radius, float euclideanDistance, int numSurfaces);
00101         
00103 
00110         void edgePointAssignment(core::DataSegment<float,4> &xyzh, core::Img32s &labelImage, 
00111                               core::Img8u &maskImage, int radius, float euclideanDistance, int numSurfaces);
00112         
00114 
00122         math::DynMatrix<bool> edgePointAssignmentAndAdjacencyMatrix(core::DataSegment<float,4> &xyzh, core::Img32s &labelImage, 
00123                               core::Img8u &maskImage, int radius, float euclideanDistance, int numSurfaces);
00124         
00125         
00126       private:
00127       
00128         struct Data;  
00129         Data *m_data; 
00130         
00131         void createColorImageCL(core::Img32s &labelImage, core::Img8u &colorImage);
00132         
00133         void createColorImageCPU(core::Img32s &labelImage, core::Img8u &colorImage);
00134         
00135         std::vector<int> calculateLabelReassignment(int countCur, int countLast, core::Channel32s &labelImageC, core::Channel32s &lastLabelImageC, utils::Size size);
00136         
00137         math::DynMatrix<bool> edgePointAssignmentAndAdjacencyMatrixCL(core::DataSegment<float,4> &xyzh, core::Img32s &labelImage, 
00138                               core::Img8u &maskImage, int radius, float euclideanDistance, int numSurfaces, bool pointAssignment);
00139         
00140         math::DynMatrix<bool> edgePointAssignmentAndAdjacencyMatrixCPU(core::DataSegment<float,4> &xyzh, core::Img32s &labelImage, 
00141                               core::Img8u &maskImage, int radius, float euclideanDistance, int numSurfaces, bool pointAssignment);
00142                              
00143         static float dist3(const Vec &a, const Vec &b){
00144           return norm3(a-b);
00145         }
00146         
00147     };
00148      
00149   } // namespace geom
00150 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines