OpenCV图像匹配算法之sift

本文深入探讨了OpenCV库中的SIFT(尺度不变特征转换)算法,详细介绍了如何利用SIFT进行图像特征检测与匹配。内容涵盖SIFT的工作原理、优势以及在实际应用中的实现步骤,帮助读者理解并掌握这一强大的图像处理工具。
摘要由CSDN通过智能技术生成
//utils.h
#ifndef _UTILS_H
#define _UTILS_H

#include <opencv2/opencv.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2\nonfree\nonfree.hpp>
using namespace cv;

// ORB settings
const int ORB_MAX_KPTS = 1500;
const float ORB_SCALE_FACTOR = 1.5;
const int ORB_PYRAMID_LEVELS = 3;
const float ORB_EDGE_THRESHOLD = 31.0;
const int ORB_FIRST_PYRAMID_LEVEL = 0;
const int ORB_WTA_K = 2;
const int ORB_PATCH_SIZE = 31;

// BRISK settings
const float BRISK_HTHRES = 10.0;
const int BRISK_NOCTAVES = 6;


const float DRATIO = 0.8f;							// NNDR Matching value
const float MIN_H_ERROR = 2.50f;			// Maximum error in pixels to accept an inlier

void matches2points_nndr(const std::vector<cv::KeyPoint>& train,
                         const std::vector<cv::KeyPoint>& query,
                         const std::vector<std::vector<cv::DMatch> >& matches,
                         std::vector<cv::Point2f>& pmatches, float nndr);
void compute_inliers_ransac(const std::vector<cv::Point2f>& matches,
                            std::vector<cv::Point2f>& inliers,
                            float error, bool use_fund);
void draw_inliers(const cv::Mat& img1, const cv::Mat& img2, cv::Mat& img_com,
                  const std::vector<cv::Point2f>& ptpairs, int color);

typedef struct info
{
	double t;
	int n1;
	int n2;
	int m;
	int rm;
}INFO;

void sift(char* path1, char* path2, INFO& info, bool show);
void surf(char* path1, char* path2, INFO& info, bool show);
void orb(char* path1, char* path2, INFO& info, bool show);
void brisk(char* path1, char* path2, INFO& info, bool show);
void freak(char* path1, char* path2, INFO& info, bool show);
void showInfo(INFO info);

#endif
//utils.
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值