91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

檢測視頻中運動的兩個點,并繪制出軌跡,輸出坐標,計算速度和角速度。此資源中的代碼可能只能處理特定的視頻,不過算法適用很廣泛。(此資源以附帶上所屬視頻,使用者可根據視頻差異更改代碼,將視頻與代碼放在一個文件夾下,用matlab即可運行。)

資源截圖

代碼片段和文件信息

clear?all;
workingDir?=?tempname;
mkdir(workingDir);
mkdir(workingDir‘images‘);????????????????????????????????????????????????%建立空間

mov=VideoReader(‘Video_L15a.avi‘);?????????????????????????????????????????%讀入?
fx1?=?0;
fy1?=?0;
sx1?=?0;
sy1?=?0;
quan?=?0;
hejiao?=?0;
jiao1?=?0;
vc?=?0;
w?=?0;
for?ii?=?1:?20?:mov.NumberOfframes

imgRgb?=?read(movii);
subplot(321);
imshow(imgRgb);
drawnow;


bw=im2bw(imgRgb0.5);??????????????????????????????????????????????????????%二值化處理
L?=?bwlabel(bw4);?????????????????????????????????????????????????????????%對黑點部分標記


a?=?0;
b?=?0;
n?=?0;

for?i?=?1?:??480;
????for?j?=?1?:??640;
????????if(L(ij)?==?1)
?????????????????a?=?i?+?a;
?????????????????b?=?j?+?b;
?????????????????n?=?n?+?1;
??????????????????
??????????????????
????????end
????end
end
fx?=?round(a/n);
fy?=?round(b/n);
fprintf(‘第一個點(%d%d)\t‘??fxfy?);


c?=?0;
d?=?0;
n?=?0;
for?i?=?1?:??480;
????for?j?=?1?:??640;
????????if(L(ij)?==?2)
?????????????????c?=?i?+?c;
?????????????????d?=?j?+?d;
?????????????????n?=?n?+?1;
??????????????????
??????????????????
????????end
????end
end
sx?=?round(c/n);
sy?=?round(d/n);
fprintf(‘第二個點(%d%d)\t‘??sxsy?);
subplot(323)
grid?on;
title(‘兩點軌跡‘);
set(gcf?‘doublebuffer‘?‘on‘);
axis([0?480?0?640]);
plot(fxfy‘.‘);
plot(sxsy‘*‘);
drawnow;
hold?on;

jiao?=?angle(?fxfysxsy?)?;

???


%while(ii>1)????????????????????????????????????????????????????????????????%區分兩個點
%if(((sy-fy1)^2+(sx-fx1)^2)<((fx-fx1)^2+(fy-fy1)^2))
%?????????as?=?sx;
?%????????sx?=?fx;
?%????????fx?=?as;
?%????????as?=?sy1;
?%????????sy?=?fy1;
?%????????fy?=?as;
%end
%break;
%end

if(fx<700&&fy<700&&sx<700&&sy<700)?????????????????????????????????????????%改進屏幕只有一個點的情景
cx?=?(fx+sx)/2;
cy?=?(fy+sy)/2;
else?
????cx?=?fx;
????cy?=?fy;
????
end


fprintf(‘中心點坐標:(%f%f)\n‘??cxcy?);


subplot(324)
grid?on;
title(‘中心點‘)
set(gcf?‘doublebuffer‘?‘on‘)
axis([0?480?0?640]);
plot(cxcy‘.‘);
drawnow;
hold?on;


hejiao?=?hejiao?+?(jiao-jiao1);?

if(hejiao>360)
????quan?=?1;
elseif(hejiao>720)
????quan?=?2;
end



fprintf(‘角度為:%f\n‘hejiao);
if(ii>1)
vc?=?sqrt((cx?-?cx1)^2+(cy?-?cy1)^2);??????????????????????????????????????%每20幀走多少像素
w??=?hejiao?-?hejiao1;?????????????????????????????????????????????????????%每20幀轉過的角度
fprintf(‘速度為:%f\n‘?vc);
fprintf(‘角速度為:%f\n‘?w);

end

subplot(325)
grid?on;
title(‘速度‘)
set(gcf?‘doublebuffer‘?‘on‘)
plot(iivc‘.‘);
drawnow;
hold?on;

if(w<40&&w>-40&&w~=0)
subplot(326)
grid?on;
title(‘角速度‘)
set(gcf?‘doublebuffer‘?‘on‘)
plot(iiw‘.‘);
drawnow;
hold?on;
end

fx1?=?fx;??????????????????????????????????????????????????????????????????%記錄上一個點
fy1?=?fy;
sx1?=?sx;
sy1?=?sy;
jiao1?=?jiao;
cx1?=?round((fx1+sx1)/2);
cy1?=?round((fy1+sy1)/2);
hejiao1?=?hejiao;



end


?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????3587008??2013-10-27?10:46??檢索視頻中運動的點并計算線速度角速度——圖像處理matlab實現\Video_L15a.avi
?????文件????????3007??2013-12-26?09:26??檢索視頻中運動的點并計算線速度角速度——圖像處理matlab實現\gaijin.m
?????目錄???????????0??2014-01-05?09:26??檢索視頻中運動的點并計算線速度角速度——圖像處理matlab實現\

評論

共有 條評論