how to convert video inputed code to webcam inputed in matlab for tracking object

2 ビュー (過去 30 日間)
Haris Elahi
Haris Elahi 2018 年 2 月 9 日
編集済み: Walter Roberson 2018 年 2 月 9 日
I have a code named "Object Tracking Using Adaptive Object Color Modeling" that works perfectly for object tracking using given video (mp4.avi etc). But now I want to convert this code to webcam any idea how?
%%initialize
obj = VideoReader('lar.avi'); % Select Video File
tfn = get(obj,'numberOfFrames'); % Total Frame Numbers
sf = 1; % Start Frame For Tracking
ef = 400; % End Frame For Tracking
Bin = 8;
img = read(obj,sf); % Get First Frame
output = zeros(ef-sf+1,2); % Centroid Locations
% figure(); imshow(img) % Show First Frame & Wait Till Select The Object
% or = round(getrect(figure(1))); % Coded Rect [xmin(col),ymin(row),width,height]
or = [390,154,50,69];
CD = round([or(2)+or(4)/2 or(1)+or(3)/2]); % Object Centroid
% close Figure 1

回答 (0 件)

カテゴリ

Help Center および File ExchangeTracking and Motion Estimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by