123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- /**
- * @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 <vector>
- // 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<double> & img, NICE::MultiChannelImageT<int> & 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<int> &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
|