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!
조회 수: 9 (최근 30일)
이전 댓글 표시
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
댓글 수: 2
Walter Roberson
2021년 4월 23일
getLoc appears to be part of https://www.mathworks.com/matlabcentral/fileexchange/57936-computer-vision-for-student-competitions-object-tracking
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!