瀏覽代碼

new OperationPool class for handling 'Operations3D'

Sven Sickert 9 年之前
父節點
當前提交
6e0539d591

+ 31 - 0
semseg/operations/OperationPool.cpp

@@ -0,0 +1,31 @@
+/**
+* @file OperationPool.cpp
+* @brief pool for feature extraction methods
+* @author Sven Sickert
+* @date 10/09/2015
+
+*/
+
+#include "OperationPool.h"
+
+using namespace OBJREC;
+
+OperationPool::OperationPool ( )
+{
+    config = NULL;
+}
+
+OperationPool::OperationPool ( const NICE::Config *_config )
+{
+    config = _config;
+}
+
+OperationPool::~OperationPool ( )
+{
+}
+
+void OperationPool::clear ( )
+{
+    while ( !pool.empty() )
+        pool.pop_back();
+}

+ 45 - 0
semseg/operations/OperationPool.h

@@ -0,0 +1,45 @@
+/**
+* @file OperationPool.h
+* @brief pool for feature extraction methods
+* @author Sven Sickert
+* @date 10/09/2015
+
+*/
+
+#ifndef OperationPoolINCLUDE
+#define OperationPoolINCLUDE
+
+#include <vector>
+
+#include "Operations3D.h"
+#include <core/basics/Config.h>
+
+namespace OBJREC {
+
+class OperationPool
+{
+    protected:
+
+        const NICE::Config *config;
+
+    public:
+
+        std::vector<Operation3D*> pool;
+
+        /** simple constructor */
+        OperationPool ( );
+        OperationPool ( const NICE::Config *_config );
+
+        /** simple destructor */
+        virtual ~OperationPool( );
+
+        /** get operations */
+        virtual void getOperations ( std::string confSection = "Features" ) = 0;
+
+        /** free memory */
+        virtual void clear ( );
+};
+
+} //namespace
+
+#endif

+ 111 - 0
semseg/operations/RectangleOperationPool.cpp

@@ -0,0 +1,111 @@
+/**
+* @file RectangleOperationPool.cpp
+* @brief pool for rectangle feature extraction methods
+* @author Sven Sickert
+* @date 10/09/2015
+
+*/
+
+#include "RectangleOperationPool.h"
+
+using namespace OBJREC;
+
+RectangleOperationPool::RectangleOperationPool ( const NICE::Config *_config )
+    : OperationPool ( _config )
+{
+    contextMode = false;
+}
+
+RectangleOperationPool::RectangleOperationPool ( const NICE::Config *_config,
+                                           const bool _contextMode )
+    : OperationPool ( _config )
+{
+    contextMode = _contextMode;
+}
+
+RectangleOperationPool::~RectangleOperationPool ( )
+{
+
+}
+
+void RectangleOperationPool::getOperations ( std::string confString )
+{
+    if ( config->gB ( confString, "int", true ) )
+    {
+        Operation3D* o = new IntegralOps3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "bi_int", true ) )
+    {
+        Operation3D* o = new BiIntegralOps3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "bi_int_cent", true ) )
+    {
+        Operation3D* o = new BiIntegralCenteredOps3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "int_cent", true ) )
+    {
+        Operation3D* o = new IntegralCenteredOps3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "haar_horz", true ) )
+    {
+        Operation3D* o = new HaarHorizontal3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "haar_vert", true ) )
+    {
+        Operation3D* o = new HaarVertical3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "haar_stack", true ) )
+    {
+        Operation3D* o = new HaarStacked3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "haar_diagxy", true ) )
+    {
+        Operation3D* o = new HaarDiagXY3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "haar_diagxz", true ) )
+    {
+        Operation3D* o = new HaarDiagXZ3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "haar_diagyz", true ) )
+    {
+        Operation3D* o = new HaarDiagYZ3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "haar3_horz", true ) )
+    {
+        Operation3D* o = new Haar3Horiz3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "haar3_vert", true ) )
+    {
+        Operation3D* o = new Haar3Vert3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "haar3_stack", true ) )
+    {
+        Operation3D* o = new Haar3Stack3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+}

+ 42 - 0
semseg/operations/RectangleOperationPool.h

@@ -0,0 +1,42 @@
+/**
+* @file RectangleOperationPool.h
+* @brief pool for rectangle feature extraction methods
+* @author Sven Sickert
+* @date 10/09/2015
+
+*/
+
+#ifndef RectangleOperationPoolINCLUDE
+#define RectangleOperationPoolINCLUDE
+
+#include "OperationPool.h"
+
+namespace OBJREC {
+
+class RectangleOperationPool : public OperationPool
+{
+    protected:
+
+        bool contextMode;
+
+    public:
+
+        /** simple constructor */
+        RectangleOperationPool ( const NICE::Config *_config );
+
+        /** extended constructor */
+        RectangleOperationPool ( const NICE::Config *_config,
+                              const bool _contextMode);
+
+        /** simple destructor */
+        virtual ~RectangleOperationPool ( );
+
+        /** get operations */
+        virtual void getOperations ( std::string confString );
+
+};
+
+
+} //namespace
+
+#endif

