第一范文网 - 专业文章范例文档资料分享平台

帧差法目标识别 - 图文

来源:用户分享 时间:2025/7/7 17:09:04 本文由杩芥ⅵ 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

fo(:,:,j)=imopen( D(:,:,j),se);%直接开运算 subplot(2,2,4);imshow( fo(:,:,j),[]); C=(C+D(:,:,j)); E=(E+ fo(:,:,j)); end C=C/10;

figure,subplot(2,2,1);imshow( C,[]); subplot(2,2,2);imshow(E,[]);

imwrite(uint8(C),'C:\\Users\\Administrator\\Desktop\\16.jpg')

a=imread('C:\\Users\\Administrator\\Desktop\\16.jpg'); figure,imshow(a) count=imhist(a); [m,n]=size(a); N=m*n; L=256;

count=count/N;%%每一个像素的分布概率

for i=1:L

if count(i)~=0 st=i-1; break; end end

for i=L:-1:1 if count(i)~=0 nd=i-1; break; end end

f=count(st+1:nd+1); %f是每个灰度出现的概率 size(f) E=[];

for Th=st:nd-1 %%%设定初始分割阈值为Th av1=0; av2=0;

Pth=sum(count(1:Th+1)); %%%第一类的平均相对熵为 for i=0:Th

av1=av1-count(i+1)/Pth*log(count(i+1)/Pth+0.00001); end

%%%第二类的平均相对熵为 for i=Th+1:L-1

av2=av2-count(i+1)/(1-Pth)*log(count(i+1)/(1-Pth)+0.00001); end

E(Th-st+1)=av1+av2;

% E(Th-st+1)=av1*(1-Pth)^15; end

position=find(E==(max(E))); th=st+position-1;

for i=1:m for j=1:n if a(i,j)>th a(i,j)=255; else

a(i,j)=0; end end end

figure,imshow(a);title('1')

se=strel('disk',1');%圆盘型结构元素 fo=imopen(a,se);%直接开运算

figure, imshow(fo);title('kai'); % B=[1 1 % 1 1]; B=[1 1 1 1 1 1 1 1 1];

A2=imdilate(fo,B);

figure, imshow(A2);title('fushi');

imwrite(A2,'C:\\Users\\Administrator\\Desktop\\10.jpg') Ibw=imread('10.jpg'); % I=rgb2gray(I); % Ibw=im2bw(I); [l,m]=bwlabel(Ibw,8);

status=regionprops(l,'BoundingBox'); imshow(Ibw);hold on; for i=1:m

rectangle('position',status(i).BoundingBox,'edgecolor','r'); end hold off;

frame = read(videoObj,start); figure,imshow(frame); for i=1:m

rectangle('position',status(i).BoundingBox,'edgecolor','r'); end

本算法的结果:

表格 1原始视频

表格 2显著图

表格 3最大熵算法处理后的二值图

表格 4二值图中的移动物体

表格 5原始图像中检测出的移动的物体

搜索更多关于: 帧差法目标识别 - 图文 的文档
帧差法目标识别 - 图文.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c52s388ygna670es7bbev_2.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top