123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- /**
- * @file SemSegObliqueTree.h
- * @brief Semantic Segmentation using Oblique Trees
- * @author Sven Sickert
- * @date 10/17/2014
- */
- #ifndef SEMSEGOBLIQUETEEINCLUDE
- #define SEMSEGOBLIQUETEEINCLUDE
- // nice-core includes
- // nice-vislearning includes
- #include "vislearning/classifier/classifierbase/FeaturePoolClassifier.h"
- // nice-semseg includes
- #include "SemanticSegmentation.h"
- namespace OBJREC
- {
- class SemSegObliqueTree : public SemanticSegmentation
- {
- private:
- /** pointer to config file */
- const NICE::Config *conf;
- /** save / load trained classifier */
- bool saveLoadData;
- /** whether to run in 3D mode or not */
- bool run3Dseg;
- /** 0 - RGB, 1 - HSV, 2 - CIELab */
- int colorMode;
- /** file location of trained classifier */
- std::string fileLocation;
- /** classifier for categorization */
- FeaturePoolClassifier *fpc;
- /**
- * @brief pre-processing: resulting channels with values in the range [0,1] for RGB, HSV or GREY
- * @param ce current cached example
- * @param isColor color mode
- */
- void preprocessChannels ( CachedExample *ce, bool isColor ) const;
- public:
- /** simple constructor */
- SemSegObliqueTree ();
- /** config constructor */
- SemSegObliqueTree (
- const NICE::Config *conf,
- const ClassNames *classNames );
- /** simple destructor */
- virtual ~SemSegObliqueTree();
- /**
- * @brief Setup internal variables and objects used
- * @param conf Configuration file to specify variable settings
- * @param s_confSection Section in configuration file
- */
- void initFromConfig (
- const NICE::Config *_conf,
- const std::string & s_confSection = "SemSegObliqueTree" );
- /**
- * @brief training function / learn classifier
- * @param md the data set
- */
- void train ( const MultiDataset *md );
- /**
- * @brief classification function
- @param ce image data
- @param segresult result of the semantic segmentation with a label
- for each pixel
- @param probabilities multi-channel image with one channel for
- each class and corresponding probabilities for each pixel
- */
- void semanticseg ( CachedExample *ce,
- NICE::ImageT<int> &segresult,
- NICE::MultiChannelImageT<double> &probabilities );
- /**
- * Classify each voxel of a 3D image (image stack)
- * @author Sven Sickert
- * @param ce 3d image data
- * @param segresult segmentation results (output)
- * @param probabilities probabilities for each pixel (output)
- */
- void semanticseg ( OBJREC::CachedExample *ce,
- NICE::MultiChannelImageT<int> & segresult,
- NICE::MultiChannelImage3DT<double> & probabilities );
- ///////////////////// INTERFACE PERSISTENT /////////////////////
- // interface specific methods for store and restore
- ///////////////////// INTERFACE PERSISTENT /////////////////////
- /**
- * @brief Load segmentation object from external file (stream)
- */
- virtual void restore ( std::istream & is, int format = 0 );
- /**
- * @brief Save segmentation-object to external file (stream)
- */
- virtual void store( std::ostream & os, int format = 0 ) const;
- /**
- * @brief Clear segmentation-object object
- */
- virtual void clear ();
- };
- } // namespace
- #endif
|