资源简介
用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基于SAD的区域立体匹配方法
- 10项目进度表(Project模板)
- RANSAC去除误匹配算法
- project软件项目开发计划模板
- 项目进度管理project模板
- 高斯卷积模板(高斯函数)Matlab代码
- NCC匹配算法
- matlab实现的基于颜色直方图的特征匹
-
OQPSK的Matlab_Simuli
nk调制解调仿真系统 - matlab模板实现对图像的平均滤波处理
- MATLAB基于肤色模型和模板匹配的人脸
- 最小二乘影像匹配程序matlab
- 多目标模板匹配
- matlab对两张彩色图进行直方图匹配并
- 多路径匹配追踪广度优先MMP_BFMATLAB代
- Mockplus原型(APP)模板参考2
- 压缩感知 贪婪追踪算法成功率的比较
- NCC图像匹配源码matlab
- matlab中ICP点云匹配算法
- Matlab图像处理模板匹配完整程序小飞
- 基于特征匹配和RANSAC的三维点云拼接
- 匹配追踪算法OMP matlab代码
- 模板匹配,使用matlab语言实现图像匹
- matlab轮廓匹配的物体识别系统
- 线性调频信号匹配滤波
- matlab 线性调频信号匹配滤波
- MATLAB实现的LSBMLSB Matching算法含界面和
- 基于MATLAB模板匹配的车牌识别
- MATLAB车牌识别汽车车牌数字模板
- surf图像匹配
评论
共有 条评论