简体   繁体   English

计算边界框的面积

[英]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.

相关问题 计算多边形边界框的面积 - Compute an area of polygon bounding box OpenCV / Python-通过边界框区域查找异常值 - OpenCV/Python - Finding Outliers by Area of Bounding Box 在给定大小的区域轮廓周围绘制边界框 - Drawing Bounding box around given size Area contour 获取边界框区域内的所有纬度/经度点 - Get all lat/lon points inside a bounding box area 如何获得边界框区域内热图的平均值 - How to get mean value of heatmap inside bounding box area 在 OpenCV 中裁剪垂直计数,获取边界框边框而不是区域 - Cropping vertical countours in OpenCV, getting bounding box borders instead of area Tensorflow 对象检测:如何计算边界框与帧中指定区域之间的距离 - Tensorflow object detection :how to calculate distance between bounding box and specified area in the frame 有没有办法通过使用 opencv/dlib 和实时流视频来获取额头(边界框)的区域 - Is there a way to get the area of the forehead (bounding box) by using opencv/dlib and for a live stream video 使用Python OpenCV,如何在特定颜色边界框内提取图像区域? - Using Python OpenCV, How would you extract an image area inside a particular color bounding box? 将边界框提取为 .jpg - Extracting bounding box as .jpg
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM