基于SURF特征检测程序 可以在VC6.0 下直接运行,对特征匹配的需求的同学有一定的帮助
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-11-20 19:00 surf
目录 0 2013-11-20 19:00 surfDebug
文件 1647104 2012-07-17 11:38 surfDebugcv200.dll
文件 3389952 2012-07-17 11:33 surfDebugcv200d.dll
文件 1010688 2012-07-17 11:40 surfDebugcvaux200.dll
文件 2317312 2012-07-17 11:34 surfDebugcvaux200d.dll
文件 2071040 2012-07-17 11:37 surfDebugcxcore200.dll
文件 3638272 2012-07-17 11:32 surfDebugcxcore200d.dll
文件 200192 2012-07-17 11:38 surfDebugcxts200.dll
文件 435200 2012-07-17 11:33 surfDebugcxts200d.dll
文件 774144 2012-07-17 11:39 surfDebughighgui200.dll
文件 1631232 2012-07-17 11:33 surfDebughighgui200d.dll
文件 432128 2012-07-17 11:38 surfDebugml200.dll
文件 945152 2012-07-17 11:33 surfDebugml200d.dll
文件 5205504 2012-07-17 11:39 surfDebugopencv_ffmpeg200.dll
文件 6607872 2012-07-17 11:33 surfDebugopencv_ffmpeg200d.dll
文件 99328 2012-07-19 15:39 surfDebugsurf.exe
文件 723672 2012-07-19 15:39 surfDebugsurf.ilk
文件 1264640 2012-07-19 15:39 surfDebugsurf.pdb
目录 0 2013-11-20 19:00 surfsurf
文件 15346688 2012-07-19 19:58 surfsurf.ncb
文件 878 2012-07-19 15:25 surfsurf.sln
文件 22528 2012-07-19 19:58 surfsurf.suo
目录 0 2013-11-20 19:00 surfsurfDebug
文件 6210 2012-07-19 15:39 surfsurfDebugBuildLog.htm
文件 351979 2012-07-19 15:39 surfsurfDebugfind_obj.obj
文件 67 2012-07-19 15:39 surfsurfDebugmt.dep
文件 663 2012-07-19 15:28 surfsurfDebugsurf.exe.embed.manifest
文件 728 2012-07-19 15:28 surfsurfDebugsurf.exe.embed.manifest.res
文件 621 2012-07-19 15:39 surfsurfDebugsurf.exe.intermediate.manifest
文件 601088 2012-07-19 15:39 surfsurfDebugvc90.idb
............此处省略4个文件信息
/*
* A Demo to OpenCV Implementation of SURF
* Further Information Refer to “SURF: Speed-Up Robust Feature“
* Author: Liu Liu
* liuliu.1987+opencv@gmail.com
*/
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#if _DEBUG
#pragma comment(lib “cv200d.lib“)
#pragma comment(lib “cxcore200d.lib“)
#pragma comment(lib “cvaux200d.lib“)
#pragma comment(lib “highgui200d.lib“)
#pragma comment(lib “ml200d.lib“)
#else
#pragma comment(lib “cv200.lib“)
#pragma comment(lib “cxcore200.lib“)
#pragma comment(lib “cvaux200.lib“)
#pragma comment(lib “highgui200.lib“)
#pragma comment(lib “ml200.lib“)
#endif
// define whether to use approximate nearest-neighbor search
#define USE_FLANN
IplImage *image = 0;
double
compareSURFDescriptors( const float* d1 const float* d2 double best int length )
{
double total_cost = 0;
assert( length % 4 == 0 );
for( int i = 0; i < length; i += 4 )
{
double t0 = d1[i] - d2[i];
double t1 = d1[i+1] - d2[i+1];
double t2 = d1[i+2] - d2[i+2];
double t3 = d1[i+3] - d2[i+3];
total_cost += t0*t0 + t1*t1 + t2*t2 + t3*t3;
if( total_cost > best )
break;
}
return total_cost;
}
int
naiveNearestNeighbor( const float* vec int laplacian
const CvSeq* model_keypoints
const CvSeq* model_descriptors )
{
int length = (int)(model_descriptors->elem_size/sizeof(float));
int i neighbor = -1;
double d dist1 = 1e6 dist2 = 1e6;
CvSeqReader reader kreader;
cvStartReadSeq( model_keypoints &kreader 0 );
cvStartReadSeq( model_descriptors &reader 0 );
for( i = 0; i < model_descriptors->total; i++ )
{
const CvSURFPoint* kp = (const CvSURFPoint*)kreader.ptr;
const float* mvec = (const float*)reader.ptr;
CV_NEXT_SEQ_ELEM( kreader.seq->elem_size kreader );
CV_NEXT_SEQ_ELEM( reader.seq->elem_size reader );
if( laplacian != kp->laplacian )
continue;
d = compareSURFDescriptors( vec mvec dist2 length );
if( d < dist1 )
{
dist2 = dist1;
dist1 = d;
neighbor = i;
}
else if ( d < dist2 )
dist2 = d;
}
if ( dist1 < 0.6*dist2 )
return neighbor;
return -1;
}
void
findPairs( const CvSeq* objectKeypoints const CvSeq* objectDescriptors
const CvSeq* imageKeypoints const CvSeq* imageDescriptors vector& ptpairs )
{
int i;
CvSeqReader reader kreader;
cvStartReadSeq( objectKeypoints &kreader );
cvStartReadSeq( objectDescriptors &reader );
ptpairs.clear();
for( i = 0; i < objectDescriptors->total; i++ )
{
const CvSURFPoint* kp = (const CvSURFPoint*)kreader.ptr;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-11-20 19:00 surf
目录 0 2013-11-20 19:00 surfDebug
文件 1647104 2012-07-17 11:38 surfDebugcv200.dll
文件 3389952 2012-07-17 11:33 surfDebugcv200d.dll
文件 1010688 2012-07-17 11:40 surfDebugcvaux200.dll
文件 2317312 2012-07-17 11:34 surfDebugcvaux200d.dll
文件 2071040 2012-07-17 11:37 surfDebugcxcore200.dll
文件 3638272 2012-07-17 11:32 surfDebugcxcore200d.dll
文件 200192 2012-07-17 11:38 surfDebugcxts200.dll
文件 435200 2012-07-17 11:33 surfDebugcxts200d.dll
文件 774144 2012-07-17 11:39 surfDebughighgui200.dll
文件 1631232 2012-07-17 11:33 surfDebughighgui200d.dll
文件 432128 2012-07-17 11:38 surfDebugml200.dll
文件 945152 2012-07-17 11:33 surfDebugml200d.dll
文件 5205504 2012-07-17 11:39 surfDebugopencv_ffmpeg200.dll
文件 6607872 2012-07-17 11:33 surfDebugopencv_ffmpeg200d.dll
文件 99328 2012-07-19 15:39 surfDebugsurf.exe
文件 723672 2012-07-19 15:39 surfDebugsurf.ilk
文件 1264640 2012-07-19 15:39 surfDebugsurf.pdb
目录 0 2013-11-20 19:00 surfsurf
文件 15346688 2012-07-19 19:58 surfsurf.ncb
文件 878 2012-07-19 15:25 surfsurf.sln
文件 22528 2012-07-19 19:58 surfsurf.suo
目录 0 2013-11-20 19:00 surfsurfDebug
文件 6210 2012-07-19 15:39 surfsurfDebugBuildLog.htm
文件 351979 2012-07-19 15:39 surfsurfDebugfind_obj.obj
文件 67 2012-07-19 15:39 surfsurfDebugmt.dep
文件 663 2012-07-19 15:28 surfsurfDebugsurf.exe.em
文件 728 2012-07-19 15:28 surfsurfDebugsurf.exe.em
文件 621 2012-07-19 15:39 surfsurfDebugsurf.exe.intermediate.manifest
文件 601088 2012-07-19 15:39 surfsurfDebugvc90.idb
............此处省略4个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)