opencv实现简单SIFT代码
来源:互联网 发布:中国最帅的程序员 编辑:程序博客网 时间:2024/05/18 06:27
运行环境:opencv2.3.1+vs2010,在opencv中有封装好的sift类库,可直接调用,实现sift只需简单几行代码,有详细注释。
//SIFT#include <tchar.h>#include "highgui.h"#include "features2d/features2d.hpp"#include <iostream>using namespace std;using namespace cv;void _tmain(int argc, _TCHAR* argv[]){/*1. input images*/Mat input1=imread("church01.jpg",1);//read image1Mat input2=imread("church02.jpg",1);//read image2/*2. feature detector*/SiftFeatureDetector detector;//define sift detectorvector<KeyPoint> keypoint1,keypoint2;//define kepoint vectordetector.detect(input1,keypoint1);//extract features of image1Mat output1;drawKeypoints(input1,keypoint1,output1);//draw features of image1imshow("sift_result1.jpg",output1);imwrite("sift_result1.jpg",output1);detector.detect(input2,keypoint2);//extract features of image2Mat output2;drawKeypoints(input2,keypoint2,output2);//draw features of image2imshow("sift_result2.jpg",output2);imwrite("sift_result2.jpg",output2);/*3. feature descriptor*/SiftDescriptorExtractor extractor;Mat descriptor1,descriptor2;//define sift descriptorBruteForceMatcher<L2<float>> matcher;vector<DMatch> matches;Mat img_matches;extractor.compute(input1,keypoint1,descriptor1);//create descriptor1extractor.compute(input2,keypoint2,descriptor2);//create descriptor2/*4. image matching*/matcher.match(descriptor1,descriptor2,matches);//match image1 to image2drawMatches(input1,keypoint1,input2,keypoint2,matches,img_matches);imshow("matches",img_matches);imwrite("matches.jpg",img_matches);waitKey();}
运行结果
0 0
- opencv实现简单SIFT代码
- SIFT Opencv 代码
- OpenCV中SIFT的实现
- 利用opencv实现sift matching
- 浅谈openCV中的SIFT实现
- sift的opencv简易实现
- opencv双目测距的简单代码实现
- 【opencv】SIFT算法原理及实现
- 基于OpenCV的SIFT算法的实现
- SIFT和SURF,及OpenCV实现
- Java opencv中sift的实现
- opencv sift 的实现与原理
- SIFT特征提取及其opencv实现
- 图像特征检测描述(一):SIFT、SURF、ORB、HOG、LBP特征的原理概述及OpenCV代码实现
- 图像特征检测描述(一):SIFT、SURF、ORB、HOG、LBP特征的原理概述及OpenCV代码实现
- 【图像特征提取12】OpenCv的SIFT图像局部特征提取描述算法C++代码的实现
- SIFT算法原理与OpenCV源码分析6:OpenCV实现SIFT算法,特征检测器FeatureDetector
- 基于Opencv的SIFT代码,使用FLANN匹配
- Lua中的_G 和_ENV
- 二叉树的遍历(递归、非递归)
- 从单机到集群会话的管理之集群模式一
- 十分钟搞清字符集和字符编码
- [Java并发包学习一]Executor和ExecutorService
- opencv实现简单SIFT代码
- mp4 box信息实例分析 1
- 数据安全处理
- java基础学习笔记(1)
- 广告sdk窃取用户隐私:你家的App被下架了吗?
- Oracle数据库操作相关命令
- mysql proxy 主从复制 读写分离
- mac 10.11.1 OSX EI Capitan 关闭单词自动纠正
- iOS图片@2X, @3x