SIFT特征提取-应用篇
SIFT特征具有缩放、旋转特征不变性,下载了大牛的matlab版SIFT特征提取代码,解释如下:
1.调用方法:
将文件加入matlab目录后,在主程序中有两种操作:
op1:寻找图像中的Sift特征:
- [image, descrips, locs] = sift('scene.pgm');
- showkeys(image, locs);
op2:对两幅图中的SIFT特征进行匹配:
- match('scene.pgm','book.pgm');
由于scene和book两图中有相同的一本书,但orientation和size都不同,可以发现所得结果中Sift特征检测结果非常好。
2.代码下载地址:
<span style="vertical-align: baseline; color: rgb(19, 61, 182);"><a target=_blank target="_blank" href="http://www.cs.ubc.ca/~lowe/keypoints/" style="color: rgb(19, 61, 182); text-decoration: none; vertical-align: baseline;"><span style="font-family: 'Microsoft YaHei'; font-size: 13px;">http://www.cs.ubc.ca/~lowe/keypoints/</span></a></span>
<span style="font-family: 'Microsoft YaHei'; font-size: 13px;">3.想用自己的图片进行调用:</span>
<span style="font-family: 'Microsoft YaHei'; font-size: 13px;"></span><div class="dp-highlighter bg_csharp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; width: 878.5625px; overflow: auto; padding-top: 1px; margin: 18px 0px !important; background-color: rgb(231, 229, 220);"><div class="bar" style="padding-left: 45px;"><div class="tools" style="padding: 3px 8px 10px 10px; font-stretch: normal; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; border-left-width: 3px; border-left-style: solid; border-left-color: rgb(108, 226, 108); background-color: rgb(248, 248, 248);"><strong>[csharp]</strong> <a target=_blank href="http://blog.csdn.net/abcjennifer/article/details/7365882#" class="ViewSource" title="view plain" style="color: rgb(160, 160, 160); text-decoration: none; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-attachment: initial; background-color: inherit; background-size: initial; background-origin: initial; background-clip: initial; background-position: 0% 0%; background-repeat: no-repeat;">view plain</a><a target=_blank href="http://blog.csdn.net/abcjennifer/article/details/7365882#" class="CopyToClipboard" title="copy" style="color: rgb(160, 160, 160); text-decoration: none; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-attachment: initial; background-color: inherit; background-size: initial; background-origin: initial; background-clip: initial; background-position: 0% 0%; background-repeat: no-repeat;">copy</a><a target=_blank href="https://code.csdn.net/snippets/135681" target="_blank" title="在CODE上查看代码片" style="color: rgb(160, 160, 160); text-decoration: none; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; background-image: none; background-attachment: initial; background-color: inherit; background-size: initial; background-origin: initial; background-clip: initial; background-position: 0% 0%; background-repeat: no-repeat;"><img src="https://code.csdn.net/assets/CODE_ico.png" width="12" height="12" alt="在CODE上查看代码片" style="border: none; max-width: 100%; position: relative; top: 1px; left: 2px;" /></a><a target=_blank href="https://code.csdn.net/snippets/135681/fork" target="_blank" title="派生到我的代码片" style="color: rgb(160, 160, 160); text-decoration: none; border: none; padding: 1px; margin: 0px 10px 0px 0px; font-size: 9px; display: inline-block; width: 16px; height: 16px; background-image: none; background-attachment: initial; background-color: inherit; background-size: initial; background-origin: initial; background-clip: initial; background-position: 0% 0%; background-repeat: no-repeat;"><img src="https://code.csdn.net/assets/ico_fork.svg" width="12" height="12" alt="派生到我的代码片" style="border: none; max-width: 100%; position: relative; top: 2px; left: 2px;" /></a><div style="position: absolute; left: 405px; top: 1050px; width: 18px; height: 18px; z-index: 99;"></div></div></div><ol start="1" class="dp-c" style="padding: 0px; border: none; color: rgb(92, 92, 92); margin: 0px 0px 1px 45px !important; background-color: rgb(255, 255, 255);"><li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">i1=imread(</span><span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">'D:\Images\New\Cars\image_0001.jpg'</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">); </span></span></li><li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important; background-color: rgb(248, 248, 248);"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">i2=imread(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">'D:\Images\New\Cars\image_0076.jpg'</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">); </span></span></li><li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">i11=rgb2gray(i1); </span></li><li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important; background-color: rgb(248, 248, 248);"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">i22=rgb2gray(i2); </span></li><li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">imwrite(i11,<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">'v1.jpg'</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">,</span><span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">'quality'</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">,80); </span></span></li><li style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important; background-color: rgb(248, 248, 248);"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">imwrite(i22,<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">'v2.jpg'</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">,</span><span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">'quality'</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">,80); </span></span></li><li class="alt" style="border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(108, 226, 108); list-style: decimal-leading-zero outside; color: inherit; line-height: 18px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">match(<span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">'v1.jpg'</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">,</span><span class="string" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">'v2.jpg'</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">); </span></span></li></ol></div>
<span style="font-family: 'Microsoft YaHei'; font-size: 13px;">experiment results:</span>
<span style="font-family: 'Microsoft YaHei'; font-size: 13px;"><img src="http://hi.csdn.net/attachment/201203/18/0_1332039524thQs.gif" alt="" style="border: none; max-width: 100%;" /> </span>
<span style="font-family: 'Microsoft YaHei'; font-size: 13px;">scene</span>
book
compare result
EXP2:
C代码:
- // FeatureDetector.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include "highgui.h"
- #include "cv.h"
- #include "vector"
- #include "opencv\cxcore.hpp"
- #include "iostream"
- #include "opencv.hpp"
- #include "nonfree.hpp"
- #include "showhelper.h"
- using namespace cv;
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- //Load Image
- Mat c_src1 = imread( "..\\Images\\3.jpg");
- Mat c_src2 = imread("..\\Images\\4.jpg");
- Mat src1 = imread( "..\\Images\\3.jpg", CV_LOAD_IMAGE_GRAYSCALE);
- Mat src2 = imread( "..\\Images\\4.jpg", CV_LOAD_IMAGE_GRAYSCALE);
- if( !src1.data || !src2.data )
- { std::cout<< " --(!) Error reading images " << std::endl; return -1; }
- //sift feature detect
- SiftFeatureDetector detector;
- std::vector<KeyPoint> kp1, kp2;
- detector.detect( src1, kp1 );
- detector.detect( src2, kp2 );
- SiftDescriptorExtractor extractor;
- Mat des1,des2;//descriptor
- extractor.compute(src1,kp1,des1);
- extractor.compute(src2,kp2,des2);
- Mat res1,res2;
- int drawmode = DrawMatchesFlags::DRAW_RICH_KEYPOINTS;
- drawKeypoints(c_src1,kp1,res1,Scalar::all(-1),drawmode);//在内存中画出特征点
- drawKeypoints(c_src2,kp2,res2,Scalar::all(-1),drawmode);
- cout<<"size of description of Img1: "<<kp1.size()<<endl;
- cout<<"size of description of Img2: "<<kp2.size()<<endl;
- BFMatcher matcher(NORM_L2);
- vector<DMatch> matches;
- matcher.match(des1,des2,matches);
- Mat img_match;
- drawMatches(src1,kp1,src2,kp2,matches,img_match);//,Scalar::all(-1),Scalar::all(-1),vector<char>(),drawmode);
- cout<<"number of matched points: "<<matches.size()<<endl;
- imshow("matches",img_match);
- cvWaitKey();
- cvDestroyAllWindows();
- return 0;
- }
Python代码:
http://blog.csdn.net/abcjennifer/article/details/7639681
关于sift的其他讲解:
http://blog.csdn.net/abcjennifer/article/details/7639681
http://blog.csdn.net/abcjennifer/article/details/7372880
http://blog.csdn.net/abcjennifer/article/details/7365882
from: http://blog.csdn.net/abcjennifer/article/details/7365882
SIFT特征提取-应用篇相关推荐
- SIFT特征提取算法总结
转自:http://www.jellon.cn/index.php/archives/374 一.综述 Scale-invariant feature transform(简称SIFT)是一种图像特征 ...
- [转]SIFT特征提取分析
SIFT(Scale-invariant feature transform)是一种检测局部特征的算法,该算法通过求一幅图中的特征点(interest points,or corner points) ...
- SIFT特征提取分析
SIFT特征提取分析 SIFT(Scale-invariant feature transform)是一种检测局部特征的算法,该算法通过求一幅图中的特征点(interest points,or cor ...
- 计算机视觉——SIFT特征提取与检索
目录 一.SIFT算法 1.1算法介绍 1.2算法特点 1.3特征检测 1.4特征匹配 二.SIFT特征提取与检索实验 2.1实验要求 2.2实验准备 2.3实验过程 2.3.1图片的SIFT特征提取 ...
- 计算机视觉——SIFT特征提取与检索+匹配地理标记图像+RANSAC算法
SIFT特征提取与检索 1. SIFT算法 1.1 基本概念 1.2 SIFT算法基本原理 1.2.1 特征点 1.2.2 尺度空间 1.2.3 高斯函数 1.2.4 高斯模糊 1.2.5 高斯金字塔 ...
- SIFT特征提取与检测
文章目录 一.SIFT算子介绍 二.SIFT算子特点 三.SIFT算子应用 四.SIFT特征点提取算法 五.SIFT算法特征匹配实验 六.RANSAC算法 1.算法描述 2.RANSAC算法在SIFT ...
- SIFT特征提取与匹配算法
目录 SIFT尺度不变特征变换 1. SIFT方法简介 2. SIFT特征提取步骤 3. 构建尺度空间 3.1 尺度空间的概念 3.2 图像多尺度表述 3.3 尺度空间的极值检测 4. 关键点定位 4 ...
- SIFT特征提取和匹配
一.sift特征原理部分: SIFT特征详解 - Brook_icv - 博客园 (cnblogs.com) sift特征提取算法_July_Zh1的博客-CSDN博客_sift特征提取算法 二.si ...
- 计算机视觉3 SIFT特征提取与全景图像拼接
1.原理 检测并提取图像的特征和关键点 匹配两个图像之间的描述符 使用RANSAC算法使用我们匹配的特征向量估计单应矩阵 拼接图像 步骤一和步骤二过程是运用SIFT局部描述算子检测图像中的关键点和特征 ...
最新文章
- 基于 Spring Cloud 的微服务架构分析
- C++字符串的个人理解
- LeetCode 423. 从英文中重建数字(找规律)
- Bootstrap validation
- Linux命令行下播放音乐SOX
- 1047: 对数表 ZZULIOJ
- ProxySQL 入门教程
- steam邮箱登录教程
- python按文件后缀进行分类,解放生产力
- tensorflow 2.0 Layer定义的源码分析
- 唯样商城:英飞凌 —— 一文弄懂IGBT驱动
- java list集合包含_Java 中的集合类包括 ArrayList 、 Linke
- 2022年运动品牌推荐,双十一运动装备推荐
- EDMA - DMA QDMA 完美总结
- Artiifact分析HSV数据
- 【数据压缩】第八次作业——MPEG音频编码
- cocos2d-iphone之魔塔20层第二部分
- 饿了么多人订餐时计算费用bug(饿了么商品促销优惠金额分摊计算规则)
- GitHub Desktop使用简介
- python 爬虫框架对比_几种爬虫框架效果分析,python最好爬虫框架是哪一种?