How to find width and height of bounding box after using vision.blobanalysis?
古いコメントを表示
For example, after this code,
hsrc = vision.VideoFileReader('mv2_001.avi');
hfg = vision.ForegroundDetector(...
'NumTrainingFrames', 10, ... % 5 because of short video
'InitialVariance', 30*30); % initial standard deviation of 30
hblob = vision.BlobAnalysis(...
'CentroidOutputPort', false, 'AreaOutputPort', false, ...
'BoundingBoxOutputPort', true, ...
'MinimumBlobAreaSource', 'Property', 'MinimumBlobArea', 250);
hsi = vision.ShapeInserter('BorderColor', 'White');
hsnk = vision.VideoPlayer();
while ~isDone(hsrc)
frame = step(hsrc);
fgMask = step(hfg, frame);
bbox = step(hblob, fgMask);
out = step(hsi, frame, bbox); % draw bounding boxes around cars
step(hsnk, out);
% view results in the video player
end
release(hsnk);
release(hsrc);
I want to track objects whose bounding box width is less than certain threshold. Pease help.
回答 (1 件)
Dima Lisin
2014 年 7 月 1 日
編集済み: Dima Lisin
2014 年 7 月 1 日
0 投票
In your example bbox is an M-by-4 matrix containing the bounding boxes represented as [x y w h]. First, you should delete the rows in which 3-rd element (the width) is less then your threshold. To learn how to track the blobs from frame to frame take a look at this example .
カテゴリ
ヘルプ センター および File Exchange で Object Detection についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!