赞
踩
- float bbOverlap(const BoundingBox& box1,const BoundingBox& box2)
- {
- if (box1.x > box2.x+box2.width) { return 0.0; }
- if (box1.y > box2.y+box2.height) { return 0.0; }
- if (box1.x+box1.width < box2.x) { return 0.0; }
- if (box1.y+box1.height < box2.y) { return 0.0; }
- float colInt = min(box1.x+box1.width,box2.x+box2.width) - max(box1.x, box2.x);
- float rowInt = min(box1.y+box1.height,box2.y+box2.height) - max(box1.y,box2.y);
- float intersection = colInt * rowInt;
- float area1 = box1.width*box1.height;
- float area2 = box2.width*box2.height;
- return intersection / (area1 + area2 - intersection);
- }
- ---------------------
- 作者:Belial_2010
- 来源:CSDN
- 原文:https://blog.csdn.net/kezunhai/article/details/8830882
- 版权声明:本文为博主原创文章,转载请附上博文链接!
其中box1,和box2可以用opencv中的Rect2d类。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。