資源簡介
這個程序代碼是關于單模板,在多個目標上進行模板匹配識別,基于MATLAB語言架構進行的程序編寫。

代碼片段和文件信息
src_souce=imread(‘55.png‘);
if?ndims(src_souce)==3
????src_souce=rgb2gray(src_souce);
end
templat_souce=imcrop(src_souce);
imwrite(templat_souce‘C:\Users\Administrator.USER-20111104FA\Desktop\多目標模板匹配\templat_souce.bmp‘);
templat_souce=imread(‘templat_souce.bmp‘);
figure;
title(‘模板圖像‘);
imshow(templat_souce)
tic;
[ab]=size(src_souce);
[cd]=size(templat_souce);
imshow(src_souce);
hold?on;
src_template=zeros(cd);
for?i=1:a-c
????for?j=1:b-d
????????src_template=src_souce(i:i+c-1j:j+d-1);???
????????r=corr2(src_templatetemplat_souce);
????????if?r>0.932
??????????????rectangle(‘Position‘[jisize(templat_souce2)size(templat_souce1)]‘EdgeColor‘‘r‘);
?????????????toc
????????end
???end
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????131676??2018-11-09?15:21??多目標模板匹配1\55.png
?????文件?????????744??2018-11-09?17:07??多目標模板匹配1\corr.m
?????文件????????1518??2018-11-09?17:06??多目標模板匹配1\templat_souce.bmp
- 上一篇:單神經元自適應PID代碼
- 下一篇:數字信號處理課程設計
評論
共有 條評論