91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

基于相關系數的影像匹配,最終結果顯示將兩張圖片合并顯示,用線將匹配點連接在一起。并輸出匹配點的行列號。

資源截圖

代碼片段和文件信息

#include?“stdafx.h“
#include?“Match.h“
#include?“math.h“??
#include?“Moravec.h“??


CMatch::CMatch()
{
windowsize?=?11;??//設置匹配窗口的大小
Threshold?=?0.8;??//設置閾值
pPoint2i?=?NULL;?
num?=?0;
}


CMatch::~CMatch()
{
}


void?CMatch::showresult(const?Mat?LeftImgColor?const?Mat?RightImgColor?Mat?&ResultImg)
{
int?rResult=?LeftImgColor.rows?>?RightImgColor.rows???LeftImgColor.rows?:?RightImgColor.rows;

ResultImg.create(rResult?LeftImgColor.cols?+?RightImgColor.cols?LeftImgColor.type());
for?(int?i?=?0;?i {
for?(int?j?=?0;?j {
ResultImg.at(i?j)?=?LeftImgColor.at(i?j);
}
}
for?(int?i?=?0;?i {
for?(int?j?=?0;?j {
ResultImg.at(i?j?+?LeftImgColor.cols)?=?RightImgColor.at(i?j);
}
}
}
double?CMatch::NCCValue(int?lr?int?lc?int?rr?int?rc)
{
double?gLeftAverage?=?0;//左影像窗口灰度平均值??
double?gRightAverage?=?0;//右影像窗口灰度平均值??
int?halfsize?=?windowsize?/?2;
for?(int?i?=?-halfsize;?i {
for?(int?j?=?-halfsize;?j {
gLeftAverage?+=?LeftImgEpi.at(lr?+?i?lc?+?j);
gRightAverage?+=?RightImgEpi.at(rr?+?i?rc?+?j);
}
}
gLeftAverage?/=?windowsize*windowsize;
gRightAverage?/=?windowsize*windowsize;
double?a?=?0;
double?b?=?0;
double?c?=?0;
for?(int?i?=?-halfsize;?i {
for?(int?j?=?-halfsize;?j {
double?left_av?=?LeftImgEpi.at(lr?+?i?lc?+?j)?-?gLeftAverage;
double?right_av?=?RightImgEpi.at(rr?+?i?rc?+?j)?-?gRightAverage;
a?+=?left_av*right_av;
b?+=?left_av*left_av;
c?+=?right_av*right_av;
}
}
return?a?/?sqrt(b*c);//返回相關系數的大小??
}
void?CMatch::FeatureMatchMain(Mat?LeftImg?Mat?RightImg?Mat?LeftImgColor?Mat?RightImgColor)
{
LeftImgEpi?=?LeftImg;
RightImgEpi?=?RightImg;
Point?offset?=?Point(0170);
int?delta?=?15;
Mat?Result;
showresult(LeftImgColor?RightImgColor?Result);//將兩張彩色影像和合并1個??
//imshow(“拼接結果“?Result);
//cvWaitKey();
Mat?Interest;//興趣矩陣??
CMoravec?CM;
int?FeatureNum;//特征點個數??
CM.Moravec(LeftImgEpi?LeftImgColor);//Moravec特征提取??
Mat?mFeaturePoint?=?CM.resMorMat.clone();
FeatureNum?=?CM.FeatureNum;
Interest?=?CM.Interest.clone();
pPoint2i?=?new?struct?MatchPoint2i[FeatureNum];//給同名點結構體數組分配內存空間??
int?halfsize?=?windowsize?/?2;
int?Lr?=?LeftImgEpi.rows;
int?Lc?=?LeftImgEpi.cols;
int?Rr?=?RightImgEpi.rows;
int?Rc?=?RightImgEpi.cols;
//搜索匹配點??
for?(int?i?=?halfsize;?i {
for?(int?j?=?20;?j {
if?(Interest.at(i?j)?==?0)
//特征點作為模板中心??
{
double?maxscore?=?0;
for?(int?r?=?i?+?offset.x?-?delta;?r? for?(int?c?=?j?+?offset.y?-?delta;?c {
double?score?=?NCCValue(i?j?r?c

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????5165982??2017-12-30?00:06??基于相關系數的數字影像匹配\result.bmp

?????文件???????4251??2017-12-30?01:02??基于相關系數的數字影像匹配\相關系數實現類\Match.cpp

?????文件????????821??2017-12-29?23:39??基于相關系數的數字影像匹配\相關系數實現類\Match.h

?????目錄??????????0??2018-12-02?15:00??基于相關系數的數字影像匹配\相關系數實現類

?????目錄??????????0??2018-12-02?15:02??基于相關系數的數字影像匹配

-----------?---------??----------?-----??----

??????????????5171054????????????????????5


評論

共有 條評論