forearchdetector = Vision.ForeCloundDetector(“NumGaussians”3,...
“NumTrainingFrames”, 50);
Videoreader = Vision.videofilereader(”vamshi.avi”);
为i = 1:15 0
框架=步骤(录像机);
前景=步骤(前景detector,帧);
结束
图;imshow(框架);标题('视频框架');
图;imshow(前景);标题(“前景”);
se = strel(“广场”3);
filteredforeground = imopen(前景,se);
图;imshow(FilteredForeground);标题('干净的前景');
blobAnalysis =愿景。BlobAnalysis ('bandingboxoutputport', 真的,...
'AreaOutputport'假的,“CentroidOutputPort”假的,...
'MiniplyBlobarea',150);
bbox = step(blobananalysis, filteredForeground);
结果= insertshape(帧,'长方形',bbox,'颜色','绿色');
numcars = size(bbox,1);
result = insertText(result, [10 10], numCars,“BoxOpacity”, 1...
“字形大小”14);
图;imshow(结果);标题(检测到汽车的);
>> VideoPlayer = Vision.videoplayer(“名字”,检测到汽车的);
videoPlayer.Position (3:4) = [650400];
se = strel(“广场”3);
尽管〜ISDONE(录像机)
框架=步骤(录像机);
前景=步骤(前景detector,帧);
filteredforeground = imopen(前景,se);
bbox = step(blobananalysis, filteredForeground);
结果= insertshape(帧,'长方形',bbox,'颜色','绿色');
numcars = size(bbox,1);
result = insertText(result, [10 10], numCars,“BoxOpacity”, 1...
“字形大小”14);
步骤(放像机、结果);
结束
释放(videoReader);