• 大小: 4.76MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-30
  • 语言: C/C++
  • 标签: harris  

资源简介

Harris 角点检测 特征匹配 C++基于Harris的特征检测与匹配

资源截图

代码片段和文件信息

#include “stdafx.h“
#include 
#include “correspEstimation.h“
#include  
#include  
using namespace std;
#define cvCopyImage( src dst )         cvCopy( src dst 0 )

#define WINDOW_OPTION  CV_BLUR
#define PARAM1 3
#define PARAM2 3
#define RANGE_NEIGHBOR  6

//一维数组转化为cvMat
void Array2CvMat(float*arrCvMat*cvArrint rowint column)
{
int ij;
for(i=0;i {
for(j=0;j {
cvmSet(cvArrijarr[i*column+j]);
}
}
}

void CvImageCopyUchar2Float(IplImage *srcIplImage *dst)
{
int ijk;
int height=src->height;
int width=src->width;
int channels=src->nChannels;
int step=src->widthStep;
float *dstData=(float*)dst->imageData;
uchar *srcData=(uchar*)src->imageData;
//copy uchar precision image to float precision image
for(i=0;i {
for(j=0;j {
for(k=0;k {
dstData[i*step+j*channels+k]
=(float)srcData[i*step+j*channels+k];

}
}
}
}


void GetffImage(IplImage *inImage
IplImage *outImage
CvMat *kernel1st 
CvMat *kernel2nd
CvPoint anchor
int windowOption
int param1
int param2)
{
IplImage *tempImage = 0;
IplImage *f1Image   = 0;
IplImage *f2Image   = 0;

float *f1Data  = 0;
float *f2Data  = 0;
float *outData ;

int width    = inImage->width;
int height   = inImage->height;
int channels = inImage->nChannels;
int step     = inImage->widthStep;

f1Image   = cvCreateImage(cvSize(width height) IPL_DEPTH_32F channels);
f2Image   = cvCreateImage(cvSize(width height) IPL_DEPTH_32F channels);
tempImage = cvCreateImage(cvSize(width height) IPL_DEPTH_32F channels);

f1Data  = (float*)f1Image->imageData;
f2Data  = (float*)f2Image->imageData;
outData = (float*)outImage->imageData;

//把Uchar的图象数据转化为float
CvImageCopyUchar2Float(inImage tempImage);

//用kernel1st和kernel2nd对图象分别在x和y方向进行卷积运算
cvFilter2D(tempImage f1Image kernel1st anchor);
cvFilter2D(tempImage f2Image kernel2nd anchor);

//计算out=f1*f2;

for(int i = 0;  i < height; i++)
{
for(int j = 0; j < width; j++)
{
for(int k = 0 ; k < channels; k++)
{
outData[i*step+j*channels+k]=f1Data[i*step+j*channels+k]
*f2Data[i*step+j*channels+k];
}
}
}

//对输出图象进行平滑处理
cvCopyImage(outImage tempImage);
cvSmooth(tempImage outImage windowOptionparam1param2);

cvReleaseImage(&tempImage);
cvReleaseImage(&f1Image);
cvReleaseImage(&f2Image);

}

//查找邻域内最大值点
void FindLocalMaxPoint(IplImage *inImageIplImage *mapint range)
{
int width    = inImage->width;;
int height   = inImage->height;
int channels = inImage->nChannels;
int step     = map->widthStep;
float current;

int r = range/2;
float *inData=(float*) inImage->imageData;
uchar *mapData= (uchar*)map->imageData;
int sum;
int numOfNeighbor= (2*r+1)*(2*r+1);
int posI;
int posJ;

for(int i = 0; i < height; i

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-09-11 13:50  TestHarrisOperator\
     文件       14073  2018-09-11 13:50  TestHarrisOperator\CornerDetecte.cpp
     文件        7998  2018-09-11 11:28  TestHarrisOperator\correspEstimation.cpp
     文件        1312  2018-09-11 11:09  TestHarrisOperator\correspEstimation.h
     文件      562556  2007-11-09 07:54  TestHarrisOperator\data1.bmp
     文件      562556  2007-11-09 07:54  TestHarrisOperator\data2.bmp
     文件        1587  2018-09-10 13:02  TestHarrisOperator\ReadMe.txt
     文件          86  2018-09-11 11:52  TestHarrisOperator\setting.conf
     文件         222  2018-09-10 13:02  TestHarrisOperator\stdafx.cpp
     文件         234  2018-09-10 13:02  TestHarrisOperator\stdafx.h
     文件         240  2018-09-10 13:02  TestHarrisOperator\targetver.h
     文件        3529  2018-09-11 11:43  TestHarrisOperator\TestHarrisOperator.cpp
     文件       12046  2018-09-11 11:36  TestHarrisOperator\TestHarrisOperator.rar
     文件        9013  2018-09-11 11:27  TestHarrisOperator\TestHarrisOperator.vcxproj
     文件        1622  2018-09-11 11:27  TestHarrisOperator\TestHarrisOperator.vcxproj.filters
     目录           0  2018-09-10 15:40  TestHarrisOperator\x64\
     目录           0  2018-09-11 09:34  TestHarrisOperator\x64\Debug\
     文件         167  2018-09-10 15:37  TestHarrisOperator\x64\Debug\setting.conf
     文件       12446  2018-09-10 13:08  TestHarrisOperator\x64\Debug\stdafx.obj
     目录           0  2018-09-11 09:34  TestHarrisOperator\x64\Debug\TestHarr.B4F8BF2D.tlog\
     文件        1902  2018-09-11 09:34  TestHarrisOperator\x64\Debug\TestHarr.B4F8BF2D.tlog\CL.command.1.tlog
     文件       68242  2018-09-11 09:34  TestHarrisOperator\x64\Debug\TestHarr.B4F8BF2D.tlog\CL.read.1.tlog
     文件        2056  2018-09-11 09:34  TestHarrisOperator\x64\Debug\TestHarr.B4F8BF2D.tlog\CL.write.1.tlog
     文件        1908  2018-09-11 09:34  TestHarrisOperator\x64\Debug\TestHarr.B4F8BF2D.tlog\link.command.1.tlog
     文件        4488  2018-09-11 09:34  TestHarrisOperator\x64\Debug\TestHarr.B4F8BF2D.tlog\link.read.1.tlog
     文件        1134  2018-09-11 09:34  TestHarrisOperator\x64\Debug\TestHarr.B4F8BF2D.tlog\link.write.1.tlog
     文件         235  2018-09-11 09:34  TestHarrisOperator\x64\Debug\TestHarr.B4F8BF2D.tlog\TestHarrisOperator.lastbuildstate
     文件     3407872  2018-09-10 13:08  TestHarrisOperator\x64\Debug\TestHarrisOperator-x64D.pch
     文件        1343  2018-09-11 09:34  TestHarrisOperator\x64\Debug\TestHarrisOperator.log
     文件     1082883  2018-09-11 09:34  TestHarrisOperator\x64\Debug\TestHarrisOperator.obj
     文件     1641472  2018-09-11 09:34  TestHarrisOperator\x64\Debug\vc140.idb
............此处省略19个文件信息

评论

共有 条评论