我正在使用具有简单背景的视频,并在有人经过时提示警报文本。
clear all
myVideoObj = VideoReader('video.avi');
nFrames = myVideoObj.NumberOfFrames;
sound = wavread('somethingwrong.wav');
flag = 1;
% Read one frame at a time.
for i = 2 : nFrames-1
frame1 = read(myVideoObj, i-1); frame2 = read(myVideoObj, i);
diff = abs(rgb2gray(frame1) - rgb2gray(frame2));
if sum(sum(diff)) < 46000
imshow(frame2, [])
drawnow
else
imshow(frame2, [])
text(100, 100, 'Intruder!!!' , 'FontSize',24)
drawnow
end
end
绘图工作。但现在我试图弄清楚如何为每个经过的人增加字符串。我该如何开始?提前致谢