[转]尺度不变特征变换(SIFT算法)Matlab程序代码测试例子的说明(Lowe的代码)

http://hi.baidu.com/simonyuee/item/0c91a6b8e8cd61a4ebba936a

目前网络上可以找到的关于SIFT算法Matlab测试代码的资源就是:

1 加拿大University of British Columbia 大学计算机科学系教授 David G. Lowe发表于2004年Int Journal of Computer Vision,2(60):91-110的那篇标题为“Distivtive Image Features from Scale -Invariant Keypoints" 的论文。作者在其学术网站上发表的Matlab程序代码(注意,这个程序代码的初始版本是 D. Alvaro and J.J. Guerrero, 来自Universidad de Zaragoza。)

    上述代码可以很容易检索到,如,http://www.cs.ubc.ca/~lowe/keypoints/

2 美国加州大学洛杉矶分校(University of California at Los Angeles) Andrea Vedaldi 博士研究生给出的基于David Lowe 发表的论文给利用Matlab和C语言混合编程给出的Sift detector and descriptor的实现过程。

      http://vision.ucla.edu/~vedaldi/

    

Andrea VedaldiPh.D. Candidate / VisionLab / UCLA
  • Andrea Vedaldi
  • Research
  • Publications
  • Code
  • Restricted
face  Andrea Vedaldi () Boelter Hall 3811 (Vision Lab - map) University of California, LA (UCLA) (formerly University of Padova DII - map) 
Résumé. 
News
  • 4/10/2008 - Minor tweaks to the MATLAB/SIFT code to eliminate dependencies on LAPACK (easier to compile)
  • 25/1/2008 - VLFeat new version and website.
  • 1/11/2007 - VicinalBoost code is now available.
Bio.  Andrea Vedaldi was born in Verona, Italy, in 1979. He received the DIng from the University of Padova, Italy, in 2003 and the MSc in Computer Science (CS) from the University of California, Los Angles (UCLA) in 2005. He is the recepient of the UCLA 2005 outstanding master in CS award and he is currently enrolled in the UCLA Ph.D program. Popular code
  • SIFT, SIFT++ and MSER.
  • VisionLab Features Library: SIFT, MSER and more (beta).
  • Bag of features.
Collaborators
  • Stefano Soatto, University of California at Los Angeles, Los Angeles, USA.
  • Serge Belongie, University of California at San Diego, San Diego, USA.
  • Paolo Favaro, Heriot-Watt University, Riccarton, Edinburgh, UK.
  • Hailin Jin, Adobe System Incorporated, California, USA.
  • Andrew Rabinowich, University of California at San Diego, San Diego, USA.
  • Gregorio Guidi, University of California at Los Angeles, Los Angeles, USA.
  • Brian Fulkerson, University of California at Los Angeles, Los Angeles, USA.

3 以后陆续有许多基于Sift算法实现图像目标匹配和目标识别等方面的应用,大多都是基于上述的代码和算法原理来进行的。

关于第一测试代码的说明:

