/** * @file RegionSegmentationMethod.h * @brief abstract interface for region segmantation * @author Björn Fröhlich, Alexander Freytag * @date 05/05/2009 */ #ifndef REGIONSEGMENTATIONMETHOD #define REGIONSEGMENTATIONMETHOD #undef DEBUGRS #include "RegionGraph.h" // STL includes #include // NICE-core includes #include "core/basics/Config.h" #include "core/basics/Persistent.h" #include "core/image/MultiChannelImage3DT.h" namespace OBJREC { class RegionSegmentationMethod : public NICE::Persistent { protected: ///////////////////////// ///////////////////////// // PROTECTED VARIABLES // ///////////////////////// ///////////////////////// // const NICE::Config *conf; public: ///////////////////// ///////////////////// ///////////////////// // CONSTRUCTORS / DESTRUCTORS ///////////////////// ///////////////////// ///////////////////// /** simple constructor */ RegionSegmentationMethod(); /** simple constructor */ RegionSegmentationMethod( const NICE::Config *c ); /** simple destructor */ virtual ~RegionSegmentationMethod(); /** * @brief Setup internal variables and objects used * @author Alexander Freytag * @param conf Config file to specify variable settings * @param s_confSection * @date 07-02-2014 ( dd-mm-yyyy ) */ virtual void initFromConfig ( const NICE::Config * _conf, const std::string & _confSection = "RegionSegmentation" ); ///////////////////// ///////////////////// ///////////////////// // SEGMENTATION STUFF ///////////////////// ///////////////////// ////////////////// /** * returns the regions of a given image * @param img input image * @param mask output regions, each region has it own number * @return count of region */ virtual int segRegions ( const NICE::Image & img, NICE::Matrix & mask ) const = 0; /** * returns the regions of a given image * @param img input color image * @param mask output regions, each region has it own number * @return count of region */ virtual int segRegions ( const NICE::ColorImage & cimg, NICE::Matrix & mask) const; /** * returns the regions of a given 3d image * @param img input 3d image data * @param mask output regions for each image slice, each region has it own number * @param isGray grayscale image or not * @return amount of regions */ virtual int segRegions (const NICE::MultiChannelImage3DT & img, NICE::MultiChannelImageT & mask, const int isGray) const; /** * transform a segmented color image in a grayimage, where each region has its own label * @param img input image * @param mask output mask * @return count of regions */ int transformSegmentedImg( const NICE::ColorImage & img, NICE::Matrix & mask) const; /** * get the Graph representation of an segmentationa * @param cimg input color image * @param mask result mask of the regions * @param rg graph representation */ void getGraphRepresentation(const NICE::ColorImage & cimg, NICE::Matrix & mask, RegionGraph & rg); /** * @brief mark contours with given segmentation * * @param cimg input image * @param mask result segmentation * @param color RGB values of marking color * @param marked resultimage * @return void **/ void markContours ( const NICE::ColorImage & cimg, NICE::Matrix & mask, std::vector &color, NICE::ColorImage &marked ); /** * visualize the graph representation * @param cimg input color image * @param mask result mask of the regions */ void visualizeGraphRepresentation(const NICE::ColorImage & cimg, NICE::Matrix & mask); ///////////////////// INTERFACE PERSISTENT ///////////////////// // interface specific methods for store and restore ///////////////////// INTERFACE PERSISTENT ///////////////////// /** * @brief Load object from external file (stream) * @author Alexander Freytag * @date 07-02-2014 ( dd-mm-yyyy ) */ void restore ( std::istream & is, int format = 0 ) = 0; /** * @brief Save object to external file (stream) * @author Alexander Freytag * @date 07-02-2014 ( dd-mm-yyyy ) */ void store ( std::ostream & os, int format = 0 ) const = 0; /** * @brief Clear object * @author Alexander Freytag * @date 07-02-2014 ( dd-mm-yyyy ) */ void clear () = 0; }; } // namespace #endif