/** * @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; /** 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 &segresult, NICE::MultiChannelImageT &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 & segresult, NICE::MultiChannelImage3DT & 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