123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- /*******************************************************
- Mean Shift Analysis Library
- =============================================
- The mean shift library is a collection of routines
- that use the mean shift algorithm. Using this algorithm,
- the necessary output will be generated needed
- to analyze a given input set of data.
- Region List Class:
- =================
- During segmentation, data regions are defined. The
- RegionList class provides a mechanism for doing so, as
- well as defines some basic operations, such as region
- growing or small region pruning, on the defined regions.
- The prototype for the RegionList class is provided below. It
- is defined in "region.cc".
- The theory is described in the papers:
- D. Comaniciu, P. Meer: Mean Shift: A robust approach toward feature
- space analysis.
- C. Christoudias, B. Georgescu, P. Meer: Synergism in low level vision.
- and they are is available at:
- http://www.caip.rutgers.edu/riul/research/papers/
- Implemented by Chris M. Christoudias, Bogdan Georgescu
- ********************************************************/
- #ifndef RLIST_H
- #define RLIST_H
- //include global type definitions
- #include "tdef.h"
- //define region structure
- struct REGION {
- int label;
- int pointCount;
- int region;
- };
- //region class prototype...
- class RegionList {
- public:
- /*/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
- /* Class Constructor and Destructor */
- /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/*/
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- //<--------------------------------------------------->|//
- //| |//
- //| Method Name: |//
- //| ============ |//
- //| * Class Constructor * |//
- //| |//
- //<--------------------------------------------------->|//
- //| |//
- //| Description: |//
- //| ============ |//
- //| |//
- //| Constructs a region list object. |//
- //| |//
- //| Its arguments are: |//
- //| |//
- //| <* maxRegions *> |//
- //| The maximum amount of regions that can be class- |//
- //| ified by the region list. |//
- //| |//
- //| <* L *> |//
- //| The length of the input data set being class- |//
- //| ified by the region list object. |//
- //| |//
- //| <* N *> |//
- //| The dimension of the input data set being class- |//
- //| ified by the region list object. |//
- //| |//
- //<--------------------------------------------------->|//
- //| |//
- //| Usage: |//
- //| ====== |//
- //| RegionList(maxRegions, L, N) |//
- //| |//
- //<--------------------------------------------------->|//
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- RegionList(int, int, int);
- // Class Destructor
- ~RegionList( void );
- /*/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
- /* Region List Manipulation */
- /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/*/
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- //<--------------------------------------------------->|//
- //| |//
- //| Method Name: |//
- //| ============ |//
- //| * Add Region * |//
- //| |//
- //<--------------------------------------------------->|//
- //| |//
- //| Description: |//
- //| ============ |//
- //| |//
- //| Adds a region to the region list. |//
- //| |//
- //| Its arguments are: |//
- //| |//
- //| <* label *> |//
- //| |//
- //| A positive integer used to uniquely identify |//
- //| a region. |//
- //| |//
- //| <* pointCount *> |//
- //| A positive integer that specifies the number of |//
- //| N-dimensional data points that exist in the re- |//
- //| gion being classified. |//
- //| |//
- //| <* indeces *> |//
- //| An integer array that specifies the set of ind- |//
- //| eces of the data points that are contianed with- |//
- //| in this region. |//
- //| |//
- //<--------------------------------------------------->|//
- //| |//
- //| Usage: |//
- //| ====== |//
- //| AddRegion(label, pointCount, indeces) |//
- //| |//
- //<--------------------------------------------------->|//
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- void AddRegion(int, int, int*);
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- //<--------------------------------------------------->|//
- //| |//
- //| Method Name: |//
- //| ============ |//
- //| * Reset * |//
- //| |//
- //<--------------------------------------------------->|//
- //| |//
- //| Description: |//
- //| ============ |//
- //| |//
- //| Resets the region list for re-use (for new |//
- //| classification). |//
- //| |//
- //<--------------------------------------------------->|//
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- void Reset( void );
- /*/\/\/\/\/\/\/\/\/\/\*/
- /* Query Region List */
- /*\/\/\/\/\/\/\/\/\/\/*/
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- //<--------------------------------------------------->|//
- //| |//
- //| Method Name: |//
- //| ============ |//
- //| * Get Number of Regions * |//
- //| |//
- //<--------------------------------------------------->|//
- //| |//
- //| Description: |//
- //| ============ |//
- //| |//
- //| Returns the number of regions stored by the |//
- //| region list. |//
- //| |//
- //<--------------------------------------------------->|//
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- int GetNumRegions ( void );
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- //<--------------------------------------------------->|//
- //| |//
- //| Method Name: |//
- //| ============ |//
- //| * Get Label * |//
- //| |//
- //<--------------------------------------------------->|//
- //| |//
- //| Description: |//
- //| ============ |//
- //| |//
- //| Returns the label of a specified region. |//
- //| |//
- //| Its arguments are: |//
- //| |//
- //| <* regionNumber *> |//
- //| The index of the region in the region list |//
- //| array. |//
- //| |//
- //<--------------------------------------------------->|//
- //| |//
- //| Usage: |//
- //| ====== |//
- //| label = GetLabel(regionNumber) |//
- //| |//
- //<--------------------------------------------------->|//
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- int GetLabel(int);
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- //<--------------------------------------------------->|//
- //| |//
- //| Method Name: |//
- //| ============ |//
- //| * Get Region Count * |//
- //| |//
- //<--------------------------------------------------->|//
- //| |//
- //| Description: |//
- //| ============ |//
- //| |//
- //| Returns number of data points contained by a sp- |//
- //| ecified region. |//
- //| |//
- //| Its arguments are: |//
- //| |//
- //| <* regionNumber *> |//
- //| The index of the region in the region list |//
- //| array. |//
- //| |//
- //<--------------------------------------------------->|//
- //| |//
- //| Usage: |//
- //| ====== |//
- //| pointCount = GetRegionCount(regionNumber) |//
- //| |//
- //<--------------------------------------------------->|//
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- int GetRegionCount(int);
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- //<--------------------------------------------------->|//
- //| |//
- //| Method Name: |//
- //| ============ |//
- //| * Get Region Indeces * |//
- //| |//
- //<--------------------------------------------------->|//
- //| |//
- //| Description: |//
- //| ============ |//
- //| |//
- //| Returns a pointer to a set of grid location ind- |//
- //| eces specifying the data points belonging to a |//
- //| specified region. |//
- //| |//
- //| Its arguments are: |//
- //| |//
- //| <* regionNumber *> |//
- //| The index of the region in the region list |//
- //| array. |//
- //| |//
- //<--------------------------------------------------->|//
- //| |//
- //| Usage: |//
- //| ====== |//
- //| indeces = GetRegionIndeces(regionNumber) |//
- //| |//
- //<--------------------------------------------------->|//
- //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
- int*GetRegionIndeces(int);
- private:
- /*/\/\/\/\/\/\/\/\/\/\/\*/
- /* Class Error Handler */
- /*\/\/\/\/\/\/\/\/\/\/\/*/
- void ErrorHandler(char*, char*, ErrorType);
- //=============================
- // *** Private Data Members ***
- //=============================
- //#####################################
- //### REGION LIST PARTITIONED ARRAY ###
- //#####################################
- REGION *regionList; //array of maxRegions regions
- int minRegion;
- int maxRegions; //defines the number maximum number of regions
- //allowed (determined by user during class construction)
- int numRegions; //the number of regions currently stored by the
- //region list
- int freeRegion; //an index into the regionList pointing to the next
- //available region in the regionList
- //#####################################
- //### INDEX TABLE ###
- //#####################################
- int *indexTable; //an array of indexes that point into an external structure
- //specifying which points belong to a region
- int freeBlockLoc; //points to the next free block of memory in the indexTable
- //#####################################
- //### INPUT DATA PARAMETERS ###
- //#####################################
- //Dimension of data set
- int N; //dimension of data set being classified by region list
- //class
- //Length of the data set
- int L; //number of points contained by the data set being classified by
- //region list class
- };
- #endif
|