Borrar filtros
Borrar filtros

When running the program, an error like "The function or variable'getLoc' cannot be recognized" is displayed.Everyone, please help to see if there is any problem, thank you very much!

4 visualizaciones (últimos 30 días)
CODE:
close all
clear
clc
%%set up video reader and player
videoFReader=vision.VideoFileReader('Dune.MP4',...
'VideoOutputDataType','double');
vidPlayer=vision.DeployableVideoPlayer;
%%create tracker object
tracker=vision.HistogramBasedTracker;
%%Initialize tracker
img=step(videoFReader);
figure
imshow(img)
h=drawrectangle;%imrect
wait(h);
[~,centLoc]=getLoc(h);%boxLoc=getLoc(h)
MotonModel='ConstantVelocity';
InitialLocation=centLoc;
InitialEstimateError=[10,10];
MotionNoise=[20 20];
MeasurementNoise=2000;
kf=configureKalmanFilter(...
MotionModel,...
InitialLocation,...
InitialEstimateError,...
MotionNoise,...
MeasurementNoise);
%%%loop algorithm
while (~isDone(videoFReader))
videoFrame=step(videoFReader);
trackedLocation=predict(kf);
out=insertShape(videoFrame,'circle',[trackedLocation 20],...
'Color','green','LineWidth',5);
%detect ball
[~,detectedLocation]=segmentBall(videoFrame,5000);
if(~isempty(detectedLocation))
%if ball is found,correct or update the Kalman filter
trackedLocation=correct(kf,detectedLocation);
out=insertShape(videoFrame,'circle',[trackedLocation 5],...
'Color','blue','LineWidth',5);
end
step(vidPlayer,out);
pause(0.1)
end

Respuestas (0)

Categorías

Más información sobre Computer Vision with Simulink en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by