cmakelists:
cmake_minimum_required(VERSION 3.7)
project(feature_extraction_robin)
set(CMAKE_CXX_STANDARD 11)
find_package(OpenCV REQUIRED)
include_directories(${OPenCV_DIRS})
set(SOURCE_FILES main.cpp)
add_executable(feature_extraction_robin ${SOURCE_FILES})
target_link_libraries(feature_extraction_robin ${OpenCV_LIBS})
程序:
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
int main(int argc, char** argv)
{
if(argc!=3)//判断命令行输入对错
{
cout<<"usage: feature_extraction img1 img2"<<endl;
return 1;
}
//读取要匹配的两张图像
Mat img_1 = imread(argv[1], CV_LOAD_IMAGE_COLOR);
Mat img_2 = imread(argv[2], CV_LOAD_IMA