1 共有三段Matlab代码源文件

   match.m:测试程序

     功能:该函数读入两幅(灰度)图像,找出各自的 SIFT 特征, 并显示两连接两幅图像中被匹配的特征点(关键特征点(the matched keypoints)直线(将对应特征点进行连接)。判断匹配的准则是匹配距离小于distRatio倍于下一个最近匹配的距离( A match is accepted only if its distance is less than distRatio times the distance to the second closest match.
                该程序返回显示的匹配对的数量。( It returns the number of matches displayed.)

    调用实例: match('desk.jpg','book.jpg');

        ( 假如,想测试一个含有一本书的桌面的图像 和一本书的图像之间特征匹配)

     调用方法和参数描述:略。

     注意:(1)图像为灰度图像,如果是彩色图像,应该在调用前利用rgb2gray转换为灰度图像。

                 (2)参数distRatio 为控制匹配点数量的系数,这里取 0.6,该参数决定了匹配点的数量,在Match.m文件中调整该参数,获得最合适的匹配点数量。

   sift.m :尺度不变特征变换(SIFT算法)的核心算法程序

     具体原理详见David G. Lowe发表于2004年Int Journal of Computer Vision,2(60):91-110的那篇标题为“Distivtive Image Features from Scale -Invariant Keypoints" 的论文

     功能:该函数读入灰度图像,返回SIFT 特征关键点( SIFT keypoints.)
  

 调用方法和参数描述:

  调用方式:[image, descriptors, locs] = sift(imageFile)

  输入参数( Input parameters):

    imageFile: 图像文件名.

     输出或返回参数( Returned):
       image: 是具有double format格式的图像矩阵
      descriptors: 一个 K-by-128 的矩阵x, 其中每行是针对找到的K个关键特征点(the K keypoints)  的不变量描述子. 这个描述子(descriptor)是一个拥有128个数值并归一化为单位长度向量.
       locs: 是K-by-4 矩阵, 其中的每一行具有四个数值,表示关键点位置信息 (在图像中的行坐标,列坐标(row, column) ,注意,一般图像的左上角为坐标原点), 尺度scale,高斯尺度空间的参数,其中该参数也决定了frame(结构)确定的图像disk的大小, 最后一个参数是方向orientation). 方向参数的范围是[-PI, PI] 单位为弧度.
%

    

    appendimages.m:    该函数创建一个新的图像分别包含两个匹配的图像和他们之间的匹配对的连接直线.

 

2、测试结果

  输入图像1:book1gray.jpg

 

\

   输入图像2:book2gray.jpg

 

\

运行结果1:(比例参数为0.6 )

调用过程: match("book1gray.jpg','book2gray.jpg')

输出结果:
Finding keypoints... 
394 keypoints found.   (第1幅图像中检测到394个特征点)
Finding keypoints... 
488 keypoints found. (第2幅图像中检测到488个特征点)
Found 82 matches.  (找到了82个匹配点)

ans =

    82

\

运行结果2:(比例参数为0 . 5 )

调用过程: match('book1gray.jpg','book2gray.jpg')

输出结果:
Finding keypoints... 
394 keypoints found.   (第1幅图像中检测到394个特征点)
Finding keypoints... 
488 keypoints found. (第2幅图像中检测到488个特征点)

Found 55 matches.  (找到了55个匹配点)

 

\

运行结果3 把第二个测试图像变成其中的一个局部,如图 (book2graypart.jpg)

 

\

参数同上,比例参数为0 . 5 

调用过程: match("book1gray.jpg','book2graypart.jpg')

Finding keypoints... 
394 keypoints found. 
Finding keypoints... 
121 keypoints found. 
Found 26 matches.

ans =

    26

 

\

1 在Matlab环境调用主函数

match("book1gray.jpg','book2gray.jpg')

2 注意,必须使matlab 的当前工作文件夹设置成你当前的文件夹


3 这个match 中,增加了 shoukeys的调用,可以显示每个图像全部的关键特征点矢量信息。

\

 

回复hrr1109:

1 关于匹配点的像素坐标

参考源程序文档被Match.m调用的Sift.m,其调用格式为

[image, descriptors, locs] = sift(imageFile),

所以,在Match.m中最前面返回的Locs参数就保留了进行匹配的两个图像所以的特征点的坐标信息:

(locs: K-by-4 matrix, in which each row has the 4 values for a keypoint location (row, column, scale, orientation). The orientation is in the range [-PI, PI] radians.)

 

   你可以在Match.m源程序中,在最后找到匹配点联线的循环语句:

for i = 1: size(des1,1)
if (match(i) > 0)
    line([loc1(i,2) loc2(match(i),2)+cols1], ...
         [loc1(i,1) loc2(match(i),1)], 'Color', 'c');
end
end

凡是Match数组不为零的,其下表i 和本身的值match(i) 就是对应的结果信息(索引坐标数组的)。

 

2 关于Matlab文件保存

请参考: Matlab中的保存数据语句比较

http://blog.sina.com.cn/s/blog_4ec6e1720100g0ss

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你可以在加拿大University of British Columbia的计算机科学系教授David G. Lowe的学术网站上找到SIFT算法Matlab代码。这个代码最初是由D. Alvaro和J.J. Guerrero从Universidad de Zaragoza提供的。你可以在这个网址上找到代码:http://www.cs.ubc.ca/~lowe/keypoints/ [1。此外,你还可以参考这篇博客文章https://blog.csdn.net/zddblog/article/details/7521424,它对SIFT算法进行了简单介绍并提供了具体的代码实现。 SIFT算法的实质是在不同的尺度空间上查找关键点,并计算出关键点的方向。SIFT所查找到的关键点是一些十分突出的点,不会因光照、仿射变换和噪音等因素而化,例如角点、边缘点、暗区的亮点和亮区的暗点等。 SIFT算法的实现可以分为以下四个步骤: 1. 尺度空间极值检测。 2. 关键点定位。 3. 方向分配。 4. 关键点描述和匹配。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Matlab实现sift特征检测和两幅图像的特征点匹配(D. Lowe)](https://blog.csdn.net/qq_45717425/article/details/120918117)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [SIFT算法详解(附有完整代码)](https://blog.csdn.net/weixin_47156401/article/details/122367593)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值