一种基于特征点匹配的图像检索方法的opencv实现

本文介绍了一种基于特征点匹配的图像检索方法,并提供了使用OpenCV实现的C++接口interface()。虽然原始实现结合了QT界面,但此处简化为单独的接口调用。文章展示了检索效果,并要求转载时注明原文链接:http://blog.youkuaiyun.com/xbcreal/article/details/70313907。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

由于最初这个方法是用qt界面的形式呈现了,没有平常见到的main函数执行图像检索的那样,我稍微做了下整理,提供出一个c++接口interface()可供调用。注释还比较少,后面有时间补上。

#ifndef IMAGERETRIVAL
#define IMAGERETRIVAL

//#include <cxcore.h>
#include <opencv2\features2d\features2d.hpp>
#include <opencv2\calib3d\calib3d.hpp>
#include <opencv2\contrib\contrib.hpp>
#include <opencv2/nonfree/nonfree.hpp>
#include <highgui.h>
#include <iostream>
#include <map>
#include <io.h>
using namespace std ;
using namespace cv;

#define HessianThreshold 400
#define MAX_Image_Num 1000
#define MIN_Image_Similar_Threshold 0.001

struct matDescToImgfile{
    int i_begin_index ;
    int i_end_index ;
    string s_imge_filename ;
};
const string trainFileType = "jpg"; //  "*" represent any file type.


//////////////////////////////////////////////////////////////////////////
//从目录中读取文件名列表
int readDirFile(const string dirName, const string fileType , vector<string> &allFilename)
{
    int fileNum = 0 ;
    _finddata_t onefile ;

    long lFile ;
    string dirName_FileType = dirName + "\\*."+fileType;

    lFile = _findfirst(dirName_FileType.c_str() , &onefile) ;
    if (lFile == -1l ) //on such file, return -1l (long type)
    {
        cout << "can`t find the file"<<endl;
        return fileNum ;
    }
    else
    {
        //cout <<"the files of the folder:"<<endl ;
        do
        {
            //cout<<onefile.name <<endl ;
            allFilename.push_back(onefile.name) ;
            fileNum ++ ;
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值