You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.2 KiB
C
89 lines
2.2 KiB
C
|
5 years ago
|
#ifndef OnlineCornerDetector_h__
|
||
|
|
#define OnlineCornerDetector_h__
|
||
|
|
|
||
|
|
#include <vector>
|
||
|
|
#include <deque>
|
||
|
|
#include <opencv2/opencv.hpp>
|
||
|
|
|
||
|
|
using std::vector;
|
||
|
|
using std::deque;
|
||
|
|
using namespace cv;
|
||
|
|
|
||
|
|
namespace pagic
|
||
|
|
{
|
||
|
|
class D2CornerDetector;
|
||
|
|
class CornerInfo;
|
||
|
|
class OnlinePathSmoother;
|
||
|
|
|
||
|
|
class OnlineCornerDetector
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
OnlineCornerDetector();
|
||
|
|
CornerInfo* addSample(Point2d pos);
|
||
|
|
void addSamples(const vector<Point2d>& posVec);
|
||
|
|
void detectCorners(const vector<Point2d>& posVec, vector<CornerInfo*>& corners);
|
||
|
|
|
||
|
|
double getSegmentMaxLength() const { return m_segmentMaxLength; }
|
||
|
|
void setSegmentMaxLength(double val) { m_segmentMaxLength = val; }
|
||
|
|
|
||
|
|
deque<Point2d> getPosSegment() const { return m_posSegment; }
|
||
|
|
deque<CornerInfo*> getCifVec() const { return m_cifVec; }
|
||
|
|
|
||
|
|
Point2d getReversePos(int i) { return *(m_posSegment.rbegin() + i); }
|
||
|
|
|
||
|
|
Point2d getCurCornerPos() const;
|
||
|
|
|
||
|
|
int getWin() ;
|
||
|
|
int getSmoothRadius();
|
||
|
|
|
||
|
|
bool isEnableSmoother() const { return m_enableSmoother; }
|
||
|
|
void enableSmoother(bool val) { m_enableSmoother = val; }
|
||
|
|
|
||
|
|
int getStartSampleIdx() const { return m_startSampleIdx; }
|
||
|
|
void setStartSampleIdx(int val) { m_startSampleIdx = val; }
|
||
|
|
|
||
|
|
vector<CornerInfo> getRsltCorners() const { return m_rsltCorners; }
|
||
|
|
void setRsltCorners(vector<CornerInfo> val) { m_rsltCorners = val; }
|
||
|
|
|
||
|
|
D2CornerDetector* getDet() { return m_pCornerDetector; }
|
||
|
|
|
||
|
|
void clear();
|
||
|
|
|
||
|
|
protected:
|
||
|
|
int m_addingCount;
|
||
|
|
int m_startSampleIdx;
|
||
|
|
|
||
|
|
D2CornerDetector* m_pCornerDetector;
|
||
|
|
bool m_enableSmoother;
|
||
|
|
|
||
|
|
OnlinePathSmoother* m_pSmoother;
|
||
|
|
|
||
|
|
double m_curSegmentLength;
|
||
|
|
double m_segmentMaxLength;
|
||
|
|
int m_segmentSampleNum;
|
||
|
|
double m_segmentStepLength;
|
||
|
|
|
||
|
|
vector<CornerInfo> m_curCorners; //buffer saving currently detected corners
|
||
|
|
vector<CornerInfo> m_rsltCorners;
|
||
|
|
|
||
|
|
void addCurCorner(CornerInfo* pCif);
|
||
|
|
CornerInfo* getCurCorner();
|
||
|
|
CornerInfo* findBestCorner(vector<CornerInfo>& vec);
|
||
|
|
|
||
|
|
deque<Point2d> m_posSegment;
|
||
|
|
void addToPosSegment(const Point2d& pos);
|
||
|
|
|
||
|
|
deque<CornerInfo*> m_cifVec;
|
||
|
|
deque<double> m_dVec;
|
||
|
|
int m_startIdx;
|
||
|
|
vector<CornerInfo*> m_DetectedCornerBuf;
|
||
|
|
|
||
|
|
void addResampledPos(Point2d pos, double maxLength);
|
||
|
|
|
||
|
|
public:
|
||
|
|
static bool pagicTest();
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif // OnlineCornerDetector_h__
|