资源简介
本资源是通过模板匹配,实现图像的匹配功能。

代码片段和文件信息
%模板匹配
function [maxHeightmaxWidthMaxR] = templateMatcher(im_matchedim_template)
if isrgb(im_matched)
im_matched = rgb2gray(im_matched);
end
if isrgb(im_template)
im_template = rgb2gray(im_template);
end
dim_matched =double(im_matched);
dim_template = double(im_template);
%方差
sigmaST = 0.0;
sigmaS = 0.0;
sigmaT = 0.0;
%相似性测度
%double R
%最大相似性测度
MaxR = 0.0;
%最大相似性出现位置
maxWidth=0;
maxHeight=0;
%计算sigmaT
[tempheighttempwidth] = size(im_template);
for n =1:tempheight
for m =1:tempwidth
sigmaT = sigmaT + dim_template(nm)^2;
end
end
sigmaT = sqrt(sigmaT);
%找到图像中最大相似性的出现位置
[heightwidth] = size(im_matched);
% width = size(im_matched2);
for j =1:height-tempheight
for i =1:width-tempwidth
sigmaST = 0;
sigmaS = 0;
for n = 1:tempheight
for m = 1:tempwidth
sigmaS = sigmaS + dim_matched(j+ni+m)^2;
sigmaST = sigmaST + dim_template(nm)*dim_matched(j+ni+m);
end
end
%计算相似性
sigmaS = sqrt(sigmaS);
R = sigmaST /(sigmaS*sigmaT);
%与最大相似性比较
if(R >MaxR)
MaxR = R;
maxWidth = i+1;
maxHeight =j+1;
end
end
end
recWidth = [maxWidth maxWidth+tempwidth-1 maxWidth+tempwidth-1 maxWidth maxWidth];
recHeight = [maxHeight maxHeight maxHeight+tempheight-1 maxHeight+tempheight-1 maxHeight];
figureimshow(im_matched);hold on plot(recWidthrecHeight‘r-‘);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1574 2007-07-07 11:03 templateMatcher.m
----------- --------- ---------- ----- ----
1792 2
相关资源
- BRISK图像配准算法
- 遥感图像配准matlab
- 基于SURF特征点的图像拼接算法
- 图像配准技术及其MATLAB编程实现源码
- 2D/3D图像配准算法实验代码
- 图像配准程序matlab
- 基于薄板样条的图像配准MATLAB代码
- 东南大学计算机视觉实验报告二图像
- matlab surf图像配准 图像检索
- 图像配准技术及其MATLAB编程实现_陈显
- 图像配准技术及其MATLAB编程实现_.pd
- 图像配准技术及MATLAB编程实现_陈显毅
- insar图像配准及滤波
- 图像配准技术及其MATLAB编程实现(书
- MATLAB图像配准
- 基于SIFT的超分辨率图像配准及MATLAB实
- 基于灰度投影的图像配准MATLAB
- 基于互信息的图像配准程序
- 图像配准matlab
- 基于边缘的图像配准程序
- 傅里叶梅林FourierMellin实现图像配准
- 基于SIFT特征的图像配准Matlab源代码
- 相位相关图像配准Matlab
- 基于harris角点特征的图像配准程序M
- MATLAB版代码红外与可见光图像配准算
- MATLAB实现Harris角点检测与图像配准
- SSDA图像匹配算法
- FFT的图像配准
- 光流场配准matlab实现
- 基于SIFT特征的图像配准之仿真图像
评论
共有 条评论