• 大小: 413KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-16
  • 语言: 其他
  • 标签:

资源简介

用opencv+VS2012实现的SIFT特征提取与匹配算法,已编译通过,直接打开就能运行

资源截图

代码片段和文件信息

// KeyPoint.cpp: implementation of the CKeyPoint class.
//
//////////////////////////////////////////////////////////////////////

#include “stdafx.h“
#include “TestSIFT.h“
#include “KeyPoint.h“

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CKeyPoint:: CKeyPoint (IplImage* gaussImg double x double y double imgScale
double kpScale double orientation)
{
m_gaussImg = gaussImg;
m_x = x;
m_y = y;
m_imgScale = imgScale;
m_kpScale = kpScale;
m_orientation = orientation;
m_featureVec = NULL;
}

CKeyPoint::~CKeyPoint()
{
if (m_featureVec != NULL)
delete m_featureVec;
}

void CKeyPoint::CreateVector (int xDim int yDim int oDim)
{
m_xDim = xDim;
m_yDim = yDim;
m_oDim = oDim;
m_featureVec = new double[yDim * xDim * oDim];
memset (m_featureVec0sizeof(double)*yDim*xDim*oDim);
}


void CKeyPoint::FVSet(int xI int yI int oI double value)
{
// row major
m_featureVec[(yI * m_xDim * m_oDim) + (xI * m_oDim) + oI] = value;
}

double CKeyPoint::FVGet(int xI int yI int oI)
{
// row major
return m_featureVec[(yI * m_xDim * m_oDim) + (xI * m_oDim) + oI];
}

// Threshhold and normalize feature vector.
// Note that the feature vector as a whole is normalized (Lowe‘s paper is
// a bit unclear at that point).
void CKeyPoint::CapAndNormalizeFV (double fvGradHicap)
{
// Straight normalization
int len = m_xDim * m_yDim * m_oDim;
double norm = 0.0;
for (int i = 0 ; i < len ; i++)
norm += m_featureVec[i]*m_featureVec[i];

norm = sqrt (norm);
if (norm == 0.0)
return;

for (i = 0 ; i < len; i++)
m_featureVec[i] /= norm;

// Hicap after normalization
for (i = 0 ; i < len; i++) 
if (m_featureVec[i] > fvGradHicap) 
m_featureVec[i] = fvGradHicap;

// Renormalize again
norm = 0;
for (i = 0 ; i < len ; i++)
norm += m_featureVec[i]*m_featureVec[i];
norm = sqrt (norm);

for (i = 0 ; i < len; i++)
m_featureVec[i] /= norm;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-06-17 22:50  OPENCV_SIFT_特征提取_匹配算法\
     文件        2187  2006-04-24 05:57  OPENCV_SIFT_特征提取_匹配算法\KeyPoint.cpp
     文件        1171  2006-04-24 05:01  OPENCV_SIFT_特征提取_匹配算法\KeyPoint.h
     文件         598  2006-04-24 17:15  OPENCV_SIFT_特征提取_匹配算法\MatchInfo.cpp
     文件         565  2006-04-24 17:14  OPENCV_SIFT_特征提取_匹配算法\MatchInfo.h
     文件        1810  2006-04-24 17:28  OPENCV_SIFT_特征提取_匹配算法\MinHeap.cpp
     文件         750  2006-04-24 16:58  OPENCV_SIFT_特征提取_匹配算法\MinHeap.h
     文件        3615  2006-04-04 16:20  OPENCV_SIFT_特征提取_匹配算法\ReadMe.txt
     文件        2276  2006-04-25 22:20  OPENCV_SIFT_特征提取_匹配算法\SIFT.cpp
     文件        1693  2006-04-25 22:08  OPENCV_SIFT_特征提取_匹配算法\SIFT.h
     文件       30737  2006-04-25 21:53  OPENCV_SIFT_特征提取_匹配算法\ScaleSpace.cpp
     文件        2354  2006-04-25 21:53  OPENCV_SIFT_特征提取_匹配算法\ScaleSpace.h
     文件         210  2006-04-04 16:20  OPENCV_SIFT_特征提取_匹配算法\StdAfx.cpp
     文件         999  2006-04-04 16:20  OPENCV_SIFT_特征提取_匹配算法\StdAfx.h
     文件       20992  2007-12-18 16:21  OPENCV_SIFT_特征提取_匹配算法\TestSIFT.aps
     文件        1820  2007-12-18 16:38  OPENCV_SIFT_特征提取_匹配算法\TestSIFT.clw
     文件        2058  2006-04-04 16:20  OPENCV_SIFT_特征提取_匹配算法\TestSIFT.cpp
     文件        4900  2006-04-24 17:56  OPENCV_SIFT_特征提取_匹配算法\TestSIFT.dsp
     文件        1439  2006-04-22 03:50  OPENCV_SIFT_特征提取_匹配算法\TestSIFT.dsw
     文件        1346  2006-04-04 16:20  OPENCV_SIFT_特征提取_匹配算法\TestSIFT.h
     文件     1139712  2007-12-18 16:52  OPENCV_SIFT_特征提取_匹配算法\TestSIFT.ncb
     文件       79360  2007-12-18 16:52  OPENCV_SIFT_特征提取_匹配算法\TestSIFT.opt
     文件        1120  2007-12-18 16:22  OPENCV_SIFT_特征提取_匹配算法\TestSIFT.plg
     文件        5452  2006-04-24 23:51  OPENCV_SIFT_特征提取_匹配算法\TestSIFT.rc
     文件       10820  2006-04-29 05:20  OPENCV_SIFT_特征提取_匹配算法\TestSIFTDlg.cpp
     文件        1573  2006-04-25 00:00  OPENCV_SIFT_特征提取_匹配算法\TestSIFTDlg.h
     目录           0  2015-06-17 22:50  OPENCV_SIFT_特征提取_匹配算法\res\
     文件        1078  2006-04-04 16:20  OPENCV_SIFT_特征提取_匹配算法\res\TestSIFT.ico
     文件         400  2006-04-04 16:20  OPENCV_SIFT_特征提取_匹配算法\res\TestSIFT.rc2
     文件        3072  2007-12-18 13:04  OPENCV_SIFT_特征提取_匹配算法\res\Thumbs.db
     文件         824  2006-04-24 23:51  OPENCV_SIFT_特征提取_匹配算法\resource.h
............此处省略0个文件信息

评论

共有 条评论