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

조회 수: 2 (최근 30일)
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 CenterFile Exchange에서 Tracking and Motion Estimation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by