OpenCV 特征点检测
2024-09-08 14:36:13
#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp" using namespace cv; void readme(); /** @function main */
int main( int argc, char** argv )
{
if( argc != )
{ readme(); return -; } Mat img_1 = imread( argv[], CV_LOAD_IMAGE_GRAYSCALE );
Mat img_2 = imread( argv[], CV_LOAD_IMAGE_GRAYSCALE ); if( !img_1.data || !img_2.data )
{ std::cout<< " --(!) Error reading images " << std::endl; return -; } //-- Step 1: Detect the keypoints using SURF Detector
int minHessian = ; SurfFeatureDetector detector( minHessian ); std::vector<KeyPoint> keypoints_1, keypoints_2; detector.detect( img_1, keypoints_1 );
detector.detect( img_2, keypoints_2 ); //-- Draw keypoints
Mat img_keypoints_1; Mat img_keypoints_2; drawKeypoints( img_1, keypoints_1, img_keypoints_1, Scalar::all(-), DrawMatchesFlags::DEFAULT );
drawKeypoints( img_2, keypoints_2, img_keypoints_2, Scalar::all(-), DrawMatchesFlags::DEFAULT ); //-- Show detected (drawn) keypoints
imshow("Keypoints 1", img_keypoints_1 );
imshow("Keypoints 2", img_keypoints_2 ); waitKey(); return ;
} /** @function readme */
void readme()
{ std::cout << " Usage: ./SURF_detector <img1> <img2>" << std::endl; }
最新文章
- JavaScript的基本语法
- core dump 是什么意思?
- LDAP 中 CN, OU, DC 的含义
- android 获取设备拔插状态广播事件易漏掉的一行属性!
- 【转】 深入main函数中的参数argc,argv的使用详解
- Can jxta be used to develop online card game (p2p style)?
- Apple Pay强势来袭,开发者应做的事情
- N3292系列资料之RTC介绍
- ajax切换明星头像!
- Spring简单的文件配置
- 图解 Monad
- 在linux环境下tomcat 指定 jdk或jre版本
- centos6.5安装禅道
- python-进程之间通信、多线程介绍
- Spark基础
- spring-boot 多线程
- extjs分页
- 带你从零学ReactNative开发跨平台App开发[expo 打包发布](八)
- Executor , ExecutorService 和 Executors
- JAVA问题定位跟踪技术