How to merge overlapping bounding boxes into one?

9 ビュー (過去 30 日間)
amir
amir 2016 年 3 月 1 日
回答済み: Anand 2016 年 3 月 3 日
I have used the "FrontalFaceCart" and "ProfileFace" detectors in parallel and in some cases I got overlapping boxes. How can I merge them into one? And any idea why it's not detecting the second person in the attached photo?

回答 (2 件)

Anand
Anand 2016 年 3 月 3 日
You could do something similar to what the MergeThreshold option in vision.CascadeObjectDetector does. The algorithm used is described in brief here:
Look under Algorithms for Merge Detection Threshold.
Essentially, you could do something like this:
If two bounding boxes overlap significantly, merge them by computing the merged bounding box at the mid point of the two detections, with size as the average of the sizes of the individual detections. You can use bboxOverlapRatio to compute the overlap ratio.

Walter Roberson
Walter Roberson 2016 年 3 月 2 日
Add the box width minus 1 to get the final box index. Now take the minimum of the left coordinates and the maximum of the right coordinates to do a horizontal merge. Likewise minimum of bottom and maximum of top to do a vertical merge. You can convert those back to widths and heights if you want: subtract left from right and add 1 to get the width.
  1 件のコメント
amir
amir 2016 年 3 月 3 日
I don't get how your method works, would you please explain it more? One more thing is how can I make sure that there are overlapping boxes in each time of my detection?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by