19年1月份的慕尼黑,大雪纷飞...
各位看官,最近在线特征相关的研究,本文把直线特征的提取和匹配的源码贴一下,希望对大家有所帮助,在下使用 OpenCV下的LSD 提取特征,LBD进行特征描述, KNNMatch做特征描述。同时,还有特征质量的简单筛选。
#include #include #include #include #include #include #include #include #include #include #include
using namespace cv;
using namespace std;
using namespace cv::line_descriptor;
struct sort_descriptor_by_queryIdx
{
inline bool operator()(const vector& a, const vector& b){
return ( a[0].queryIdx < b[0].queryIdx );
}
};
struct sort_lines_by_response
{
inline bool operator()(const KeyLine& a, const KeyLine& b){
return ( a.response > b.response );
}
};
void ExtractLineSegment(const Mat &img, const Mat &image2, vector &keylines,vector &keylines2);
int main(int argc, char**argv)
{
if(argc != 3)
{
cerr << endl << "Usage: ./Line path_to_image1 path_to_image2" << endl;
return 1;
}
string imagePath1=string(argv[1]);
string imagePath2=string(argv[2]);
cout<