00001 #ifndef APPEARANCESEGMENT_HPP
00002 #define APPEARANCESEGMENT_HPP
00003
00004 #ifdef HAVE_MODULE_DSEG
00005
00006 #include "rtslam/appearanceAbstract.hpp"
00007 #include "dseg/SegmentsSet.hpp"
00008 #include "dseg/SegmentHypothesis.hpp"
00009 #include "jmath/misc.hpp"
00010
00011 namespace jafar
00012 {
00013 namespace rtslam
00014 {
00015 class AppearanceSegment;
00016 typedef boost::shared_ptr<AppearanceSegment> app_seg_ptr_t;
00017
00023 class AppearanceSegment: public AppearanceAbstract {
00024 private:
00025 dseg::SegmentsSet m_hypothesis;
00026 public:
00027 AppearanceSegment(dseg::SegmentHypothesis* _hypothesis = NULL){if(_hypothesis != NULL)m_hypothesis.addSegment(_hypothesis);}
00028 virtual ~AppearanceSegment(){}
00029 virtual AppearanceAbstract* clone(){return new AppearanceSegment(hypothesis());}
00030
00031 dseg::SegmentHypothesis* hypothesis() {return m_hypothesis.segmentAt(0);}
00032 void setHypothesis(dseg::SegmentHypothesis* _hypothesis)
00033 {
00034 m_hypothesis = dseg::SegmentsSet();
00035 m_hypothesis.addSegment(_hypothesis);
00036 }
00037
00038 jblas::vec4 realObs()
00039 {
00040 jblas::vec4 ret;
00041 ret.clear();
00042 if(m_hypothesis.count() > 0)
00043 {
00044 ret[0] = m_hypothesis.segmentAt(0)->x1();
00045 ret[1] = m_hypothesis.segmentAt(0)->y1();
00046 ret[2] = m_hypothesis.segmentAt(0)->x2();
00047 ret[3] = m_hypothesis.segmentAt(0)->y2();
00048 }
00049 return ret;
00050 }
00051 };
00052 }
00053 }
00054
00055 #endif //HAVE_MODULE_DSEG
00056
00057 #endif // APPEARANCESEGMENT_HPP