-
大小: 14.25MB文件類型: .zip金幣: 1下載: 0 次發(fā)布日期: 2023-07-26
- 語(yǔ)言: Matlab
- 標(biāo)簽:
資源簡(jiǎn)介
matlab開(kāi)發(fā)-移動(dòng)對(duì)象跟蹤基到背景減法。檢測(cè)物體運(yùn)動(dòng)的圖像處理應(yīng)用程序。
代碼片段和文件信息
function?[indicador]=compare(input_imagebackgroundthreshold)
indicador?=?0;
%?
diference?=?(abs(input_image(::1)-background(::1))?>?threshold)?|?(abs(input_image(::2)?-?background(::2))?>?threshold)?...
????????????????????|?(abs(input_image(::3)?-?background(::3))?>?threshold);?????????????
%?Remove?noise?(eliminating?little?holes?and?refill?openings)
%?a?=?bwlabel(diference8);
%?Performs?morphological?closing?(dilation?followed?by?erosion).
b?=?bwmorph(diference‘close‘);
%?Performs?morphological?opening?(erosion?followed?by?dilation).
diference?=?bwmorph(b‘open‘);????????
diference?=?bwmorph(diference‘erode‘2);?
%?Seelct?the?biggest?object
etiqueta?=?bwlabel(diference8);
%?Measure?properties?of?image?regions?such?as:?‘Area‘?‘Centroid‘?and?‘Box‘
objeto?=?regionprops(etiqueta);
N?=?size(objeto1);?%?Number?of?objects?in?in?the?image.
if?N?1||isempty(objeto)?%?Return?whether?no?object?in?the?image
????return
end
%?Remove?holes?less?than?200?pixels
s=find([objeto.Area]<200);
if?~isempty(s)
????objeto(s)=[?];
end
N=size(objeto1);%?Count?objects
if?N?1?||?isempty(objeto)
????return
end
%?Draw?a?rectangle?and?center?point?for?every?object?in?the?image
for?n=1:N
????hold?on
????centroid?=?objeto(n).Centroid;
????C_X?=?centroid(1);
????C_Y?=?centroid(2);
????rectangle(‘Position‘objeto(n).BoundingBox‘EdgeColor‘‘g‘‘LineWidth‘2)????
????plot(C_XC_Y‘Color‘‘g‘‘Marker‘‘+‘‘LineWidth‘2)
????title([‘X=?‘num2str(round(C_X))‘?Y=?‘num2str(round(C_X))])
????hold?off
end
indicador?=?1;
return
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????1538??2015-02-03?01:00??ob
?????文件????????6737??2015-02-03?00:58??ob
?????文件????????7560??2015-02-03?00:58??ob
?????文件?????????284??2015-02-03?01:00??ob
?????文件????????1370??2009-05-19?22:16??ob
?????文件????????3187??2015-01-29?21:15??ob
?????文件????????2203??2015-01-29?21:15??ob
?????文件????26090230??2015-01-31?01:34??ob
?????文件?????????413??2015-01-31?05:45??ob
?????文件????????1315??2015-02-02?12:21??license.txt
評(píng)論
共有 條評(píng)論