目标跟踪程序.docx

  1. 1、本文档共4页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
clear data disp('input video'); avi = aviread('viplanedeparture.avi'); video = {avi.cdata}; for a = 1:length(video) imagesc(video{a}); axis image off drawnow; end; disp('output video'); tracking(video); function d = tracking(video) if ischar(video) % Load the video from an avi file. avi = aviread(video); pixels = double(cat(4,avi(1:2:end).cdata))/255; clear avi else % Compile the pixel data into a single array pixels = double(cat(4,video{1:2:end}))/255; clear video end % Convert to RGB to GRAY SCALE image. nFrames = size(pixels,4); for f = 1:nFrames % F = getframe(gcf); % [x,map]=frame2im(F); % imwrite(x,'fln.jpg','jpg'); % end pixel(:,:,f) = (rgb2gray(pixels(:,:,:,f))); end rows=240; cols=320; nrames=f; for l = 2:nrames d(:,:,l)=(abs(pixel(:,:,l)-pixel(:,:,l-1))); k=d(:,:,l); % imagesc(k); % drawnow; % himage = imshow('d(:,:,l)'); % hfigure = figure; % impixelregionpanel(hfigure, himage); % datar=imageinfo(imagesc(d(:,:,l))); % disp(datar); bw(:,:,l) = im2bw(k, .2); bw1=bwlabel(bw(:,:,l)); imshow(bw(:,:,l)) hold on % % for h=1:rows % for w=1:cols % % if(d(:,:,l)< 0.1) % d(h,w,l)=0; % end % end % % end % % disp(d(:,:,l)); % % size(d(:,:,l)) cou=1; for h=1:rows for w=1:cols if(bw(h,w,l)>0.5) % disp(d(h,w,l)); toplen = h; if (cou == 1) tpln=toplen; end cou=cou+1; break end end end disp(toplen); coun=1; for w=1:cols for h=1:rows if(bw(h,w,l)>0.5) leftsi = w; if (coun == 1) lftln=leftsi; coun=coun+1; end break end end end disp(leftsi); disp(lftln); % % drawnow; % % d = abs(pixel(:, :, l), pixel(:, :, l-1)); % % disp(d); % s = regionprops(bw1, 'BoundingBox'); % %

文档评论(0)

asd522513656 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档