简体   繁体   English

计算矩形面积加一

[英]Plus one in calculating area of rectangle

areas = (end_x - start_x + 1) * (end_y - start_y + 1)

Above is what use in calculating area of rectangle for non-max-suppression in two different links below, why there is a need for plus one?以上是在下面两个不同链接中计算非最大抑制矩形面积的用途,为什么需要加一?

https://github.com/amusi/Non-Maximum-Suppression/blob/master/nms.py https://www.pyimagesearch.com/2014/11/17/non-maximum-suppression-object-detection-python/ https://github.com/amusi/Non-Maximum-Suppression/blob/master/nms.py https://www.pyimagesearch.com/2014/11/17/non-maximum-suppression-object-detection-python /

I guess that plus one is just used to get the exact area.我想加一只是用来得到确切的面积。 For example, width begin in pixel 2, end in pixel 4. The exact width is 3 (pixel 2, 3, 4).例如,宽度从像素 2 开始,到像素 4 结束。确切的宽度是 3(像素 2、3、4)。 A 3 equals to 4 - 2 + 1. A 3 等于 4 - 2 + 1。

But in my opion, it's not essential to care about that.但在我看来,关心这个并不重要。 Just make sure you cal every area in the same standard.只要确保您以相同的标准对每个区域进行校准。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM