資源簡介
用matlab實現對一段視頻中車輛的檢測,使用GMM方法.
代碼片段和文件信息
foregroundDetector?=?vision.ForegroundDetector(‘NumGaussians‘?5?...
????‘NumTrainingframes‘?50);
videoTrainReader?=?vision.VideoFileReader(‘training2.avi‘);
%training
for?i?=?1:50
????frame?=?step(videoTrainReader);?%?read?the?next?video?frame
????foreground?=?step(foregroundDetector?frame);
end
release(videoTrainReader);?%?close?the?video?file
videoReader?=?vision.VideoFileReader(‘CH00_20150708092041_4.avi‘);
videoPlayer?=?vision.VideoPlayer(‘Name‘?‘Detected?Cars‘);
videoPlayer.Position(3:4)?=?[650400];??%?window?size:?[width?height]
se?=?strel(‘square‘?3);?%?morphological?filter?for?noise?removal
blobAnalysis?=?vision.BlobAnalysis(‘BoundingBoxOutputPort‘?true?...
????‘AreaOutputPort‘?false?‘CentroidOutputPort‘?false?...
????‘MinimumBlobArea‘?250);
k=1;
while?~isDone(videoReader)
????if?(mod(k25)~=1)
????????k=k+1;
????????continue;
- 上一篇:基于蟻群算法的圖像邊緣檢測
- 下一篇:小波包分解與重構、能量譜 MATLAB代碼
評論
共有 條評論