首页 技术 正文
技术 2022年11月10日
0 收藏 382 点赞 3,827 浏览 1506 个字

下面单独介绍KEYPOINT 与DMatch的内在联系

     std::vector<cv::Point2f> points1, points2;     for (std::vector<cv::DMatch>::const_iterator it= matches.begin();
it!= matches.end(); ++it) { // Get the position of left keypoints
float x= keypoints1[it->queryIdx].pt.x;
8 float y= keypoints1[it->queryIdx].pt.y;
points1.push_back(cv::Point2f(x,y));
cv::circle(image1,cv::Point(x,y),,cv::Scalar(,,),);
// Get the position of right keypoints
x= keypoints2[it->trainIdx].pt.x;
13 y= keypoints2[it->trainIdx].pt.y;
cv::circle(image2,cv::Point(x,y),,cv::Scalar(,,),);
points2.push_back(cv::Point2f(x,y));
}

class KeyPoint

{

 Point2f  pt;  //坐标  常用的就是这个了

float  size; //特征点邻域直径

float  angle; //特征点的方向,值为[零,三百六十),负值表示不使用

float  response;

int  octave; //特征点所在的图像金字塔的组

int  class_id; //用于聚类的id

}

  1. 存放匹配结果的结构:

    struct DMatch

    {              //三个构造函数

    DMatch():

    queryIdx(-1),trainIdx(-1),imgIdx(-1),distance(std::numeric_limits<float>::max()) {} //这块就相当于初始化

    DMatch(int  _queryIdx, int  _trainIdx, float  _distance ) :

    queryIdx( _queryIdx),trainIdx( _trainIdx), imgIdx(-1),distance( _distance) {}

    DMatch(int  _queryIdx, int  _trainIdx, int  _imgIdx, float  _distance ) :                   queryIdx(_queryIdx), trainIdx( _trainIdx), imgIdx( _imgIdx),distance( _distance) {}

    intqueryIdx;  //此匹配对应的查询图像的特征描述子索引

    inttrainIdx;   //此匹配对应的训练(模板)图像的特征描述子索引

    intimgIdx;    //训练图像的索引(若有多个)

    /*********************************         

    int queryIdx; // query descriptor index
    int trainIdx; // train descriptor index
    int imgIdx; // train image index

    ***********************************/

    float distance;  //两个特征向量之间的欧氏距离,越小表明匹配度越高。

    bool operator  < (const DMatch &m) const;

    };

  2. 3

    图片中特征点欧式距离的计算公式:

    0ρ = √( (x1-x2)2+(y1-y2)2 ) |x| = √( x2 + y2 )

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,110
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,584
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,431
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,202
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,837
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,920