How can i get a bounding box around the vehicles and not around all the objects in the image

6 次查看(过去 30 天)
st = regionprops(bw_I, 'BoundingBox' );
for k= 1: length(st)
thisBB = st(k).BoundingBox;
rectangle('Position', [thisBB(1),thisBB(2),thisBB(3),thisBB(4)],...
'EdgeColor','g','LineWidth',2 )
end

回答(1 个)

Tarunbir Gambhir
Tarunbir Gambhir 2020-12-3
If you just want to get a bounding box around the vehicles in this particular image, you could set constraints on the size of the bounding box. The bounding boxes for the background objects in this image are either too big or too small, and hence I think you could set some threshold by trial and error. Keep in mind that these constraints might or might not work with other similar images for vehicle detection.
If you want to automate the processes of getting bounding boxes around vehicles in multiple images, an algorithm or logic is required for the identification and detection of vehicles and background objects. Usually this task is performed by a trained Deep Learning model. After the identification of the vehicles in the image, bounding boxes can be formed around them.
If this is what you are trying to achieve, I suggest you go through the MATLAB example on training a vehicle detector.

类别

Help CenterFile Exchange 中查找有关 Image Processing and Computer Vision 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by