Filter löschen
Filter löschen

webカメラを用いて​差分をとり動くものの​カウントをしたい

1 Ansicht (letzte 30 Tage)
Keiichi Hirayama
Keiichi Hirayama am 18 Jul. 2018
Kommentiert: michio am 18 Jul. 2018
現在できている分がこんな感じで 動いた部分を差分で白くなるようにはできているのですが、そこから動くものをどうカウントしたらいいかわかりません。
clear all; close all;
runloop = true;
numPts = 0;
frameCount = 0;
%Create the webcam object.
cam = webcam();
video_tmp = snapshot(cam);
im_tmp=im2bw(video_tmp);
figure;
while runloop
%Capture one frame to get its size.
videoFrame = snapshot(cam);
im_video=im2bw(videoFrame);
subplot(1,3,1)
imshow(videoFrame);
subplot(1,3,2)
imshow(im_video);
subplot(1,3,3)
%imshowpair(im_video,im_tmp,'diff')
h=im_video-im_tmp;
imshow(h)
video_tmp=videoFrame;
im_tmp=im_video;
drawnow;
end
  1 Kommentar
michio
michio am 18 Jul. 2018
コード部分表示修正しました。コード部分を選択した上で以下添付画像中の {}Code ボタンをクリック頂ければコード表示となります。参考まで。

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by