123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- /**
- * @file LocalizationResult.h
- * @brief classification result, what else?
- * @author Erik Rodner
- * @date 02/13/2008
- */
- #ifndef LocalizationResultINCLUDE
- #define LocalizationResultINCLUDE
- #include <vislearning/nice_nonvis.h>
- #include <string>
- #include <vector>
- #include <assert.h>
-
- #include "ClassificationResult.h"
- #include "ClassNames.h"
- #include "core/basics/Persistent.h"
- #include <core/image/Region.h>
- #include <core/image/RectT.h>
- namespace OBJREC {
- class SingleLocalizationResult
- {
- private:
- /** used for depth ordering */
- int controlPoints;
- int xi, yi, xa, ya;
-
- bool hasRegionInformation_bool;
- NICE::Region reg;
-
-
- public:
-
- ClassificationResult *r;
- SingleLocalizationResult ( ClassificationResult *r, const NICE::Region & reg, int controlPoints = 0 );
- SingleLocalizationResult ( ClassificationResult *r, int xi, int yi, int xa, int ya );
- ~SingleLocalizationResult ();
- void getBoundingBox ( int & xi, int & yi, int & xa, int & ya ) const;
- void getBoundingBox ( NICE::RectT<int> & rectangle ) const;
- void getCentroid ( double & x, double & y ) const;
- bool hasRegionInformation () const { return hasRegionInformation_bool; };
- int getControlPoints () const { return controlPoints; };
- const NICE::Region & getRegion () const { assert (hasRegionInformation_bool); return reg; };
- void addPoint ( int x, int y ) { assert(hasRegionInformation_bool); reg.add(x,y); };
- double getBBOverlapMeasure ( const SingleLocalizationResult & slr ) const;
- double getBBOverlapMeasureMin ( const SingleLocalizationResult & slr ) const;
- };
- class LocalizationResult : public std::vector<SingleLocalizationResult *>, public NICE::Persistent
- {
- private:
- const ClassNames *cn;
- NICE::Image *labeledImage;
-
- public:
- bool hasLabeledImage;
- int xsize;
- int ysize;
-
- enum {
- FILEFORMAT_PASCAL2006_RESULT = 0,
- FILEFORMAT_PASCAL2006_GROUNDTRUTH,
- FILEFORMAT_POLYGON
- };
- LocalizationResult ( int xsize = -1, int ysize = -1 );
- LocalizationResult ( const ClassNames *cn, int xsize = -1, int ysize = -1);
- LocalizationResult ( const ClassNames *cn, const NICE::Image & img, int classno );
- LocalizationResult ( const ClassNames *cn, const NICE::ColorImage & img );
- ~LocalizationResult ();
- void sortEmpricalDepth();
- void sortDescendingConfidence();
- void getLabeledImageCache ( NICE::Image & mark ) const;
- void calcLabeledImage ( NICE::Image & mark, int backgroundClassNo ) const;
- void setMap ( const NICE::Image & labeledImage );
- void displayBoxes ( NICE::ColorImage & img,
- const ClassNames *cn = NULL,
- bool display_confidence = true,
- bool invert = false,
- int width = 1) const;
- void restore (std::istream & is, int format = 0);
- void store (std::ostream & os, int format = 0) const;
- void clear ();
- int getMaxClassno () { assert(cn != NULL); return cn->getMaxClassno(); };
- };
- } // namespace
- #endif
|