图像特征点—SIFT特征点
生活随笔
收集整理的這篇文章主要介紹了
图像特征点—SIFT特征点
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
圖像特征點—SIFT特征點
關于SIFT特征點,以下三篇博客說的非常詳細,再次不再贅述。
https://mp.weixin.qq.com/s/XVB88f119gRqpwTTRvTyrA
https://mp.weixin.qq.com/s/Vx-8xsXd6aXoJupr0BEMow
https://mp.weixin.qq.com/s/8WAgDmc1R_9rGRjM9eanDg
OpenCV 代碼測試
#include <iostream>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include <opencv2/opencv.hpp>
#include<opencv2/xfeatures2d.hpp>
#include<opencv2/core/core.hpp>using namespace cv;
using namespace std;
using namespace cv::xfeatures2d;int main()
{Mat image = imread("../pig.jpg");Ptr<Feature2D> sift = xfeatures2d::SIFT::create();vector<KeyPoint> kps;Mat descriptor;sift->detect(image,kps);sift->compute(image,kps,descriptor);Mat outImage;drawKeypoints(image,kps,outImage,Scalar::all(-1),0);imshow("SIFT",outImage);cout<<"特征點的數量:"<<kps.size()<<endl;cout<<"描述子的維度:"<<descriptor.size()<<endl;waitKey(0);}
測試效果
PS :Opencv中SIFT運行時直接報錯問題
在用SIFT函數時,opencv報出一下錯誤:
OpenCV(3.4.3) Error: The function/feature is not implemented (This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library) in cv::xfeatures2d::SIFT::create, file D:\library\opencv-3.4.3\opencv_contrib-3.4.3\modules\xfeatures2d\src\sift.cpp, line 1207
原因是在編譯opencv時沒有選擇 OPENCV_ENABLE_NONFREE。按照網上的說法,只要cmake時勾選這部分,然后重新編譯即可。但是本機在配置了其他環境之后Opencv編譯過程總是出錯。
無奈之下只能調用ROS中的Opencv,調用方式如下:
set(OpenCV_DIR /opt/ros/kinetic/share/OpenCV-3.3.1-dev)
find_package(OpenCV REQUIRED)
include_directories(${OPenCV_DIRS})
參考博客:
https://blog.csdn.net/fxmfxm9304/article/details/86093564
https://blog.csdn.net/zhoukehu_CSDN/article/details/83145026
總結
以上是生活随笔為你收集整理的图像特征点—SIFT特征点的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 求足字开头的成语接龙!
- 下一篇: 姓吴的起什么名字好听