資源簡介
基于機器視覺常見的幀間差分的運動目標檢測程序
代碼片段和文件信息
mov=aviread(‘C:\Documents?and?Settings\Administrator\桌面\照片\cup.avi‘);
temp=size(mov);?
fnum=temp(2);
for?i=1:fnum
????strtemp=strcat(int2str(i)‘.‘‘JPG‘);
????imwrite(mov(i).cdata(:::)strtemp);
end??????????%??從視頻中提出每一幀圖像
o=1;
e=‘.jpg‘;
for?i=1:15
????u=o-1;v=o-2;
????m=int2str(o);
????n=int2str(u);h=int2str(v);
????s=strcat(me);%%把字符串b與m連接后在連接e得到圖像文件存儲的位置
????m=imread(s);%%從S處把圖像讀取出來
????m=rgb2gray(m);%%將圖像M灰度化
???
m=medfilt2(m[33]);
if(o>=3)
????????s=strcat(ne);
????????n=imread(s);
????????n=rgb2gray(n);
????????s=strcat(he);
????????h=imread(s);
????????h=rgb2gray(h);
????????
????????n=medfilt2(n[33]);
????????h=medfilt2(h[33]);
????????q=im2double(m);%%將圖像數組轉換為double型
????????w=im2double(n);?g=im2double(h);
????????c=q-w;j=w-g;
????????
????????th=10/255;
????????
????????k=find(abs(c)>=th);
????????c(k)=1;
????????k=find(abs(c) ????????c(k)=0;??
????????c=bwareaopen(c15);
??????????
????????se90=strel?(‘line‘390);se0=strel?(‘line‘30);
???????
- 上一篇:matlab正弦信號高斯處理
- 下一篇:把圖像分割成RGB通道的MATLAB代碼
評論
共有 條評論