How to find width and height of bounding box after using vision.blobanalysis?
Ältere Kommentare anzeigen
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.
Antworten (1)
Dima Lisin
am 1 Jul. 2014
Bearbeitet: Dima Lisin
am 1 Jul. 2014
0 Stimmen
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 .
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!