OpenCV3.1 xfeatures2d::SIFT 使用
2016-04-18 00:00
351 查看
OpenCV3.1 SIFT使用
OpenCV3对OpenCV的模块进行了调整,将开发中与nofree模块放在 了OpenCV_contrib中(包含SIFT),gitHub上的官方项目分成了两个,opencv 与 opencv_contrib。所以,要使用sift接口需在opencv3.1基础上,再安装opencv_contrib。本文主要记录如何安装opencv_contrib,配置Xcode,sift接口的用法。环境:OSX + Xcode + OpenCV3.1
OpenCV31 SIFT使用
install opencv_contrib
configuration Xcode
pro_name Build Setting Search Paths
pro_name Build Setting Other Linker Flags
sample of sift
References
install opencv_contrib
download contrib source code https://github.com/Itseez/opencv_contrib, follow README.md to install$ cd <opencv_build_directory> $ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory> $ make -j5 $ sudo make install
Where
<opencv_build_directory>and
<opencv_source_directory>is directory in opencv3.1 install tutorial
configuration Xcode
like How to develop OpenCV with Xcodepro_name Build Setting > Search Paths
/usr/local/lib/usr/local/include
pro_name Build Setting >Other Linker Flags
-lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn -lopencv_dpm -lopencv_fuzzy -lopencv_line_descriptor -lopencv_optflow -lopencv_plot -lopencv_reg -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_rgbd -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_face -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_xobjdetect -lopencv_objdetect -lopencv_ml -lopencv_xphoto -lippicv -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_photo -lopencv_imgproc -lopencv_coresample of sift
sample in (souce_dir)/samples/cpp/tutorial_code/xfeatures2D/LATCH_match.cpp or bellow#include "opencv2/xfeatures2d.hpp" // // now, you can no more create an instance on the 'stack', like in the tutorial // (yea, noticed for a fix/pr). // you will have to use cv::Ptr all the way down: // cv::Ptr<Feature2D> f2d = xfeatures2d::SIFT::create(); //cv::Ptr<Feature2D> f2d = xfeatures2d::SURF::create(); //cv::Ptr<Feature2D> f2d = ORB::create(); // you get the picture, i hope.. //-- Step 1: Detect the keypoints: std::vector<KeyPoint> keypoints_1, keypoints_2; f2d->detect( img_1, keypoints_1 ); f2d->detect( img_2, keypoints_2 ); //-- Step 2: Calculate descriptors (feature vectors) Mat descriptors_1, descriptors_2; f2d->compute( img_1, keypoints_1, descriptors_1 ); f2d->compute( img_2, keypoints_2, descriptors_2 ); //-- Step 3: Matching descriptor vectors using BFMatcher : BFMatcher matcher; std::vector< DMatch > matches; matcher.match( descriptors_1, descriptors_2, matches );
References
https://github.com/Itseez/opencv_contribhttps://github.com/Itseez/opencv
http://blog.csdn.net/lijiang1991/article/details/50756065
http://docs.opencv.org/3.1.0/d5/d3c/classcv_1_1xfeatures2d_1_1SIFT.html#gsc.tab=0
相关文章推荐
- 安装caffe过程记录
- Node系列-koa2开发实践
- BZOJ 1016 JSOI 2008 巨额奖金 最小生成树计数
- 继续说一下2016里面的json功能(1)
- JS的事件处理
- 程序已经执行完毕,返回JSP页面报错 Servlet.service() for servlet jsp threw exception
- 9. Delete Node in a Linked List
- 使用CSS3旋转DIV
- [RxJS] Returning subscriptions from the subscribe function
- css浮动模型初理解
- HTML5 之 图片墙
- CSS中margin和padding的区别
- jquery 常用异步请求(ajax,post,get)和json对象的遍历
- Json解析库的使用
- 利用HTML5分片上传超大文件
- Daily JS 04-17
- jsp标签库学习
- gulp css html image js 合并压缩
- 前端构建工具gulpjs的使用介绍及技巧(转载)
- Scrapy学习系列(一):网页元素查询CSS Selector和XPath Selector