00001
00002
00003 #ifndef _DSEG_HIERARCHICAL_DIRECT_SEGMENTS_DETECTOR_HPP_
00004 #define _DSEG_HIERARCHICAL_DIRECT_SEGMENTS_DETECTOR_HPP_
00005
00006 #include <dseg/DirectSegmentsDetectorBase.hpp>
00007
00008 namespace jafar {
00009 namespace dseg {
00010 class PyramidSP;
00016 class HierarchicalDirectSegmentsDetector : public DirectSegmentsDetectorBase {
00017 public:
00018 HierarchicalDirectSegmentsDetector(kernel::IdFactory<>* _idMaker = 0);
00019 public:
00031 void detectSegment( const jafar::image::Image& _image, const image::ConvexRoi *roiPtr, SegmentsSet& segmentStorage, SegmentDebug* _sdebug = 0);
00032 void detectSegment( PyramidSP* pyramid, const jafar::image::Image& _image, const image::ConvexRoi *roiPtr, SegmentsSet& segmentStorage, SegmentDebug* _sdebug = 0);
00033
00034 PyramidSP* computePyramid(const jafar::image::Image& _image );
00035
00036 public:
00040 JFR_DEFINE_PARAM_RW( int, levels, setLevels )
00041 protected:
00042 virtual void detectedSegment( SegmentHypothesis* , DirectSegmentsDetectorBase::LoopDetectionContext* _context, GrowSegmentContext&);
00043 virtual bool isInASegment( DirectSegmentsDetectorBase::LoopDetectionContext* _context, int _x, int _y );
00044 private:
00052 void detectSegmentAtScale( SegmentHypothesis* segHyp, DirectSegmentsDetectorBase::LoopDetectionContext* _context, int level);
00056 SegmentHypothesis* findSegHyp( const jblas::vec2& _center, double angle, std::vector< GrowSegmentContext >& hyps, int _level, DirectSegmentsDetectorBase::LoopDetectionContext* _context, double* grads, double scaledMinLength2 );
00057 struct Interval;
00058 void updateIntervals( SegmentHypothesis* _segHyp, const Interval& _currentInterval, std::list<Interval>& _intervals, int _level, const jblas::vec2& _center, const jblas::vec2& _dir, double _scaledMinLength );
00059 private:
00060 PyramidSP* m_pyramidSP;
00061 int m_topToBottomScale;
00062 };
00063 }
00064 }
00065
00066 #endif