资源简介
matlab开发-移动对象跟踪基到背景减法。检测物体运动的图像处理应用程序。
代码片段和文件信息
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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 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
- 上一篇:matlab开发-用PCA检测平面图像的眼镜
- 下一篇:移动机器人避障含CAD等仿真
评论
共有 条评论