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

2 vues (au cours des 30 derniers jours)
Haris Elahi
Haris Elahi le 9 Fév 2018
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

Réponses (0)

Catégories

En savoir plus sur Tracking and Motion Estimation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by