Clear Filters
Clear Filters

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

1 view (last 30 days)
Keiichi Hirayama
Keiichi Hirayama on 18 Jul 2018
Commented: michio on 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 Comment
michio
michio on 18 Jul 2018
コード部分表示修正しました。コード部分を選択した上で以下添付画像中の {}Code ボタンをクリック頂ければコード表示となります。参考まで。

Sign in to comment.

Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!