[英]compute area of bounding box
I have coordinates of two bounding boxes.我有两个边界框的坐标。 I want to compare them.
我想比较它们。 How can I compute area of each box?
如何计算每个盒子的面积?
Coordinates:坐标:
Box1 : 0.20212765957446807 0.145625 0.24822695035460993 0.10875
Box2: 0.15212765957446807 0.145625 0.25822695035460993 0.8875
overlaping_bbox_area1/bbox_area_image_2重叠_bbox_area1/bbox_area_image_2
A quantity saying if the bboxes in avarerage are larger or small in image one than in image two.表示图像一中的平均 bbox 比图像二大还是小的数量。
from bbox import BBox2D
box1 = BBox2D([0.20212765957446807, 0.145625, 0.24822695035460993, 0.10875])
box2 = BBox2D([0.6693262411347518, 0.146875, 0.31382978723404253, 0.06875])
print(box2.height * box2.width)
print(box1.height * box1.width)
I have found the solution.我找到了解决办法。
def _getArea(box):
return (box[2] - box[0] + 1) * (box[3] - box[1] + 1)
This should do the trick.这应该可以解决问题。 Structure of Box: [xmin,ymin,xmax,ymax] This should do the trick.
框的结构: [xmin,ymin,xmax,ymax] 这应该可以解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.