123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- /**
- * @file RSMeanShift.h
- * @brief implementation of the MeanShift algorithm (uses EDISON)
- * @author Björn Fröhlich, Alexander Freytag
- * @date 05/05/2009
- */
- #ifndef RSMEANSHIFT
- #define RSMEANSHIFT
- #include "core/basics/Config.h"
- #include "RegionSegmentationMethod.h"
- #include <segmentation/edisonSegm/tdef.h>
- #include <segmentation/edisonSegm/msImageProcessor.h>
- namespace OBJREC {
- class RSMeanShift: public RegionSegmentationMethod
- {
- protected:
-
- /////////////////////////
- /////////////////////////
- // PROTECTED VARIABLES //
- /////////////////////////
- /////////////////////////
- //! Specifies the minimum allowable region area (in pixels) contained in the segmented image
- int minimumRegionArea;
- //! Specifies the bandwidth of the search window in the range subspace during the computation of mean shift
- double rangeBandwidth;
- //! Specifies a spatial search window of size (2r+1)x (2r+1) during the mean shift computation, where r is the spatial bandwidth
- int spatialBandwidth;
- //! Specifies the SpeedUpLevel. See EDISON Manual for details.
- std::string speedUpLvlString;
- SpeedUpLevel speedUpLevel;
- //! EDISON - ImageProcessor
- msImageProcessor *imageProc;
-
-
- void setSpeedUpLevel ( const std::string & _speedUpLevelString );
- public:
-
- ///////////////////// ///////////////////// /////////////////////
- // CONSTRUCTORS / DESTRUCTORS
- ///////////////////// ///////////////////// /////////////////////
- /** simple constructor */
- RSMeanShift();
- /**
- * @brief standard constructor, calls this->initFromConfig
- * @param conf config file
- * @author Bjoern Froehlich, Alexander Freytag
- */
- RSMeanShift(const NICE::Config * _conf );
- /** simple destructor */
- virtual ~RSMeanShift();
-
- /**
- * @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 = "RSMeanShift" );
- ///////////////////// ///////////////////// /////////////////////
- // 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
- */
- int segRegions ( const NICE::Image & img, NICE::Matrix & mask ) const;
- /**
- * 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
- */
- int segRegions ( const NICE::ColorImage & img, NICE::Matrix & mask ) const;
-
- ///////////////////// 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 );
-
- /**
- * @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;
-
- /**
- * @brief Clear object
- * @author Alexander Freytag
- * @date 07-02-2014 ( dd-mm-yyyy )
- */
- void clear ();
- };
- } //namespace
- #endif
|