【问题标题】:How to calculate aspect ratio of car in matlab?如何在matlab中计算汽车的纵横比?
【发布时间】:2017-03-31 10:40:36
【问题描述】:

我正在尝试检测视频中的汽车。背景减除后我们得到如下图像:

现在我用边界框包围汽车。

blobAnalysis = vision.BlobAnalysis('BoundingBoxOutputPort', true, ...
'AreaOutputPort', false, 'CentroidOutputPort', false, ...
'MinimumBlobArea', 150);
bbox = step(blobAnalysis, filteredForeground);
result = insertShape(frame, 'Rectangle', bbox, 'Color', 'green');

下一步是计算边界框的纵横比。我该怎么做?

托管代码的 matlab 网站的链接是: https://in.mathworks.com/help/vision/examples/detecting-cars-using-gaussian-mixture-models.html?prodcode=VP&language=en

【问题讨论】:

  • 宽度除以高度......

标签: matlab object-detection


【解决方案1】:

假设您的边界框 (bbox) 在 MATLAB 中是 1 x 4 矩阵,分别指定 x、y、宽度和高度。那么,你的纵横比就是bbox的宽高比。

aspect_ratio = bbox(1, 3) / bbox(1, 4);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-03-12
    • 1970-01-01
    • 2010-11-14
    • 2013-06-13
    • 1970-01-01
    • 2011-11-18
    • 1970-01-01
    相关资源
    最近更新 更多