12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- /**
- * @file SemanticSegmentation.h
- * @brief abstract interface for semantic segmentation algorithms
- * @author Erik Rodner
- * @date 03/19/2009
- */
- #ifndef SEMANTICSEGMENTATIONINCLUDE
- #define SEMANTICSEGMENTATIONINCLUDE
- #include <objrec/nice.h>
-
- #include "objrec/cbaselib/MultiDataset.h"
- #include "objrec/cbaselib/LocalizationResult.h"
- #include "objrec/cbaselib/CachedExample.h"
- #include "objrec/cbaselib/Example.h"
-
- namespace OBJREC {
- /** abstract interface for semantic segmentation algorithms */
- class SemanticSegmentation
- {
- protected:
- /** accessible class names and information about
- number of classes etc. */
- const ClassNames *classNames;
- /** enum type for imagetype */
- enum {
- IMAGETYPE_RGB = 0,
- IMAGETYPE_GRAY
- };
- /** whether to load images with color information */
- int imagetype;
- public:
-
- /** simple constructor
- @param conf global settings
- @param classNames this ClassNames object while be stored as a attribute
- */
- SemanticSegmentation( const Config *conf,
- const ClassNames *classNames );
-
- /** simple destructor */
- virtual ~SemanticSegmentation();
- /** this function has to be overloaded by all subclasses
- @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
- */
- virtual void semanticseg ( CachedExample *ce,
- NICE::Image & segresult,
- GenericImage<double> & probabilities ) = 0;
-
- /**
- * convert different datatypes
- */
- void convertVVectorToExamples(VVector &feats,Examples &examples, vector<int> &label);
- void convertExamplesToVVector(VVector &feats,Examples &examples, vector<int> &label);
- void convertExamplesToLSet(Examples &examples, LabeledSetVector &lvec);
- void convertLSetToExamples(Examples &examples, LabeledSetVector &lvec);
- void convertLSetToSparseExamples(Examples &examples, LabeledSetVector &lvec);
-
- /** load img from file call localize(CachedExample *ce) etc. */
- void semanticseg ( const std::string & filename,
- NICE::Image & segresult,
- GenericImage<double> & probabilities);
- };
- } // namespace
- #endif
|