如何在matlab中计算汽车的纵横比?

时间:2017-03-31 10:40:37

标签: matlab object-detection

我正试图在视频中检测到一辆汽车。在背景扣除后,我们得到以下图像:

现在我用一个边框包围汽车。

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

1 个答案:

答案 0 :(得分:0)

假设你的边界框(bbox)在MATLAB中是1 x 4矩阵,它分别指定x,y,width和height。然后,您的宽高比只是宽度与bbox高度的比率。

    int returnVal = db.showOpenDialog(null);