matlab开发-移动对象跟踪基到背景减法


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  object_trackingcompare.m
     文件        6737  2015-02-03 00:58  object_trackingobject_tracking.fig
     文件        7560  2015-02-03 00:58  object_trackingobject_tracking.m
     文件         284  2015-02-03 01:00  object_trackingREADME.txt
     文件        1370  2009-05-19 22:16  object_trackingscript_object_tracking.m
     文件        3187  2015-01-29 21:15  object_trackingsel_camera.fig
     文件        2203  2015-01-29 21:15  object_trackingsel_camera.m
     文件    26090230  2015-01-31 01:34  object_trackingv2.avi
     文件         413  2015-01-31 05:45  object_trackingz_read_video.m
     文件        1315  2015-02-02 12:21  license.txt

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)