+ 39 - 0
semseg/operations/RegionOperationPool.cpp

@@ -0,0 +1,39 @@
+/**
+* @file RegionOperationPool.cpp
+* @brief pool for region feature extraction methods
+* @author Sven Sickert
+* @date 10/09/2015
+
+*/
+
+#include "RegionOperationPool.h"
+
+using namespace OBJREC;
+
+RegionOperationPool::RegionOperationPool ( const NICE::Config *_config )
+    : OperationPool ( _config )
+{
+    contextMode = false;
+}
+
+RegionOperationPool::RegionOperationPool ( const NICE::Config *_config,
+                                           const bool _contextMode )
+    : OperationPool ( _config )
+{
+    contextMode = _contextMode;
+}
+
+RegionOperationPool::~RegionOperationPool ( )
+{
+
+}
+
+void RegionOperationPool::getOperations ( std::string confString )
+{
+    if ( config->gB ( confString, "region", true ) )
+    {
+        Operation3D* o = new RegionFeat3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+}

+ 42 - 0
semseg/operations/RegionOperationPool.h

@@ -0,0 +1,42 @@
+/**
+* @file RegionOperationPool.h
+* @brief pool for region feature extraction methods
+* @author Sven Sickert
+* @date 10/09/2015
+
+*/
+
+#ifndef RegionOperationPoolINCLUDE
+#define RegionOperationPoolINCLUDE
+
+#include "OperationPool.h"
+
+namespace OBJREC {
+
+class RegionOperationPool : public OperationPool
+{
+    protected:
+
+        bool contextMode;
+
+    public:
+
+        /** simple constructor */
+        RegionOperationPool ( const NICE::Config *_config );
+
+        /** extended constructor */
+        RegionOperationPool ( const NICE::Config *_config,
+                              const bool _contextMode);
+
+        /** simple destructor */
+        virtual ~RegionOperationPool ( );
+
+        /** get operations */
+        virtual void getOperations ( std::string confString );
+
+};
+
+
+} //namespace
+
+#endif

+ 68 - 0
semseg/operations/SimpleOperationPool.cpp

@@ -0,0 +1,68 @@
+/**
+* @file SimpleOperationPool.cpp
+* @brief pool for simple feature extraction methods
+* @author Sven Sickert
+* @date 10/09/2015
+
+*/
+
+#include "SimpleOperationPool.h"
+
+using namespace OBJREC;
+
+SimpleOperationPool::SimpleOperationPool ( )
+    : OperationPool ( )
+{
+}
+
+SimpleOperationPool::SimpleOperationPool ( const NICE::Config *_config )
+    : OperationPool ( _config )
+{
+    contextMode = false;
+}
+
+SimpleOperationPool::SimpleOperationPool ( const NICE::Config *_config,
+                                           const bool _contextMode )
+    : OperationPool ( _config )
+{
+    contextMode = _contextMode;
+}
+
+SimpleOperationPool::~SimpleOperationPool ( )
+{
+
+}
+
+void SimpleOperationPool::getOperations ( std::string confString )
+{
+    if ( config->gB ( confString, "minus", true ) )
+    {
+        Operation3D* o = new Minus3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "minus_abs", true ) )
+    {
+        Operation3D* o = new MinusAbs3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "addition", true ) )
+    {
+        Operation3D* o = new Addition3D();
+        o->setContext( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "only1", true ) )
+    {
+        Operation3D* o = new Only13D();
+        o->setContext ( contextMode );
+        pool.push_back ( o );
+    }
+    if ( config->gB ( confString, "rel_x", true ) )
+        pool.push_back ( new RelativeXPosition3D() );
+    if ( config->gB ( confString, "rel_y", true ) )
+        pool.push_back ( new RelativeYPosition3D() );
+    if ( config->gB ( confString, "rel_z", true ) )
+        pool.push_back ( new RelativeZPosition3D() );
+}

+ 43 - 0
semseg/operations/SimpleOperationPool.h

@@ -0,0 +1,43 @@
+/**
+* @file SimpleOperationPool.h
+* @brief pool for simple feature extraction methods
+* @author Sven Sickert
+* @date 10/09/2015
+
+*/
+
+#ifndef SimpleOperationPoolINCLUDE
+#define SimpleOperationPoolINCLUDE
+
+#include "OperationPool.h"
+
+namespace OBJREC {
+
+class SimpleOperationPool : public OperationPool
+{
+    protected:
+
+        bool contextMode;
+
+    public:
+
+        /** simple constructor */
+        SimpleOperationPool ( );
+        SimpleOperationPool ( const NICE::Config *_config );
+
+        /** extended constructor */
+        SimpleOperationPool ( const NICE::Config *_config,
+                              const bool _contextMode);
+
+        /** simple destructor */
+        virtual ~SimpleOperationPool ( );
+
+        /** get operations */
+        virtual void getOperations ( std::string confString );
+
+};
+
+
+} //namespace
+
+#endif