资源简介
用matlab实现图像的模板匹配,简单易用,有实例。

代码片段和文件信息
% Target Recongition
% This program detects a target in a given image and focuses on it
% Programmed By: Mina Ayman Makar
% On 2/2/2004
% Part(1) : Entering the image for MATLAB
fprintf(‘\n This program detects a target in an image‘)
fprintf(‘\n Entering the image for MATLAB...‘)
fprintf(‘\n Save the image or its copy in MATLAB working Directory‘)
imagname = input(‘\n Enter the name of the image file (filename.ext) : ‘‘s‘);
w = imread(imagname);
w = im2double(w);
sizw = size(w);
figure
imshow(w)
title(‘Input Image‘)
pause(3.5);
close;
fprintf(‘\n Entering the target image for MATLAB...‘)
fprintf(‘\n Save the target image or its copy in MATLAB working Directory‘)
tarname = input(‘\n Enter the name of the target image file (filename.ext) : ‘‘s‘);
t = imread(tarname);
t = im2double(t);
sizt = size(t);
figure
imshow(t)
title(‘Target Image‘)
pause(3.5);
close;
ww = rgb2gray(w);
tt = rgb2gray(t);
tedge = edge(tt);
wedge = edge(ww);
out = filter2(tedgewedge);
o = max(max(out));
output = (1/o)*out;
pixel = find(output == 1);
pcolumn = fix(pixel / sizw(1));
prow = mod(pixelsizw(1));
rdis = fix(sizt(1)/2);
cdis = fix(sizt(2)/2);
cmin = pcolumn - cdis;
cmax = pcolumn + cdis;
rmin = prow - rdis;
rmax = prow + rdis;
c = [cmin cmin cmax cmax];
r = [rmin rmax rmax rmin];
m = roipoly(wwcr);
m = im2double(m);
m = 0.5 * (m + 1);
mask(::1) = m;
mask(::2) = m;
mask(::3) = m;
final = mask .* w;
figure
imshow(final)
title(‘Result Image‘)
pause(3.5);
close;
subplot(121)
imshow(w)
title(‘Input Image‘)
subplot(122)
imshow(final)
title(‘Result Image‘)
sav = input(‘\n Do you like to SAVE Result Image? (y/n) : ‘‘s‘);
if (sav == ‘y‘)
fprintf(‘\n You choose to SAVE the Result Image‘)
naming = input(‘\n Type the name of the new image file (filename.ext) : ‘‘s‘);
fprintf(‘\n Saving ...‘)
imwrite(finalnaming);
fprintf(‘\n The new file is called %s and it is saved in MATLAB working Directory‘naming)
else
fprintf(‘\n You choose NOT to SAVE the Result Image‘)
end
clear
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6629 2007-06-06 10:34 98240713Cross-Correlation-Target-Image-Detection\image1.jpg
文件 903 2007-06-18 14:50 98240713Cross-Correlation-Target-Image-Detection\image2.JPG
文件 1009 2008-05-22 13:40 98240713Cross-Correlation-Target-Image-Detection\K.JPG
文件 9516 2008-05-22 13:40 98240713Cross-Correlation-Target-Image-Detection\letters.JPG
文件 7334 2010-09-14 15:31 98240713Cross-Correlation-Target-Image-Detection\Result.jpg
文件 2091 2008-01-27 22:28 98240713Cross-Correlation-Target-Image-Detection\target.m
目录 0 2011-03-21 17:09 98240713Cross-Correlation-Target-Image-Detection
----------- --------- ---------- ----- ----
27482 7
- 上一篇:光伏MPPT模型
- 下一篇:图像分割的多种算法MATLAB代码
相关资源
- Matlab实现基于相关的模板匹配程序
- 基于harris算法的角点检测matlab原代码
- 图像匹配matlab源程序sift算法
- 基于MATLAB的图像特征点匹配和筛选
- matlab模板匹配车牌识别
- 直线匹配程序
- 基于matlab的坐标变换程序,通过坐标
- MPPT增量电导法的模板与s函数
- 使用matlab实现ICP点云匹配
- 基于蚁群算法和神经网络匹配算法的
- 基于matlab+模板匹配的车牌识别程序
- MATLAB多方法车牌识别系统bp+模板+GUI
- 基于matlab的模板匹配与车牌识别
- matlab实现sift算法匹配
- 基于角点检测的图像匹配
-
基于Simuli
nk的匹配滤波器设计 - SAD模板匹配算法matlab实现
- Census及Hamming距离三维立体重建Matlab程
- SIFT特征匹配 MATLAB 实现
- matlab 基于HOG特征值模板匹配的汉字识
- 最佳接收机的实现与仿真,matlab仿真
- 人脸识别及匹配的matlab实现
- 基于MATLAB车牌识别系统设计--程序--字
- Matlab图像匹配
- matlab指纹匹配
- 基于乘积量化的快速特征匹配
- 直线匹配程序MATLAB.zip
- 基于蚁群算法和神经网络匹配算法的
- 字符模板+工程.rar
- 基于模板匹配的人脸检测实现-MATLAB
评论
共有 条评论